Fix "proc num out of range" error. Missing rpc call.
[tprouty/samba.git] / source / 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_SAMLOGON           0x02
30 #define NET_SAMLOGOFF          0x03
31 #define NET_REQCHAL            0x04
32 #define NET_AUTH               0x05
33 #define NET_SRVPWSET           0x06
34 #define NET_AUTH2              0x0f
35 #define NET_LOGON_CTRL2        0x0e
36 #define NET_SAM_SYNC           0x10
37 #define NET_TRUST_DOM_LIST     0x13
38
39 /* Secure Channel types.  used in NetrServerAuthenticate negotiation */
40 #define SEC_CHAN_WKSTA   2
41 #define SEC_CHAN_DOMAIN  4
42 #define SEC_CHAN_BDC     6
43
44 #if 0
45 /* I think this is correct - it's what gets parsed on the wire. JRA. */
46 /* NET_USER_INFO_2 */
47 typedef struct net_user_info_2
48 {
49         uint32 ptr_user_info;
50
51         NTTIME logon_time;            /* logon time */
52         NTTIME logoff_time;           /* logoff time */
53         NTTIME kickoff_time;          /* kickoff time */
54         NTTIME pass_last_set_time;    /* password last set time */
55         NTTIME pass_can_change_time;  /* password can change time */
56         NTTIME pass_must_change_time; /* password must change time */
57
58         UNIHDR hdr_user_name;    /* username unicode string header */
59         UNIHDR hdr_full_name;    /* user's full name unicode string header */
60         UNIHDR hdr_logon_script; /* logon script unicode string header */
61         UNIHDR hdr_profile_path; /* profile path unicode string header */
62         UNIHDR hdr_home_dir;     /* home directory unicode string header */
63         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
64
65         uint16 logon_count;  /* logon count */
66         uint16 bad_pw_count; /* bad password count */
67
68         uint32 user_id;       /* User ID */
69         uint32 group_id;      /* Group ID */
70         uint32 num_groups;    /* num groups */
71         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
72         uint32 user_flgs;     /* user flags */
73
74         uint8 user_sess_key[16]; /* unused user session key */
75
76         UNIHDR hdr_logon_srv; /* logon server unicode string header */
77         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
78
79         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
80         uint8 padding[40];    /* unused padding bytes.  expansion room */
81
82         UNISTR2 uni_user_name;    /* username unicode string */
83         UNISTR2 uni_full_name;    /* user's full name unicode string */
84         UNISTR2 uni_logon_script; /* logon script unicode string */
85         UNISTR2 uni_profile_path; /* profile path unicode string */
86         UNISTR2 uni_home_dir;     /* home directory unicode string */
87         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
88
89         uint32 num_groups2;        /* num groups */
90         DOM_GID *gids; /* group info */
91
92         UNISTR2 uni_logon_srv; /* logon server unicode string */
93         UNISTR2 uni_logon_dom; /* logon domain unicode string */
94
95         DOM_SID2 dom_sid;           /* domain SID */
96
97         uint32 num_other_groups;        /* other groups */
98         DOM_GID *other_gids; /* group info */
99         DOM_SID2 *other_sids; /* undocumented - domain SIDs */
100
101 } NET_USER_INFO_2;
102 #endif
103
104 /* NET_USER_INFO_3 */
105 typedef struct net_user_info_3
106 {
107         uint32 ptr_user_info;
108
109         NTTIME logon_time;            /* logon time */
110         NTTIME logoff_time;           /* logoff time */
111         NTTIME kickoff_time;          /* kickoff time */
112         NTTIME pass_last_set_time;    /* password last set time */
113         NTTIME pass_can_change_time;  /* password can change time */
114         NTTIME pass_must_change_time; /* password must change time */
115
116         UNIHDR hdr_user_name;    /* username unicode string header */
117         UNIHDR hdr_full_name;    /* user's full name unicode string header */
118         UNIHDR hdr_logon_script; /* logon script unicode string header */
119         UNIHDR hdr_profile_path; /* profile path unicode string header */
120         UNIHDR hdr_home_dir;     /* home directory unicode string header */
121         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
122
123         uint16 logon_count;  /* logon count */
124         uint16 bad_pw_count; /* bad password count */
125
126         uint32 user_id;       /* User ID */
127         uint32 group_id;      /* Group ID */
128         uint32 num_groups;    /* num groups */
129         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
130         uint32 user_flgs;     /* user flags */
131
132         uint8 user_sess_key[16]; /* unused user session key */
133
134         UNIHDR hdr_logon_srv; /* logon server unicode string header */
135         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
136
137         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
138         uint8 padding[40];    /* unused padding bytes.  expansion room */
139
140         uint32 num_other_sids; /* 0 - num_sids */
141         uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
142         
143         UNISTR2 uni_user_name;    /* username unicode string */
144         UNISTR2 uni_full_name;    /* user's full name unicode string */
145         UNISTR2 uni_logon_script; /* logon script unicode string */
146         UNISTR2 uni_profile_path; /* profile path unicode string */
147         UNISTR2 uni_home_dir;     /* home directory unicode string */
148         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
149
150         uint32 num_groups2;        /* num groups */
151         DOM_GID *gids; /* group info */
152
153         UNISTR2 uni_logon_srv; /* logon server unicode string */
154         UNISTR2 uni_logon_dom; /* logon domain unicode string */
155
156         DOM_SID2 dom_sid;           /* domain SID */
157
158         uint32 num_other_groups;        /* other groups */
159         DOM_GID *other_gids; /* group info */
160         DOM_SID2 *other_sids; /* undocumented - domain SIDs */
161
162 } NET_USER_INFO_3;
163
164
165 /********************************************************
166  Logon Control Query
167
168  query_level 0x1 - pdc status
169  query_level 0x3 - number of logon attempts.
170
171  ********************************************************/
172 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2*/
173 typedef struct net_q_logon_ctrl2_info
174 {
175         uint32       ptr;             /* undocumented buffer pointer */
176         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
177         
178         uint32       function_code; /* 0x1 */
179         uint32       query_level;   /* 0x1, 0x3 */
180         uint32       switch_value;  /* 0x1 */
181
182 } NET_Q_LOGON_CTRL2;
183
184 /* NETLOGON_INFO_1 - pdc status info, i presume */
185 typedef struct netlogon_1_info
186 {
187         uint32 flags;            /* 0x0 - undocumented */
188         uint32 pdc_status;       /* 0x0 - undocumented */
189
190 } NETLOGON_INFO_1;
191
192 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
193 typedef struct netlogon_2_info
194 {
195         uint32  flags;            /* 0x0 - undocumented */
196         uint32  pdc_status;       /* 0x0 - undocumented */
197         uint32  ptr_trusted_dc_name; /* pointer to trusted domain controller name */
198         uint32  tc_status;           /* 0x051f - ERROR_NO_LOGON_SERVERS */
199         UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
200
201 } NETLOGON_INFO_2;
202
203 /* NETLOGON_INFO_3 - logon status info, i presume */
204 typedef struct netlogon_3_info
205 {
206         uint32 flags;            /* 0x0 - undocumented */
207         uint32 logon_attempts;   /* number of logon attempts */
208         uint32 reserved_1;       /* 0x0 - undocumented */
209         uint32 reserved_2;       /* 0x0 - undocumented */
210         uint32 reserved_3;       /* 0x0 - undocumented */
211         uint32 reserved_4;       /* 0x0 - undocumented */
212         uint32 reserved_5;       /* 0x0 - undocumented */
213
214 } NETLOGON_INFO_3;
215
216 /*******************************************************
217  Logon Control Response
218
219  switch_value is same as query_level in request 
220  *******************************************************/
221
222 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
223 typedef struct net_r_logon_ctrl2_info
224 {
225         uint32       switch_value;  /* 0x1, 0x3 */
226         uint32       ptr;
227
228         union
229         {
230                 NETLOGON_INFO_1 info1;
231                 NETLOGON_INFO_2 info2;
232                 NETLOGON_INFO_3 info3;
233
234         } logon;
235
236         uint32 status; /* return code */
237
238 } NET_R_LOGON_CTRL2;
239
240 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
241 typedef struct net_q_trust_dom_info
242 {
243         uint32       ptr;             /* undocumented buffer pointer */
244         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
245
246 } NET_Q_TRUST_DOM_LIST;
247
248 #define MAX_TRUST_DOMS 1
249
250 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
251 typedef struct net_r_trust_dom_info
252 {
253         UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
254
255         uint32 status; /* return code */
256
257 } NET_R_TRUST_DOM_LIST;
258
259
260 /* NEG_FLAGS */
261 typedef struct neg_flags_info
262 {
263     uint32 neg_flags; /* negotiated flags */
264
265 } NEG_FLAGS;
266
267
268 /* NET_Q_REQ_CHAL */
269 typedef struct net_q_req_chal_info
270 {
271     uint32  undoc_buffer; /* undocumented buffer pointer */
272     UNISTR2 uni_logon_srv; /* logon server unicode string */
273     UNISTR2 uni_logon_clnt; /* logon client unicode string */
274     DOM_CHAL clnt_chal; /* client challenge */
275
276 } NET_Q_REQ_CHAL;
277
278
279 /* NET_R_REQ_CHAL */
280 typedef struct net_r_req_chal_info
281 {
282     DOM_CHAL srv_chal; /* server challenge */
283
284   uint32 status; /* return code */
285
286 } NET_R_REQ_CHAL;
287
288 /* NET_Q_AUTH */
289 typedef struct net_q_auth_info
290 {
291         DOM_LOG_INFO clnt_id; /* client identification info */
292         DOM_CHAL clnt_chal;     /* client-calculated credentials */
293 } NET_Q_AUTH;
294
295 /* NET_R_AUTH */
296 typedef struct net_r_auth_info
297 {
298         DOM_CHAL srv_chal;     /* server-calculated credentials */
299         uint32 status; /* return code */
300 } NET_R_AUTH;
301
302 /* NET_Q_AUTH_2 */
303 typedef struct net_q_auth2_info
304 {
305     DOM_LOG_INFO clnt_id; /* client identification info */
306     DOM_CHAL clnt_chal;     /* client-calculated credentials */
307
308     NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
309
310 } NET_Q_AUTH_2;
311
312
313 /* NET_R_AUTH_2 */
314 typedef struct net_r_auth2_info
315 {
316     DOM_CHAL srv_chal;     /* server-calculated credentials */
317     NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
318
319   uint32 status; /* return code */
320
321 } NET_R_AUTH_2;
322
323
324 /* NET_Q_SRV_PWSET */
325 typedef struct net_q_srv_pwset_info
326 {
327     DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
328     uint8 pwd[16]; /* new password - undocumented. */
329
330 } NET_Q_SRV_PWSET;
331     
332 /* NET_R_SRV_PWSET */
333 typedef struct net_r_srv_pwset_info
334 {
335     DOM_CRED srv_cred;     /* server-calculated credentials */
336
337   uint32 status; /* return code */
338
339 } NET_R_SRV_PWSET;
340
341 /* NET_ID_INFO_2 */
342 typedef struct net_network_info_2
343 {
344         uint32            ptr_id_info2;        /* pointer to id_info_2 */
345         UNIHDR            hdr_domain_name;     /* domain name unicode header */
346         uint32            param_ctrl;          /* param control (0x2) */
347         DOM_LOGON_ID      logon_id;            /* logon ID */
348         UNIHDR            hdr_user_name;       /* user name unicode header */
349         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
350         uint8             lm_chal[8];          /* lan manager 8 byte challenge */
351         STRHDR            hdr_nt_chal_resp;    /* nt challenge response */
352         STRHDR            hdr_lm_chal_resp;    /* lm challenge response */
353
354         UNISTR2           uni_domain_name;     /* domain name unicode string */
355         UNISTR2           uni_user_name;       /* user name unicode string */
356         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
357         STRING2           nt_chal_resp;        /* nt challenge response */
358         STRING2           lm_chal_resp;        /* lm challenge response */
359
360 } NET_ID_INFO_2;
361
362 /* NET_ID_INFO_1 */
363 typedef struct id_info_1
364 {
365         uint32            ptr_id_info1;        /* pointer to id_info_1 */
366         UNIHDR            hdr_domain_name;     /* domain name unicode header */
367         uint32            param_ctrl;          /* param control */
368         DOM_LOGON_ID      logon_id;            /* logon ID */
369         UNIHDR            hdr_user_name;       /* user name unicode header */
370         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
371         OWF_INFO          lm_owf;              /* LM OWF Password */
372         OWF_INFO          nt_owf;              /* NT OWF Password */
373         UNISTR2           uni_domain_name;     /* domain name unicode string */
374         UNISTR2           uni_user_name;       /* user name unicode string */
375         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
376
377 } NET_ID_INFO_1;
378
379 #define INTERACTIVE_LOGON_TYPE 1
380 #define NET_LOGON_TYPE 2
381
382 /* NET_ID_INFO_CTR */
383 typedef struct net_id_info_ctr_info
384 {
385   uint16         switch_value;
386   
387   union
388   {
389     NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
390     NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
391
392   } auth;
393   
394 } NET_ID_INFO_CTR;
395
396 /* SAM_INFO - sam logon/off id structure */
397 typedef struct sam_info
398 {
399   DOM_CLNT_INFO2  client;
400   uint32          ptr_rtn_cred; /* pointer to return credentials */
401   DOM_CRED        rtn_cred; /* return credentials */
402   uint16          logon_level;
403   NET_ID_INFO_CTR *ctr;
404
405 } DOM_SAM_INFO;
406
407 /* NET_Q_SAM_LOGON */
408 typedef struct net_q_sam_logon_info
409 {
410     DOM_SAM_INFO sam_id;
411         uint16          validation_level;
412
413 } NET_Q_SAM_LOGON;
414
415 /* NET_R_SAM_LOGON */
416 typedef struct net_r_sam_logon_info
417 {
418     uint32 buffer_creds; /* undocumented buffer pointer */
419     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
420     
421         uint16 switch_value; /* 3 - indicates type of USER INFO */
422     NET_USER_INFO_3 *user;
423
424     uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
425
426   uint32 status; /* return code */
427
428 } NET_R_SAM_LOGON;
429
430
431 /* NET_Q_SAM_LOGOFF */
432 typedef struct net_q_sam_logoff_info
433 {
434     DOM_SAM_INFO sam_id;
435
436 } NET_Q_SAM_LOGOFF;
437
438 /* NET_R_SAM_LOGOFF */
439 typedef struct net_r_sam_logoff_info
440 {
441     uint32 buffer_creds; /* undocumented buffer pointer */
442     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
443     
444   uint32 status; /* return code */
445
446 } NET_R_SAM_LOGOFF;
447
448
449 #endif /* _RPC_NETLOGON_H */
450