2 Unix SMB/CIFS implementation.
4 Winbind daemon for ntdom nss module
6 Copyright (C) Tim Potter 2000
7 Copyright (C) Gerald Carter 2006
9 You are free to use this interface definition in any way you see
10 fit, including without restriction, using this header in your own
11 products. You do not need to give any attribution.
16 #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
20 #define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
24 #define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
27 #ifndef _WINBINDD_NTDOM_H
28 #define _WINBINDD_NTDOM_H
30 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
31 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
32 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
33 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
34 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
36 /* Update this when you change the interface. */
38 #define WINBIND_INTERFACE_VERSION 16
40 /* Have to deal with time_t being 4 or 8 bytes due to structure alignment.
41 On a 64bit Linux box, we have to support a constant structure size
42 between /lib/libnss_winbind.so.2 and /li64/libnss_winbind.so.2.
43 The easiest way to do this is to always use 8byte values for time_t. */
46 # define SMB_TIME_T uint64
48 # define SMB_TIME_T time_t
55 WINBINDD_INTERFACE_VERSION, /* Always a well known value */
57 /* Get users and groups */
65 /* Enumerate users and groups */
74 /* PAM authenticate and password change */
77 WINBINDD_PAM_AUTH_CRAP,
78 WINBINDD_PAM_CHAUTHTOK,
80 WINBINDD_PAM_CHNG_PSWD_AUTH_CRAP,
82 /* List various things */
84 WINBINDD_LIST_USERS, /* List w/o rid->id mapping */
85 WINBINDD_LIST_GROUPS, /* Ditto */
86 WINBINDD_LIST_TRUSTDOM,
94 /* Lookup functions */
101 WINBINDD_ALLOCATE_UID,
102 WINBINDD_ALLOCATE_GID,
104 /* Miscellaneous other stuff */
106 WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
107 WINBINDD_PING, /* Just tell me winbind is running */
108 WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
109 WINBINDD_DOMAIN_NAME, /* The domain this winbind server is a member of (lp_workgroup()) */
111 WINBINDD_DOMAIN_INFO, /* Most of what we know from
112 struct winbindd_domain */
113 WINBINDD_GETDCNAME, /* Issue a GetDCName Request */
115 WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
120 WINBINDD_WINS_BYNAME,
122 /* this is like GETGRENT but gives an empty group list */
125 WINBINDD_NETBIOS_NAME, /* The netbios name of the server */
127 /* find the location of our privileged pipe */
128 WINBINDD_PRIV_PIPE_DIR,
130 /* return a list of group sids for a user sid */
131 WINBINDD_GETUSERSIDS,
133 /* Various group queries */
134 WINBINDD_GETUSERDOMGROUPS,
136 /* Initialize connection in a child */
137 WINBINDD_INIT_CONNECTION,
139 /* Blocking calls that are not allowed on the main winbind pipe, only
140 * between parent and children */
141 WINBINDD_DUAL_SID2UID,
142 WINBINDD_DUAL_SID2GID,
143 WINBINDD_DUAL_IDMAPSET,
145 /* Wrapper around possibly blocking unix nss calls */
146 WINBINDD_DUAL_UID2NAME,
147 WINBINDD_DUAL_NAME2UID,
148 WINBINDD_DUAL_GID2NAME,
149 WINBINDD_DUAL_NAME2GID,
151 WINBINDD_DUAL_USERINFO,
152 WINBINDD_DUAL_GETSIDALIASES,
157 typedef struct winbindd_pw {
168 typedef struct winbindd_gr {
173 uint32 gr_mem_ofs; /* offset to group membership */
177 #define WBFLAG_PAM_INFO3_NDR 0x0001
178 #define WBFLAG_PAM_INFO3_TEXT 0x0002
179 #define WBFLAG_PAM_USER_SESSION_KEY 0x0004
180 #define WBFLAG_PAM_LMKEY 0x0008
181 #define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
182 #define WBFLAG_QUERY_ONLY 0x0020
183 #define WBFLAG_PAM_UNIX_NAME 0x0080
184 #define WBFLAG_PAM_AFS_TOKEN 0x0100
185 #define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
187 /* This is a flag that can only be sent from parent to child */
188 #define WBFLAG_IS_PRIVILEGED 0x0400
189 /* Flag to say this is a winbindd internal send - don't recurse. */
190 #define WBFLAG_RECURSE 0x0800
192 #define WBFLAG_PAM_KRB5 0x1000
193 #define WBFLAG_PAM_FALLBACK_AFTER_KRB5 0x2000
194 #define WBFLAG_PAM_CACHED_LOGIN 0x4000
195 #define WBFLAG_PAM_GET_PWD_POLICY 0x8000
197 #define WINBINDD_MAX_EXTRA_DATA (128*1024)
199 /* Winbind request structure */
201 /*******************************************************************************
202 * This structure MUST be the same size in the 32bit and 64bit builds
203 * for compatibility between /lib64/libnss_winbind.so and /lib/libnss_winbind.so
205 * DO NOT CHANGE THIS STRUCTURE WITHOUT TESTING THE 32BIT NSS LIB AGAINST
206 * A 64BIT WINBINDD --jerry
207 ******************************************************************************/
209 struct winbindd_request {
211 enum winbindd_cmd cmd; /* Winbindd command to execute */
212 pid_t pid; /* pid of calling process */
213 uint32 flags; /* flags relavant to a given request */
214 fstring domain_name; /* name of domain for which the request applies */
217 fstring winsreq; /* WINS request */
218 fstring username; /* getpwnam */
219 fstring groupname; /* getgrnam */
220 uid_t uid; /* getpwuid, uid_to_sid */
221 gid_t gid; /* getgrgid, gid_to_sid */
223 /* We deliberatedly don't split into domain/user to
224 avoid having the client know what the separator
228 fstring require_membership_of_sid;
229 fstring krb5_cc_type;
231 } auth; /* pam_winbind auth module */
233 unsigned char chal[8];
234 uint32 logon_parameters;
242 fstring require_membership_of_sid;
248 } chauthtok; /* pam_winbind passwd module */
252 unsigned char new_nt_pswd[516];
253 uint16 new_nt_pswd_len;
254 unsigned char old_nt_hash_enc[16];
255 uint16 old_nt_hash_enc_len;
256 unsigned char new_lm_pswd[516];
257 uint16 new_lm_pswd_len;
258 unsigned char old_lm_hash_enc[16];
259 uint16 old_lm_hash_enc_len;
260 } chng_pswd_auth_crap;/* pam_winbind passwd module */
265 } logoff; /* pam_winbind session module */
266 fstring sid; /* lookupsid, sid_to_[ug]id */
268 fstring dom_name; /* lookupname */
271 uint32 num_entries; /* getpwent, getgrent */
291 BOOL list_all_domains;
293 /* padding -- needed to fix alignment between 32bit and 64bit libs.
294 The size if the sizeof the union without the padding aligned on
295 an 8 byte boundary. --jerry */
307 /* Response values */
309 enum winbindd_result {
315 /* Winbind response structure */
317 /*******************************************************************************
318 * This structure MUST be the same size in the 32bit and 64bit builds
319 * for compatibility between /lib64/libnss_winbind.so and /lib/libnss_winbind.so
321 * DO NOT CHANGE THIS STRUCTURE WITHOUT TESTING THE 32BIT NSS LIB AGAINST
322 * A 64BIT WINBINDD --jerry
323 ******************************************************************************/
325 struct winbindd_response {
327 /* Header information */
329 uint32 length; /* Length of response */
330 enum winbindd_result result; /* Result code */
332 /* Fixed length return data */
335 int interface_version; /* Try to ensure this is always in the same spot... */
337 fstring winsresp; /* WINS response */
339 /* getpwnam, getpwuid */
341 struct winbindd_pw pw;
343 /* getgrnam, getgrgid */
345 struct winbindd_gr gr;
347 uint32 num_entries; /* getpwent, getgrent */
348 struct winbindd_sid {
349 fstring sid; /* lookupname, [ug]id_to_sid */
352 struct winbindd_name {
353 fstring dom_name; /* lookupsid */
357 uid_t uid; /* sid_to_uid */
358 gid_t gid; /* sid_to_gid */
359 struct winbindd_info {
360 char winbind_separator;
361 fstring samba_version;
364 fstring netbios_name;
369 fstring nt_status_string;
370 fstring error_string;
372 char user_session_key[16];
373 char first_8_lm_hash[8];
375 uint32 reject_reason;
377 struct policy_settings {
378 uint32 min_length_password;
379 uint32 password_history;
380 uint32 password_properties;
383 SMB_TIME_T min_passwordage;
386 SMB_TIME_T logon_time;
387 SMB_TIME_T logoff_time;
388 SMB_TIME_T kickoff_time;
389 SMB_TIME_T pass_last_set_time;
390 SMB_TIME_T pass_can_change_time;
391 SMB_TIME_T pass_must_change_time;
399 uint32 num_other_sids;
403 fstring logon_script;
404 fstring profile_path;
416 BOOL active_directory;
418 uint32 sequence_number;
429 /* Variable length return data */
437 struct WINBINDD_CCACHE_ENTRY {
438 const char *principal_name;
441 const char *username;
442 const char *sid_string;
449 struct timed_event *event;
450 struct WINBINDD_CCACHE_ENTRY *next, *prev;