#ifndef CONST_DISCARD
#define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
#endif
#ifndef CONST_ADD
#define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
#endif
#ifndef SAFE_FREE
#define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
#endif
#ifndef _WINBINDD_NTDOM_H
#define _WINBINDD_NTDOM_H
#define WINBINDD_SOCKET_NAME "pipe"
#ifndef WINBINDD_SOCKET_DIR
#define WINBINDD_SOCKET_DIR "/tmp/.winbindd"
#endif
#define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged"
#define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN"
#define WINBINDD_DONT_ENV "_NO_WINBINDD"
#define WINBIND_INTERFACE_VERSION 18
#if defined(int64)
# define SMB_TIME_T int64
#else
# define SMB_TIME_T time_t
#endif
enum winbindd_cmd {
WINBINDD_INTERFACE_VERSION,
WINBINDD_GETPWNAM,
WINBINDD_GETPWUID,
WINBINDD_GETGRNAM,
WINBINDD_GETGRGID,
WINBINDD_GETGROUPS,
WINBINDD_SETPWENT,
WINBINDD_ENDPWENT,
WINBINDD_GETPWENT,
WINBINDD_SETGRENT,
WINBINDD_ENDGRENT,
WINBINDD_GETGRENT,
WINBINDD_PAM_AUTH,
WINBINDD_PAM_AUTH_CRAP,
WINBINDD_PAM_CHAUTHTOK,
WINBINDD_PAM_LOGOFF,
WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP,
WINBINDD_LIST_USERS,
WINBINDD_LIST_GROUPS,
WINBINDD_LIST_TRUSTDOM,
WINBINDD_LOOKUPSID,
WINBINDD_LOOKUPNAME,
WINBINDD_LOOKUPRIDS,
WINBINDD_SID_TO_UID,
WINBINDD_SID_TO_GID,
WINBINDD_SIDS_TO_XIDS,
WINBINDD_UID_TO_SID,
WINBINDD_GID_TO_SID,
WINBINDD_ALLOCATE_UID,
WINBINDD_ALLOCATE_GID,
WINBINDD_SET_MAPPING,
WINBINDD_SET_HWM,
WINBINDD_DUMP_MAPS,
WINBINDD_CHECK_MACHACC,
WINBINDD_PING,
WINBINDD_INFO,
WINBINDD_DOMAIN_NAME,
WINBINDD_DOMAIN_INFO,
WINBINDD_GETDCNAME,
WINBINDD_SHOW_SEQUENCE,
WINBINDD_WINS_BYIP,
WINBINDD_WINS_BYNAME,
WINBINDD_GETGRLST,
WINBINDD_NETBIOS_NAME,
WINBINDD_PRIV_PIPE_DIR,
WINBINDD_GETUSERSIDS,
WINBINDD_GETUSERDOMGROUPS,
WINBINDD_INIT_CONNECTION,
WINBINDD_DUAL_SID2UID,
WINBINDD_DUAL_SID2GID,
WINBINDD_DUAL_SIDS2XIDS,
WINBINDD_DUAL_UID2SID,
WINBINDD_DUAL_GID2SID,
WINBINDD_DUAL_SET_MAPPING,
WINBINDD_DUAL_SET_HWM,
WINBINDD_DUAL_DUMP_MAPS,
WINBINDD_DUAL_UID2NAME,
WINBINDD_DUAL_NAME2UID,
WINBINDD_DUAL_GID2NAME,
WINBINDD_DUAL_NAME2GID,
WINBINDD_DUAL_USERINFO,
WINBINDD_DUAL_GETSIDALIASES,
WINBINDD_CCACHE_NTLMAUTH,
WINBINDD_NUM_CMDS
};
typedef struct winbindd_pw {
fstring pw_name;
fstring pw_passwd;
uid_t pw_uid;
gid_t pw_gid;
fstring pw_gecos;
fstring pw_dir;
fstring pw_shell;
} WINBINDD_PW;
typedef struct winbindd_gr {
fstring gr_name;
fstring gr_passwd;
gid_t gr_gid;
uint32 num_gr_mem;
uint32 gr_mem_ofs;
} WINBINDD_GR;
#define WBFLAG_PAM_INFO3_NDR 0x0001
#define WBFLAG_PAM_INFO3_TEXT 0x0002
#define WBFLAG_PAM_USER_SESSION_KEY 0x0004
#define WBFLAG_PAM_LMKEY 0x0008
#define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
#define WBFLAG_QUERY_ONLY 0x0020
#define WBFLAG_PAM_UNIX_NAME 0x0080
#define WBFLAG_PAM_AFS_TOKEN 0x0100
#define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
#define WBFLAG_IS_PRIVILEGED 0x0400
#define WBFLAG_RECURSE 0x0800
#define WBFLAG_PAM_KRB5 0x1000
#define WBFLAG_PAM_FALLBACK_AFTER_KRB5 0x2000
#define WBFLAG_PAM_CACHED_LOGIN 0x4000
#define WBFLAG_PAM_GET_PWD_POLICY 0x8000
#define WINBINDD_MAX_EXTRA_DATA (128*1024)
struct winbindd_request {
uint32 length;
enum winbindd_cmd cmd;
pid_t pid;
uint32 flags;
fstring domain_name;
union {
fstring winsreq;
fstring username;
fstring groupname;
uid_t uid;
gid_t gid;
struct {
fstring user;
fstring pass;
pstring require_membership_of_sid;
fstring krb5_cc_type;
uid_t uid;
} auth;
struct {
unsigned char chal[8];
uint32 logon_parameters;
fstring user;
fstring domain;
fstring lm_resp;
uint32 lm_resp_len;
fstring nt_resp;
uint32 nt_resp_len;
fstring workstation;
fstring require_membership_of_sid;
} auth_crap;
struct {
fstring user;
fstring oldpass;
fstring newpass;
} chauthtok;
struct {
fstring user;
fstring domain;
unsigned char new_nt_pswd[516];
uint16 new_nt_pswd_len;
unsigned char old_nt_hash_enc[16];
uint16 old_nt_hash_enc_len;
unsigned char new_lm_pswd[516];
uint16 new_lm_pswd_len;
unsigned char old_lm_hash_enc[16];
uint16 old_lm_hash_enc_len;
} chng_pswd_auth_crap;
struct {
fstring user;
fstring krb5ccname;
uid_t uid;
} logoff;
fstring sid;
struct {
fstring dom_name;
fstring name;
} name;
uint32 num_entries;
struct {
fstring username;
fstring groupname;
} acct_mgt;
struct {
BOOL is_primary;
fstring dcname;
} init_conn;
struct {
fstring sid;
fstring name;
} dual_sid2id;
struct {
fstring sid;
uint32 type;
uint32 id;
} dual_idmapset;
BOOL list_all_domains;
struct {
uid_t uid;
fstring user;
uint32 initial_blob_len;
uint32 challenge_blob_len;
} ccache_ntlm_auth;
char padding[1560];
} data;
union {
SMB_TIME_T padding;
char *data;
} extra_data;
uint32 extra_len;
char null_term;
};
enum winbindd_result {
WINBINDD_ERROR,
WINBINDD_PENDING,
WINBINDD_OK
};
struct winbindd_response {
uint32 length;
enum winbindd_result result;
union {
int interface_version;
fstring winsresp;
struct winbindd_pw pw;
struct winbindd_gr gr;
uint32 num_entries;
struct winbindd_sid {
fstring sid;
int type;
} sid;
struct winbindd_name {
fstring dom_name;
fstring name;
int type;
} name;
uid_t uid;
gid_t gid;
struct winbindd_info {
char winbind_separator;
fstring samba_version;
} info;
fstring domain_name;
fstring netbios_name;
fstring dc_name;
struct auth_reply {
uint32 nt_status;
fstring nt_status_string;
fstring error_string;
int pam_error;
char user_session_key[16];
char first_8_lm_hash[8];
fstring krb5ccname;
uint32 reject_reason;
uint32 padding;
struct policy_settings {
uint32 min_length_password;
uint32 password_history;
uint32 password_properties;
uint32 padding;
SMB_TIME_T expire;
SMB_TIME_T min_passwordage;
} policy;
struct info3_text {
SMB_TIME_T logon_time;
SMB_TIME_T logoff_time;
SMB_TIME_T kickoff_time;
SMB_TIME_T pass_last_set_time;
SMB_TIME_T pass_can_change_time;
SMB_TIME_T pass_must_change_time;
uint32 logon_count;
uint32 bad_pw_count;
uint32 user_rid;
uint32 group_rid;
uint32 num_groups;
uint32 user_flgs;
uint32 acct_flags;
uint32 num_other_sids;
fstring dom_sid;
fstring user_name;
fstring full_name;
fstring logon_script;
fstring profile_path;
fstring home_dir;
fstring dir_drive;
fstring logon_srv;
fstring logon_dom;
} info3;
} auth;
struct {
fstring name;
fstring alt_name;
fstring sid;
BOOL native_mode;
BOOL active_directory;
BOOL primary;
uint32 sequence_number;
} domain_info;
struct {
fstring acct_name;
fstring full_name;
fstring homedir;
fstring shell;
uint32 primary_gid;
uint32 group_rid;
} user_info;
struct {
uint32 auth_blob_len;
} ccache_ntlm_auth;
} data;
union {
SMB_TIME_T padding;
void *data;
} extra_data;
};
struct WINBINDD_MEMORY_CREDS {
struct WINBINDD_MEMORY_CREDS *next, *prev;
const char *username;
uid_t uid;
int ref_count;
size_t len;
unsigned char *nt_hash;
unsigned char *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;
};
#endif