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