s3-samr-idl: add Domain Object specific access rights.
[ira/wip.git] / source3 / librpc / idl / samr.idl
1 #include "idl_types.h"
2
3 /*
4   samr interface definition
5 */
6 import "misc.idl", "lsa.idl", "security.idl";
7
8 /*
9   Thanks to Todd Sabin for some information from his samr.idl in acltools
10 */
11
12 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
13   version(1.0),
14   endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
15   pointer_default(unique)
16 ] interface samr
17 {
18         typedef bitmap security_secinfo security_secinfo;
19
20         /* account control (acct_flags) bits */
21         typedef [public,bitmap32bit] bitmap {
22                 ACB_DISABLED                    = 0x00000001,  /* 1 = User account disabled */
23                 ACB_HOMDIRREQ                   = 0x00000002,  /* 1 = Home directory required */
24                 ACB_PWNOTREQ                    = 0x00000004,  /* 1 = User password not required */
25                 ACB_TEMPDUP                     = 0x00000008,  /* 1 = Temporary duplicate account */
26                 ACB_NORMAL                      = 0x00000010,  /* 1 = Normal user account */
27                 ACB_MNS                         = 0x00000020,  /* 1 = MNS logon user account */
28                 ACB_DOMTRUST                    = 0x00000040,  /* 1 = Interdomain trust account */
29                 ACB_WSTRUST                     = 0x00000080,  /* 1 = Workstation trust account */
30                 ACB_SVRTRUST                    = 0x00000100,  /* 1 = Server trust account */
31                 ACB_PWNOEXP                     = 0x00000200,  /* 1 = User password does not expire */
32                 ACB_AUTOLOCK                    = 0x00000400,  /* 1 = Account auto locked */
33                 ACB_ENC_TXT_PWD_ALLOWED         = 0x00000800,  /* 1 = Encryped text password is allowed */
34                 ACB_SMARTCARD_REQUIRED          = 0x00001000,  /* 1 = Smart Card required */
35                 ACB_TRUSTED_FOR_DELEGATION      = 0x00002000,  /* 1 = Trusted for Delegation */
36                 ACB_NOT_DELEGATED               = 0x00004000,  /* 1 = Not delegated */
37                 ACB_USE_DES_KEY_ONLY            = 0x00008000,  /* 1 = Use DES key only */
38                 ACB_DONT_REQUIRE_PREAUTH        = 0x00010000,  /* 1 = Preauth not required */
39                 ACB_PW_EXPIRED                  = 0x00020000,  /* 1 = Password Expired */
40                 ACB_NO_AUTH_DATA_REQD           = 0x00080000   /* 1 = No authorization data required */
41         } samr_AcctFlags;
42
43         /* SAM server specific access rights */
44
45         typedef [bitmap32bit] bitmap {
46                 SAMR_ACCESS_CONNECT_TO_SERVER   = 0x00000001,
47                 SAMR_ACCESS_SHUTDOWN_SERVER     = 0x00000002,
48                 SAMR_ACCESS_INITIALIZE_SERVER   = 0x00000004,
49                 SAMR_ACCESS_CREATE_DOMAIN       = 0x00000008,
50                 SAMR_ACCESS_ENUM_DOMAINS        = 0x00000010,
51                 SAMR_ACCESS_OPEN_DOMAIN         = 0x00000020
52         } samr_ConnectAccessMask;
53
54         const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
55
56         const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
57                 (STANDARD_RIGHTS_REQUIRED_ACCESS        |
58                  SAMR_ACCESS_ALL_ACCESS);
59
60         const int GENERIC_RIGHTS_SAM_READ =
61                 (STANDARD_RIGHTS_READ_ACCESS            |
62                  SAMR_ACCESS_ENUM_DOMAINS);
63
64         const int GENERIC_RIGHTS_SAM_WRITE =
65                 (STANDARD_RIGHTS_WRITE_ACCESS           |
66                  SAMR_ACCESS_CREATE_DOMAIN              |
67                  SAMR_ACCESS_INITIALIZE_SERVER          |
68                  SAMR_ACCESS_SHUTDOWN_SERVER);
69
70         const int GENERIC_RIGHTS_SAM_EXECUTE =
71                 (STANDARD_RIGHTS_EXECUTE_ACCESS         |
72                  SAMR_ACCESS_OPEN_DOMAIN                |
73                  SAMR_ACCESS_CONNECT_TO_SERVER);
74
75         /* User Object specific access rights */
76
77         typedef [bitmap32bit] bitmap {
78                 SAMR_USER_ACCESS_GET_NAME_ETC             = 0x00000001,
79                 SAMR_USER_ACCESS_GET_LOCALE               = 0x00000002,
80                 SAMR_USER_ACCESS_SET_LOC_COM              = 0x00000004,
81                 SAMR_USER_ACCESS_GET_LOGONINFO            = 0x00000008,
82                 SAMR_USER_ACCESS_GET_ATTRIBUTES           = 0x00000010,
83                 SAMR_USER_ACCESS_SET_ATTRIBUTES           = 0x00000020,
84                 SAMR_USER_ACCESS_CHANGE_PASSWORD          = 0x00000040,
85                 SAMR_USER_ACCESS_SET_PASSWORD             = 0x00000080,
86                 SAMR_USER_ACCESS_GET_GROUPS               = 0x00000100,
87                 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP     = 0x00000200,
88                 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP  = 0x00000400
89         } samr_UserAccessMask;
90
91         const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF;
92
93         const int GENERIC_RIGHTS_USER_ALL_ACCESS =
94                 (STANDARD_RIGHTS_REQUIRED_ACCESS        |
95                  SAMR_USER_ACCESS_ALL_ACCESS);  /* 0x000f07ff */
96
97         const int GENERIC_RIGHTS_USER_READ =
98                 (STANDARD_RIGHTS_READ_ACCESS            |
99                  SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP  |
100                  SAMR_USER_ACCESS_GET_GROUPS            |
101                  SAMR_USER_ACCESS_GET_ATTRIBUTES        |
102                  SAMR_USER_ACCESS_GET_LOGONINFO         |
103                  SAMR_USER_ACCESS_GET_LOCALE);  /* 0x0002031a */
104
105         const int GENERIC_RIGHTS_USER_WRITE =
106                 (STANDARD_RIGHTS_WRITE_ACCESS           |
107                  SAMR_USER_ACCESS_CHANGE_PASSWORD       |
108                  SAMR_USER_ACCESS_SET_LOC_COM           |
109                  SAMR_USER_ACCESS_SET_ATTRIBUTES        |
110                  SAMR_USER_ACCESS_SET_PASSWORD          |
111                  SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP);     /* 0x000204e4 */
112
113         const int GENERIC_RIGHTS_USER_EXECUTE =
114                 (STANDARD_RIGHTS_EXECUTE_ACCESS         |
115                  SAMR_USER_ACCESS_CHANGE_PASSWORD       |
116                  SAMR_USER_ACCESS_GET_NAME_ETC);        /* 0x00020041 */
117
118         /* Domain Object specific access rights */
119
120         typedef [bitmap32bit] bitmap {
121                 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1  = 0x00000001,
122                 SAMR_DOMAIN_ACCESS_SET_INFO_1     = 0x00000002,
123                 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2  = 0x00000004,
124                 SAMR_DOMAIN_ACCESS_SET_INFO_2     = 0x00000008,
125                 SAMR_DOMAIN_ACCESS_CREATE_USER    = 0x00000010,
126                 SAMR_DOMAIN_ACCESS_CREATE_GROUP   = 0x00000020,
127                 SAMR_DOMAIN_ACCESS_CREATE_ALIAS   = 0x00000040,
128                 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS   = 0x00000080,
129                 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS  = 0x00000100,
130                 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT   = 0x00000200,
131                 SAMR_DOMAIN_ACCESS_SET_INFO_3     = 0x00000400
132         } samr_DomainAccessMask;
133
134         const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF;
135
136         const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS =
137                 (STANDARD_RIGHTS_REQUIRED_ACCESS        |
138                  SAMR_DOMAIN_ACCESS_ALL_ACCESS);
139
140         const int GENERIC_RIGHTS_DOMAIN_READ =
141                 (STANDARD_RIGHTS_READ_ACCESS            |
142                  SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS        |
143                  SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2);
144
145         const int GENERIC_RIGHTS_DOMAIN_WRITE =
146                 (STANDARD_RIGHTS_WRITE_ACCESS           |
147                  SAMR_DOMAIN_ACCESS_SET_INFO_3          |
148                  SAMR_DOMAIN_ACCESS_CREATE_ALIAS        |
149                  SAMR_DOMAIN_ACCESS_CREATE_GROUP        |
150                  SAMR_DOMAIN_ACCESS_CREATE_USER         |
151                  SAMR_DOMAIN_ACCESS_SET_INFO_2          |
152                  SAMR_DOMAIN_ACCESS_SET_INFO_1);
153
154         const int GENERIC_RIGHTS_DOMAIN_EXECUTE =
155                 (STANDARD_RIGHTS_EXECUTE_ACCESS         |
156                  SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT        |
157                  SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS       |
158                  SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1);
159
160         typedef [bitmap32bit] bitmap {
161                 SAMR_GROUP_ACCESS_LOOKUP_INFO     = 0x00000001,
162                 SAMR_GROUP_ACCESS_SET_INFO        = 0x00000002,
163                 SAMR_GROUP_ACCESS_ADD_MEMBER      = 0x00000004,
164                 SAMR_GROUP_ACCESS_REMOVE_MEMBER   = 0x00000008,
165                 SAMR_GROUP_ACCESS_GET_MEMBERS     = 0x00000010
166         } samr_GroupAccessMask;
167
168         typedef [bitmap32bit] bitmap {
169                 SAMR_ALIAS_ACCESS_ADD_MEMBER      = 0x00000001,
170                 SAMR_ALIAS_ACCESS_REMOVE_MEMBER   = 0x00000002,
171                 SAMR_ALIAS_ACCESS_GET_MEMBERS     = 0x00000004,
172                 SAMR_ALIAS_ACCESS_LOOKUP_INFO     = 0x00000008,
173                 SAMR_ALIAS_ACCESS_SET_INFO        = 0x00000010
174         } samr_AliasAccessMask;
175
176         /******************/
177         /* Function: 0x00 */
178         NTSTATUS samr_Connect (
179                 /* notice the lack of [string] */
180                 [in,unique] uint16 *system_name,
181                 [in]       samr_ConnectAccessMask access_mask,
182                 [out,ref]  policy_handle *connect_handle
183                 );
184
185
186         /******************/
187         /* Function: 0x01 */
188         [public] NTSTATUS samr_Close (
189                 [in,out,ref]  policy_handle *handle
190                 );
191
192         /******************/
193         /* Function: 0x02 */
194
195         NTSTATUS samr_SetSecurity (
196                 [in,ref]          policy_handle *handle,
197                 [in]              security_secinfo sec_info,
198                 [in,ref]          sec_desc_buf *sdbuf
199                 );
200
201         /******************/
202         /* Function: 0x03 */
203
204         NTSTATUS samr_QuerySecurity (
205                 [in,ref]          policy_handle *handle,
206                 [in]              security_secinfo sec_info,
207                 [out,ref]         sec_desc_buf **sdbuf
208                 );
209
210         /******************/
211         /* Function: 0x04 */
212
213         /*
214           shutdown the SAM - once you call this the SAM will be dead
215         */
216         NTSTATUS samr_Shutdown (
217                 [in,ref]   policy_handle *connect_handle
218                 );
219
220         /******************/
221         /* Function: 0x05 */
222         NTSTATUS samr_LookupDomain (
223                 [in,ref]  policy_handle *connect_handle,
224                 [in,ref]  lsa_String *domain_name,
225                 [out,ref] dom_sid2 **sid
226                 );
227
228
229         /******************/
230         /* Function: 0x06 */
231
232         typedef struct {
233                 uint32 idx;
234                 lsa_String name;
235         } samr_SamEntry;
236
237         typedef struct {
238                 uint32 count;
239                 [size_is(count)] samr_SamEntry *entries;
240         } samr_SamArray;
241
242         NTSTATUS samr_EnumDomains (
243                 [in]          policy_handle *connect_handle,
244                 [in,out,ref]  uint32 *resume_handle,
245                 [out,ref]     samr_SamArray **sam,
246                 [in]          uint32 buf_size,
247                 [out,ref]     uint32 *num_entries
248                 );
249
250
251         /************************/
252         /* Function    0x07     */
253         [public] NTSTATUS samr_OpenDomain(
254                 [in,ref]      policy_handle *connect_handle,
255                 [in]          samr_DomainAccessMask access_mask,
256                 [in,ref]      dom_sid2 *sid,
257                 [out,ref]     policy_handle *domain_handle
258                 );
259
260         /************************/
261         /* Function    0x08     */
262         /* server roles */
263         typedef [v1_enum] enum {
264                 SAMR_ROLE_STANDALONE    = 0,
265                 SAMR_ROLE_DOMAIN_MEMBER = 1,
266                 SAMR_ROLE_DOMAIN_BDC    = 2,
267                 SAMR_ROLE_DOMAIN_PDC    = 3
268         } samr_Role;
269
270         /* password properties flags */
271         typedef [public,bitmap32bit] bitmap {
272                 DOMAIN_PASSWORD_COMPLEX         = 0x00000001,
273                 DOMAIN_PASSWORD_NO_ANON_CHANGE  = 0x00000002,
274                 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
275                 DOMAIN_PASSWORD_LOCKOUT_ADMINS  = 0x00000008,
276                 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
277                 DOMAIN_REFUSE_PASSWORD_CHANGE   = 0x00000020
278         } samr_PasswordProperties;
279
280         typedef struct {
281                 uint16 min_password_length;
282                 uint16 password_history_length;
283                 samr_PasswordProperties password_properties;
284                 /* yes, these are signed. They are in negative 100ns */
285                 dlong  max_password_age;
286                 dlong  min_password_age;
287         } samr_DomInfo1;
288
289         typedef struct {
290                 NTTIME force_logoff_time;
291                 lsa_String oem_information; /* comment */
292                 lsa_String domain_name;
293                 lsa_String primary; /* PDC name if this is a BDC */
294                 udlong sequence_num;
295                 uint32 unknown2;
296                 samr_Role role;
297                 uint32 unknown3;
298                 uint32 num_users;
299                 uint32 num_groups;
300                 uint32 num_aliases;
301         } samr_DomGeneralInformation;
302
303         typedef struct {
304                 NTTIME force_logoff_time;
305         } samr_DomInfo3;
306
307         typedef struct {
308                 lsa_String oem_information; /* comment */
309         } samr_DomOEMInformation;
310
311         typedef struct {
312                 lsa_String domain_name;
313         } samr_DomInfo5;
314
315         typedef struct {
316                 lsa_String primary;
317         } samr_DomInfo6;
318
319         typedef struct {
320                 samr_Role role;
321         } samr_DomInfo7;
322
323         typedef struct {
324                 hyper sequence_num;
325                 NTTIME domain_create_time;
326         } samr_DomInfo8;
327
328         typedef struct {
329                 uint32 unknown; /* w2k3 returns 1 */
330         } samr_DomInfo9;
331
332         typedef struct {
333                 samr_DomGeneralInformation general;
334                 hyper lockout_duration;
335                 hyper lockout_window;
336                 uint16 lockout_threshold;
337         } samr_DomGeneralInformation2;
338
339         typedef struct {
340                 hyper lockout_duration;
341                 hyper lockout_window;
342                 uint16 lockout_threshold;
343         } samr_DomInfo12;
344
345         typedef struct {
346                 hyper sequence_num;
347                 NTTIME domain_create_time;
348                 uint32 unknown1;
349                 uint32 unknown2;
350         } samr_DomInfo13;
351
352         typedef [switch_type(uint16)] union {
353                 [case(1)] samr_DomInfo1 info1;
354                 [case(2)] samr_DomGeneralInformation general;
355                 [case(3)] samr_DomInfo3 info3;
356                 [case(4)] samr_DomOEMInformation oem;
357                 [case(5)] samr_DomInfo5 info5;
358                 [case(6)] samr_DomInfo6 info6;
359                 [case(7)] samr_DomInfo7 info7;
360                 [case(8)] samr_DomInfo8 info8;
361                 [case(9)] samr_DomInfo9 info9;
362                 [case(11)] samr_DomGeneralInformation2 general2;
363                 [case(12)] samr_DomInfo12 info12;
364                 [case(13)] samr_DomInfo13 info13;
365         } samr_DomainInfo;
366
367         NTSTATUS samr_QueryDomainInfo(
368                 [in,ref]      policy_handle *domain_handle,
369                 [in]          uint16 level,
370                 [out,ref,switch_is(level)] samr_DomainInfo **info
371                 );
372
373         /************************/
374         /* Function    0x09     */
375         /*
376           only levels 1, 3, 4, 6, 7, 9, 12 are valid for this 
377           call in w2k3
378         */
379         NTSTATUS samr_SetDomainInfo(
380                 [in,ref]      policy_handle *domain_handle,
381                 [in]          uint16 level,
382                 [in,switch_is(level),ref] samr_DomainInfo *info
383                 );
384
385
386         /************************/
387         /* Function    0x0a     */
388         NTSTATUS samr_CreateDomainGroup(
389                 [in,ref]      policy_handle *domain_handle,
390                 [in,ref]      lsa_String *name,
391                 [in]          samr_GroupAccessMask access_mask,
392                 [out,ref]     policy_handle *group_handle,
393                 [out,ref]     uint32 *rid
394                 );
395                 
396
397         /************************/
398         /* Function    0x0b     */
399
400         const int MAX_SAM_ENTRIES_W2K = 0x400; /* 1024 */
401         const int MAX_SAM_ENTRIES_W95 = 50;
402
403         NTSTATUS samr_EnumDomainGroups(
404                 [in]          policy_handle *domain_handle,
405                 [in,out,ref]  uint32 *resume_handle,
406                 [out,ref]     samr_SamArray **sam,
407                 [in]          uint32 max_size,
408                 [out,ref]     uint32 *num_entries
409                 );
410
411         /************************/
412         /* Function    0x0c     */
413         NTSTATUS samr_CreateUser(
414                 [in,ref]      policy_handle *domain_handle,
415                 [in,ref]      lsa_String *account_name,
416                 [in]          samr_UserAccessMask access_mask,
417                 [out,ref]     policy_handle *user_handle,
418                 [out,ref]     uint32 *rid
419                 );
420
421         /************************/
422         /* Function    0x0d     */
423
424
425         /* w2k3 treats max_size as max_users*54 and sets the
426            resume_handle as the rid of the last user sent
427         */
428         const int SAMR_ENUM_USERS_MULTIPLIER = 54;
429
430         NTSTATUS samr_EnumDomainUsers(
431                 [in]          policy_handle *domain_handle,
432                 [in,out,ref]  uint32 *resume_handle,
433                 [in]          samr_AcctFlags acct_flags,
434                 [out,ref]     samr_SamArray **sam,
435                 [in]          uint32 max_size,
436                 [out,ref]     uint32 *num_entries
437                 );
438
439         /************************/
440         /* Function    0x0e     */
441         NTSTATUS samr_CreateDomAlias(
442                 [in,ref]      policy_handle *domain_handle,
443                 [in,ref]      lsa_String   *alias_name,
444                 [in]          samr_AliasAccessMask access_mask,
445                 [out,ref]     policy_handle *alias_handle,
446                 [out,ref]     uint32        *rid
447                 );
448
449         /************************/
450         /* Function    0x0f     */
451         NTSTATUS samr_EnumDomainAliases(
452                 [in]          policy_handle *domain_handle,
453                 [in,out,ref]  uint32 *resume_handle,
454                 [out,ref]     samr_SamArray **sam,
455                 [in]          uint32 max_size,
456                 [out,ref]     uint32 *num_entries
457                 );
458
459         /************************/
460         /* Function    0x10     */
461
462         typedef struct {
463                 [range(0,1024)]  uint32 count;
464                 [size_is(count)] uint32 *ids;
465         } samr_Ids;
466
467         NTSTATUS samr_GetAliasMembership(
468                 [in,ref]      policy_handle *domain_handle,
469                 [in,ref]      lsa_SidArray  *sids,
470                 [out,ref]     samr_Ids *rids
471                 );
472
473         /************************/
474         /* Function    0x11     */
475
476         [public] NTSTATUS samr_LookupNames(
477                 [in,ref]      policy_handle *domain_handle,
478                 [in,range(0,1000)] uint32 num_names,
479                 [in,size_is(1000),length_is(num_names)] lsa_String names[],
480                 [out,ref]     samr_Ids *rids,
481                 [out,ref]     samr_Ids *types
482                 );
483
484
485         /************************/
486         /* Function    0x12     */
487         NTSTATUS samr_LookupRids(
488                 [in,ref]      policy_handle *domain_handle,
489                 [in,range(0,1000)] uint32 num_rids,
490                 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
491                 [out,ref]     lsa_Strings *names,
492                 [out,ref]     samr_Ids *types
493                 );
494
495         /************************/
496         /* Function    0x13     */
497         NTSTATUS samr_OpenGroup(
498                 [in,ref]      policy_handle *domain_handle,
499                 [in]          samr_GroupAccessMask access_mask,
500                 [in]          uint32 rid,
501                 [out,ref]     policy_handle *group_handle
502                 );
503
504         /* Group attributes */
505         typedef [public,bitmap32bit] bitmap {
506                 SE_GROUP_MANDATORY              = 0x00000001,
507                 SE_GROUP_ENABLED_BY_DEFAULT     = 0x00000002,
508                 SE_GROUP_ENABLED                = 0x00000004,
509                 SE_GROUP_OWNER                  = 0x00000008,
510                 SE_GROUP_USE_FOR_DENY_ONLY      = 0x00000010,
511                 SE_GROUP_RESOURCE               = 0x20000000,
512                 SE_GROUP_LOGON_ID               = 0xC0000000
513         } samr_GroupAttrs;
514
515         /************************/
516         /* Function    0x14     */
517
518         typedef struct {
519                 lsa_String name;
520                 samr_GroupAttrs attributes;
521                 uint32 num_members;
522                 lsa_String description;
523         } samr_GroupInfoAll;
524
525         typedef struct {
526                 samr_GroupAttrs attributes;
527         } samr_GroupInfoAttributes;
528
529         typedef struct {
530                 lsa_String description;
531         } samr_GroupInfoDescription;
532
533         typedef enum {
534                 GROUPINFOALL          = 1,
535                 GROUPINFONAME         = 2,
536                 GROUPINFOATTRIBUTES   = 3,
537                 GROUPINFODESCRIPTION  = 4,
538                 GROUPINFOALL2         = 5
539         } samr_GroupInfoEnum;
540
541         typedef [switch_type(samr_GroupInfoEnum)] union {
542                 [case(GROUPINFOALL)]         samr_GroupInfoAll        all;
543                 [case(GROUPINFONAME)]        lsa_String               name;
544                 [case(GROUPINFOATTRIBUTES)]  samr_GroupInfoAttributes attributes;
545                 [case(GROUPINFODESCRIPTION)] lsa_String               description;
546                 [case(GROUPINFOALL2)]        samr_GroupInfoAll        all2;
547         } samr_GroupInfo;
548
549         NTSTATUS samr_QueryGroupInfo(
550                 [in,ref]                  policy_handle *group_handle,
551                 [in]                      samr_GroupInfoEnum level,
552                 [out,ref,switch_is(level)] samr_GroupInfo **info
553                 );
554
555         /************************/
556         /* Function    0x15     */
557         NTSTATUS samr_SetGroupInfo(
558                 [in,ref]                  policy_handle *group_handle,
559                 [in]                      samr_GroupInfoEnum level,
560                 [in,switch_is(level),ref] samr_GroupInfo *info
561                 );
562
563         /************************/
564         /* Function    0x16     */
565         NTSTATUS samr_AddGroupMember(
566                 [in,ref]                  policy_handle *group_handle,
567                 [in]                      uint32 rid,
568                 [in]                      uint32 flags
569                 );
570
571         /************************/
572         /* Function    0x17     */
573         NTSTATUS samr_DeleteDomainGroup(
574                 [in,out,ref]   policy_handle *group_handle
575                 );
576
577         /************************/
578         /* Function    0x18     */
579         NTSTATUS samr_DeleteGroupMember(
580                 [in,ref]                  policy_handle *group_handle,
581                 [in]                      uint32 rid
582                 );
583
584
585         /************************/
586         /* Function    0x19     */
587         typedef struct {
588                 uint32 count;
589                 [size_is(count)] uint32 *rids;
590                 [size_is(count)] uint32 *types;
591         } samr_RidTypeArray;
592
593         NTSTATUS samr_QueryGroupMember(
594                 [in,ref]  policy_handle *group_handle,
595                 [out,ref] samr_RidTypeArray **rids
596                 );
597
598
599         /************************/
600         /* Function    0x1a     */
601
602         /*
603           win2003 seems to accept any data at all for the two integers
604           below, and doesn't seem to do anything with them that I can
605           see. Weird. I really expected the first integer to be a rid
606           and the second to be the attributes for that rid member.
607         */
608         NTSTATUS samr_SetMemberAttributesOfGroup(
609                 [in,ref]  policy_handle *group_handle,
610                 [in]      uint32 unknown1,
611                 [in]      uint32 unknown2
612                 );
613
614
615         /************************/
616         /* Function    0x1b     */
617         NTSTATUS samr_OpenAlias (
618                 [in,ref]      policy_handle *domain_handle,
619                 [in]          samr_AliasAccessMask access_mask,
620                 [in]          uint32 rid,
621                 [out,ref]     policy_handle *alias_handle
622                 );
623
624
625         /************************/
626         /* Function    0x1c     */
627
628         typedef struct {
629                 lsa_String name;
630                 uint32 num_members;
631                 lsa_String description;
632         } samr_AliasInfoAll;
633
634         typedef enum {
635                 ALIASINFOALL          = 1,
636                 ALIASINFONAME         = 2,
637                 ALIASINFODESCRIPTION  = 3
638         } samr_AliasInfoEnum;
639
640         typedef [switch_type(samr_AliasInfoEnum)] union {
641                 [case(ALIASINFOALL)] samr_AliasInfoAll all;
642                 [case(ALIASINFONAME)] lsa_String name;
643                 [case(ALIASINFODESCRIPTION)] lsa_String description;
644         } samr_AliasInfo;
645
646         NTSTATUS samr_QueryAliasInfo(
647                 [in,ref]                  policy_handle  *alias_handle,
648                 [in]                      samr_AliasInfoEnum      level,
649                 [out,ref,switch_is(level)] samr_AliasInfo **info
650                 );
651
652         /************************/
653         /* Function    0x1d     */
654         NTSTATUS samr_SetAliasInfo(
655                 [in,ref]                  policy_handle  *alias_handle,
656                 [in]                      samr_AliasInfoEnum      level,
657                 [in,switch_is(level),ref] samr_AliasInfo *info
658                 );
659
660         /************************/
661         /* Function    0x1e     */
662         NTSTATUS samr_DeleteDomAlias(
663                 [in,out,ref]  policy_handle *alias_handle
664                 );
665
666         /************************/
667         /* Function    0x1f     */
668         NTSTATUS samr_AddAliasMember(
669                 [in,ref]  policy_handle *alias_handle,
670                 [in,ref]  dom_sid2      *sid
671                 );
672
673         /************************/
674         /* Function    0x20     */
675         NTSTATUS samr_DeleteAliasMember(
676                 [in,ref] policy_handle *alias_handle,
677                 [in,ref] dom_sid2      *sid
678                 );
679
680         /************************/
681         /* Function    0x21     */
682         NTSTATUS samr_GetMembersInAlias(
683                 [in,ref]   policy_handle *alias_handle,
684                 [out,ref]  lsa_SidArray    *sids
685                 );
686
687         /************************/
688         /* Function    0x22     */
689         [public] NTSTATUS samr_OpenUser(
690                 [in,ref]      policy_handle *domain_handle,
691                 [in]          samr_UserAccessMask access_mask,
692                 [in]          uint32 rid,
693                 [out,ref]     policy_handle *user_handle
694                 );
695
696         /************************/
697         /* Function    0x23     */
698         NTSTATUS samr_DeleteUser(
699                 [in,out,ref]   policy_handle *user_handle
700                 );
701
702         /************************/
703         /* Function    0x24     */
704         typedef struct {
705                 lsa_String account_name;
706                 lsa_String full_name;
707                 uint32 primary_gid;
708                 lsa_String description;
709                 lsa_String comment;
710         } samr_UserInfo1;
711
712         typedef struct {
713                 lsa_String comment;
714                 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
715                 uint16 country_code;
716                 uint16 code_page;
717         } samr_UserInfo2;
718
719         /* this is also used in samr and netlogon */
720         typedef [public, flag(NDR_PAHEX)] struct {
721                 uint16 units_per_week;
722                 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
723         } samr_LogonHours;
724
725         typedef struct {
726                 lsa_String account_name;
727                 lsa_String full_name;
728                 uint32 rid;
729                 uint32 primary_gid;
730                 lsa_String home_directory;
731                 lsa_String home_drive;
732                 lsa_String logon_script;
733                 lsa_String profile_path;
734                 lsa_String workstations;
735                 NTTIME last_logon;
736                 NTTIME last_logoff;
737                 NTTIME last_password_change;
738                 NTTIME allow_password_change;
739                 NTTIME force_password_change;
740                 samr_LogonHours logon_hours;
741                 uint16 bad_password_count;
742                 uint16 logon_count;
743                 samr_AcctFlags acct_flags;
744         } samr_UserInfo3;
745
746         typedef struct {
747                 samr_LogonHours logon_hours;
748         } samr_UserInfo4;
749
750         typedef struct {
751                 lsa_String account_name;
752                 lsa_String full_name;
753                 uint32 rid;
754                 uint32 primary_gid;
755                 lsa_String home_directory;
756                 lsa_String home_drive;
757                 lsa_String logon_script;
758                 lsa_String profile_path;
759                 lsa_String description;
760                 lsa_String workstations;
761                 NTTIME last_logon;
762                 NTTIME last_logoff;
763                 samr_LogonHours logon_hours;
764                 uint16 bad_password_count;
765                 uint16 logon_count;
766                 NTTIME last_password_change;
767                 NTTIME acct_expiry;
768                 samr_AcctFlags acct_flags;
769         } samr_UserInfo5;
770
771         typedef struct {
772                 lsa_String account_name;
773                 lsa_String full_name;
774         } samr_UserInfo6;
775
776         typedef struct {
777                 lsa_String account_name;
778         } samr_UserInfo7;
779
780         typedef struct {
781                 lsa_String full_name;
782         } samr_UserInfo8;
783
784         typedef struct {
785                 uint32 primary_gid;
786         } samr_UserInfo9;
787
788         typedef struct {
789                 lsa_String home_directory;
790                 lsa_String home_drive;
791         } samr_UserInfo10;
792
793         typedef struct {
794                 lsa_String logon_script;
795         } samr_UserInfo11;
796
797         typedef struct {
798                 lsa_String profile_path;
799         } samr_UserInfo12;
800
801         typedef struct {
802                 lsa_String description;
803         } samr_UserInfo13;
804
805         typedef struct {
806                 lsa_String workstations;
807         } samr_UserInfo14;
808
809         typedef struct {
810                 samr_AcctFlags acct_flags;
811         } samr_UserInfo16;
812         
813         typedef struct {
814                 NTTIME acct_expiry;
815         } samr_UserInfo17;
816
817         typedef [public, flag(NDR_PAHEX)] struct {
818                 uint8 hash[16];
819         } samr_Password;
820
821         typedef struct {
822                 samr_Password lm_pwd;
823                 samr_Password nt_pwd;
824                 boolean8 lm_pwd_active;
825                 boolean8 nt_pwd_active;
826         } samr_UserInfo18;
827
828         typedef struct {
829                 lsa_BinaryString parameters;
830         } samr_UserInfo20;
831
832         /* this defines the bits used for fields_present in info21 */
833         typedef [bitmap32bit] bitmap {
834                 SAMR_FIELD_ACCOUNT_NAME     = 0x00000001,
835                 SAMR_FIELD_FULL_NAME        = 0x00000002,
836                 SAMR_FIELD_RID              = 0x00000004,
837                 SAMR_FIELD_PRIMARY_GID      = 0x00000008,
838                 SAMR_FIELD_DESCRIPTION      = 0x00000010,
839                 SAMR_FIELD_COMMENT          = 0x00000020,
840                 SAMR_FIELD_HOME_DIRECTORY   = 0x00000040,
841                 SAMR_FIELD_HOME_DRIVE       = 0x00000080,
842                 SAMR_FIELD_LOGON_SCRIPT     = 0x00000100,
843                 SAMR_FIELD_PROFILE_PATH     = 0x00000200,
844                 SAMR_FIELD_WORKSTATIONS     = 0x00000400,
845                 SAMR_FIELD_LAST_LOGON       = 0x00000800,
846                 SAMR_FIELD_LAST_LOGOFF      = 0x00001000,
847                 SAMR_FIELD_LOGON_HOURS      = 0x00002000,
848                 SAMR_FIELD_BAD_PWD_COUNT    = 0x00004000,
849                 SAMR_FIELD_NUM_LOGONS       = 0x00008000,
850                 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
851                 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
852                 SAMR_FIELD_LAST_PWD_CHANGE  = 0x00040000,
853                 SAMR_FIELD_ACCT_EXPIRY      = 0x00080000,
854                 SAMR_FIELD_ACCT_FLAGS       = 0x00100000,
855                 SAMR_FIELD_PARAMETERS       = 0x00200000,
856                 SAMR_FIELD_COUNTRY_CODE     = 0x00400000,
857                 SAMR_FIELD_CODE_PAGE        = 0x00800000,
858                 SAMR_FIELD_PASSWORD         = 0x01000000, /* either of these */
859                 SAMR_FIELD_PASSWORD2        = 0x02000000, /* two bits seems to work */
860                 SAMR_FIELD_PRIVATE_DATA     = 0x04000000,
861                 SAMR_FIELD_EXPIRED_FLAG     = 0x08000000,
862                 SAMR_FIELD_SEC_DESC         = 0x10000000,
863                 SAMR_FIELD_OWF_PWD          = 0x20000000
864         } samr_FieldsPresent;
865
866         /* used for 'password_expired' in samr_UserInfo21 */
867         const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
868         const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
869
870         typedef struct {
871                 NTTIME last_logon;
872                 NTTIME last_logoff;
873                 NTTIME last_password_change;
874                 NTTIME acct_expiry;
875                 NTTIME allow_password_change;
876                 NTTIME force_password_change;
877                 lsa_String account_name;
878                 lsa_String full_name;
879                 lsa_String home_directory;
880                 lsa_String home_drive;
881                 lsa_String logon_script;
882                 lsa_String profile_path;
883                 lsa_String description;
884                 lsa_String workstations;
885                 lsa_String comment;
886                 lsa_BinaryString parameters;
887                 lsa_String unknown1;
888                 lsa_String unknown2;
889                 lsa_String unknown3;
890                 uint32 buf_count;
891                 [size_is(buf_count)] uint8 *buffer;
892                 uint32 rid;
893                 uint32 primary_gid;
894                 samr_AcctFlags acct_flags;
895                 samr_FieldsPresent fields_present;
896                 samr_LogonHours logon_hours;
897                 uint16 bad_password_count;
898                 uint16 logon_count;
899                 uint16 country_code;
900                 uint16 code_page;
901                 uint8  nt_password_set;
902                 uint8  lm_password_set;
903                 uint8  password_expired;
904                 uint8  unknown4;
905         } samr_UserInfo21;
906
907         typedef [public, flag(NDR_PAHEX)] struct {
908                 uint8 data[516];
909         } samr_CryptPassword;
910
911         typedef struct {
912                 samr_UserInfo21 info;
913                 samr_CryptPassword password;
914         } samr_UserInfo23;
915
916         typedef struct {
917                 samr_CryptPassword password;
918                 uint8 pw_len;
919         } samr_UserInfo24;
920
921         typedef [flag(NDR_PAHEX)] struct {
922                 uint8 data[532];
923         } samr_CryptPasswordEx;
924
925         typedef struct {
926                 samr_UserInfo21 info;
927                 samr_CryptPasswordEx password;
928         } samr_UserInfo25;
929
930         typedef struct {
931                 samr_CryptPasswordEx password;
932                 uint8 pw_len;
933         } samr_UserInfo26;
934
935         typedef [switch_type(uint16)] union {
936                 [case(1)] samr_UserInfo1 info1;
937                 [case(2)] samr_UserInfo2 info2;
938                 [case(3)] samr_UserInfo3 info3;
939                 [case(4)] samr_UserInfo4 info4;
940                 [case(5)] samr_UserInfo5 info5;
941                 [case(6)] samr_UserInfo6 info6;
942                 [case(7)] samr_UserInfo7 info7;
943                 [case(8)] samr_UserInfo8 info8;
944                 [case(9)] samr_UserInfo9 info9;
945                 [case(10)] samr_UserInfo10 info10;
946                 [case(11)] samr_UserInfo11 info11;
947                 [case(12)] samr_UserInfo12 info12;
948                 [case(13)] samr_UserInfo13 info13;
949                 [case(14)] samr_UserInfo14 info14;
950                 [case(16)] samr_UserInfo16 info16;
951                 [case(17)] samr_UserInfo17 info17;
952                 [case(18)] samr_UserInfo18 info18;
953                 [case(20)] samr_UserInfo20 info20;
954                 [case(21)] samr_UserInfo21 info21;
955                 [case(23)] samr_UserInfo23 info23;
956                 [case(24)] samr_UserInfo24 info24;
957                 [case(25)] samr_UserInfo25 info25;
958                 [case(26)] samr_UserInfo26 info26;
959         } samr_UserInfo;
960
961         [public] NTSTATUS samr_QueryUserInfo(
962                 [in,ref]                  policy_handle *user_handle,
963                 [in]                      uint16 level,
964                 [out,ref,switch_is(level)] samr_UserInfo **info
965                 );
966
967
968         /************************/
969         /* Function    0x25     */
970         [public] NTSTATUS samr_SetUserInfo(
971                 [in,ref]                   policy_handle *user_handle,
972                 [in]                       uint16 level,
973                 [in,ref,switch_is(level)]  samr_UserInfo *info
974                 );
975
976         /************************/
977         /* Function    0x26     */
978         /*
979           this is a password change interface that doesn't give
980           the server the plaintext password. Depricated.
981         */
982         NTSTATUS samr_ChangePasswordUser(
983                 [in,ref]    policy_handle *user_handle,
984                 [in]        boolean8 lm_present,
985                 [in,unique] samr_Password *old_lm_crypted,
986                 [in,unique] samr_Password *new_lm_crypted,
987                 [in]        boolean8 nt_present,
988                 [in,unique] samr_Password *old_nt_crypted,
989                 [in,unique] samr_Password *new_nt_crypted,
990                 [in]        boolean8 cross1_present,
991                 [in,unique] samr_Password *nt_cross,
992                 [in]        boolean8 cross2_present,
993                 [in,unique] samr_Password *lm_cross
994                 );
995
996         /************************/
997         /* Function    0x27     */
998
999         typedef [public] struct {
1000                 uint32 rid;
1001                 samr_GroupAttrs attributes;
1002         } samr_RidWithAttribute;
1003
1004         typedef [public] struct {
1005                 uint32     count;
1006                 [size_is(count)] samr_RidWithAttribute *rids;
1007         } samr_RidWithAttributeArray;
1008
1009         NTSTATUS samr_GetGroupsForUser(
1010                 [in,ref]   policy_handle *user_handle,
1011                 [out,ref]  samr_RidWithAttributeArray  **rids
1012                 );
1013
1014         /************************/
1015         /* Function    0x28     */
1016
1017         typedef struct {
1018                 uint32    idx;
1019                 uint32    rid;
1020                 samr_AcctFlags acct_flags;
1021                 lsa_String account_name;
1022                 lsa_String description;
1023                 lsa_String full_name;
1024         } samr_DispEntryGeneral;
1025
1026         typedef struct {
1027                 uint32 count;
1028                 [size_is(count)] samr_DispEntryGeneral *entries;
1029         } samr_DispInfoGeneral;
1030
1031         typedef struct {
1032                 uint32    idx;
1033                 uint32    rid;
1034                 samr_AcctFlags acct_flags;
1035                 lsa_String account_name;
1036                 lsa_String description;
1037         } samr_DispEntryFull;
1038
1039         typedef struct {
1040                 uint32 count;
1041                 [size_is(count)] samr_DispEntryFull *entries;
1042         } samr_DispInfoFull;
1043
1044         typedef struct {
1045                 uint32    idx;
1046                 uint32    rid;
1047                 samr_GroupAttrs acct_flags;
1048                 lsa_String account_name;
1049                 lsa_String description;
1050         } samr_DispEntryFullGroup;
1051
1052         typedef struct {
1053                 uint32 count;
1054                 [size_is(count)] samr_DispEntryFullGroup *entries;
1055         } samr_DispInfoFullGroups;
1056
1057         typedef struct {
1058                 uint32    idx;
1059                 lsa_AsciiStringLarge account_name;
1060         } samr_DispEntryAscii;
1061
1062         typedef struct {
1063                 uint32 count;
1064                 [size_is(count)] samr_DispEntryAscii *entries;
1065         } samr_DispInfoAscii;
1066
1067         typedef [switch_type(uint16)] union {
1068                 [case(1)] samr_DispInfoGeneral info1;/* users */
1069                 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1070                 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1071                 [case(4)] samr_DispInfoAscii info4; /* users */
1072                 [case(5)] samr_DispInfoAscii info5; /* groups */
1073         } samr_DispInfo;
1074
1075         NTSTATUS samr_QueryDisplayInfo(
1076                 [in,ref]    policy_handle *domain_handle,
1077                 [in]        uint16 level,
1078                 [in]        uint32 start_idx,
1079                 [in]        uint32 max_entries,
1080                 [in]        uint32 buf_size,
1081                 [out,ref]   uint32 *total_size,
1082                 [out,ref]   uint32 *returned_size,
1083                 [out,ref,switch_is(level)] samr_DispInfo *info
1084                 );
1085
1086
1087         /************************/
1088         /* Function    0x29     */
1089
1090         /*
1091           this seems to be an alphabetic search function. The returned index
1092           is the index for samr_QueryDisplayInfo needed to get names occurring
1093           after the specified name. The supplied name does not need to exist
1094           in the database (for example you can supply just a first letter for 
1095           searching starting at that letter)
1096
1097           The level corresponds to the samr_QueryDisplayInfo level
1098         */
1099         NTSTATUS samr_GetDisplayEnumerationIndex(
1100                 [in,ref]    policy_handle *domain_handle,
1101                 [in]        uint16 level,
1102                 [in,ref]    lsa_String *name,
1103                 [out,ref]   uint32 *idx
1104                 );
1105
1106
1107
1108         /************************/
1109         /* Function    0x2a     */
1110
1111         /*
1112           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1113         */
1114         NTSTATUS samr_TestPrivateFunctionsDomain(
1115                 [in,ref]    policy_handle *domain_handle
1116                 );
1117
1118
1119         /************************/
1120         /* Function    0x2b     */
1121
1122         /*
1123           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1124         */
1125         NTSTATUS samr_TestPrivateFunctionsUser(
1126                 [in,ref]    policy_handle *user_handle
1127                 );
1128
1129
1130         /************************/
1131         /* Function    0x2c     */
1132
1133         typedef struct {
1134                 uint16 min_password_length;
1135                 samr_PasswordProperties password_properties;
1136         } samr_PwInfo;
1137
1138         [public] NTSTATUS samr_GetUserPwInfo(
1139                 [in,ref]    policy_handle *user_handle,
1140                 [out,ref]   samr_PwInfo *info
1141                 );
1142
1143         /************************/
1144         /* Function    0x2d     */
1145         NTSTATUS samr_RemoveMemberFromForeignDomain(
1146                 [in,ref]    policy_handle *domain_handle,
1147                 [in,ref]    dom_sid2 *sid
1148                 );
1149
1150         /************************/
1151         /* Function    0x2e     */
1152
1153         /*
1154           how is this different from QueryDomainInfo ??
1155         */
1156         NTSTATUS samr_QueryDomainInfo2(
1157                 [in,ref]      policy_handle *domain_handle,
1158                 [in]          uint16 level,
1159                 [out,ref,switch_is(level)] samr_DomainInfo **info
1160                 );
1161
1162         /************************/
1163         /* Function    0x2f     */
1164
1165         /*
1166           how is this different from QueryUserInfo ??
1167         */
1168         NTSTATUS samr_QueryUserInfo2(
1169                 [in,ref]                  policy_handle *user_handle,
1170                 [in]                      uint16 level,
1171                 [out,ref,switch_is(level)]    samr_UserInfo *info
1172                 );
1173
1174         /************************/
1175         /* Function    0x30     */
1176
1177         /*
1178           how is this different from QueryDisplayInfo??
1179         */
1180         NTSTATUS samr_QueryDisplayInfo2(
1181                 [in,ref]    policy_handle *domain_handle,
1182                 [in]        uint16 level,
1183                 [in]        uint32 start_idx,
1184                 [in]        uint32 max_entries,
1185                 [in]        uint32 buf_size,
1186                 [out,ref]   uint32 *total_size,
1187                 [out,ref]   uint32 *returned_size,
1188                 [out,ref,switch_is(level)] samr_DispInfo *info
1189                 );
1190
1191         /************************/
1192         /* Function    0x31     */
1193
1194         /*
1195           how is this different from GetDisplayEnumerationIndex ??
1196         */
1197         NTSTATUS samr_GetDisplayEnumerationIndex2(
1198                 [in,ref]    policy_handle *domain_handle,
1199                 [in]        uint16 level,
1200                 [in,ref]    lsa_String *name,
1201                 [out,ref]   uint32 *idx
1202                 );
1203
1204
1205         /************************/
1206         /* Function    0x32     */
1207         NTSTATUS samr_CreateUser2(
1208                 [in,ref]      policy_handle *domain_handle,
1209                 [in,ref]      lsa_String *account_name,
1210                 [in]          samr_AcctFlags acct_flags,
1211                 [in]          samr_UserAccessMask access_mask,
1212                 [out,ref]     policy_handle *user_handle,
1213                 [out,ref]     uint32 *access_granted,
1214                 [out,ref]     uint32 *rid
1215                 );
1216
1217
1218         /************************/
1219         /* Function    0x33     */
1220
1221         /*
1222           another duplicate. There must be a reason ....
1223         */
1224         NTSTATUS samr_QueryDisplayInfo3(
1225                 [in,ref]    policy_handle *domain_handle,
1226                 [in]        uint16 level,
1227                 [in]        uint32 start_idx,
1228                 [in]        uint32 max_entries,
1229                 [in]        uint32 buf_size,
1230                 [out,ref]   uint32 *total_size,
1231                 [out,ref]   uint32 *returned_size,
1232                 [out,ref,switch_is(level)] samr_DispInfo *info
1233                 );
1234
1235         /************************/
1236         /* Function    0x34     */
1237         NTSTATUS samr_AddMultipleMembersToAlias(
1238                 [in,ref]    policy_handle *alias_handle,
1239                 [in,ref]    lsa_SidArray *sids
1240                 );
1241
1242         /************************/
1243         /* Function    0x35     */
1244         NTSTATUS samr_RemoveMultipleMembersFromAlias(
1245                 [in,ref]    policy_handle *alias_handle,
1246                 [in,ref]    lsa_SidArray *sids
1247                 );
1248
1249         /************************/
1250         /* Function    0x36     */
1251
1252         NTSTATUS samr_OemChangePasswordUser2(
1253                 [in,unique]       lsa_AsciiString *server,
1254                 [in,ref]          lsa_AsciiString *account,
1255                 [in,unique]       samr_CryptPassword *password,
1256                 [in,unique]       samr_Password *hash
1257                 );
1258
1259         /************************/
1260         /* Function    0x37     */
1261         NTSTATUS samr_ChangePasswordUser2(
1262                 [in,unique]       lsa_String *server,
1263                 [in,ref]          lsa_String *account,
1264                 [in,unique]       samr_CryptPassword *nt_password,
1265                 [in,unique]       samr_Password *nt_verifier,
1266                 [in]              boolean8 lm_change,
1267                 [in,unique]       samr_CryptPassword *lm_password,
1268                 [in,unique]       samr_Password *lm_verifier
1269                 );
1270
1271         /************************/
1272         /* Function    0x38     */
1273         NTSTATUS samr_GetDomPwInfo(
1274                 [in,unique] lsa_String *domain_name,
1275                 [out,ref]   samr_PwInfo *info
1276                 );
1277
1278         /************************/
1279         /* Function    0x39     */
1280         NTSTATUS samr_Connect2(
1281                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1282                 [in] samr_ConnectAccessMask access_mask,
1283                 [out,ref]  policy_handle *connect_handle
1284                 );
1285
1286         /************************/
1287         /* Function    0x3a     */
1288         /*
1289           seems to be an exact alias for samr_SetUserInfo() 
1290         */
1291         [public] NTSTATUS samr_SetUserInfo2(
1292                 [in,ref]                   policy_handle *user_handle,
1293                 [in]                       uint16 level,
1294                 [in,ref,switch_is(level)]  samr_UserInfo *info
1295                 );
1296
1297         /************************/
1298         /* Function    0x3b     */
1299         /*
1300           this one is mysterious. I have a few guesses, but nothing working yet
1301         */
1302         NTSTATUS samr_SetBootKeyInformation(
1303                 [in,ref]   policy_handle *connect_handle,
1304                 [in]       uint32 unknown1,
1305                 [in]       uint32 unknown2,
1306                 [in]       uint32 unknown3
1307                 );
1308
1309         /************************/
1310         /* Function    0x3c     */
1311         NTSTATUS samr_GetBootKeyInformation(
1312                 [in,ref]   policy_handle *domain_handle,
1313                 [out,ref]  uint32 *unknown
1314                 );
1315
1316         /************************/
1317         /* Function    0x3d     */
1318         NTSTATUS samr_Connect3(
1319                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1320                 /* this unknown value seems to be completely ignored by w2k3 */
1321                 [in] uint32 unknown,
1322                 [in] samr_ConnectAccessMask access_mask,
1323                 [out,ref]  policy_handle *connect_handle
1324                 );
1325
1326         /************************/
1327         /* Function    0x3e     */
1328
1329         typedef enum {
1330                 SAMR_CONNECT_PRE_W2K    = 1,
1331                 SAMR_CONNECT_W2K        = 2,
1332                 SAMR_CONNECT_AFTER_W2K  = 3
1333         } samr_ConnectVersion;
1334
1335         NTSTATUS samr_Connect4(
1336                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1337                 [in] samr_ConnectVersion client_version,
1338                 [in] samr_ConnectAccessMask access_mask,
1339                 [out,ref]  policy_handle *connect_handle
1340                 );
1341
1342         /************************/
1343         /* Function    0x3f     */
1344
1345         typedef enum samr_RejectReason samr_RejectReason;
1346
1347         typedef struct {
1348                 samr_RejectReason reason;
1349                 uint32 unknown1;
1350                 uint32 unknown2;
1351         } samr_ChangeReject;
1352
1353         NTSTATUS samr_ChangePasswordUser3(
1354                 [in,unique]       lsa_String *server,
1355                 [in,ref]          lsa_String *account,
1356                 [in,unique]       samr_CryptPassword *nt_password,
1357                 [in,unique]       samr_Password *nt_verifier,
1358                 [in]              boolean8 lm_change,
1359                 [in,unique]       samr_CryptPassword *lm_password,
1360                 [in,unique]       samr_Password *lm_verifier,
1361                 [in,unique]       samr_CryptPassword *password3,
1362                 [out,ref]         samr_DomInfo1 **dominfo,
1363                 [out,ref]         samr_ChangeReject **reject
1364                 );
1365
1366         /************************/
1367         /* Function    0x40      */
1368
1369         typedef struct {
1370                 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1371                 uint32         unknown2; /* w2k3 gives 0 */
1372         } samr_ConnectInfo1;
1373
1374         typedef union {
1375                 [case(1)]  samr_ConnectInfo1 info1;
1376         } samr_ConnectInfo;
1377
1378         [public] NTSTATUS samr_Connect5(
1379                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1380                 [in]       samr_ConnectAccessMask  access_mask,
1381                 [in]       uint32             level_in,
1382                 [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
1383                 [out,ref]  uint32             *level_out,
1384                 [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
1385                 [out,ref]  policy_handle      *connect_handle
1386                 );
1387
1388         /************************/
1389         /* Function    0x41     */
1390         NTSTATUS samr_RidToSid(
1391                 [in,ref]    policy_handle *domain_handle,
1392                 [in]        uint32        rid,
1393                 [out,ref]   dom_sid2      *sid
1394                 );
1395
1396
1397         /************************/
1398         /* Function    0x42     */
1399
1400         /*
1401           this should set the DSRM password for the server, which is used
1402           when booting into Directory Services Recovery Mode on a DC. Win2003
1403           gives me NT_STATUS_NOT_SUPPORTED
1404         */
1405
1406         NTSTATUS samr_SetDsrmPassword(
1407                 [in,unique] lsa_String *name,
1408                 [in]       uint32 unknown,
1409                 [in,unique] samr_Password *hash
1410                 );
1411
1412
1413         /************************/
1414         /* Function    0x43     */
1415         /************************/
1416         typedef [bitmap32bit] bitmap {
1417                 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET           = 0x00000001,
1418                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME           = 0x00000002,
1419                 SAMR_VALIDATE_FIELD_LOCKOUT_TIME                = 0x00000004,
1420                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT          = 0x00000008,
1421                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH     = 0x00000010,
1422                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY            = 0x00000020
1423         } samr_ValidateFieldsPresent;
1424
1425         typedef enum {
1426                 NetValidateAuthentication = 1,
1427                 NetValidatePasswordChange= 2,
1428                 NetValidatePasswordReset = 3
1429         } samr_ValidatePasswordLevel;
1430
1431         /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1432          * identified the mapping of
1433          * - NERR_PasswordFilterError
1434          * - NERR_PasswordExpired and
1435          * - NERR_PasswordCantChange
1436          * yet - Guenther
1437          */
1438
1439         typedef enum {
1440                 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1441                 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1442                 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1443                 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1444                 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1445                 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1446                 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1447                 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1448                 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1449         } samr_ValidationStatus;
1450
1451         typedef struct {
1452                 uint32 length;
1453                 [size_is(length)] uint8 *data;
1454         } samr_ValidationBlob;
1455
1456         typedef struct {
1457                 samr_ValidateFieldsPresent fields_present;
1458                 NTTIME_hyper last_password_change;
1459                 NTTIME_hyper bad_password_time;
1460                 NTTIME_hyper lockout_time;
1461                 uint32 bad_pwd_count;
1462                 uint32 pwd_history_len;
1463                 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1464         } samr_ValidatePasswordInfo;
1465
1466         typedef struct {
1467                 samr_ValidatePasswordInfo info;
1468                 samr_ValidationStatus status;
1469         } samr_ValidatePasswordRepCtr;
1470
1471         typedef [switch_type(uint16)] union {
1472                 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1473                 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1474                 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1475         } samr_ValidatePasswordRep;
1476
1477         typedef struct {
1478                 samr_ValidatePasswordInfo info;
1479                 lsa_StringLarge password;
1480                 lsa_StringLarge account;
1481                 samr_ValidationBlob hash;
1482                 boolean8 pwd_must_change_at_next_logon;
1483                 boolean8 clear_lockout;
1484         } samr_ValidatePasswordReq3;
1485
1486         typedef struct {
1487                 samr_ValidatePasswordInfo info;
1488                 lsa_StringLarge password;
1489                 lsa_StringLarge account;
1490                 samr_ValidationBlob hash;
1491                 boolean8 password_matched;
1492         } samr_ValidatePasswordReq2;
1493
1494         typedef struct {
1495                 samr_ValidatePasswordInfo info;
1496                 boolean8 password_matched;
1497         } samr_ValidatePasswordReq1;
1498
1499         typedef [switch_type(uint16)] union {
1500                 [case(1)] samr_ValidatePasswordReq1 req1;
1501                 [case(2)] samr_ValidatePasswordReq2 req2;
1502                 [case(3)] samr_ValidatePasswordReq3 req3;
1503         } samr_ValidatePasswordReq;
1504
1505         NTSTATUS samr_ValidatePassword(
1506                 [in] samr_ValidatePasswordLevel level,
1507                 [in,switch_is(level)] samr_ValidatePasswordReq req,
1508                 [out,ref,switch_is(level)] samr_ValidatePasswordRep *rep
1509                 );
1510 }