#ifndef _WINBINDD_H
#define _WINBINDD_H
#include "nterr.h"
#include "winbindd_nss.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_WINBIND
struct winbindd_cli_state {
struct winbindd_cli_state *prev, *next;
int sock;
pid_t pid;
int read_buf_len, write_buf_len;
BOOL finished;
BOOL write_extra_data;
time_t last_access;
BOOL privileged;
struct winbindd_request request;
struct winbindd_response response;
struct getent_state *getpwent_state;
struct getent_state *getgrent_state;
};
struct getent_state {
struct getent_state *prev, *next;
void *sam_entries;
uint32 sam_entry_index, num_sam_entries;
BOOL got_sam_entries;
fstring domain_name;
};
struct getpwent_user {
fstring name;
fstring gecos;
DOM_SID user_sid;
DOM_SID group_sid;
};
struct winbindd_state {
uid_t uid_low, uid_high;
gid_t gid_low, gid_high;
};
extern struct winbindd_state server_state;
typedef struct {
char *acct_name;
char *full_name;
DOM_SID *user_sid;
DOM_SID *group_sid;
} WINBIND_USERINFO;
struct winbindd_domain {
fstring name;
fstring alt_name;
DOM_SID sid;
BOOL native_mode;
BOOL active_directory;
BOOL primary;
struct winbindd_methods *methods;
struct winbindd_methods *backend;
void *private;
time_t last_seq_check;
uint32 sequence_number;
NTSTATUS last_status;
struct winbindd_domain *prev, *next;
};
struct winbindd_methods {
BOOL consistent;
NTSTATUS (*query_user_list)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
WINBIND_USERINFO **info);
NTSTATUS (*enum_dom_groups)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
struct acct_info **info);
NTSTATUS (*enum_local_groups)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_entries,
struct acct_info **info);
NTSTATUS (*name_to_sid)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const char *name,
DOM_SID *sid,
enum SID_NAME_USE *type);
NTSTATUS (*sid_to_name)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
const DOM_SID *sid,
char **name,
enum SID_NAME_USE *type);
NTSTATUS (*query_user)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
DOM_SID *user_sid,
WINBIND_USERINFO *user_info);
NTSTATUS (*lookup_usergroups)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
DOM_SID *user_sid,
uint32 *num_groups, DOM_SID ***user_gids);
NTSTATUS (*lookup_groupmem)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
DOM_SID *group_sid,
uint32 *num_names,
DOM_SID ***sid_mem, char ***names,
uint32 **name_types);
NTSTATUS (*sequence_number)(struct winbindd_domain *domain, uint32 *seq);
NTSTATUS (*trusted_domains)(struct winbindd_domain *domain,
TALLOC_CTX *mem_ctx,
uint32 *num_domains,
char ***names,
char ***alt_names,
DOM_SID **dom_sids);
NTSTATUS (*domain_sid)(struct winbindd_domain *domain,
DOM_SID *sid);
NTSTATUS (*alternate_name)(struct winbindd_domain *domain);
};
typedef struct {
struct cli_state *cli;
POLICY_HND pol;
} CLI_POLICY_HND;
struct winbindd_idmap_methods {
BOOL (*init)(void);
BOOL (*get_sid_from_uid)(uid_t uid, DOM_SID *sid);
BOOL (*get_sid_from_gid)(gid_t gid, DOM_SID *sid);
BOOL (*get_uid_from_sid)(DOM_SID *sid, uid_t *uid);
BOOL (*get_gid_from_sid)(DOM_SID *sid, gid_t *gid);
BOOL (*close)(void);
void (*status)(void);
};
#include "../nsswitch/winbindd_proto.h"
#include "rpc_parse.h"
#include "rpc_client.h"
#define WINBINDD_ESTABLISH_LOOP 30
#define WINBINDD_RESCAN_FREQ 300
#define DOM_SEQUENCE_NONE ((uint32)-1)
#endif