dynamic allocation of NET_USER_INFO_3 gids.
[nivanova/samba-autobuild/.git] / source3 / include / rpc_netlogon.h
1 /* 
2    Unix SMB/Netbios implementation.
3    Version 1.9.
4    SMB parameters and setup
5    Copyright (C) Andrew Tridgell 1992-1997
6    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
7    Copyright (C) Paul Ashton 1997
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24 #ifndef _RPC_NETLOGON_H /* _RPC_NETLOGON_H */
25 #define _RPC_NETLOGON_H 
26
27
28 /* NETLOGON pipe */
29 #define NET_REQCHAL            0x04
30 #define NET_SRVPWSET           0x06
31 #define NET_SAMLOGON           0x02
32 #define NET_SAMLOGOFF          0x03
33 #define NET_AUTH2              0x0f
34 #define NET_LOGON_CTRL2        0x0e
35 #define NET_TRUST_DOM_LIST     0x13
36
37 /* Secure Channel types.  used in NetrServerAuthenticate negotiation */
38 #define SEC_CHAN_WKSTA   2
39 #define SEC_CHAN_DOMAIN  4
40
41 #if 0
42 /* JRATEST.... */
43 /* NET_USER_INFO_2 */
44 typedef struct net_user_info_2
45 {
46         uint32 ptr_user_info;
47
48         NTTIME logon_time;            /* logon time */
49         NTTIME logoff_time;           /* logoff time */
50         NTTIME kickoff_time;          /* kickoff time */
51         NTTIME pass_last_set_time;    /* password last set time */
52         NTTIME pass_can_change_time;  /* password can change time */
53         NTTIME pass_must_change_time; /* password must change time */
54
55 ....
56         uint32 user_id;       /* User ID */
57         uint32 group_id;      /* Group ID */
58 ....
59         uint32 num_groups2;        /* num groups */
60         DOM_GID *gids; /* group info */
61
62         UNIHDR hdr_logon_srv; /* logon server unicode string header */
63         UNISTR2 uni_logon_dom; /* logon domain unicode string */
64         DOM_SID2 dom_sid;
65         
66 } NET_USER_INFO_2;
67 /* ! JRATEST.... */
68 #endif
69
70 /* NET_USER_INFO_3 */
71 typedef struct net_user_info_3
72 {
73         uint32 ptr_user_info;
74
75         NTTIME logon_time;            /* logon time */
76         NTTIME logoff_time;           /* logoff time */
77         NTTIME kickoff_time;          /* kickoff time */
78         NTTIME pass_last_set_time;    /* password last set time */
79         NTTIME pass_can_change_time;  /* password can change time */
80         NTTIME pass_must_change_time; /* password must change time */
81
82         UNIHDR hdr_user_name;    /* username unicode string header */
83         UNIHDR hdr_full_name;    /* user's full name unicode string header */
84         UNIHDR hdr_logon_script; /* logon script unicode string header */
85         UNIHDR hdr_profile_path; /* profile path unicode string header */
86         UNIHDR hdr_home_dir;     /* home directory unicode string header */
87         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
88
89         uint16 logon_count;  /* logon count */
90         uint16 bad_pw_count; /* bad password count */
91
92         uint32 user_id;       /* User ID */
93         uint32 group_id;      /* Group ID */
94         uint32 num_groups;    /* num groups */
95         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
96         uint32 user_flgs;     /* user flags */
97
98         uint8 user_sess_key[16]; /* unused user session key */
99
100         UNIHDR hdr_logon_srv; /* logon server unicode string header */
101         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
102
103         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
104         uint8 padding[40];    /* unused padding bytes.  expansion room */
105
106         uint32 num_other_sids; /* 0 - num_sids */
107         uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
108         
109         UNISTR2 uni_user_name;    /* username unicode string */
110         UNISTR2 uni_full_name;    /* user's full name unicode string */
111         UNISTR2 uni_logon_script; /* logon script unicode string */
112         UNISTR2 uni_profile_path; /* profile path unicode string */
113         UNISTR2 uni_home_dir;     /* home directory unicode string */
114         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
115
116         uint32 num_groups2;        /* num groups */
117         DOM_GID *gids; /* group info */
118
119         UNISTR2 uni_logon_srv; /* logon server unicode string */
120         UNISTR2 uni_logon_dom; /* logon domain unicode string */
121
122         DOM_SID2 dom_sid;           /* domain SID */
123         DOM_SID2 other_sids[LSA_MAX_SIDS]; /* undocumented - domain SIDs */
124
125 } NET_USER_INFO_3;
126
127
128 /********************************************************
129  Logon Control Query
130
131  query_level 0x1 - pdc status
132  query_level 0x3 - number of logon attempts.
133
134  ********************************************************/
135 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2*/
136 typedef struct net_q_logon_ctrl2_info
137 {
138         uint32       ptr;             /* undocumented buffer pointer */
139         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
140         
141         uint32       function_code; /* 0x1 */
142         uint32       query_level;   /* 0x1, 0x3 */
143         uint32       switch_value;  /* 0x1 */
144
145 } NET_Q_LOGON_CTRL2;
146
147 /* NETLOGON_INFO_1 - pdc status info, i presume */
148 typedef struct netlogon_1_info
149 {
150         uint32 flags;            /* 0x0 - undocumented */
151         uint32 pdc_status;       /* 0x0 - undocumented */
152
153 } NETLOGON_INFO_1;
154
155 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
156 typedef struct netlogon_2_info
157 {
158         uint32  flags;            /* 0x0 - undocumented */
159         uint32  pdc_status;       /* 0x0 - undocumented */
160         uint32  ptr_trusted_dc_name; /* pointer to trusted domain controller name */
161         uint32  tc_status;           /* 0x051f - ERROR_NO_LOGON_SERVERS */
162         UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
163
164 } NETLOGON_INFO_2;
165
166 /* NETLOGON_INFO_3 - logon status info, i presume */
167 typedef struct netlogon_3_info
168 {
169         uint32 flags;            /* 0x0 - undocumented */
170         uint32 logon_attempts;   /* number of logon attempts */
171         uint32 reserved_1;       /* 0x0 - undocumented */
172         uint32 reserved_2;       /* 0x0 - undocumented */
173         uint32 reserved_3;       /* 0x0 - undocumented */
174         uint32 reserved_4;       /* 0x0 - undocumented */
175         uint32 reserved_5;       /* 0x0 - undocumented */
176
177 } NETLOGON_INFO_3;
178
179 /*******************************************************
180  Logon Control Response
181
182  switch_value is same as query_level in request 
183  *******************************************************/
184
185 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
186 typedef struct net_r_logon_ctrl2_info
187 {
188         uint32       switch_value;  /* 0x1, 0x3 */
189         uint32       ptr;
190
191         union
192         {
193                 NETLOGON_INFO_1 info1;
194                 NETLOGON_INFO_2 info2;
195                 NETLOGON_INFO_3 info3;
196
197         } logon;
198
199         uint32 status; /* return code */
200
201 } NET_R_LOGON_CTRL2;
202
203 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
204 typedef struct net_q_trust_dom_info
205 {
206         uint32       ptr;             /* undocumented buffer pointer */
207         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
208         
209         uint32       function_code; /* 0x31 */
210
211 } NET_Q_TRUST_DOM_LIST;
212
213 #define MAX_TRUST_DOMS 1
214
215 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
216 typedef struct net_r_trust_dom_info
217 {
218         UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
219
220         uint32 status; /* return code */
221
222 } NET_R_TRUST_DOM_LIST;
223
224
225 /* NEG_FLAGS */
226 typedef struct neg_flags_info
227 {
228     uint32 neg_flags; /* negotiated flags */
229
230 } NEG_FLAGS;
231
232
233 /* NET_Q_REQ_CHAL */
234 typedef struct net_q_req_chal_info
235 {
236     uint32  undoc_buffer; /* undocumented buffer pointer */
237     UNISTR2 uni_logon_srv; /* logon server unicode string */
238     UNISTR2 uni_logon_clnt; /* logon client unicode string */
239     DOM_CHAL clnt_chal; /* client challenge */
240
241 } NET_Q_REQ_CHAL;
242
243
244 /* NET_R_REQ_CHAL */
245 typedef struct net_r_req_chal_info
246 {
247     DOM_CHAL srv_chal; /* server challenge */
248
249   uint32 status; /* return code */
250
251 } NET_R_REQ_CHAL;
252
253
254
255 /* NET_Q_AUTH_2 */
256 typedef struct net_q_auth2_info
257 {
258     DOM_LOG_INFO clnt_id; /* client identification info */
259     DOM_CHAL clnt_chal;     /* client-calculated credentials */
260
261     NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
262
263 } NET_Q_AUTH_2;
264
265
266 /* NET_R_AUTH_2 */
267 typedef struct net_r_auth2_info
268 {
269     DOM_CHAL srv_chal;     /* server-calculated credentials */
270     NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
271
272   uint32 status; /* return code */
273
274 } NET_R_AUTH_2;
275
276
277 /* NET_Q_SRV_PWSET */
278 typedef struct net_q_srv_pwset_info
279 {
280     DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
281     uint8 pwd[16]; /* new password - undocumented. */
282
283 } NET_Q_SRV_PWSET;
284     
285 /* NET_R_SRV_PWSET */
286 typedef struct net_r_srv_pwset_info
287 {
288     DOM_CRED srv_cred;     /* server-calculated credentials */
289
290   uint32 status; /* return code */
291
292 } NET_R_SRV_PWSET;
293
294 /* NET_ID_INFO_2 */
295 typedef struct net_network_info_2
296 {
297         uint32            ptr_id_info2;        /* pointer to id_info_2 */
298         UNIHDR            hdr_domain_name;     /* domain name unicode header */
299         uint32            param_ctrl;          /* param control (0x2) */
300         DOM_LOGON_ID      logon_id;            /* logon ID */
301         UNIHDR            hdr_user_name;       /* user name unicode header */
302         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
303         uint8             lm_chal[8];          /* lan manager 8 byte challenge */
304         STRHDR            hdr_nt_chal_resp;    /* nt challenge response */
305         STRHDR            hdr_lm_chal_resp;    /* lm challenge response */
306
307         UNISTR2           uni_domain_name;     /* domain name unicode string */
308         UNISTR2           uni_user_name;       /* user name unicode string */
309         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
310         STRING2           nt_chal_resp;        /* nt challenge response */
311         STRING2           lm_chal_resp;        /* lm challenge response */
312
313 } NET_ID_INFO_2;
314
315 /* NET_ID_INFO_1 */
316 typedef struct id_info_1
317 {
318         uint32            ptr_id_info1;        /* pointer to id_info_1 */
319         UNIHDR            hdr_domain_name;     /* domain name unicode header */
320         uint32            param_ctrl;          /* param control */
321         DOM_LOGON_ID      logon_id;            /* logon ID */
322         UNIHDR            hdr_user_name;       /* user name unicode header */
323         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
324         OWF_INFO          lm_owf;              /* LM OWF Password */
325         OWF_INFO          nt_owf;              /* NT OWF Password */
326         UNISTR2           uni_domain_name;     /* domain name unicode string */
327         UNISTR2           uni_user_name;       /* user name unicode string */
328         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
329
330 } NET_ID_INFO_1;
331
332 #define INTERACTIVE_LOGON_TYPE 1
333 #define NET_LOGON_TYPE 2
334
335 /* NET_ID_INFO_CTR */
336 typedef struct net_id_info_ctr_info
337 {
338   uint16         switch_value;
339   
340   union
341   {
342     NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
343     NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
344
345   } auth;
346   
347 } NET_ID_INFO_CTR;
348
349 /* SAM_INFO - sam logon/off id structure */
350 typedef struct sam_info
351 {
352   DOM_CLNT_INFO2  client;
353   uint32          ptr_rtn_cred; /* pointer to return credentials */
354   DOM_CRED        rtn_cred; /* return credentials */
355   uint16          logon_level;
356   NET_ID_INFO_CTR *ctr;
357
358 } DOM_SAM_INFO;
359
360 /* NET_Q_SAM_LOGON */
361 typedef struct net_q_sam_logon_info
362 {
363     DOM_SAM_INFO sam_id;
364         uint16          validation_level;
365
366 } NET_Q_SAM_LOGON;
367
368 /* NET_R_SAM_LOGON */
369 typedef struct net_r_sam_logon_info
370 {
371     uint32 buffer_creds; /* undocumented buffer pointer */
372     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
373     
374         uint16 switch_value; /* 3 - indicates type of USER INFO */
375     NET_USER_INFO_3 *user;
376
377     uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
378
379   uint32 status; /* return code */
380
381 } NET_R_SAM_LOGON;
382
383
384 /* NET_Q_SAM_LOGOFF */
385 typedef struct net_q_sam_logoff_info
386 {
387     DOM_SAM_INFO sam_id;
388
389 } NET_Q_SAM_LOGOFF;
390
391 /* NET_R_SAM_LOGOFF */
392 typedef struct net_r_sam_logoff_info
393 {
394     uint32 buffer_creds; /* undocumented buffer pointer */
395     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
396     
397   uint32 status; /* return code */
398
399 } NET_R_SAM_LOGOFF;
400
401
402 #endif /* _RPC_NETLOGON_H */
403