#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"
#define WINBINDD_SOCKET_DIR "/tmp/.winbindd"
#define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged"
#define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN"
#define WINBINDD_DONT_ENV "_NO_WINBINDD"
#define WINBIND_INTERFACE_VERSION 10
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_LIST_USERS,
WINBINDD_LIST_GROUPS,
WINBINDD_LIST_TRUSTDOM,
WINBINDD_LOOKUPSID,
WINBINDD_LOOKUPNAME,
WINBINDD_SID_TO_UID,
WINBINDD_SID_TO_GID,
WINBINDD_UID_TO_SID,
WINBINDD_GID_TO_SID,
WINBINDD_ALLOCATE_RID,
WINBINDD_CHECK_MACHACC,
WINBINDD_PING,
WINBINDD_INFO,
WINBINDD_DOMAIN_NAME,
WINBINDD_DOMAIN_INFO,
WINBINDD_SHOW_SEQUENCE,
WINBINDD_WINS_BYIP,
WINBINDD_WINS_BYNAME,
WINBINDD_CREATE_USER,
WINBINDD_CREATE_GROUP,
WINBINDD_ADD_USER_TO_GROUP,
WINBINDD_REMOVE_USER_FROM_GROUP,
WINBINDD_SET_USER_PRIMARY_GROUP,
WINBINDD_DELETE_USER,
WINBINDD_DELETE_GROUP,
WINBINDD_GETGRLST,
WINBINDD_NETBIOS_NAME,
WINBINDD_PRIV_PIPE_DIR,
WINBINDD_GETUSERSIDS,
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;
int num_gr_mem;
int gr_mem_ofs;
char **gr_mem;
} 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_ALLOCATE_RID 0x0040
#define WBFLAG_PAM_UNIX_NAME 0x0080
#define WBFLAG_PAM_AFS_TOKEN 0x0100
#define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
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;
fstring require_membership_of_sid;
} auth;
struct {
unsigned char chal[8];
fstring user;
fstring domain;
fstring lm_resp;
uint16 lm_resp_len;
fstring nt_resp;
uint16 nt_resp_len;
fstring workstation;
fstring require_membership_of_sid;
} auth_crap;
struct {
fstring user;
fstring oldpass;
fstring newpass;
} chauthtok;
fstring sid;
struct {
fstring dom_name;
fstring name;
} name;
uint32 num_entries;
struct {
fstring username;
fstring groupname;
} acct_mgt;
} data;
char null_term;
};
enum winbindd_result {
WINBINDD_ERROR,
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;
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];
} auth;
uint32 rid;
struct {
fstring name;
fstring alt_name;
fstring sid;
BOOL native_mode;
BOOL active_directory;
BOOL primary;
uint32 sequence_number;
} domain_info;
} data;
void *extra_data;
};
#endif