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