2 Unix SMB/CIFS implementation.
4 Winbind daemon for ntdom nss module
6 Copyright (C) Tim Potter 2000
8 You are free to use this interface definition in any way you see
9 fit, including without restriction, using this header in your own
10 products. You do not need to give any attribution.
15 #define CONST_DISCARD(type, ptr) ((type) ((void *) (ptr)))
19 #define CONST_ADD(type, ptr) ((type) ((const void *) (ptr)))
23 #define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
26 #ifndef _WINBINDD_NTDOM_H
27 #define _WINBINDD_NTDOM_H
29 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
30 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
31 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
32 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
33 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
35 /* Update this when you change the interface. */
37 #define WINBIND_INTERFACE_VERSION 14
43 WINBINDD_INTERFACE_VERSION
, /* Always a well known value */
45 /* Get users and groups */
53 /* Enumerate users and groups */
62 /* PAM authenticate and password change */
65 WINBINDD_PAM_AUTH_CRAP
,
66 WINBINDD_PAM_CHAUTHTOK
,
69 /* List various things */
71 WINBINDD_LIST_USERS
, /* List w/o rid->id mapping */
72 WINBINDD_LIST_GROUPS
, /* Ditto */
73 WINBINDD_LIST_TRUSTDOM
,
80 /* Lookup functions */
87 WINBINDD_ALLOCATE_UID
,
88 WINBINDD_ALLOCATE_GID
,
90 /* Miscellaneous other stuff */
92 WINBINDD_CHECK_MACHACC
, /* Check machine account pw works */
93 WINBINDD_PING
, /* Just tell me winbind is running */
94 WINBINDD_INFO
, /* Various bit of info. Currently just tidbits */
95 WINBINDD_DOMAIN_NAME
, /* The domain this winbind server is a member of (lp_workgroup()) */
97 WINBINDD_DOMAIN_INFO
, /* Most of what we know from
98 struct winbindd_domain */
99 WINBINDD_GETDCNAME
, /* Issue a GetDCName Request */
101 WINBINDD_SHOW_SEQUENCE
, /* display sequence numbers of domains */
106 WINBINDD_WINS_BYNAME
,
108 /* this is like GETGRENT but gives an empty group list */
111 WINBINDD_NETBIOS_NAME
, /* The netbios name of the server */
113 /* find the location of our privileged pipe */
114 WINBINDD_PRIV_PIPE_DIR
,
116 /* return a list of group sids for a user sid */
117 WINBINDD_GETUSERSIDS
,
119 /* Various group queries */
120 WINBINDD_GETUSERDOMGROUPS
,
122 /* Initialize connection in a child */
123 WINBINDD_INIT_CONNECTION
,
125 /* Blocking calls that are not allowed on the main winbind pipe, only
126 * between parent and children */
127 WINBINDD_DUAL_SID2UID
,
128 WINBINDD_DUAL_SID2GID
,
129 WINBINDD_DUAL_IDMAPSET
,
131 /* Wrapper around possibly blocking unix nss calls */
132 WINBINDD_DUAL_UID2NAME
,
133 WINBINDD_DUAL_NAME2UID
,
134 WINBINDD_DUAL_GID2NAME
,
135 WINBINDD_DUAL_NAME2GID
,
137 WINBINDD_DUAL_USERINFO
,
138 WINBINDD_DUAL_GETSIDALIASES
,
143 typedef struct winbindd_pw
{
154 typedef struct winbindd_gr
{
159 uint32 gr_mem_ofs
; /* offset to group membership */
163 #define WBFLAG_PAM_INFO3_NDR 0x0001
164 #define WBFLAG_PAM_INFO3_TEXT 0x0002
165 #define WBFLAG_PAM_USER_SESSION_KEY 0x0004
166 #define WBFLAG_PAM_LMKEY 0x0008
167 #define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
168 #define WBFLAG_QUERY_ONLY 0x0020
169 #define WBFLAG_PAM_UNIX_NAME 0x0080
170 #define WBFLAG_PAM_AFS_TOKEN 0x0100
171 #define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
173 /* This is a flag that can only be sent from parent to child */
174 #define WBFLAG_IS_PRIVILEGED 0x0400
175 /* Flag to say this is a winbindd internal send - don't recurse. */
176 #define WBFLAG_RECURSE 0x0800
178 #define WBFLAG_PAM_KRB5 0x1000
179 #define WBFLAG_PAM_FALLBACK_AFTER_KRB5 0x2000
180 #define WBFLAG_PAM_CACHED_LOGIN 0x4000
181 #define WBFLAG_PAM_GET_PWD_POLICY 0x8000
183 #define WINBINDD_MAX_EXTRA_DATA (128*1024)
185 /* Winbind request structure */
187 struct winbindd_request
{
189 enum winbindd_cmd cmd
; /* Winbindd command to execute */
190 pid_t pid
; /* pid of calling process */
191 uint32 flags
; /* flags relavant to a given request */
192 fstring domain_name
; /* name of domain for which the request applies */
195 fstring winsreq
; /* WINS request */
196 fstring username
; /* getpwnam */
197 fstring groupname
; /* getgrnam */
198 uid_t uid
; /* getpwuid, uid_to_sid */
199 gid_t gid
; /* getgrgid, gid_to_sid */
201 /* We deliberatedly don't split into domain/user to
202 avoid having the client know what the separator
206 fstring require_membership_of_sid
;
207 fstring krb5_cc_type
;
209 } auth
; /* pam_winbind auth module */
211 unsigned char chal
[8];
212 uint32 logon_parameters
;
220 fstring require_membership_of_sid
;
226 } chauthtok
; /* pam_winbind passwd module */
231 } logoff
; /* pam_winbind session module */
232 fstring sid
; /* lookupsid, sid_to_[ug]id */
234 fstring dom_name
; /* lookupname */
237 uint32 num_entries
; /* getpwent, getgrent */
257 BOOL list_all_domains
;
269 /* Response values */
271 enum winbindd_result
{
277 /* Winbind response structure */
279 struct winbindd_response
{
281 /* Header information */
283 uint32 length
; /* Length of response */
284 enum winbindd_result result
; /* Result code */
286 /* Fixed length return data */
289 int interface_version
; /* Try to ensure this is always in the same spot... */
291 fstring winsresp
; /* WINS response */
293 /* getpwnam, getpwuid */
295 struct winbindd_pw pw
;
297 /* getgrnam, getgrgid */
299 struct winbindd_gr gr
;
301 uint32 num_entries
; /* getpwent, getgrent */
302 struct winbindd_sid
{
303 fstring sid
; /* lookupname, [ug]id_to_sid */
306 struct winbindd_name
{
307 fstring dom_name
; /* lookupsid */
311 uid_t uid
; /* sid_to_uid */
312 gid_t gid
; /* sid_to_gid */
313 struct winbindd_info
{
314 char winbind_separator
;
315 fstring samba_version
;
318 fstring netbios_name
;
323 fstring nt_status_string
;
324 fstring error_string
;
326 char user_session_key
[16];
327 char first_8_lm_hash
[8];
329 struct policy_settings
{
330 uint16 min_length_password
;
331 uint16 password_history
;
332 uint32 password_properties
;
334 uint32 min_passwordage
;
336 uint32 reject_reason
;
341 uint32 pass_last_set_time
;
342 uint32 pass_can_change_time
;
343 uint32 pass_must_change_time
;
352 uint32 num_other_sids
;
355 fstring logon_script
;
356 fstring profile_path
;
368 BOOL active_directory
;
370 uint32 sequence_number
;
381 /* Variable length return data */
391 struct WINBINDD_CCACHE_ENTRY
{
392 const char *principal_name
;
395 const char *username
;
396 const char *sid_string
;
403 struct timed_event
*event
;
404 struct WINBINDD_CCACHE_ENTRY
*next
, *prev
;