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