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