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