r13442: Implement samr_chgpasswd_user3 server-side.
[samba.git] / source / include / rpc_samr.h
1 /* 
2    Unix SMB/CIFS implementation.
3    SMB parameters and setup
4    Copyright (C) Andrew Tridgell              1992-2000
5    Copyright (C) Luke Kenneth Casson Leighton 1996-2000
6    Copyright (C) Paul Ashton                  1997-2000
7    Copyright (C) Jean François Micouleau      1998-2001
8    Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2002
9    
10    
11    This program is free software; you can redistribute it and/or modify
12    it under the terms of the GNU General Public License as published by
13    the Free Software Foundation; either version 2 of the License, or
14    (at your option) any later version.
15    
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License for more details.
20    
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26 #ifndef _RPC_SAMR_H /* _RPC_SAMR_H */
27 #define _RPC_SAMR_H 
28
29 /*******************************************************************
30  the following information comes from a QuickView on samsrv.dll,
31  and gives an idea of exactly what is needed:
32  
33 x SamrAddMemberToAlias
34 x SamrAddMemberToGroup
35 SamrAddMultipleMembersToAlias
36 x SamrChangePasswordUser
37 x SamrCloseHandle
38 x SamrConnect
39 x SamrCreateAliasInDomain
40 x SamrCreateGroupInDomain
41 x SamrCreateUserInDomain
42 ? SamrDeleteAlias
43 SamrDeleteGroup
44 x SamrDeleteUser
45 x SamrEnumerateAliasesInDomain
46 SamrEnumerateDomainsInSamServer
47 x SamrEnumerateGroupsInDomain
48 x SamrEnumerateUsersInDomain
49 SamrGetUserDomainPasswordInformation
50 SamrLookupDomainInSamServer
51 ? SamrLookupIdsInDomain
52 x SamrLookupNamesInDomain
53 x SamrOpenAlias
54 x SamrOpenDomain
55 x SamrOpenGroup
56 x SamrOpenUser
57 x SamrQueryDisplayInformation
58 x SamrQueryInformationAlias
59 SamrQueryInformationDomain
60 ? SamrQueryInformationUser
61 x SamrQuerySecurityObject
62 SamrRemoveMemberFromAlias
63 SamrRemoveMemberFromForiegnDomain
64 SamrRemoveMemberFromGroup
65 SamrRemoveMultipleMembersFromAlias
66 x SamrSetInformationAlias
67 SamrSetInformationDomain
68 x SamrSetInformationGroup
69 x SamrSetInformationUser
70 SamrSetMemberAttributesOfGroup
71 SamrSetSecurityObject
72 SamrShutdownSamServer
73 SamrTestPrivateFunctionsDomain
74 SamrTestPrivateFunctionsUser
75
76 ********************************************************************/
77
78 #define SAMR_CONNECT_ANON      0x00
79 #define SAMR_CLOSE_HND         0x01
80 #define SAMR_SET_SEC_OBJECT    0x02
81 #define SAMR_QUERY_SEC_OBJECT  0x03
82
83 #define SAMR_UNKNOWN_4         0x04 /* profile info? */
84 #define SAMR_LOOKUP_DOMAIN     0x05
85 #define SAMR_ENUM_DOMAINS      0x06
86 #define SAMR_OPEN_DOMAIN       0x07
87 #define SAMR_QUERY_DOMAIN_INFO 0x08
88 #define SAMR_SET_DOMAIN_INFO   0x09
89
90 #define SAMR_CREATE_DOM_GROUP  0x0a
91 #define SAMR_ENUM_DOM_GROUPS   0x0b
92 #define SAMR_ENUM_DOM_USERS    0x0d
93 #define SAMR_CREATE_DOM_ALIAS  0x0e
94 #define SAMR_ENUM_DOM_ALIASES  0x0f
95 #define SAMR_QUERY_USERALIASES 0x10
96
97 #define SAMR_LOOKUP_NAMES      0x11
98 #define SAMR_LOOKUP_RIDS       0x12
99
100 #define SAMR_OPEN_GROUP        0x13
101 #define SAMR_QUERY_GROUPINFO   0x14
102 #define SAMR_SET_GROUPINFO     0x15
103 #define SAMR_ADD_GROUPMEM      0x16
104 #define SAMR_DELETE_DOM_GROUP  0x17
105 #define SAMR_DEL_GROUPMEM      0x18
106 #define SAMR_QUERY_GROUPMEM    0x19
107 #define SAMR_UNKNOWN_1A        0x1a
108
109 #define SAMR_OPEN_ALIAS        0x1b
110 #define SAMR_QUERY_ALIASINFO   0x1c
111 #define SAMR_SET_ALIASINFO     0x1d
112 #define SAMR_DELETE_DOM_ALIAS  0x1e
113 #define SAMR_ADD_ALIASMEM      0x1f
114 #define SAMR_DEL_ALIASMEM      0x20
115 #define SAMR_QUERY_ALIASMEM    0x21
116
117 #define SAMR_OPEN_USER         0x22
118 #define SAMR_DELETE_DOM_USER   0x23
119 #define SAMR_QUERY_USERINFO    0x24
120 #define SAMR_SET_USERINFO2     0x25
121 #define SAMR_QUERY_USERGROUPS  0x27
122
123 #define SAMR_QUERY_DISPINFO    0x28
124 #define SAMR_UNKNOWN_29        0x29
125 #define SAMR_UNKNOWN_2a        0x2a
126 #define SAMR_UNKNOWN_2b        0x2b
127 #define SAMR_GET_USRDOM_PWINFO 0x2c
128 #define SAMR_REMOVE_SID_FOREIGN_DOMAIN        0x2d
129 #define SAMR_QUERY_DOMAIN_INFO2  0x2e /* looks like an alias for SAMR_QUERY_DOMAIN_INFO */
130 #define SAMR_UNKNOWN_2f        0x2f
131 #define SAMR_QUERY_DISPINFO3   0x30 /* Alias for SAMR_QUERY_DISPINFO
132                                        with info level 3 */
133 #define SAMR_UNKNOWN_31        0x31
134 #define SAMR_CREATE_USER       0x32
135 #define SAMR_QUERY_DISPINFO4   0x33 /* Alias for SAMR_QUERY_DISPINFO
136                                        with info level 4 */
137 #define SAMR_ADDMULTI_ALIASMEM 0x34
138
139 #define SAMR_UNKNOWN_35        0x35
140 #define SAMR_UNKNOWN_36        0x36
141 #define SAMR_CHGPASSWD_USER    0x37
142 #define SAMR_GET_DOM_PWINFO    0x38
143 #define SAMR_CONNECT           0x39
144 #define SAMR_SET_USERINFO      0x3A
145 #define SAMR_CONNECT4          0x3E
146 #define SAMR_CHGPASSWD_USER3   0x3F
147 #define SAMR_CONNECT5          0x40
148
149 typedef struct logon_hours_info
150 {
151         uint32 max_len; /* normally 1260 bytes */
152         uint32 offset;
153         uint32 len; /* normally 21 bytes */
154         uint8 hours[32];
155
156 } LOGON_HRS;
157
158 /* SAM_USER_INFO_23 */
159 typedef struct sam_user_info_23
160 {
161         /* TIMES MAY NOT IN RIGHT ORDER!!!! */
162         NTTIME logon_time;            /* logon time */
163         NTTIME logoff_time;           /* logoff time */
164         NTTIME kickoff_time;          /* kickoff time */
165         NTTIME pass_last_set_time;    /* password last set time */
166         NTTIME pass_can_change_time;  /* password can change time */
167         NTTIME pass_must_change_time; /* password must change time */
168
169         UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
170         UNIHDR hdr_full_name;    /* user's full name unicode string header */
171         UNIHDR hdr_home_dir;     /* home directory unicode string header */
172         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
173         UNIHDR hdr_logon_script; /* logon script unicode string header */
174         UNIHDR hdr_profile_path; /* profile path unicode string header */
175         UNIHDR hdr_acct_desc  ;  /* user description */
176         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
177         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
178         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
179
180         uint8 lm_pwd[16];    /* lm user passwords */
181         uint8 nt_pwd[16];    /* nt user passwords */
182
183         uint32 user_rid;      /* Primary User ID */
184         uint32 group_rid;     /* Primary Group ID */
185
186         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
187
188         uint32 fields_present; /* 0x09f8 27fa */
189
190         uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
191         /* uint8 pad[2] */
192         uint32 ptr_logon_hrs; /* pointer to logon hours */
193
194         /* Was unknown_5. */
195         uint16 bad_password_count;
196         uint16 logon_count;
197
198         uint8 padding1[6];
199                 
200         uint8 passmustchange; /* 0x00 must change = 0x01 */
201
202         uint8 padding2;
203
204         uint8 pass[516];
205
206         UNISTR2 uni_user_name;    /* NULL - username unicode string */
207         UNISTR2 uni_full_name;    /* user's full name unicode string */
208         UNISTR2 uni_home_dir;     /* home directory unicode string */
209         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
210         UNISTR2 uni_logon_script; /* logon script unicode string */
211         UNISTR2 uni_profile_path; /* profile path unicode string */
212         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
213         UNISTR2 uni_workstations; /* login from workstations unicode string */
214         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
215         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
216
217         LOGON_HRS logon_hrs;
218
219 } SAM_USER_INFO_23;
220
221 /* SAM_USER_INFO_24 */
222 typedef struct sam_user_info_24
223 {
224         uint8 pass[516];
225         uint16 pw_len;
226 } SAM_USER_INFO_24;
227
228 /*
229  * NB. This structure is *definately* incorrect. It's my best guess
230  * currently for W2K SP2. The password field is encrypted in a different
231  * way than normal... And there are definately other problems. JRA.
232  */
233
234 /* SAM_USER_INFO_25 */
235 typedef struct sam_user_info_25
236 {
237         /* TIMES MAY NOT IN RIGHT ORDER!!!! */
238         NTTIME logon_time;            /* logon time */
239         NTTIME logoff_time;           /* logoff time */
240         NTTIME kickoff_time;          /* kickoff time */
241         NTTIME pass_last_set_time;    /* password last set time */
242         NTTIME pass_can_change_time;  /* password can change time */
243         NTTIME pass_must_change_time; /* password must change time */
244
245         UNIHDR hdr_user_name;    /* NULL - user name unicode string header */
246         UNIHDR hdr_full_name;    /* user's full name unicode string header */
247         UNIHDR hdr_home_dir;     /* home directory unicode string header */
248         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
249         UNIHDR hdr_logon_script; /* logon script unicode string header */
250         UNIHDR hdr_profile_path; /* profile path unicode string header */
251         UNIHDR hdr_acct_desc  ;  /* user description */
252         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
253         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
254         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
255
256         uint8 lm_pwd[16];    /* lm user passwords */
257         uint8 nt_pwd[16];    /* nt user passwords */
258
259         uint32 user_rid;      /* Primary User ID */
260         uint32 group_rid;     /* Primary Group ID */
261
262         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
263
264         uint32 unknown_6[6];
265
266         uint8 pass[532];
267
268         UNISTR2 uni_user_name;    /* NULL - username unicode string */
269         UNISTR2 uni_full_name;    /* user's full name unicode string */
270         UNISTR2 uni_home_dir;     /* home directory unicode string */
271         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
272         UNISTR2 uni_logon_script; /* logon script unicode string */
273         UNISTR2 uni_profile_path; /* profile path unicode string */
274         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
275         UNISTR2 uni_workstations; /* login from workstations unicode string */
276         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
277         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel no */
278 } SAM_USER_INFO_25;
279
280 /* SAM_USER_INFO_26 */
281 typedef struct sam_user_info_26
282 {
283         uint8 pass[532];
284         uint8 pw_len;
285 } SAM_USER_INFO_26;
286
287
288 /* SAM_USER_INFO_21 */
289 typedef struct sam_user_info_21
290 {
291         NTTIME logon_time;            /* logon time */
292         NTTIME logoff_time;           /* logoff time */
293         NTTIME kickoff_time;          /* kickoff time */
294         NTTIME pass_last_set_time;    /* password last set time */
295         NTTIME pass_can_change_time;  /* password can change time */
296         NTTIME pass_must_change_time; /* password must change time */
297
298         UNIHDR hdr_user_name;    /* username unicode string header */
299         UNIHDR hdr_full_name;    /* user's full name unicode string header */
300         UNIHDR hdr_home_dir;     /* home directory unicode string header */
301         UNIHDR hdr_dir_drive;    /* home drive unicode string header */
302         UNIHDR hdr_logon_script; /* logon script unicode string header */
303         UNIHDR hdr_profile_path; /* profile path unicode string header */
304         UNIHDR hdr_acct_desc  ;  /* user description */
305         UNIHDR hdr_workstations; /* comma-separated workstations user can log in from */
306         UNIHDR hdr_unknown_str ; /* don't know what this is, yet. */
307         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
308
309         uint8 lm_pwd[16];    /* lm user passwords */
310         uint8 nt_pwd[16];    /* nt user passwords */
311
312         uint32 user_rid;      /* Primary User ID */
313         uint32 group_rid;     /* Primary Group ID */
314
315         uint32 acb_info; /* account info (ACB_xxxx bit-mask) */
316
317         /* Was unknown_3 */
318         uint32 fields_present; /* 0x00ff ffff */
319
320         uint16 logon_divs; /* 0x0000 00a8 which is 168 which is num hrs in a week */
321         /* uint8 pad[2] */
322         uint32 ptr_logon_hrs; /* unknown pointer */
323
324         /* Was unknown_5. */
325         uint16 bad_password_count;
326         uint16 logon_count;
327
328         uint8 padding1[6];
329                 
330         uint8 passmustchange; /* 0x00 must change = 0x01 */
331
332         uint8 padding2;
333
334         UNISTR2 uni_user_name;    /* username unicode string */
335         UNISTR2 uni_full_name;    /* user's full name unicode string */
336         UNISTR2 uni_home_dir;     /* home directory unicode string */
337         UNISTR2 uni_dir_drive;    /* home directory drive unicode string */
338         UNISTR2 uni_logon_script; /* logon script unicode string */
339         UNISTR2 uni_profile_path; /* profile path unicode string */
340         UNISTR2 uni_acct_desc  ;  /* user description unicode string */
341         UNISTR2 uni_workstations; /* login from workstations unicode string */
342         UNISTR2 uni_unknown_str ; /* don't know what this is, yet. */
343         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
344
345         LOGON_HRS logon_hrs;
346
347 } SAM_USER_INFO_21;
348
349 #define PASS_MUST_CHANGE_AT_NEXT_LOGON  0x01
350 #define PASS_DONT_CHANGE_AT_NEXT_LOGON  0x00
351
352 /* SAM_USER_INFO_20 */
353 typedef struct sam_user_info_20
354 {
355         UNIHDR hdr_munged_dial ; /* munged path name and dial-back tel number */
356
357         UNISTR2 uni_munged_dial ; /* munged path name and dial-back tel number */
358
359 } SAM_USER_INFO_20;
360
361 /* SAM_USER_INFO_18 */
362 typedef struct sam_user_info_18
363 {
364         uint8 lm_pwd[16];    /* lm user passwords */
365         uint8 nt_pwd[16];    /* nt user passwords */
366
367         uint8 lm_pwd_active; 
368         uint8 nt_pwd_active; 
369
370 } SAM_USER_INFO_18;
371
372 /* SAM_USER_INFO_17 */
373 typedef struct sam_user_info_17
374 {
375         uint8  padding_0[16];  /* 0 - padding 16 bytes */
376         NTTIME expiry;         /* expiry time or something? */
377         uint8  padding_1[24];  /* 0 - padding 24 bytes */
378
379         UNIHDR hdr_mach_acct;  /* unicode header for machine account */
380         uint32 padding_2;      /* 0 - padding 4 bytes */
381
382         uint32 ptr_1;          /* pointer */
383         uint8  padding_3[32];  /* 0 - padding 32 bytes */
384         uint32 padding_4;      /* 0 - padding 4 bytes */
385
386         uint32 ptr_2;          /* pointer */
387         uint32 padding_5;      /* 0 - padding 4 bytes */
388
389         uint32 ptr_3;          /* pointer */
390         uint8  padding_6[32];  /* 0 - padding 32 bytes */
391
392         uint32 rid_user;       /* user RID */
393         uint32 rid_group;      /* group RID */
394
395         uint16 acct_ctrl;      /* 0080 - ACB_XXXX */
396         uint16 unknown_3;      /* 16 bit padding */
397
398         uint16 unknown_4;      /* 0x003f      - 16 bit unknown */
399         uint16 unknown_5;      /* 0x003c      - 16 bit unknown */
400
401         uint8  padding_7[16];  /* 0 - padding 16 bytes */
402         uint32 padding_8;      /* 0 - padding 4 bytes */
403         
404         UNISTR2 uni_mach_acct; /* unicode string for machine account */
405
406         uint8  padding_9[48];  /* 0 - padding 48 bytes */
407
408 } SAM_USER_INFO_17;
409
410
411 /* SAM_USER_INFO_16 */
412 typedef struct sam_user_info_16
413 {
414         uint32 acb_info;
415
416 } SAM_USER_INFO_16;
417
418
419 /* SAM_USER_INFO_7 */
420 typedef struct sam_user_info_7
421 {
422         UNIHDR hdr_name;  /* unicode header for name */
423         UNISTR2 uni_name; /* unicode string for name */
424
425 } SAM_USER_INFO_7;
426
427
428 /* SAM_USER_INFO_9 */
429 typedef struct sam_user_info_9
430 {
431         uint32 rid_group;     /* Primary Group RID */
432 } SAM_USER_INFO_9;
433
434
435 /* SAMR_Q_CLOSE_HND - probably a policy handle close */
436 typedef struct q_samr_close_hnd_info
437 {
438     POLICY_HND pol;          /* policy handle */
439
440 } SAMR_Q_CLOSE_HND;
441
442
443 /* SAMR_R_CLOSE_HND - probably a policy handle close */
444 typedef struct r_samr_close_hnd_info
445 {
446         POLICY_HND pol;       /* policy handle */
447         NTSTATUS status;         /* return status */
448
449 } SAMR_R_CLOSE_HND;
450
451
452 /****************************************************************************
453 SAMR_Q_GET_USRDOM_PWINFO - a "set user info" occurs just after this
454 *****************************************************************************/
455
456 /* SAMR_Q_GET_USRDOM_PWINFO */
457 typedef struct q_samr_usrdom_pwinfo_info
458 {
459         POLICY_HND user_pol;          /* policy handle */
460
461 } SAMR_Q_GET_USRDOM_PWINFO;
462
463
464 /****************************************************************************
465 SAMR_R_GET_USRDOM_PWINFO - a "set user info" occurs just after this
466 *****************************************************************************/
467
468 /* SAMR_R_GET_USRDOM_PWINFO */
469 typedef struct r_samr_usrdom_pwinfo_info
470 {
471         uint16 unknown_0; /* 0000 */
472         uint16 unknown_1; /* 0x0016 or 0x0015 */
473         uint32 unknown_2; /* 0x0000 0000 */
474         NTSTATUS status; 
475
476 } SAMR_R_GET_USRDOM_PWINFO;
477
478 /****************************************************************************
479 SAMR_Q_SET_SEC_OBJ - info level 4.
480 *****************************************************************************/
481
482 /* SAMR_Q_SET_SEC_OBJ - */
483 typedef struct q_samr_set_sec_obj_info
484 {
485         POLICY_HND pol;          /* policy handle */
486         uint32 sec_info;         /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
487         SEC_DESC_BUF *buf;
488
489 } SAMR_Q_SET_SEC_OBJ;
490
491 /* SAMR_R_SET_SEC_OBJ - */
492 typedef struct r_samr_set_sec_obj_info
493 {
494         NTSTATUS status;         /* return status */
495
496 } SAMR_R_SET_SEC_OBJ;
497
498
499 /****************************************************************************
500 SAMR_Q_QUERY_SEC_OBJ - info level 4.  returns SIDs.
501 *****************************************************************************/
502
503 /* SAMR_Q_QUERY_SEC_OBJ - probably get domain info... */
504 typedef struct q_samr_query_sec_obj_info
505 {
506         POLICY_HND user_pol;          /* policy handle */
507         uint32 sec_info;     /* xxxx_SECURITY_INFORMATION 0x0000 0004 */
508
509 } SAMR_Q_QUERY_SEC_OBJ;
510
511 /* SAMR_R_QUERY_SEC_OBJ - probably an open */
512 typedef struct r_samr_query_sec_obj_info
513 {
514         uint32 ptr;
515         SEC_DESC_BUF *buf;
516
517         NTSTATUS status;         /* return status */
518
519 } SAMR_R_QUERY_SEC_OBJ;
520
521
522 /****************************************************************************
523 SAMR_Q_QUERY_DOMAIN_INFO - probably a query on domain group info.
524 *****************************************************************************/
525
526 /* SAMR_Q_QUERY_DOMAIN_INFO - */
527 typedef struct q_samr_query_domain_info
528 {
529         POLICY_HND domain_pol;   /* policy handle */
530         uint16 switch_value;     /* 0x0002, 0x0001 */
531
532 } SAMR_Q_QUERY_DOMAIN_INFO;
533
534 typedef struct sam_unknown_info_3_info
535 {
536         NTTIME logout;  
537         /* 0x8000 0000 */ /* DON'T forcibly disconnect remote users from server when logon hours expire*/
538
539         /* 0x0000 0000 */ /* forcibly disconnect remote users from server when logon hours expire*/
540
541 } SAM_UNK_INFO_3;
542
543 typedef struct sam_unknown_info_6_info
544 {
545         uint32 unknown_0; /* 0x0000 0000 */
546
547         uint32 ptr_0;     /* pointer to unknown structure */
548         uint8  padding[12]; /* 12 bytes zeros */
549
550 } SAM_UNK_INFO_6;
551
552 typedef struct sam_unknown_info_7_info
553 {
554         uint16 server_role;
555
556 } SAM_UNK_INFO_7;
557
558 typedef struct sam_unknown_info_8_info
559 {
560         UINT64_S seq_num;
561         NTTIME domain_create_time;
562
563 } SAM_UNK_INFO_8;
564
565 typedef struct sam_unknown_info_12_inf
566 {
567         NTTIME duration;
568         NTTIME reset_count;
569         uint16 bad_attempt_lockout;
570
571 } SAM_UNK_INFO_12;
572
573 typedef struct sam_unknown_info_5_inf
574 {
575         UNIHDR hdr_server; /* server name unicode header */
576         UNISTR2 uni_server; /* server name unicode string */
577
578 } SAM_UNK_INFO_5;
579
580 typedef struct sam_unknown_info_2_inf
581 {
582         NTTIME logout; /* whether users are forcibly disconnected when logon hours expire */
583         UNIHDR hdr_comment; /* comment according to samba4 idl */
584         UNIHDR hdr_domain; /* domain name unicode header */
585         UNIHDR hdr_server; /* server name unicode header */
586
587         /* put all the data in here, at the moment, including what the above
588            pointer is referring to
589          */
590
591         UINT64_S seq_num;
592         
593         uint32 unknown_4; /* 0x0000 0001 */
594         uint32 server_role;
595         uint32 unknown_6; /* 0x0000 0001 */
596         uint32 num_domain_usrs; /* number of users in domain */
597         uint32 num_domain_grps; /* number of domain groups in domain */
598         uint32 num_local_grps; /* number of local groups in domain */
599
600         uint8 padding[12]; /* 12 bytes zeros */
601
602         UNISTR2 uni_comment; /* comment unicode string */
603         UNISTR2 uni_domain; /* domain name unicode string */
604         UNISTR2 uni_server; /* server name unicode string */
605
606 } SAM_UNK_INFO_2;
607
608 typedef struct sam_unknown_info_1_inf
609 {
610         uint16 min_length_password;
611         uint16 password_history;
612         uint32 password_properties;
613         NTTIME expire;
614         NTTIME min_passwordage;
615
616 } SAM_UNK_INFO_1;
617
618
619 typedef struct sam_unknown_ctr_info
620 {
621         union
622         {
623                 SAM_UNK_INFO_1 inf1;
624                 SAM_UNK_INFO_2 inf2;
625                 SAM_UNK_INFO_3 inf3;
626                 SAM_UNK_INFO_5 inf5;
627                 SAM_UNK_INFO_6 inf6;
628                 SAM_UNK_INFO_7 inf7;
629                 SAM_UNK_INFO_8 inf8;
630                 SAM_UNK_INFO_12 inf12;
631
632         } info;
633
634 } SAM_UNK_CTR;
635
636
637 /* SAMR_R_QUERY_DOMAIN_INFO - */
638 typedef struct r_samr_query_domain_info
639 {
640         uint32 ptr_0;
641         uint16 switch_value; /* same as in query */
642
643         SAM_UNK_CTR *ctr;
644
645         NTSTATUS status;         /* return status */
646
647 } SAMR_R_QUERY_DOMAIN_INFO;
648
649
650 /* SAMR_Q_LOOKUP_DOMAIN - obtain SID for a local domain */
651 typedef struct q_samr_lookup_domain_info
652 {
653         POLICY_HND connect_pol;
654
655         UNIHDR  hdr_domain;
656         UNISTR2 uni_domain;
657
658 } SAMR_Q_LOOKUP_DOMAIN;
659
660
661 /* SAMR_R_LOOKUP_DOMAIN */
662 typedef struct r_samr_lookup_domain_info
663 {
664         uint32   ptr_sid;
665         DOM_SID2 dom_sid;
666
667         NTSTATUS status;
668
669 } SAMR_R_LOOKUP_DOMAIN;
670
671
672 /****************************************************************************
673 SAMR_Q_OPEN_DOMAIN - unknown_0 values seen associated with SIDs:
674
675 0x0000 03f1 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
676 0x0000 0200 and a specific   domain sid - S-1-5-21-44c01ca6-797e5c3d-33f83fd0
677 *****************************************************************************/
678
679 /* SAMR_Q_OPEN_DOMAIN */
680 typedef struct q_samr_open_domain_info
681 {
682         POLICY_HND pol;   /* policy handle */
683         uint32 flags;               /* 0x2000 0000; 0x0000 0211; 0x0000 0280; 0x0000 0200 - flags? */
684         DOM_SID2 dom_sid;         /* domain SID */
685
686 } SAMR_Q_OPEN_DOMAIN;
687
688
689 /* SAMR_R_OPEN_DOMAIN - probably an open */
690 typedef struct r_samr_open_domain_info
691 {
692         POLICY_HND domain_pol; /* policy handle associated with the SID */
693         NTSTATUS status;         /* return status */
694
695 } SAMR_R_OPEN_DOMAIN;
696
697 #define MAX_SAM_ENTRIES_W2K 0x400
698 #define MAX_SAM_ENTRIES_W95 50
699 /* The following should be the greater of the preceeding two. */
700 #define MAX_SAM_ENTRIES MAX_SAM_ENTRIES_W2K
701
702 typedef struct samr_entry_info
703 {
704         uint32 rid;
705         UNIHDR hdr_name;
706
707 } SAM_ENTRY;
708
709
710 /* SAMR_Q_ENUM_DOMAINS - SAM rids and names */
711 typedef struct q_samr_enum_domains_info
712 {
713         POLICY_HND pol;     /* policy handle */
714
715         uint32 start_idx;   /* enumeration handle */
716         uint32 max_size;    /* 0x0000 ffff */
717
718 } SAMR_Q_ENUM_DOMAINS;
719
720 /* SAMR_R_ENUM_DOMAINS - SAM rids and Domain names */
721 typedef struct r_samr_enum_domains_info
722 {
723         uint32 next_idx;     /* next starting index required for enum */
724         uint32 ptr_entries1;  
725
726         uint32 num_entries2;
727         uint32 ptr_entries2;
728
729         uint32 num_entries3;
730
731         SAM_ENTRY *sam;
732         UNISTR2 *uni_dom_name;
733
734         uint32 num_entries4;
735
736         NTSTATUS status;
737
738 } SAMR_R_ENUM_DOMAINS;
739
740 /* SAMR_Q_ENUM_DOM_USERS - SAM rids and names */
741 typedef struct q_samr_enum_dom_users_info
742 {
743         POLICY_HND pol;          /* policy handle */
744
745         uint32 start_idx;   /* number of values (0 indicates unlimited?) */
746         uint16 acb_mask;          /* 0x0000 indicates all */
747         uint16 unknown_1;         /* 0x0000 */
748
749         uint32 max_size;              /* 0x0000 ffff */
750
751 } SAMR_Q_ENUM_DOM_USERS;
752
753
754 /* SAMR_R_ENUM_DOM_USERS - SAM rids and names */
755 typedef struct r_samr_enum_dom_users_info
756 {
757         uint32 next_idx;     /* next starting index required for enum */
758         uint32 ptr_entries1;  
759
760         uint32 num_entries2;
761         uint32 ptr_entries2;
762
763         uint32 num_entries3;
764
765         SAM_ENTRY *sam;
766         UNISTR2 *uni_acct_name;
767
768         uint32 num_entries4;
769
770         NTSTATUS status;
771
772 } SAMR_R_ENUM_DOM_USERS;
773
774
775 /* SAMR_Q_ENUM_DOM_GROUPS - SAM rids and names */
776 typedef struct q_samr_enum_dom_groups_info
777 {
778         POLICY_HND pol;          /* policy handle */
779
780         /* this is possibly an enumeration context handle... */
781         uint32 start_idx;         /* 0x0000 0000 */
782
783         uint32 max_size;              /* 0x0000 ffff */
784
785 } SAMR_Q_ENUM_DOM_GROUPS;
786
787
788 /* SAMR_R_ENUM_DOM_GROUPS - SAM rids and names */
789 typedef struct r_samr_enum_dom_groups_info
790 {
791         uint32 next_idx;
792         uint32 ptr_entries1;
793
794         uint32 num_entries2;
795         uint32 ptr_entries2;
796
797         uint32 num_entries3;
798
799         SAM_ENTRY *sam;
800         UNISTR2 *uni_grp_name;
801
802         uint32 num_entries4;
803
804         NTSTATUS status;
805
806 } SAMR_R_ENUM_DOM_GROUPS;
807
808
809 /* SAMR_Q_ENUM_DOM_ALIASES - SAM rids and names */
810 typedef struct q_samr_enum_dom_aliases_info
811 {
812         POLICY_HND pol;          /* policy handle */
813
814         /* this is possibly an enumeration context handle... */
815         uint32 start_idx;         /* 0x0000 0000 */
816
817         uint32 max_size;              /* 0x0000 ffff */
818
819 } SAMR_Q_ENUM_DOM_ALIASES;
820
821
822 /* SAMR_R_ENUM_DOM_ALIASES - SAM rids and names */
823 typedef struct r_samr_enum_dom_aliases_info
824 {
825         uint32 next_idx;
826         uint32 ptr_entries1;
827
828         uint32 num_entries2;
829         uint32 ptr_entries2;
830
831         uint32 num_entries3;
832
833         SAM_ENTRY *sam;
834         UNISTR2 *uni_grp_name;
835
836         uint32 num_entries4;
837
838         NTSTATUS status;
839
840 } SAMR_R_ENUM_DOM_ALIASES;
841
842
843 /* -- Level 1 Display Info - User Information -- */
844
845 typedef struct samr_entry_info1
846 {
847         uint32 user_idx;
848
849         uint32 rid_user;
850         uint16 acb_info;
851
852         UNIHDR hdr_acct_name;
853         UNIHDR hdr_user_name;
854         UNIHDR hdr_user_desc;
855
856 } SAM_ENTRY1;
857
858 typedef struct samr_str_entry_info1
859 {
860         UNISTR2 uni_acct_name;
861         UNISTR2 uni_full_name;
862         UNISTR2 uni_acct_desc;
863
864 } SAM_STR1;
865
866 typedef struct sam_entry_info_1
867 {
868         SAM_ENTRY1 *sam;
869         SAM_STR1   *str;
870
871 } SAM_DISPINFO_1;
872
873
874 /* -- Level 2 Display Info - Trust Account Information -- */
875
876 typedef struct samr_entry_info2
877 {
878         uint32 user_idx;
879
880         uint32 rid_user;
881         uint16 acb_info;
882
883         UNIHDR hdr_srv_name;
884         UNIHDR hdr_srv_desc;
885
886 } SAM_ENTRY2;
887
888 typedef struct samr_str_entry_info2
889 {
890         UNISTR2 uni_srv_name;
891         UNISTR2 uni_srv_desc;
892
893 } SAM_STR2;
894
895 typedef struct sam_entry_info_2
896 {
897         SAM_ENTRY2 *sam;
898         SAM_STR2   *str;
899
900 } SAM_DISPINFO_2;
901
902
903 /* -- Level 3 Display Info - Domain Group Information -- */
904
905 typedef struct samr_entry_info3
906 {
907         uint32 grp_idx;
908
909         uint32 rid_grp;
910         uint32 attr;     /* SE_GROUP_xxx, usually 7 */
911
912         UNIHDR hdr_grp_name;
913         UNIHDR hdr_grp_desc;
914
915 } SAM_ENTRY3;
916
917 typedef struct samr_str_entry_info3
918 {
919         UNISTR2 uni_grp_name;
920         UNISTR2 uni_grp_desc;
921
922 } SAM_STR3;
923
924 typedef struct sam_entry_info_3
925 {
926         SAM_ENTRY3 *sam;
927         SAM_STR3   *str;
928
929 } SAM_DISPINFO_3;
930
931
932 /* -- Level 4 Display Info - User List (ASCII) -- */
933
934 typedef struct samr_entry_info4
935 {
936         uint32 user_idx;
937         STRHDR hdr_acct_name;
938
939 } SAM_ENTRY4;
940
941 typedef struct samr_str_entry_info4
942 {
943         STRING2 acct_name;
944
945 } SAM_STR4;
946
947 typedef struct sam_entry_info_4
948 {
949         SAM_ENTRY4 *sam;
950         SAM_STR4   *str;
951
952 } SAM_DISPINFO_4;
953
954
955 /* -- Level 5 Display Info - Group List (ASCII) -- */
956
957 typedef struct samr_entry_info5
958 {
959         uint32 grp_idx;
960         STRHDR hdr_grp_name;
961
962 } SAM_ENTRY5;
963
964 typedef struct samr_str_entry_info5
965 {
966         STRING2 grp_name;
967
968 } SAM_STR5;
969
970 typedef struct sam_entry_info_5
971 {
972         SAM_ENTRY5 *sam;
973         SAM_STR5   *str;
974
975 } SAM_DISPINFO_5;
976
977
978 typedef struct sam_dispinfo_ctr_info
979 {
980         union
981         {
982                 SAM_DISPINFO_1 *info1; /* users/names/descriptions */
983                 SAM_DISPINFO_2 *info2; /* trust accounts */
984                 SAM_DISPINFO_3 *info3; /* domain groups/descriptions */
985                 SAM_DISPINFO_4 *info4; /* user list (ASCII) - used by Win95 */
986                 SAM_DISPINFO_5 *info5; /* group list (ASCII) */
987                 void       *info; /* allows assignment without typecasting, */
988
989         } sam;
990
991 } SAM_DISPINFO_CTR;
992
993
994 /* SAMR_Q_QUERY_DISPINFO - SAM rids, names and descriptions */
995 typedef struct q_samr_query_disp_info
996 {
997         POLICY_HND domain_pol;
998
999         uint16 switch_level;    /* see SAM_DISPINFO_CTR above */
1000         /* align */
1001
1002         uint32 start_idx;       /* start enumeration index */
1003         uint32 max_entries;     /* maximum number of entries to return */
1004         uint32 max_size;        /* recommended data size; if exceeded server
1005                                    should return STATUS_MORE_ENTRIES */
1006
1007 } SAMR_Q_QUERY_DISPINFO;
1008
1009
1010 /* SAMR_R_QUERY_DISPINFO  */
1011 typedef struct r_samr_query_dispinfo_info
1012 {
1013         uint32 total_size;     /* total data size for all matching entries
1014                                   (0 = uncalculated) */
1015         uint32 data_size;      /* actual data size returned = size of SAM_ENTRY
1016                                   structures + total length of strings */
1017
1018         uint16 switch_level;   /* see SAM_DISPINFO_CTR above */
1019         /* align */
1020
1021         uint32 num_entries;    /* number of entries returned */
1022         uint32 ptr_entries;
1023         uint32 num_entries2;
1024
1025         SAM_DISPINFO_CTR *ctr;
1026
1027         NTSTATUS status;
1028
1029 } SAMR_R_QUERY_DISPINFO;
1030
1031
1032 /* SAMR_Q_DELETE_DOM_GROUP - delete domain group */
1033 typedef struct q_samr_delete_dom_group_info
1034 {
1035     POLICY_HND group_pol;          /* policy handle */
1036
1037 } SAMR_Q_DELETE_DOM_GROUP;
1038
1039
1040 /* SAMR_R_DELETE_DOM_GROUP - delete domain group */
1041 typedef struct r_samr_delete_dom_group_info
1042 {
1043         POLICY_HND pol;       /* policy handle */
1044         NTSTATUS status;        /* return status */
1045
1046 } SAMR_R_DELETE_DOM_GROUP;
1047
1048
1049 /* SAMR_Q_CREATE_DOM_GROUP - SAM create group */
1050 typedef struct q_samr_create_dom_group_info
1051 {
1052         POLICY_HND pol;        /* policy handle */
1053
1054         UNIHDR hdr_acct_desc;
1055         UNISTR2 uni_acct_desc;
1056
1057         uint32 access_mask;    
1058
1059 } SAMR_Q_CREATE_DOM_GROUP;
1060
1061 /* SAMR_R_CREATE_DOM_GROUP - SAM create group */
1062 typedef struct r_samr_create_dom_group_info
1063 {
1064         POLICY_HND pol;        /* policy handle */
1065
1066         uint32 rid;    
1067         NTSTATUS status;    
1068
1069 } SAMR_R_CREATE_DOM_GROUP;
1070
1071 /* SAMR_Q_QUERY_GROUPINFO - SAM Group Info */
1072 typedef struct q_samr_query_group_info
1073 {
1074         POLICY_HND pol;        /* policy handle */
1075
1076         uint16 switch_level;    /* 0x0001 seen */
1077
1078 } SAMR_Q_QUERY_GROUPINFO;
1079
1080 typedef struct samr_group_info1
1081 {
1082         UNIHDR hdr_acct_name;
1083
1084         uint32 group_attr; /* 0x0000 0003 - group attribute */
1085         uint32 num_members; /* 0x0000 0001 - number of group members? */
1086
1087         UNIHDR hdr_acct_desc;
1088
1089         UNISTR2 uni_acct_name;
1090         UNISTR2 uni_acct_desc;
1091
1092 } GROUP_INFO1;
1093
1094 typedef struct samr_group_info2
1095 {
1096         uint16 level;
1097         UNIHDR hdr_acct_name;
1098         UNISTR2 uni_acct_name;
1099
1100 } GROUP_INFO2;
1101
1102 typedef struct samr_group_info3
1103 {
1104         uint32 group_attr; /* 0x0000 0003 - group attribute */
1105
1106 } GROUP_INFO3;
1107
1108 typedef struct samr_group_info4
1109 {
1110         uint16 level;
1111         UNIHDR hdr_acct_desc;
1112         UNISTR2 uni_acct_desc;
1113
1114 } GROUP_INFO4;
1115
1116 /* GROUP_INFO_CTR */
1117 typedef struct group_info_ctr
1118 {
1119         uint16 switch_value1;
1120
1121         union
1122         {
1123                 GROUP_INFO1 info1;
1124                 GROUP_INFO2 info2;
1125                 GROUP_INFO3 info3;
1126                 GROUP_INFO4 info4;
1127
1128         } group;
1129
1130 } GROUP_INFO_CTR;
1131
1132 /* SAMR_R_QUERY_GROUPINFO - SAM Group Info */
1133 typedef struct r_samr_query_groupinfo_info
1134 {
1135         uint32 ptr;        
1136         GROUP_INFO_CTR *ctr;
1137
1138         NTSTATUS status;
1139
1140 } SAMR_R_QUERY_GROUPINFO;
1141
1142
1143 /* SAMR_Q_SET_GROUPINFO - SAM Group Info */
1144 typedef struct q_samr_set_group_info
1145 {
1146         POLICY_HND pol;        /* policy handle */
1147         GROUP_INFO_CTR *ctr;
1148
1149 } SAMR_Q_SET_GROUPINFO;
1150
1151 /* SAMR_R_SET_GROUPINFO - SAM Group Info */
1152 typedef struct r_samr_set_group_info
1153 {
1154         NTSTATUS status;
1155
1156 } SAMR_R_SET_GROUPINFO;
1157
1158
1159 /* SAMR_Q_DELETE_DOM_ALIAS - delete domain alias */
1160 typedef struct q_samr_delete_dom_alias_info
1161 {
1162     POLICY_HND alias_pol;          /* policy handle */
1163
1164 } SAMR_Q_DELETE_DOM_ALIAS;
1165
1166
1167 /* SAMR_R_DELETE_DOM_ALIAS - delete domain alias */
1168 typedef struct r_samr_delete_dom_alias_info
1169 {
1170         POLICY_HND pol;       /* policy handle */
1171         NTSTATUS status;        /* return status */
1172
1173 } SAMR_R_DELETE_DOM_ALIAS;
1174
1175
1176 /* SAMR_Q_CREATE_DOM_ALIAS - SAM create alias */
1177 typedef struct q_samr_create_dom_alias_info
1178 {
1179         POLICY_HND dom_pol;        /* policy handle */
1180
1181         UNIHDR hdr_acct_desc;
1182         UNISTR2 uni_acct_desc;
1183
1184         uint32 access_mask;    /* 0x001f000f */
1185
1186 } SAMR_Q_CREATE_DOM_ALIAS;
1187
1188 /* SAMR_R_CREATE_DOM_ALIAS - SAM create alias */
1189 typedef struct r_samr_create_dom_alias_info
1190 {
1191         POLICY_HND alias_pol;        /* policy handle */
1192
1193         uint32 rid;    
1194         NTSTATUS status;    
1195
1196 } SAMR_R_CREATE_DOM_ALIAS;
1197
1198
1199 /********************************************************/
1200
1201 typedef struct {
1202         UNISTR4 name;
1203         UNISTR4 description;
1204         uint32 num_member;
1205 } ALIAS_INFO1;
1206
1207 typedef struct {
1208         UNISTR4 description;
1209 } ALIAS_INFO3;
1210
1211 typedef struct {
1212         POLICY_HND pol;        /* policy handle */
1213         uint16 level;    /* 0x0003 seen */
1214 } SAMR_Q_QUERY_ALIASINFO;
1215
1216 typedef struct {
1217         uint16 level;
1218         union {
1219                 ALIAS_INFO1 info1;
1220                 ALIAS_INFO3 info3;
1221         } alias;
1222 } ALIAS_INFO_CTR;
1223
1224 typedef struct {
1225         ALIAS_INFO_CTR *ctr;
1226         NTSTATUS status;
1227 } SAMR_R_QUERY_ALIASINFO;
1228
1229
1230 /********************************************************/
1231
1232 typedef struct {
1233         POLICY_HND alias_pol;        /* policy handle */
1234         ALIAS_INFO_CTR ctr;
1235 } SAMR_Q_SET_ALIASINFO;
1236
1237 typedef struct {
1238         NTSTATUS status;
1239 } SAMR_R_SET_ALIASINFO;
1240
1241
1242 /********************************************************/
1243
1244 /* SAMR_Q_QUERY_USERGROUPS - */
1245 typedef struct q_samr_query_usergroup_info
1246 {
1247         POLICY_HND pol;          /* policy handle associated with unknown id */
1248
1249 } SAMR_Q_QUERY_USERGROUPS;
1250
1251 /* SAMR_R_QUERY_USERGROUPS - probably a get sam info */
1252 typedef struct r_samr_query_usergroup_info
1253 {
1254         uint32 ptr_0;            /* pointer */
1255         uint32 num_entries;      /* number of RID groups */
1256         uint32 ptr_1;            /* pointer */
1257         uint32 num_entries2;     /* number of RID groups */
1258
1259         DOM_GID *gid; /* group info */
1260
1261         NTSTATUS status;         /* return status */
1262
1263 } SAMR_R_QUERY_USERGROUPS;
1264
1265 /* SAM_USERINFO_CTR - sam user info */
1266 typedef struct sam_userinfo_ctr_info
1267 {
1268         uint16 switch_value;      
1269
1270         union
1271         {
1272                 SAM_USER_INFO_7  *id7;
1273                 SAM_USER_INFO_9  *id9;
1274                 SAM_USER_INFO_16 *id16;
1275                 SAM_USER_INFO_17 *id17;
1276                 SAM_USER_INFO_18 *id18;
1277                 SAM_USER_INFO_20 *id20;
1278                 SAM_USER_INFO_21 *id21;
1279                 SAM_USER_INFO_23 *id23;
1280                 SAM_USER_INFO_24 *id24;
1281                 SAM_USER_INFO_25 *id25;
1282                 SAM_USER_INFO_26 *id26;
1283                 void* id; /* to make typecasting easy */
1284
1285         } info;
1286
1287 } SAM_USERINFO_CTR;
1288
1289
1290 /* SAMR_Q_SET_USERINFO2 - set sam info */
1291 typedef struct q_samr_set_user_info2
1292 {
1293         POLICY_HND pol;          /* policy handle associated with user */
1294         uint16 switch_value;      /* 0x0010 */
1295
1296         SAM_USERINFO_CTR *ctr;
1297
1298 } SAMR_Q_SET_USERINFO2;
1299
1300 /* SAMR_R_SET_USERINFO2 - set sam info */
1301 typedef struct r_samr_set_user_info2
1302 {
1303         NTSTATUS status;         /* return status */
1304
1305 } SAMR_R_SET_USERINFO2;
1306
1307 /* SAMR_Q_SET_USERINFO - set sam info */
1308 typedef struct q_samr_set_user_info
1309 {
1310         POLICY_HND pol;          /* policy handle associated with user */
1311         uint16 switch_value;
1312         SAM_USERINFO_CTR *ctr;
1313
1314 } SAMR_Q_SET_USERINFO;
1315
1316 /* SAMR_R_SET_USERINFO - set sam info */
1317 typedef struct r_samr_set_user_info
1318 {
1319         NTSTATUS status;         /* return status */
1320
1321 } SAMR_R_SET_USERINFO;
1322
1323
1324 /* SAMR_Q_QUERY_USERINFO - probably a get sam info */
1325 typedef struct q_samr_query_user_info
1326 {
1327         POLICY_HND pol;          /* policy handle associated with unknown id */
1328         uint16 switch_value;         /* 0x0015, 0x0011 or 0x0010 - 16 bit unknown */
1329
1330 } SAMR_Q_QUERY_USERINFO;
1331
1332 /* SAMR_R_QUERY_USERINFO - probably a get sam info */
1333 typedef struct r_samr_query_user_info
1334 {
1335         uint32 ptr;            /* pointer */
1336         SAM_USERINFO_CTR *ctr;
1337
1338         NTSTATUS status;         /* return status */
1339
1340 } SAMR_R_QUERY_USERINFO;
1341
1342
1343 /****************************************************************************
1344 SAMR_Q_QUERY_USERALIASES - do a conversion from name to RID.
1345
1346 the policy handle allocated by an "samr open secret" call is associated
1347 with a SID.  this policy handle is what is queried here, *not* the SID
1348 itself.  the response to the lookup rids is relative to this SID.
1349 *****************************************************************************/
1350 /* SAMR_Q_QUERY_USERALIASES */
1351 typedef struct q_samr_query_useraliases_info
1352 {
1353         POLICY_HND pol;       /* policy handle */
1354
1355         uint32 num_sids1;      /* number of rids being looked up */
1356         uint32 ptr;            /* buffer pointer */
1357         uint32 num_sids2;      /* number of rids being looked up */
1358
1359         uint32   *ptr_sid; /* pointers to sids to be looked up */
1360         DOM_SID2 *sid    ; /* sids to be looked up. */
1361
1362 } SAMR_Q_QUERY_USERALIASES;
1363
1364
1365 /* SAMR_R_QUERY_USERALIASES */
1366 typedef struct r_samr_query_useraliases_info
1367 {
1368         uint32 num_entries;
1369         uint32 ptr; /* undocumented buffer pointer */
1370
1371         uint32 num_entries2; 
1372         uint32 *rid; /* domain RIDs being looked up */
1373
1374         NTSTATUS status; /* return code */
1375
1376 } SAMR_R_QUERY_USERALIASES;
1377
1378
1379 /****************************************************************************
1380 SAMR_Q_LOOKUP_NAMES - do a conversion from Names to RIDs+types.
1381 *****************************************************************************/
1382 /* SAMR_Q_LOOKUP_NAMES */
1383 typedef struct q_samr_lookup_names_info
1384 {
1385         POLICY_HND pol;       /* policy handle */
1386
1387         uint32 num_names1;      /* number of names being looked up */
1388         uint32 flags;           /* 0x0000 03e8 - unknown */
1389         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1390         uint32 num_names2;      /* number of names being looked up */
1391
1392         UNIHDR  *hdr_name; /* unicode account name header */
1393         UNISTR2 *uni_name; /* unicode account name string */
1394
1395 } SAMR_Q_LOOKUP_NAMES;
1396
1397
1398 /* SAMR_R_LOOKUP_NAMES */
1399 typedef struct r_samr_lookup_names_info
1400 {
1401         uint32 num_rids1;      /* number of aliases being looked up */
1402         uint32 ptr_rids;       /* pointer to aliases */
1403         uint32 num_rids2;      /* number of aliases being looked up */
1404
1405         uint32 *rids; /* rids */
1406
1407         uint32 num_types1;      /* number of users in aliases being looked up */
1408         uint32 ptr_types;       /* pointer to users in aliases */
1409         uint32 num_types2;      /* number of users in aliases being looked up */
1410
1411         uint32 *types; /* SID_ENUM type */
1412
1413         NTSTATUS status; /* return code */
1414
1415 } SAMR_R_LOOKUP_NAMES;
1416
1417
1418 /****************************************************************************
1419 SAMR_Q_LOOKUP_RIDS - do a conversion from RID groups to something.
1420
1421 called to resolve domain RID groups.
1422 *****************************************************************************/
1423 /* SAMR_Q_LOOKUP_RIDS */
1424 typedef struct q_samr_lookup_rids_info
1425 {
1426         POLICY_HND pol;       /* policy handle */
1427
1428         uint32 num_rids1;      /* number of rids being looked up */
1429         uint32 flags;          /* 0x0000 03e8 - unknown */
1430         uint32 ptr;            /* 0x0000 0000 - 32 bit unknown */
1431         uint32 num_rids2;      /* number of rids being looked up */
1432
1433         uint32 *rid; /* domain RIDs being looked up */
1434
1435 } SAMR_Q_LOOKUP_RIDS;
1436
1437
1438 /****************************************************************************
1439 SAMR_R_LOOKUP_RIDS - do a conversion from group RID to names
1440
1441 *****************************************************************************/
1442 /* SAMR_R_LOOKUP_RIDS */
1443 typedef struct r_samr_lookup_rids_info
1444 {
1445         uint32 num_names1;      /* number of aliases being looked up */
1446         uint32 ptr_names;       /* pointer to aliases */
1447         uint32 num_names2;      /* number of aliases being looked up */
1448
1449         UNIHDR  *hdr_name; /* unicode account name header */
1450         UNISTR2 *uni_name; /* unicode account name string */
1451
1452         uint32 num_types1;      /* number of users in aliases being looked up */
1453         uint32 ptr_types;       /* pointer to users in aliases */
1454         uint32 num_types2;      /* number of users in aliases being looked up */
1455
1456         uint32 *type; /* SID_ENUM type */
1457
1458         NTSTATUS status;
1459
1460 } SAMR_R_LOOKUP_RIDS;
1461
1462
1463 /* SAMR_Q_OPEN_USER - probably an open */
1464 typedef struct q_samr_open_user_info
1465 {
1466         POLICY_HND domain_pol;       /* policy handle */
1467         uint32 access_mask;     /* 32 bit unknown - 0x02011b */
1468         uint32 user_rid;      /* user RID */
1469
1470 } SAMR_Q_OPEN_USER;
1471
1472
1473 /* SAMR_R_OPEN_USER - probably an open */
1474 typedef struct r_samr_open_user_info
1475 {
1476         POLICY_HND user_pol;       /* policy handle associated with unknown id */
1477         NTSTATUS status;         /* return status */
1478
1479 } SAMR_R_OPEN_USER;
1480
1481
1482 /* SAMR_Q_CREATE_USER - probably a create */
1483 typedef struct q_samr_create_user_info
1484 {
1485         POLICY_HND domain_pol;       /* policy handle */
1486
1487         UNIHDR  hdr_name;       /* unicode account name header */
1488         UNISTR2 uni_name;       /* unicode account name */
1489
1490         uint32 acb_info;      /* account control info */
1491         uint32 access_mask;     /* 0xe005 00b0 */
1492
1493 } SAMR_Q_CREATE_USER;
1494
1495
1496 /* SAMR_R_CREATE_USER - probably a create */
1497 typedef struct r_samr_create_user_info
1498 {
1499         POLICY_HND user_pol;       /* policy handle associated with user */
1500
1501         uint32 access_granted;
1502         uint32 user_rid;      /* user RID */
1503         NTSTATUS status;         /* return status */
1504
1505 } SAMR_R_CREATE_USER;
1506
1507
1508 /* SAMR_Q_DELETE_DOM_USER - delete domain user */
1509 typedef struct q_samr_delete_dom_user_info
1510 {
1511     POLICY_HND user_pol;          /* policy handle */
1512
1513 } SAMR_Q_DELETE_DOM_USER;
1514
1515
1516 /* SAMR_R_DELETE_DOM_USER - delete domain user */
1517 typedef struct r_samr_delete_dom_user_info
1518 {
1519         POLICY_HND pol;       /* policy handle */
1520         NTSTATUS status;        /* return status */
1521
1522 } SAMR_R_DELETE_DOM_USER;
1523
1524
1525 /* SAMR_Q_QUERY_GROUPMEM - query group members */
1526 typedef struct q_samr_query_groupmem_info
1527 {
1528         POLICY_HND group_pol;        /* policy handle */
1529
1530 } SAMR_Q_QUERY_GROUPMEM;
1531
1532
1533 /* SAMR_R_QUERY_GROUPMEM - query group members */
1534 typedef struct r_samr_query_groupmem_info
1535 {
1536         uint32 ptr;
1537         uint32 num_entries;
1538
1539         uint32 ptr_rids;
1540         uint32 ptr_attrs;
1541
1542         uint32 num_rids;
1543         uint32 *rid;
1544
1545         uint32 num_attrs;
1546         uint32 *attr;
1547
1548         NTSTATUS status;
1549
1550 } SAMR_R_QUERY_GROUPMEM;
1551
1552
1553 /* SAMR_Q_DEL_GROUPMEM - probably an del group member */
1554 typedef struct q_samr_del_group_mem_info
1555 {
1556         POLICY_HND pol;       /* policy handle */
1557         uint32 rid;         /* rid */
1558
1559 } SAMR_Q_DEL_GROUPMEM;
1560
1561
1562 /* SAMR_R_DEL_GROUPMEM - probably an del group member */
1563 typedef struct r_samr_del_group_mem_info
1564 {
1565         NTSTATUS status;         /* return status */
1566
1567 } SAMR_R_DEL_GROUPMEM;
1568
1569
1570 /* SAMR_Q_ADD_GROUPMEM - probably an add group member */
1571 typedef struct q_samr_add_group_mem_info
1572 {
1573         POLICY_HND pol;       /* policy handle */
1574
1575         uint32 rid;         /* rid */
1576         uint32 unknown;     /* 0x0000 0005 */
1577
1578 } SAMR_Q_ADD_GROUPMEM;
1579
1580
1581 /* SAMR_R_ADD_GROUPMEM - probably an add group member */
1582 typedef struct r_samr_add_group_mem_info
1583 {
1584         NTSTATUS status;         /* return status */
1585
1586 } SAMR_R_ADD_GROUPMEM;
1587
1588
1589 /* SAMR_Q_OPEN_GROUP - probably an open */
1590 typedef struct q_samr_open_group_info
1591 {
1592         POLICY_HND domain_pol;       /* policy handle */
1593         uint32 access_mask;         /* 0x0000 0001, 0x0000 0003, 0x0000 001f */
1594         uint32 rid_group;        /* rid */
1595
1596 } SAMR_Q_OPEN_GROUP;
1597
1598
1599 /* SAMR_R_OPEN_GROUP - probably an open */
1600 typedef struct r_samr_open_group_info
1601 {
1602         POLICY_HND pol;       /* policy handle */
1603         NTSTATUS status;         /* return status */
1604
1605 } SAMR_R_OPEN_GROUP;
1606
1607
1608 /* SAMR_Q_QUERY_ALIASMEM - query alias members */
1609 typedef struct q_samr_query_aliasmem_info
1610 {
1611         POLICY_HND alias_pol;        /* policy handle */
1612
1613 } SAMR_Q_QUERY_ALIASMEM;
1614
1615
1616 /* SAMR_R_QUERY_ALIASMEM - query alias members */
1617 typedef struct r_samr_query_aliasmem_info
1618 {
1619         uint32 num_sids;
1620         uint32 ptr;
1621         uint32 num_sids1;
1622
1623         DOM_SID2 *sid;
1624
1625         NTSTATUS status;
1626
1627 } SAMR_R_QUERY_ALIASMEM;
1628
1629
1630 /* SAMR_Q_ADD_ALIASMEM - add alias member */
1631 typedef struct q_samr_add_alias_mem_info
1632 {
1633         POLICY_HND alias_pol;       /* policy handle */
1634
1635         DOM_SID2 sid; /* member sid to be added to the alias */
1636
1637 } SAMR_Q_ADD_ALIASMEM;
1638
1639
1640 /* SAMR_R_ADD_ALIASMEM - add alias member */
1641 typedef struct r_samr_add_alias_mem_info
1642 {
1643         NTSTATUS status;         /* return status */
1644
1645 } SAMR_R_ADD_ALIASMEM;
1646
1647
1648 /* SAMR_Q_DEL_ALIASMEM - add an add alias member */
1649 typedef struct q_samr_del_alias_mem_info
1650 {
1651         POLICY_HND alias_pol;       /* policy handle */
1652
1653         DOM_SID2 sid; /* member sid to be added to alias */
1654
1655 } SAMR_Q_DEL_ALIASMEM;
1656
1657
1658 /* SAMR_R_DEL_ALIASMEM - delete alias member */
1659 typedef struct r_samr_del_alias_mem_info
1660 {
1661         NTSTATUS status;         /* return status */
1662
1663 } SAMR_R_DEL_ALIASMEM;
1664
1665
1666
1667 /* SAMR_Q_OPEN_ALIAS - probably an open */
1668 typedef struct q_samr_open_alias_info
1669 {
1670         POLICY_HND dom_pol;
1671
1672         uint32 access_mask;         
1673         uint32 rid_alias;
1674
1675 } SAMR_Q_OPEN_ALIAS;
1676
1677
1678 /* SAMR_R_OPEN_ALIAS - probably an open */
1679 typedef struct r_samr_open_alias_info
1680 {
1681         POLICY_HND pol;       /* policy handle */
1682         NTSTATUS status;         /* return status */
1683
1684 } SAMR_R_OPEN_ALIAS;
1685
1686
1687 /* SAMR_Q_CONNECT_ANON - probably an open */
1688 typedef struct q_samr_connect_anon_info {
1689         uint32 ptr;                  /* ptr? */
1690         uint16 unknown_0;            /* Only pushed if ptr is non-zero. */
1691         uint32 access_mask;
1692 } SAMR_Q_CONNECT_ANON;
1693
1694 /* SAMR_R_CONNECT_ANON - probably an open */
1695 typedef struct r_samr_connect_anon_info
1696 {
1697         POLICY_HND connect_pol;       /* policy handle */
1698         NTSTATUS status;         /* return status */
1699
1700 } SAMR_R_CONNECT_ANON;
1701
1702 /* SAMR_Q_CONNECT - probably an open */
1703 typedef struct q_samr_connect_info
1704 {
1705         uint32 ptr_srv_name;         /* pointer (to server name?) */
1706         UNISTR2 uni_srv_name;        /* unicode server name starting with '\\' */
1707
1708         uint32 access_mask;            
1709
1710 } SAMR_Q_CONNECT;
1711
1712
1713 /* SAMR_R_CONNECT - probably an open */
1714 typedef struct r_samr_connect_info
1715 {
1716         POLICY_HND connect_pol;       /* policy handle */
1717         NTSTATUS status;         /* return status */
1718
1719 } SAMR_R_CONNECT;
1720
1721 /* SAMR_Q_CONNECT4 */
1722 typedef struct q_samr_connect4_info
1723 {
1724         uint32 ptr_srv_name; /* pointer to server name */
1725         UNISTR2 uni_srv_name;
1726
1727         uint32 unk_0; /* possible server name type, 1 for IP num, 2 for name */
1728         uint32 access_mask;
1729 } SAMR_Q_CONNECT4;
1730
1731 /* SAMR_R_CONNECT4 - same format as connect */
1732 typedef struct r_samr_connect_info SAMR_R_CONNECT4;       
1733
1734 /* SAMR_Q_CONNECT5 */
1735 typedef struct q_samr_connect5_info
1736 {
1737         uint32 ptr_srv_name; /* pointer to server name */
1738         UNISTR2 uni_srv_name;
1739         uint32 access_mask;
1740         uint32 level;
1741         /* These following are acutally a level dependent
1742            value. Fudge it for now. JRA */
1743         uint32 info1_unk1;
1744         uint32 info1_unk2;
1745 } SAMR_Q_CONNECT5;
1746
1747 /* SAMR_R_CONNECT5 */
1748 typedef struct r_samr_connect_info5
1749 {
1750         uint32 level;
1751         uint32 info1_unk1;
1752         uint32 info1_unk2;
1753         POLICY_HND connect_pol;       /* policy handle */
1754         NTSTATUS status;         /* return status */
1755
1756 } SAMR_R_CONNECT5;
1757
1758
1759 /* SAMR_Q_GET_DOM_PWINFO */
1760 typedef struct q_samr_get_dom_pwinfo
1761 {
1762         uint32 ptr; 
1763         UNIHDR  hdr_srv_name;
1764         UNISTR2 uni_srv_name;
1765
1766 } SAMR_Q_GET_DOM_PWINFO;
1767
1768 #define DOMAIN_PASSWORD_COMPLEX         0x00000001
1769 #define DOMAIN_PASSWORD_NO_ANON_CHANGE  0x00000002
1770 #define DOMAIN_PASSWORD_NO_CLEAR_CHANGE 0x00000004
1771 #define DOMAIN_LOCKOUT_ADMINS           0x00000008
1772 #define DOMAIN_PASSWORD_STORE_CLEARTEXT 0x00000010
1773 #define DOMAIN_REFUSE_PASSWORD_CHANGE   0x00000020
1774
1775 /* SAMR_R_GET_DOM_PWINFO */
1776 typedef struct r_samr_get_dom_pwinfo
1777 {
1778         uint16 min_pwd_length;
1779         uint32 password_properties;
1780         NTSTATUS status;
1781
1782 } SAMR_R_GET_DOM_PWINFO;
1783
1784 /* SAMR_ENC_PASSWD */
1785 typedef struct enc_passwd_info
1786 {
1787         uint32 ptr;
1788         uint8 pass[516];
1789
1790 } SAMR_ENC_PASSWD;
1791
1792 /* SAMR_ENC_HASH */
1793 typedef struct enc_hash_info
1794 {
1795         uint32 ptr;
1796         uint8 hash[16];
1797
1798 } SAMR_ENC_HASH;
1799
1800 /* SAMR_Q_CHGPASSWD_USER */
1801 typedef struct q_samr_chgpasswd_user_info
1802 {
1803         uint32 ptr_0;
1804
1805         UNIHDR hdr_dest_host; /* server name unicode header */
1806         UNISTR2 uni_dest_host; /* server name unicode string */
1807
1808         UNIHDR hdr_user_name;    /* username unicode string header */
1809         UNISTR2 uni_user_name;    /* username unicode string */
1810
1811         SAMR_ENC_PASSWD nt_newpass;
1812         SAMR_ENC_HASH nt_oldhash;
1813
1814         uint32 unknown; /* 0x0000 0001 */
1815
1816         SAMR_ENC_PASSWD lm_newpass;
1817         SAMR_ENC_HASH lm_oldhash;
1818
1819 } SAMR_Q_CHGPASSWD_USER;
1820
1821 /* SAMR_R_CHGPASSWD_USER */
1822 typedef struct r_samr_chgpasswd_user_info
1823 {
1824         NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1825
1826 } SAMR_R_CHGPASSWD_USER;
1827
1828 /* SAMR_Q_CHGPASSWD3 */
1829 typedef struct q_samr_chgpasswd_user3
1830 {
1831         uint32 ptr_0;
1832
1833         UNIHDR hdr_dest_host; /* server name unicode header */
1834         UNISTR2 uni_dest_host; /* server name unicode string */
1835
1836         UNIHDR hdr_user_name;    /* username unicode string header */
1837         UNISTR2 uni_user_name;    /* username unicode string */
1838
1839         SAMR_ENC_PASSWD nt_newpass;
1840         SAMR_ENC_HASH nt_oldhash;
1841
1842         uint32 lm_change; /* 0x0000 0001 */
1843
1844         SAMR_ENC_PASSWD lm_newpass;
1845         SAMR_ENC_HASH lm_oldhash;
1846
1847         SAMR_ENC_PASSWD password3;
1848
1849 } SAMR_Q_CHGPASSWD_USER3;
1850
1851 #define REJECT_REASON_TOO_SHORT         0x00000001
1852 #define REJECT_REASON_IN_HISTORY        0x00000002
1853 #define REJECT_REASON_NOT_COMPLEX       0x00000005
1854
1855 /* SAMR_CHANGE_REJECT */
1856 typedef struct samr_change_reject
1857 {
1858         uint32 reject_reason;
1859         uint32 unknown1;
1860         uint32 unknown2;
1861
1862 } SAMR_CHANGE_REJECT;
1863
1864 /* SAMR_R_CHGPASSWD3 */
1865 typedef struct r_samr_chgpasswd_user3
1866 {
1867         uint32 ptr_info;
1868         uint32 ptr_reject;
1869         SAM_UNK_INFO_1 *info;
1870         SAMR_CHANGE_REJECT *reject;
1871         NTSTATUS status; /* 0 == OK, C000006A (NT_STATUS_WRONG_PASSWORD) */
1872
1873 } SAMR_R_CHGPASSWD_USER3;
1874
1875
1876
1877 /* SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN */
1878 typedef struct q_samr_remove_sid_foreign_domain_info
1879 {
1880         POLICY_HND dom_pol;   /* policy handle */
1881         DOM_SID2 sid;         /* SID */
1882
1883 } SAMR_Q_REMOVE_SID_FOREIGN_DOMAIN;
1884
1885
1886 /* SAMR_R_REMOVE_SID_FOREIGN_DOMAIN */
1887 typedef struct r_samr_remove_sid_foreign_domain_info
1888 {
1889         NTSTATUS status;         /* return status */
1890
1891 } SAMR_R_REMOVE_SID_FOREIGN_DOMAIN;
1892
1893
1894
1895 /* these are from the old rpc_samr.h - they are needed while the merge
1896    is still going on */
1897 #define MAX_SAM_SIDS 15
1898
1899 /* DOM_SID3 - security id */
1900 typedef struct sid_info_3
1901 {
1902         uint16 len; /* length, bytes, including length of len :-) */
1903         /* uint8  pad[2]; */
1904         
1905         DOM_SID sid;
1906
1907 } DOM_SID3;
1908
1909 /* SAMR_Q_QUERY_DOMAIN_INFO2 */
1910 typedef struct q_samr_query_domain_info2
1911 {
1912         POLICY_HND domain_pol;   /* policy handle */
1913         uint16 switch_value;
1914
1915 } SAMR_Q_QUERY_DOMAIN_INFO2;
1916
1917 /* SAMR_R_QUERY_DOMAIN_INFO2 */
1918 typedef struct r_samr_query_domain_info2
1919 {
1920         uint32 ptr_0;
1921         uint16 switch_value;
1922         SAM_UNK_CTR *ctr;
1923         NTSTATUS status;         /* return status */
1924
1925 } SAMR_R_QUERY_DOMAIN_INFO2;
1926
1927 /* SAMR_Q_SET_DOMAIN_INFO */
1928 typedef struct q_samr_set_domain_info
1929 {
1930         POLICY_HND domain_pol;   /* policy handle */
1931         uint16 switch_value0;
1932         uint16 switch_value;
1933         SAM_UNK_CTR *ctr;
1934
1935 } SAMR_Q_SET_DOMAIN_INFO;
1936
1937 /* SAMR_R_SET_DOMAIN_INFO */
1938 typedef struct r_samr_set_domain_info
1939 {
1940         NTSTATUS status;         /* return status */
1941
1942 } SAMR_R_SET_DOMAIN_INFO;
1943
1944 #endif /* _RPC_SAMR_H */