r6303: Setting up for 3.0.15pre1
[Samba.git] / source / nsswitch / winbindd_nss.h
blob06ebd68f8f80ae0d8fd9f14bff43306fdeb2c21a
1 /*
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.
13 #ifndef SAFE_FREE
14 #define SAFE_FREE(x) do { if(x) {free(CONST_DISCARD(void *, (x))); x=NULL;} } while(0)
15 #endif
17 #ifndef _WINBINDD_NTDOM_H
18 #define _WINBINDD_NTDOM_H
20 #define WINBINDD_SOCKET_NAME "pipe" /* Name of PF_UNIX socket */
21 #define WINBINDD_SOCKET_DIR "/tmp/.winbindd" /* Name of PF_UNIX dir */
22 #define WINBINDD_PRIV_SOCKET_SUBDIR "winbindd_privileged" /* name of subdirectory of lp_lockdir() to hold the 'privileged' pipe */
23 #define WINBINDD_DOMAIN_ENV "WINBINDD_DOMAIN" /* Environment variables */
24 #define WINBINDD_DONT_ENV "_NO_WINBINDD"
26 /* Update this when you change the interface. */
28 #define WINBIND_INTERFACE_VERSION 10
30 /* Socket commands */
32 enum winbindd_cmd {
34 WINBINDD_INTERFACE_VERSION, /* Always a well known value */
36 /* Get users and groups */
38 WINBINDD_GETPWNAM,
39 WINBINDD_GETPWUID,
40 WINBINDD_GETGRNAM,
41 WINBINDD_GETGRGID,
42 WINBINDD_GETGROUPS,
44 /* Enumerate users and groups */
46 WINBINDD_SETPWENT,
47 WINBINDD_ENDPWENT,
48 WINBINDD_GETPWENT,
49 WINBINDD_SETGRENT,
50 WINBINDD_ENDGRENT,
51 WINBINDD_GETGRENT,
53 /* PAM authenticate and password change */
55 WINBINDD_PAM_AUTH,
56 WINBINDD_PAM_AUTH_CRAP,
57 WINBINDD_PAM_CHAUTHTOK,
59 /* List various things */
61 WINBINDD_LIST_USERS, /* List w/o rid->id mapping */
62 WINBINDD_LIST_GROUPS, /* Ditto */
63 WINBINDD_LIST_TRUSTDOM,
65 /* SID conversion */
67 WINBINDD_LOOKUPSID,
68 WINBINDD_LOOKUPNAME,
70 /* Lookup functions */
72 WINBINDD_SID_TO_UID,
73 WINBINDD_SID_TO_GID,
74 WINBINDD_UID_TO_SID,
75 WINBINDD_GID_TO_SID,
76 WINBINDD_ALLOCATE_RID,
78 /* Miscellaneous other stuff */
80 WINBINDD_CHECK_MACHACC, /* Check machine account pw works */
81 WINBINDD_PING, /* Just tell me winbind is running */
82 WINBINDD_INFO, /* Various bit of info. Currently just tidbits */
83 WINBINDD_DOMAIN_NAME, /* The domain this winbind server is a member of (lp_workgroup()) */
85 WINBINDD_DOMAIN_INFO, /* Most of what we know from
86 struct winbindd_domain */
88 WINBINDD_SHOW_SEQUENCE, /* display sequence numbers of domains */
90 /* WINS commands */
92 WINBINDD_WINS_BYIP,
93 WINBINDD_WINS_BYNAME,
95 /* account management commands */
97 WINBINDD_CREATE_USER,
98 WINBINDD_CREATE_GROUP,
99 WINBINDD_ADD_USER_TO_GROUP,
100 WINBINDD_REMOVE_USER_FROM_GROUP,
101 WINBINDD_SET_USER_PRIMARY_GROUP,
102 WINBINDD_DELETE_USER,
103 WINBINDD_DELETE_GROUP,
105 /* this is like GETGRENT but gives an empty group list */
106 WINBINDD_GETGRLST,
108 WINBINDD_NETBIOS_NAME, /* The netbios name of the server */
110 /* find the location of our privileged pipe */
111 WINBINDD_PRIV_PIPE_DIR,
113 /* return a list of group sids for a user sid */
114 WINBINDD_GETUSERSIDS,
116 /* Placeholder for end of cmd list */
117 WINBINDD_NUM_CMDS
120 typedef struct winbindd_pw {
121 fstring pw_name;
122 fstring pw_passwd;
123 uid_t pw_uid;
124 gid_t pw_gid;
125 fstring pw_gecos;
126 fstring pw_dir;
127 fstring pw_shell;
128 } WINBINDD_PW;
131 typedef struct winbindd_gr {
132 fstring gr_name;
133 fstring gr_passwd;
134 gid_t gr_gid;
135 int num_gr_mem;
136 int gr_mem_ofs; /* offset to group membership */
137 char **gr_mem;
138 } WINBINDD_GR;
141 #define WBFLAG_PAM_INFO3_NDR 0x0001
142 #define WBFLAG_PAM_INFO3_TEXT 0x0002
143 #define WBFLAG_PAM_USER_SESSION_KEY 0x0004
144 #define WBFLAG_PAM_LMKEY 0x0008
145 #define WBFLAG_PAM_CONTACT_TRUSTDOM 0x0010
146 #define WBFLAG_QUERY_ONLY 0x0020
147 #define WBFLAG_ALLOCATE_RID 0x0040
148 #define WBFLAG_PAM_UNIX_NAME 0x0080
149 #define WBFLAG_PAM_AFS_TOKEN 0x0100
150 #define WBFLAG_PAM_NT_STATUS_SQUASH 0x0200
152 /* Winbind request structure */
154 struct winbindd_request {
155 uint32 length;
156 enum winbindd_cmd cmd; /* Winbindd command to execute */
157 pid_t pid; /* pid of calling process */
158 uint32 flags; /* flags relavant to a given request */
159 fstring domain_name; /* name of domain for which the request applies */
161 union {
162 fstring winsreq; /* WINS request */
163 fstring username; /* getpwnam */
164 fstring groupname; /* getgrnam */
165 uid_t uid; /* getpwuid, uid_to_sid */
166 gid_t gid; /* getgrgid, gid_to_sid */
167 struct {
168 /* We deliberatedly don't split into domain/user to
169 avoid having the client know what the separator
170 character is. */
171 fstring user;
172 fstring pass;
173 fstring require_membership_of_sid;
174 } auth; /* pam_winbind auth module */
175 struct {
176 unsigned char chal[8];
177 fstring user;
178 fstring domain;
179 fstring lm_resp;
180 uint16 lm_resp_len;
181 fstring nt_resp;
182 uint16 nt_resp_len;
183 fstring workstation;
184 fstring require_membership_of_sid;
185 } auth_crap;
186 struct {
187 fstring user;
188 fstring oldpass;
189 fstring newpass;
190 } chauthtok; /* pam_winbind passwd module */
191 fstring sid; /* lookupsid, sid_to_[ug]id */
192 struct {
193 fstring dom_name; /* lookupname */
194 fstring name;
195 } name;
196 uint32 num_entries; /* getpwent, getgrent */
197 struct {
198 fstring username;
199 fstring groupname;
200 } acct_mgt;
201 } data;
202 char null_term;
205 /* Response values */
207 enum winbindd_result {
208 WINBINDD_ERROR,
209 WINBINDD_OK
212 /* Winbind response structure */
214 struct winbindd_response {
216 /* Header information */
218 uint32 length; /* Length of response */
219 enum winbindd_result result; /* Result code */
221 /* Fixed length return data */
223 union {
224 int interface_version; /* Try to ensure this is always in the same spot... */
226 fstring winsresp; /* WINS response */
228 /* getpwnam, getpwuid */
230 struct winbindd_pw pw;
232 /* getgrnam, getgrgid */
234 struct winbindd_gr gr;
236 uint32 num_entries; /* getpwent, getgrent */
237 struct winbindd_sid {
238 fstring sid; /* lookupname, [ug]id_to_sid */
239 int type;
240 } sid;
241 struct winbindd_name {
242 fstring dom_name; /* lookupsid */
243 fstring name;
244 int type;
245 } name;
246 uid_t uid; /* sid_to_uid */
247 gid_t gid; /* sid_to_gid */
248 struct winbindd_info {
249 char winbind_separator;
250 fstring samba_version;
251 } info;
252 fstring domain_name;
253 fstring netbios_name;
255 struct auth_reply {
256 uint32 nt_status;
257 fstring nt_status_string;
258 fstring error_string;
259 int pam_error;
260 char user_session_key[16];
261 char first_8_lm_hash[8];
262 } auth;
263 uint32 rid; /* create user or group or allocate rid */
264 struct {
265 fstring name;
266 fstring alt_name;
267 fstring sid;
268 BOOL native_mode;
269 BOOL active_directory;
270 BOOL primary;
271 uint32 sequence_number;
272 } domain_info;
273 } data;
275 /* Variable length return data */
277 void *extra_data; /* getgrnam, getgrgid, getgrent */
280 #endif