2 Unix SMB/CIFS implementation.
4 Winbind daemon for ntdom nss module
6 Copyright (C) Tim Potter 2000
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either
11 version 2 of the License, or (at your option) any later version.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public
19 License along with this library; if not, write to the
20 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 Boston, MA 02111-1307, USA.
25 #define SAFE_FREE(x) do { if(x) {free(x); x=NULL;} } while(0)
28 #ifndef _WINBINDD_NTDOM_H
29 #define _WINBINDD_NTDOM_H
31 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
32 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
33 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
34 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
35 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
37 /* Update this when you change the interface. */
39 #define WINBIND_INTERFACE_VERSION 10
45 WINBINDD_INTERFACE_VERSION
, /* Always a well known value */
47 /* Get users and groups */
55 /* Enumerate users and groups */
64 /* PAM authenticate and password change */
67 WINBINDD_PAM_AUTH_CRAP
,
68 WINBINDD_PAM_CHAUTHTOK
,
70 /* List various things */
72 WINBINDD_LIST_USERS
, /* List w/o rid->id mapping */
73 WINBINDD_LIST_GROUPS
, /* Ditto */
74 WINBINDD_LIST_TRUSTDOM
,
81 /* Lookup functions */
87 WINBINDD_ALLOCATE_RID
,
89 /* Miscellaneous other stuff */
91 WINBINDD_CHECK_MACHACC
, /* Check machine account pw works */
92 WINBINDD_PING
, /* Just tell me winbind is running */
93 WINBINDD_INFO
, /* Various bit of info. Currently just tidbits */
94 WINBINDD_DOMAIN_NAME
, /* The domain this winbind server is a member of (lp_workgroup()) */
96 WINBINDD_DOMAIN_INFO
, /* Most of what we know from
97 struct winbindd_domain */
99 WINBINDD_SHOW_SEQUENCE
, /* display sequence numbers of domains */
104 WINBINDD_WINS_BYNAME
,
106 /* account management commands */
108 WINBINDD_CREATE_USER
,
109 WINBINDD_CREATE_GROUP
,
110 WINBINDD_ADD_USER_TO_GROUP
,
111 WINBINDD_REMOVE_USER_FROM_GROUP
,
112 WINBINDD_SET_USER_PRIMARY_GROUP
,
113 WINBINDD_DELETE_USER
,
114 WINBINDD_DELETE_GROUP
,
116 /* this is like GETGRENT but gives an empty group list */
119 WINBINDD_NETBIOS_NAME
, /* The netbios name of the server */
121 /* find the location of our privileged pipe */
122 WINBINDD_PRIV_PIPE_DIR
,
124 /* return a list of group sids for a user sid */
125 WINBINDD_GETUSERSIDS
,
127 /* Placeholder for end of cmd list */
131 typedef struct winbindd_pw
{
142 typedef struct winbindd_gr
{
147 int gr_mem_ofs
; /* offset to group membership */
152 #define WBFLAG_PAM_INFO3_NDR 0x0001
153 #define WBFLAG_PAM_INFO3_TEXT 0x0002
154 #define WBFLAG_PAM_USER_SESSION_KEY 0x0004
155 #define WBFLAG_PAM_LMKEY 0x0008
156 #define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
157 #define WBFLAG_QUERY_ONLY 0x0020
158 #define WBFLAG_ALLOCATE_RID 0x0040
159 #define WBFLAG_PAM_UNIX_NAME 0x0080
160 #define WBFLAG_PAM_AFS_TOKEN 0x0100
161 #define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
163 /* Winbind request structure */
165 struct winbindd_request
{
167 enum winbindd_cmd cmd
; /* Winbindd command to execute */
168 pid_t pid
; /* pid of calling process */
169 uint32 flags
; /* flags relavant to a given request */
170 fstring domain_name
; /* name of domain for which the request applies */
173 fstring winsreq
; /* WINS request */
174 fstring username
; /* getpwnam */
175 fstring groupname
; /* getgrnam */
176 uid_t uid
; /* getpwuid, uid_to_sid */
177 gid_t gid
; /* getgrgid, gid_to_sid */
179 /* We deliberatedly don't split into domain/user to
180 avoid having the client know what the separator
184 fstring required_membership_sid
;
185 } auth
; /* pam_winbind auth module */
187 unsigned char chal
[8];
195 fstring required_membership_sid
;
201 } chauthtok
; /* pam_winbind passwd module */
202 fstring sid
; /* lookupsid, sid_to_[ug]id */
204 fstring dom_name
; /* lookupname */
207 uint32 num_entries
; /* getpwent, getgrent */
216 /* Response values */
218 enum winbindd_result
{
223 /* Winbind response structure */
225 struct winbindd_response
{
227 /* Header information */
229 uint32 length
; /* Length of response */
230 enum winbindd_result result
; /* Result code */
232 /* Fixed length return data */
235 int interface_version
; /* Try to ensure this is always in the same spot... */
237 fstring winsresp
; /* WINS response */
239 /* getpwnam, getpwuid */
241 struct winbindd_pw pw
;
243 /* getgrnam, getgrgid */
245 struct winbindd_gr gr
;
247 uint32 num_entries
; /* getpwent, getgrent */
248 struct winbindd_sid
{
249 fstring sid
; /* lookupname, [ug]id_to_sid */
252 struct winbindd_name
{
253 fstring dom_name
; /* lookupsid */
257 uid_t uid
; /* sid_to_uid */
258 gid_t gid
; /* sid_to_gid */
259 struct winbindd_info
{
260 char winbind_separator
;
261 fstring samba_version
;
264 fstring netbios_name
;
268 fstring nt_status_string
;
269 fstring error_string
;
271 char user_session_key
[16];
272 char first_8_lm_hash
[8];
274 uint32 rid
; /* create user or group or allocate rid */
280 BOOL active_directory
;
282 uint32 sequence_number
;
286 /* Variable length return data */
288 void *extra_data
; /* getgrnam, getgrgid, getgrent */