Remove unused struct CLI_POLICY_HND
[samba.git] / source3 / winbindd / winbindd.h
index c4c1278d739868899b457189e44e2e6ada4ec558..5ebbb72cf5eb24492cd3c25f6fe854edcb79e3bf 100644 (file)
@@ -24,6 +24,7 @@
 #define _WINBINDD_H
 
 #include "nsswitch/winbind_struct_protocol.h"
+#include "nsswitch/libwbclient/wbclient.h"
 
 #ifdef HAVE_LIBNSCD
 #include <libnscd.h>
 
 #define WB_REPLACE_CHAR                '_'
 
-/* bits for fd_event.flags */
-#define EVENT_FD_READ 1
-#define EVENT_FD_WRITE 2
-
-struct fd_event {
-       struct fd_event *next, *prev;
+struct winbindd_fd_event {
+       struct winbindd_fd_event *next, *prev;
        int fd;
        int flags; /* see EVENT_FD_* flags */
-       void (*handler)(struct fd_event *fde, int flags);
+       void (*handler)(struct winbindd_fd_event *fde, int flags);
        void *data;
        size_t length, done;
        void (*finished)(void *private_data, bool success);
@@ -64,7 +61,7 @@ struct sid_ctr {
 struct winbindd_cli_state {
        struct winbindd_cli_state *prev, *next;   /* Linked list pointers */
        int sock;                                 /* Open socket from client */
-       struct fd_event fd_event;
+       struct winbindd_fd_event fd_event;
        pid_t pid;                                /* pid of client */
        bool finished;                            /* Can delete from list */
        bool write_extra_data;                    /* Write extra_data field */
@@ -150,8 +147,9 @@ struct winbindd_child {
        struct winbindd_domain *domain;
        char *logfilename;
 
-       struct fd_event event;
+       struct winbindd_fd_event event;
        struct timed_event *lockout_policy_event;
+       struct timed_event *machine_password_change_event;
        struct winbindd_async_request *requests;
 
        const struct winbindd_child_dispatch_table *table;
@@ -176,6 +174,14 @@ struct winbindd_domain {
        time_t startup_time;                   /* When we set "startup" true. */
        bool startup;                          /* are we in the first 30 seconds after startup_time ? */
 
+       bool can_do_samlogon_ex; /* Due to the lack of finer control what type
+                                 * of DC we have, let us try to do a
+                                 * credential-chain less samlogon_ex call
+                                 * with AD and schannel. If this fails with
+                                 * DCERPC_FAULT_OP_RNG_ERROR, then set this
+                                 * to False. This variable is around so that
+                                 * we don't have to try _ex every time. */
+
        /* Lookup methods for this domain (LDAP or RPC) */
        struct winbindd_methods *methods;
 
@@ -187,7 +193,15 @@ struct winbindd_domain {
 
        void *private_data;
 
+       /*
+        * idmap config settings, used to tell the idmap child which
+        * special domain config to use for a mapping
+        */
+       bool have_idmap_config;
+       uint32_t id_range_low, id_range_high;
+
        /* A working DC */
+       pid_t dc_probe_pid; /* Child we're using to detect the DC. */
        fstring dcname;
        struct sockaddr_storage dcaddr;
 
@@ -301,15 +315,15 @@ struct winbindd_methods {
        NTSTATUS (*sequence_number)(struct winbindd_domain *domain, uint32 *seq);
 
        /* return the lockout policy */
-       NTSTATUS (*lockout_policy)(struct winbindd_domain *domain, 
+       NTSTATUS (*lockout_policy)(struct winbindd_domain *domain,
                                   TALLOC_CTX *mem_ctx,
-                                  SAM_UNK_INFO_12 *lockout_policy);
+                                  struct samr_DomInfo12 *lockout_policy);
+
        /* return the lockout policy */
-       NTSTATUS (*password_policy)(struct winbindd_domain *domain, 
+       NTSTATUS (*password_policy)(struct winbindd_domain *domain,
                                    TALLOC_CTX *mem_ctx,
-                                   SAM_UNK_INFO_1 *password_policy);
+                                   struct samr_DomInfo1 *password_policy);
+
        /* enumerate trusted domains */
        NTSTATUS (*trusted_domains)(struct winbindd_domain *domain,
                                    TALLOC_CTX *mem_ctx,
@@ -319,13 +333,6 @@ struct winbindd_methods {
                                    DOM_SID **dom_sids);
 };
 
-/* Used to glue a policy handle and cli_state together */
-
-typedef struct {
-       struct cli_state *cli;
-       POLICY_HND pol;
-} CLI_POLICY_HND;
-
 /* Filled out by IDMAP backends */
 struct winbindd_idmap_methods {
   /* Called when backend is first loaded */
@@ -354,6 +361,38 @@ struct winbindd_tdc_domain {
        uint32 trust_type;
 };
 
+/* Switch for listing users or groups */
+enum ent_type {
+       LIST_USERS = 0,
+       LIST_GROUPS,
+};
+
+struct WINBINDD_MEMORY_CREDS {
+       struct WINBINDD_MEMORY_CREDS *next, *prev;
+       const char *username; /* lookup key. */
+       uid_t uid;
+       int ref_count;
+       size_t len;
+       uint8_t *nt_hash; /* Base pointer for the following 2 */
+       uint8_t *lm_hash;
+       char *pass;
+};
+
+struct WINBINDD_CCACHE_ENTRY {
+       struct WINBINDD_CCACHE_ENTRY *next, *prev;
+       const char *principal_name;
+       const char *ccname;
+       const char *service;
+       const char *username;
+       const char *realm;
+       struct WINBINDD_MEMORY_CREDS *cred_ptr;
+       int ref_count;
+       uid_t uid;
+       time_t create_time;
+       time_t renew_until;
+       time_t refresh_time;
+       struct timed_event *event;
+};
 
 #include "winbindd/winbindd_proto.h"
 
@@ -365,4 +404,6 @@ struct winbindd_tdc_domain {
 #define IS_DOMAIN_OFFLINE(x) ( lp_winbind_offline_logon() && \
                               ( get_global_winbindd_state_offline() \
                                 || !(x)->online ) )
+#define IS_DOMAIN_ONLINE(x) (!IS_DOMAIN_OFFLINE(x))
+
 #endif /* _WINBINDD_H */