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