Spelling fixes.
[samba.git] / source / include / rpc_netlogon.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
4    Copyright (C) Andrew Tridgell 1992-1997
5    Copyright (C) Luke Kenneth Casson Leighton 1996-1997
6    Copyright (C) Paul Ashton 1997
7    Copyright (C) Jean François Micouleau 2002
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_SAM_DELTAS          0x07
35 #define NET_LOGON_CTRL          0x0c
36 #define NET_AUTH2               0x0f
37 #define NET_LOGON_CTRL2         0x0e
38 #define NET_SAM_SYNC            0x10
39 #define NET_TRUST_DOM_LIST      0x13
40 #define NET_AUTH3               0x1a
41
42 /* Secure Channel types.  used in NetrServerAuthenticate negotiation */
43 #define SEC_CHAN_WKSTA   2
44 #define SEC_CHAN_DOMAIN  4
45 #define SEC_CHAN_BDC     6
46
47 /* Returned delta types */
48 #define SAM_DELTA_DOMAIN_INFO  0x01 /* Domain */
49 #define SAM_DELTA_GROUP_INFO   0x02 /* Domain groups */
50 #define SAM_DELTA_ACCOUNT_INFO 0x05 /* Users */
51 #define SAM_DELTA_GROUP_MEM    0x08 /* Group membership */
52 #define SAM_DELTA_ALIAS_INFO   0x09 /* Local groups */
53 #define SAM_DELTA_ALIAS_MEM    0x0C /* Local group membership */
54 #define SAM_DELTA_DOM_INFO     0x0D /* Privilege stuff */
55 #define SAM_DELTA_UNK0E_INFO   0x0e /* Privilege stuff */
56 #define SAM_DELTA_PRIVS_INFO   0x10 /* Privilege stuff */
57 #define SAM_DELTA_UNK12_INFO   0x12 /* Privilege stuff */
58 #define SAM_DELTA_SAM_STAMP    0x16 /* Some kind of journal record? */
59
60 /* SAM database types */
61 #define SAM_DATABASE_DOMAIN    0x00 /* Domain users and groups */
62 #define SAM_DATABASE_BUILTIN   0x01 /* BUILTIN users and g/* SAM database types */
63 #define SAM_DATABASE_DOMAIN    0x00 /* Domain users and groups */
64 #define SAM_DATABASE_BUILTIN   0x01 /* BUILTIN users and groups */
65 #define SAM_DATABASE_PRIVS     0x02 /* Privileges */
66
67 #if 0
68 /* I think this is correct - it's what gets parsed on the wire. JRA. */
69 /* NET_USER_INFO_2 */
70 typedef struct net_user_info_2
71 {
72         uint32 ptr_user_info;
73
74         NTTIME logon_time;            /* logon time */
75         NTTIME logoff_time;           /* logoff time */
76         NTTIME kickoff_time;          /* kickoff time */
77         NTTIME pass_last_set_time;    /* password last set time */
78         NTTIME pass_can_change_time;  /* password can change time */
79         NTTIME pass_must_change_time; /* password must change time */
80
81         UNIHDR hdr_user_name;    /* username unicode string header */
82         UNIHDR hdr_full_name;    /* user's full name unicode string header */
83         UNIHDR hdr_logon_script; /* logon script unicode string header */
84         UNIHDR hdr_profile_path; /* profile path unicode string header */
85         UNIHDR hdr_home_dir;     /* home directory unicode string header */
86         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
87
88         uint16 logon_count;  /* logon count */
89         uint16 bad_pw_count; /* bad password count */
90
91         uint32 user_id;       /* User ID */
92         uint32 group_id;      /* Group ID */
93         uint32 num_groups;    /* num groups */
94         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
95         uint32 user_flgs;     /* user flags */
96
97         uint8 user_sess_key[16]; /* unused user session key */
98
99         UNIHDR hdr_logon_srv; /* logon server unicode string header */
100         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
101
102         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
103         uint8 padding[40];    /* unused padding bytes.  expansion room */
104
105         UNISTR2 uni_user_name;    /* username unicode string */
106         UNISTR2 uni_full_name;    /* user's full name unicode string */
107         UNISTR2 uni_logon_script; /* logon script unicode string */
108         UNISTR2 uni_profile_path; /* profile path unicode string */
109         UNISTR2 uni_home_dir;     /* home directory unicode string */
110         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
111
112         uint32 num_groups2;        /* num groups */
113         DOM_GID *gids; /* group info */
114
115         UNISTR2 uni_logon_srv; /* logon server unicode string */
116         UNISTR2 uni_logon_dom; /* logon domain unicode string */
117
118         DOM_SID2 dom_sid;           /* domain SID */
119
120         uint32 num_other_groups;        /* other groups */
121         DOM_GID *other_gids; /* group info */
122         DOM_SID2 *other_sids; /* undocumented - domain SIDs */
123
124 } NET_USER_INFO_2;
125 #endif
126
127 /* NET_USER_INFO_3 */
128 typedef struct net_user_info_3
129 {
130         uint32 ptr_user_info;
131
132         NTTIME logon_time;            /* logon time */
133         NTTIME logoff_time;           /* logoff time */
134         NTTIME kickoff_time;          /* kickoff time */
135         NTTIME pass_last_set_time;    /* password last set time */
136         NTTIME pass_can_change_time;  /* password can change time */
137         NTTIME pass_must_change_time; /* password must change time */
138
139         UNIHDR hdr_user_name;    /* username unicode string header */
140         UNIHDR hdr_full_name;    /* user's full name unicode string header */
141         UNIHDR hdr_logon_script; /* logon script unicode string header */
142         UNIHDR hdr_profile_path; /* profile path unicode string header */
143         UNIHDR hdr_home_dir;     /* home directory unicode string header */
144         UNIHDR hdr_dir_drive;    /* home directory drive unicode string header */
145
146         uint16 logon_count;  /* logon count */
147         uint16 bad_pw_count; /* bad password count */
148
149         uint32 user_rid;       /* User RID */
150         uint32 group_rid;      /* Group RID */
151
152         uint32 num_groups;    /* num groups */
153         uint32 buffer_groups; /* undocumented buffer pointer to groups. */
154         uint32 user_flgs;     /* user flags */
155
156         uint8 user_sess_key[16]; /* unused user session key */
157
158         UNIHDR hdr_logon_srv; /* logon server unicode string header */
159         UNIHDR hdr_logon_dom; /* logon domain unicode string header */
160
161         uint32 buffer_dom_id; /* undocumented logon domain id pointer */
162         uint8 padding[40];    /* unused padding bytes.  expansion room */
163
164         uint32 num_other_sids; /* 0 - num_sids */
165         uint32 buffer_other_sids; /* NULL - undocumented pointer to SIDs. */
166         
167         UNISTR2 uni_user_name;    /* username unicode string */
168         UNISTR2 uni_full_name;    /* user's full name unicode string */
169         UNISTR2 uni_logon_script; /* logon script unicode string */
170         UNISTR2 uni_profile_path; /* profile path unicode string */
171         UNISTR2 uni_home_dir;     /* home directory unicode string */
172         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
173
174         uint32 num_groups2;        /* num groups */
175         DOM_GID *gids; /* group info */
176
177         UNISTR2 uni_logon_srv; /* logon server unicode string */
178         UNISTR2 uni_logon_dom; /* logon domain unicode string */
179
180         DOM_SID2 dom_sid;           /* domain SID */
181
182         uint32 num_other_groups;        /* other groups */
183         DOM_GID *other_gids; /* group info */
184         DOM_SID2 *other_sids; /* undocumented - domain SIDs */
185
186 } NET_USER_INFO_3;
187
188
189 /* NETLOGON_INFO_1 - pdc status info, i presume */
190 typedef struct netlogon_1_info
191 {
192         uint32 flags;            /* 0x0 - undocumented */
193         uint32 pdc_status;       /* 0x0 - undocumented */
194
195 } NETLOGON_INFO_1;
196
197 /* NETLOGON_INFO_2 - pdc status info, plus trusted domain info */
198 typedef struct netlogon_2_info
199 {
200         uint32  flags;            /* 0x0 - undocumented */
201         uint32  pdc_status;       /* 0x0 - undocumented */
202         uint32  ptr_trusted_dc_name; /* pointer to trusted domain controller name */
203         uint32  tc_status;           /* 0x051f - ERROR_NO_LOGON_SERVERS */
204         UNISTR2 uni_trusted_dc_name; /* unicode string - trusted dc name */
205
206 } NETLOGON_INFO_2;
207
208 /* NETLOGON_INFO_3 - logon status info, i presume */
209 typedef struct netlogon_3_info
210 {
211         uint32 flags;            /* 0x0 - undocumented */
212         uint32 logon_attempts;   /* number of logon attempts */
213         uint32 reserved_1;       /* 0x0 - undocumented */
214         uint32 reserved_2;       /* 0x0 - undocumented */
215         uint32 reserved_3;       /* 0x0 - undocumented */
216         uint32 reserved_4;       /* 0x0 - undocumented */
217         uint32 reserved_5;       /* 0x0 - undocumented */
218
219 } NETLOGON_INFO_3;
220
221 /********************************************************
222  Logon Control Query
223
224  This is generated by a nltest /bdc_query:DOMAIN
225
226  query_level 0x1, function_code 0x1
227
228  ********************************************************/
229
230 /* NET_Q_LOGON_CTRL - LSA Netr Logon Control */
231
232 typedef struct net_q_logon_ctrl_info
233 {
234         uint32 ptr;
235         UNISTR2 uni_server_name;
236         uint32 function_code;
237         uint32 query_level;
238 } NET_Q_LOGON_CTRL;
239
240 /* NET_R_LOGON_CTRL - LSA Netr Logon Control */
241
242 typedef struct net_r_logon_ctrl_info
243 {
244         uint32 switch_value;
245         uint32 ptr;
246
247         union {
248                 NETLOGON_INFO_1 info1;
249         } logon;
250
251         NTSTATUS status;
252 } NET_R_LOGON_CTRL;
253
254 /********************************************************
255  Logon Control2 Query
256
257  query_level 0x1 - pdc status
258  query_level 0x3 - number of logon attempts.
259
260  ********************************************************/
261
262 /* NET_Q_LOGON_CTRL2 - LSA Netr Logon Control 2 */
263 typedef struct net_q_logon_ctrl2_info
264 {
265         uint32       ptr;             /* undocumented buffer pointer */
266         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
267         
268         uint32       function_code; /* 0x1 */
269         uint32       query_level;   /* 0x1, 0x3 */
270         uint32       switch_value;  /* 0x1 */
271
272 } NET_Q_LOGON_CTRL2;
273
274 /*******************************************************
275  Logon Control Response
276
277  switch_value is same as query_level in request 
278  *******************************************************/
279
280 /* NET_R_LOGON_CTRL2 - response to LSA Logon Control2 */
281 typedef struct net_r_logon_ctrl2_info
282 {
283         uint32       switch_value;  /* 0x1, 0x3 */
284         uint32       ptr;
285
286         union
287         {
288                 NETLOGON_INFO_1 info1;
289                 NETLOGON_INFO_2 info2;
290                 NETLOGON_INFO_3 info3;
291
292         } logon;
293
294         NTSTATUS status; /* return code */
295
296 } NET_R_LOGON_CTRL2;
297
298 /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */
299 typedef struct net_q_trust_dom_info
300 {
301         uint32       ptr;             /* undocumented buffer pointer */
302         UNISTR2      uni_server_name; /* server name, starting with two '\'s */
303
304 } NET_Q_TRUST_DOM_LIST;
305
306 #define MAX_TRUST_DOMS 1
307
308 /* NET_R_TRUST_DOM_LIST - response to LSA Trusted Domains */
309 typedef struct net_r_trust_dom_info
310 {
311         UNISTR2 uni_trust_dom_name[MAX_TRUST_DOMS];
312
313         NTSTATUS status; /* return code */
314
315 } NET_R_TRUST_DOM_LIST;
316
317
318 /* NEG_FLAGS */
319 typedef struct neg_flags_info
320 {
321     uint32 neg_flags; /* negotiated flags */
322
323 } NEG_FLAGS;
324
325
326 /* NET_Q_REQ_CHAL */
327 typedef struct net_q_req_chal_info
328 {
329     uint32  undoc_buffer; /* undocumented buffer pointer */
330     UNISTR2 uni_logon_srv; /* logon server unicode string */
331     UNISTR2 uni_logon_clnt; /* logon client unicode string */
332     DOM_CHAL clnt_chal; /* client challenge */
333
334 } NET_Q_REQ_CHAL;
335
336
337 /* NET_R_REQ_CHAL */
338 typedef struct net_r_req_chal_info
339 {
340         DOM_CHAL srv_chal; /* server challenge */
341         NTSTATUS status; /* return code */
342 } NET_R_REQ_CHAL;
343
344 /* NET_Q_AUTH */
345 typedef struct net_q_auth_info
346 {
347         DOM_LOG_INFO clnt_id; /* client identification info */
348         DOM_CHAL clnt_chal;     /* client-calculated credentials */
349 } NET_Q_AUTH;
350
351 /* NET_R_AUTH */
352 typedef struct net_r_auth_info
353 {
354         DOM_CHAL srv_chal;     /* server-calculated credentials */
355         NTSTATUS status; /* return code */
356 } NET_R_AUTH;
357
358 /* NET_Q_AUTH_2 */
359 typedef struct net_q_auth2_info
360 {
361     DOM_LOG_INFO clnt_id; /* client identification info */
362     DOM_CHAL clnt_chal;     /* client-calculated credentials */
363
364     NEG_FLAGS clnt_flgs; /* usually 0x0000 01ff */
365
366 } NET_Q_AUTH_2;
367
368
369 /* NET_R_AUTH_2 */
370 typedef struct net_r_auth2_info
371 {
372         DOM_CHAL srv_chal;     /* server-calculated credentials */
373         NEG_FLAGS srv_flgs; /* usually 0x0000 01ff */
374         NTSTATUS status; /* return code */
375 } NET_R_AUTH_2;
376
377 /* NET_Q_AUTH_3 */
378 typedef struct net_q_auth3_info
379 {
380     DOM_LOG_INFO clnt_id;       /* client identification info */
381     DOM_CHAL clnt_chal;         /* client-calculated credentials */
382     NEG_FLAGS clnt_flgs;        /* usually 0x6007 ffff */
383 } NET_Q_AUTH_3;
384
385 /* NET_R_AUTH_3 */
386 typedef struct net_r_auth3_info
387 {
388         DOM_CHAL srv_chal;      /* server-calculated credentials */
389         NEG_FLAGS srv_flgs;     /* usually 0x6007 ffff */
390         uint32 unknown;         /* 0x0000045b */
391         NTSTATUS status;        /* return code */
392 } NET_R_AUTH_3;
393
394
395 /* NET_Q_SRV_PWSET */
396 typedef struct net_q_srv_pwset_info
397 {
398     DOM_CLNT_INFO clnt_id; /* client identification/authentication info */
399     uint8 pwd[16]; /* new password - undocumented. */
400
401 } NET_Q_SRV_PWSET;
402     
403 /* NET_R_SRV_PWSET */
404 typedef struct net_r_srv_pwset_info
405 {
406     DOM_CRED srv_cred;     /* server-calculated credentials */
407
408   NTSTATUS status; /* return code */
409
410 } NET_R_SRV_PWSET;
411
412 /* NET_ID_INFO_2 */
413 typedef struct net_network_info_2
414 {
415         uint32            ptr_id_info2;        /* pointer to id_info_2 */
416         UNIHDR            hdr_domain_name;     /* domain name unicode header */
417         uint32            param_ctrl;          /* param control (0x2) */
418         DOM_LOGON_ID      logon_id;            /* logon ID */
419         UNIHDR            hdr_user_name;       /* user name unicode header */
420         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
421         uint8             lm_chal[8];          /* lan manager 8 byte challenge */
422         STRHDR            hdr_nt_chal_resp;    /* nt challenge response */
423         STRHDR            hdr_lm_chal_resp;    /* lm challenge response */
424
425         UNISTR2           uni_domain_name;     /* domain name unicode string */
426         UNISTR2           uni_user_name;       /* user name unicode string */
427         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
428         STRING2           nt_chal_resp;        /* nt challenge response */
429         STRING2           lm_chal_resp;        /* lm challenge response */
430
431 } NET_ID_INFO_2;
432
433 /* NET_ID_INFO_1 */
434 typedef struct id_info_1
435 {
436         uint32            ptr_id_info1;        /* pointer to id_info_1 */
437         UNIHDR            hdr_domain_name;     /* domain name unicode header */
438         uint32            param_ctrl;          /* param control */
439         DOM_LOGON_ID      logon_id;            /* logon ID */
440         UNIHDR            hdr_user_name;       /* user name unicode header */
441         UNIHDR            hdr_wksta_name;      /* workstation name unicode header */
442         OWF_INFO          lm_owf;              /* LM OWF Password */
443         OWF_INFO          nt_owf;              /* NT OWF Password */
444         UNISTR2           uni_domain_name;     /* domain name unicode string */
445         UNISTR2           uni_user_name;       /* user name unicode string */
446         UNISTR2           uni_wksta_name;      /* workgroup name unicode string */
447
448 } NET_ID_INFO_1;
449
450 #define INTERACTIVE_LOGON_TYPE 1
451 #define NET_LOGON_TYPE 2
452
453 /* NET_ID_INFO_CTR */
454 typedef struct net_id_info_ctr_info
455 {
456   uint16         switch_value;
457   
458   union
459   {
460     NET_ID_INFO_1 id1; /* auth-level 1 - interactive user login */
461     NET_ID_INFO_2 id2; /* auth-level 2 - workstation referred login */
462
463   } auth;
464   
465 } NET_ID_INFO_CTR;
466
467 /* SAM_INFO - sam logon/off id structure */
468 typedef struct sam_info
469 {
470   DOM_CLNT_INFO2  client;
471   uint32          ptr_rtn_cred; /* pointer to return credentials */
472   DOM_CRED        rtn_cred; /* return credentials */
473   uint16          logon_level;
474   NET_ID_INFO_CTR *ctr;
475
476 } DOM_SAM_INFO;
477
478 /* NET_Q_SAM_LOGON */
479 typedef struct net_q_sam_logon_info
480 {
481     DOM_SAM_INFO sam_id;
482         uint16          validation_level;
483
484 } NET_Q_SAM_LOGON;
485
486 /* NET_R_SAM_LOGON */
487 typedef struct net_r_sam_logon_info
488 {
489     uint32 buffer_creds; /* undocumented buffer pointer */
490     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
491     
492         uint16 switch_value; /* 3 - indicates type of USER INFO */
493     NET_USER_INFO_3 *user;
494
495     uint32 auth_resp; /* 1 - Authoritative response; 0 - Non-Auth? */
496
497   NTSTATUS status; /* return code */
498
499 } NET_R_SAM_LOGON;
500
501
502 /* NET_Q_SAM_LOGOFF */
503 typedef struct net_q_sam_logoff_info
504 {
505     DOM_SAM_INFO sam_id;
506
507 } NET_Q_SAM_LOGOFF;
508
509 /* NET_R_SAM_LOGOFF */
510 typedef struct net_r_sam_logoff_info
511 {
512     uint32 buffer_creds; /* undocumented buffer pointer */
513     DOM_CRED srv_creds; /* server credentials.  server time stamp appears to be ignored. */
514     
515   NTSTATUS status; /* return code */
516
517 } NET_R_SAM_LOGOFF;
518
519 /* NET_Q_SAM_SYNC */
520 typedef struct net_q_sam_sync_info
521 {
522         UNISTR2 uni_srv_name; /* \\PDC */
523         UNISTR2 uni_cli_name; /* BDC */
524         DOM_CRED cli_creds;
525         DOM_CRED ret_creds;
526
527         uint32 database_id;
528         uint32 restart_state;
529         uint32 sync_context;
530
531         uint32 max_size;       /* preferred maximum length */
532
533 } NET_Q_SAM_SYNC;
534
535 /* SAM_DELTA_HDR */
536 typedef struct sam_delta_hdr_info
537 {
538         uint16 type;  /* type of structure attached */
539         uint16 type2;
540         uint32 target_rid;
541
542         uint32 type3;
543         uint32 ptr_delta;
544
545 } SAM_DELTA_HDR;
546
547 /* SAM_DOMAIN_INFO (0x1) */
548 typedef struct sam_domain_info_info
549 {
550         UNIHDR hdr_dom_name;
551         UNIHDR hdr_oem_info;
552
553         UINT64_S force_logoff;
554         uint16   min_pwd_len;
555         uint16   pwd_history_len;
556         UINT64_S max_pwd_age;
557         UINT64_S min_pwd_age;
558         UINT64_S dom_mod_count;
559         NTTIME   creation_time;
560
561         BUFHDR2 hdr_sec_desc; /* security descriptor */
562         UNIHDR hdr_unknown;
563         uint8 reserved[40];
564
565         UNISTR2 uni_dom_name;
566         UNISTR2 buf_oem_info; /* never seen */
567
568         BUFFER4 buf_sec_desc;
569         UNISTR2 buf_unknown;
570
571 } SAM_DOMAIN_INFO;
572
573 /* SAM_GROUP_INFO (0x2) */
574 typedef struct sam_group_info_info
575 {
576         UNIHDR hdr_grp_name;
577         DOM_GID gid;
578         UNIHDR hdr_grp_desc;
579         BUFHDR2 hdr_sec_desc;  /* security descriptor */
580         uint8 reserved[48];
581
582         UNISTR2 uni_grp_name;
583         UNISTR2 uni_grp_desc;
584         BUFFER4 buf_sec_desc;
585
586 } SAM_GROUP_INFO;
587
588 /* SAM_PWD */
589 typedef struct sam_passwd_info
590 {
591         /* this structure probably contains password history */
592         /* this is probably a count of lm/nt pairs */
593         uint32 unk_0; /* 0x0000 0002 */
594
595         UNIHDR hdr_lm_pwd;
596         uint8  buf_lm_pwd[16];
597
598         UNIHDR hdr_nt_pwd;
599         uint8  buf_nt_pwd[16];
600
601         UNIHDR hdr_empty_lm;
602         UNIHDR hdr_empty_nt;
603
604 } SAM_PWD;
605
606 /* SAM_ACCOUNT_INFO (0x5) */
607 typedef struct sam_account_info_info
608 {
609         UNIHDR hdr_acct_name;
610         UNIHDR hdr_full_name;
611
612         uint32 user_rid;
613         uint32 group_rid;
614
615         UNIHDR hdr_home_dir;
616         UNIHDR hdr_dir_drive;
617         UNIHDR hdr_logon_script;
618         UNIHDR hdr_acct_desc;
619         UNIHDR hdr_workstations;
620
621         NTTIME logon_time;
622         NTTIME logoff_time;
623
624         uint32 logon_divs; /* 0xA8 */
625         uint32 ptr_logon_hrs;
626
627         uint16 bad_pwd_count;
628         uint16 logon_count;
629         NTTIME pwd_last_set_time;
630         NTTIME acct_expiry_time;
631
632         uint32 acb_info;
633         uint8 nt_pwd[16];
634         uint8 lm_pwd[16];
635         uint8 nt_pwd_present;
636         uint8 lm_pwd_present;
637         uint8 pwd_expired;
638
639         UNIHDR hdr_comment;
640         UNIHDR hdr_parameters;
641         uint16 country;
642         uint16 codepage;
643
644         BUFHDR2 hdr_sec_desc;  /* security descriptor */
645
646         UNIHDR  hdr_profile;
647         UNIHDR  hdr_reserved[3];  /* space for more strings */
648         uint32  dw_reserved[4];   /* space for more data - first two seem to
649                                      be an NTTIME */
650
651         UNISTR2 uni_acct_name;
652         UNISTR2 uni_full_name;
653         UNISTR2 uni_home_dir;
654         UNISTR2 uni_dir_drive;
655         UNISTR2 uni_logon_script;
656         UNISTR2 uni_acct_desc;
657         UNISTR2 uni_workstations;
658
659         uint32 unknown1; /* 0x4EC */
660         uint32 unknown2; /* 0 */
661
662         BUFFER4 buf_logon_hrs;
663         UNISTR2 uni_comment;
664         UNISTR2 uni_parameters;
665         SAM_PWD pass;
666         BUFFER4 buf_sec_desc;
667         UNISTR2 uni_profile;
668
669 } SAM_ACCOUNT_INFO;
670
671 /* SAM_GROUP_MEM_INFO (0x8) */
672 typedef struct sam_group_mem_info_info
673 {
674         uint32 ptr_rids;
675         uint32 ptr_attribs;
676         uint32 num_members;
677         uint8 unknown[16];
678
679         uint32 num_members2;
680         uint32 *rids;
681
682         uint32 num_members3;
683         uint32 *attribs;
684
685 } SAM_GROUP_MEM_INFO;
686
687 /* SAM_ALIAS_INFO (0x9) */
688 typedef struct sam_alias_info_info
689 {
690         UNIHDR hdr_als_name;
691         uint32 als_rid;
692         BUFHDR2 hdr_sec_desc;  /* security descriptor */
693         UNIHDR hdr_als_desc;
694         uint8 reserved[40];
695
696         UNISTR2 uni_als_name;
697         BUFFER4 buf_sec_desc;
698         UNISTR2 uni_als_desc;
699
700 } SAM_ALIAS_INFO;
701
702 /* SAM_ALIAS_MEM_INFO (0xC) */
703 typedef struct sam_alias_mem_info_info
704 {
705         uint32 num_members;
706         uint32 ptr_members;
707         uint8 unknown[16];
708
709         uint32 num_sids;
710         uint32 *ptr_sids;
711         DOM_SID2 *sids;
712
713 } SAM_ALIAS_MEM_INFO;
714
715
716 /* SAM_DELTA_DOM (0x0D) */
717 typedef struct
718 {
719         uint32 unknown1; /* 0x5000 */
720         uint32 unknown2; /* 0 */
721         uint32 unknown3; /* 0 */
722         uint32 unknown4; /* 0 */
723         uint32 count1;
724         uint32 ptr1;
725         uint16 count2;
726         uint16 count3;
727         uint32 ptr2;
728         uint32 ptr3;
729
730         uint32 unknown4b; /* 0x02000000 */
731         uint32 unknown5; /* 0x00100000 */
732         uint32 unknown6; /* 0x00010000 */
733         uint32 unknown7; /* 0x0f000000 */
734         uint32 unknown8; /* 0 */
735         uint32 unknown9; /* 0 */
736         uint32 unknown10; /* 0 */
737         uint32 unknown11; /* 0x3c*/
738         uint32 unknown12; /* 0*/
739
740         uint32 unknown13; /* a7080110 */
741         uint32 unknown14; /* 01bfb0dd */
742         uint32 unknown15; /* 0f */
743         uint32 unknown16; /* 68 */
744         uint32 unknown17; /* 00169000 */
745
746         uint32 count4;
747         uint32 unknown18; /* 0  times count4 */
748         
749         uint32 unknown19; /* 8 */
750
751         uint32 unknown20; /* 0x04 times count1 */
752         
753         uint32 ptr4;
754         
755         UNISTR2 domain_name;
756         DOM_SID2 domain_sid;
757
758 } SAM_DELTA_DOM;
759
760 /* SAM_DELTA_UNK0E (0x0e) */
761 typedef struct
762 {
763         uint32 buf_size;
764         SEC_DESC *sec_desc;
765         DOM_SID2 sid;
766         UNIHDR hdr_domain;
767         
768         uint32 unknown0;
769         uint32 unknown1;
770         uint32 unknown2;
771         
772         uint32 buf_size2;
773         uint32 ptr;
774
775         uint32 unknown3;
776         UNISTR2 domain;
777
778 } SAM_DELTA_UNK0E;
779
780 /* SAM_DELTA_PRIVS (0x10) */
781 typedef struct
782 {
783         uint32 buf_size;
784         SEC_DESC *sec_desc;
785         DOM_SID2 sid;
786
787         uint32 priv_count;
788         uint32 reserved1; /* 0x0 */
789
790         uint32 ptr1;
791         uint32 ptr2;
792
793         uint32 unknown1;
794         uint32 unknown2;
795         uint32 unknown3;
796         uint32 unknown4;
797         uint32 unknown5;
798         uint32 unknown6;
799         uint32 unknown7;
800         uint32 unknown8;
801         uint32 unknown9;
802         
803         uint32 buf_size2;
804         uint32 ptr3;
805         uint32 unknown10; /* 48 bytes 0x0*/
806         
807         uint32 attribute_count;
808         uint32 *attributes;
809         
810         uint32 privlist_count;
811         UNIHDR *hdr_privslist;
812         UNISTR2 *uni_privslist;
813
814
815 } SAM_DELTA_PRIVS;
816
817 /* SAM_DELTA_UNK12 (0x12) */
818 typedef struct
819 {
820         uint32 buf_size;
821         SEC_DESC *sec_desc;
822         UNISTR2 secret;
823
824         uint32 count1;
825         uint32 count2;
826         uint32 ptr;
827         NTTIME time1;
828         uint32 count3;
829         uint32 count4;
830         uint32 ptr2;
831         NTTIME time2;
832         uint32 unknow1;
833
834         uint32 buf_size2;
835         uint32 ptr3;
836         uint32 unknow2; /* 0x0 12 times */
837
838         uint32 chal_len;
839         uint32 reserved1; /* 0 */
840         uint32 chal_len2;
841         uint8 chal[16];
842
843         uint32 key_len;
844         uint32 reserved2; /* 0 */
845         uint32 key_len2;
846         uint8 key[8];
847
848         uint32 buf_size3;
849         SEC_DESC *sec_desc2;
850
851 } SAM_DELTA_UNK12;
852
853 /* SAM_DELTA_STAMP (0x16) */
854 typedef struct
855 {
856         uint32 seqnum;
857         uint32 dom_mod_count_ptr;
858         UINT64_S dom_mod_count;  /* domain mod count at last sync */
859 } SAM_DELTA_STAMP;
860
861 typedef union sam_delta_ctr_info
862 {
863         SAM_DOMAIN_INFO    domain_info ;
864         SAM_GROUP_INFO     group_info  ;
865         SAM_ACCOUNT_INFO   account_info;
866         SAM_GROUP_MEM_INFO grp_mem_info;
867         SAM_ALIAS_INFO     alias_info  ;
868         SAM_ALIAS_MEM_INFO als_mem_info;
869         SAM_DELTA_DOM      dom_info;
870         SAM_DELTA_PRIVS    privs_info;
871         SAM_DELTA_STAMP    stamp;
872         SAM_DELTA_UNK0E    unk0e_info;
873         SAM_DELTA_UNK12    unk12_info;
874 } SAM_DELTA_CTR;
875
876 /* NET_R_SAM_SYNC */
877 typedef struct net_r_sam_sync_info
878 {
879         DOM_CRED srv_creds;
880
881         uint32 sync_context;
882
883         uint32 ptr_deltas;
884         uint32 num_deltas;
885         uint32 ptr_deltas2;
886         uint32 num_deltas2;
887
888         SAM_DELTA_HDR *hdr_deltas;
889         SAM_DELTA_CTR *deltas;
890
891         NTSTATUS status;
892 } NET_R_SAM_SYNC;
893
894 /* NET_Q_SAM_DELTAS */
895 typedef struct net_q_sam_deltas_info
896 {
897         UNISTR2 uni_srv_name;
898         UNISTR2 uni_cli_name;
899         DOM_CRED cli_creds;
900         DOM_CRED ret_creds;
901
902         uint32 database_id;
903         UINT64_S dom_mod_count;  /* domain mod count at last sync */
904
905         uint32 max_size;       /* preferred maximum length */
906
907 } NET_Q_SAM_DELTAS;
908
909 /* NET_R_SAM_DELTAS */
910 typedef struct net_r_sam_deltas_info
911 {
912         DOM_CRED srv_creds;
913
914         UINT64_S dom_mod_count;   /* new domain mod count */
915
916         uint32 ptr_deltas;
917         uint32 num_deltas;
918         uint32 num_deltas2;
919
920         SAM_DELTA_HDR *hdr_deltas;
921         SAM_DELTA_CTR *deltas;
922
923         NTSTATUS status;
924 } NET_R_SAM_DELTAS;
925
926 #endif /* _RPC_NETLOGON_H */