s4-samr: merge Domain Object specific access rights from s3 idl.
[ira/wip.git] / 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,unique]      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,unique] 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,ref]      policy_handle *connect_handle,
244                 [in,out,ref]  uint32 *resume_handle,
245                 [in]          uint32 buf_size,
246                 [out,unique]  samr_SamArray *sam,
247                 [out]         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,switch_is(level),unique] 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         NTSTATUS samr_EnumDomainGroups(
400                 [in,ref]      policy_handle *domain_handle,
401                 [in,out,ref]  uint32 *resume_handle,
402                 [in]          uint32 max_size,
403                 [out,unique]  samr_SamArray *sam,
404                 [out]         uint32 num_entries
405                 );
406
407         /************************/
408         /* Function    0x0c     */
409         NTSTATUS samr_CreateUser(
410                 [in,ref]      policy_handle *domain_handle,
411                 [in,ref]      lsa_String *account_name,
412                 [in]          samr_UserAccessMask access_mask,
413                 [out,ref]     policy_handle *user_handle,
414                 [out,ref]     uint32 *rid
415                 );
416
417         /************************/
418         /* Function    0x0d     */
419
420
421         /* w2k3 treats max_size as max_users*54 and sets the
422            resume_handle as the rid of the last user sent
423         */
424         const int SAMR_ENUM_USERS_MULTIPLIER = 54;
425
426         NTSTATUS samr_EnumDomainUsers(
427                 [in,ref]      policy_handle *domain_handle,
428                 [in,out,ref]  uint32 *resume_handle,
429                 [in]          samr_AcctFlags acct_flags,
430                 [in]          uint32 max_size,
431                 [out,unique]  samr_SamArray *sam,
432                 [out]         uint32 num_entries
433                 );
434
435         /************************/
436         /* Function    0x0e     */
437         NTSTATUS samr_CreateDomAlias(
438                 [in,ref]      policy_handle *domain_handle,
439                 [in,ref]      lsa_String   *alias_name,
440                 [in]          samr_AliasAccessMask access_mask,
441                 [out,ref]     policy_handle *alias_handle,
442                 [out,ref]     uint32        *rid
443                 );
444
445         /************************/
446         /* Function    0x0f     */
447         NTSTATUS samr_EnumDomainAliases(
448                 [in,ref]      policy_handle *domain_handle,
449                 [in,out,ref]  uint32 *resume_handle,
450                 [in]          samr_AcctFlags acct_flags,
451                 [out,unique]  samr_SamArray *sam,
452                 [out]         uint32 num_entries
453                 );
454
455         /************************/
456         /* Function    0x10     */
457
458         typedef struct {
459                 [range(0,1024)]  uint32 count;
460                 [size_is(count)] uint32 *ids;
461         } samr_Ids;
462
463         NTSTATUS samr_GetAliasMembership(
464                 [in,ref]      policy_handle *domain_handle,
465                 [in,ref]      lsa_SidArray  *sids,
466                 [out,ref]     samr_Ids *rids
467                 );
468
469         /************************/
470         /* Function    0x11     */
471
472         [public] NTSTATUS samr_LookupNames(
473                 [in,ref]      policy_handle *domain_handle,
474                 [in,range(0,1000)] uint32 num_names,
475                 [in,size_is(1000),length_is(num_names)] lsa_String names[],
476                 [out]         samr_Ids rids,
477                 [out]         samr_Ids types
478                 );
479
480
481         /************************/
482         /* Function    0x12     */
483         NTSTATUS samr_LookupRids(
484                 [in,ref]      policy_handle *domain_handle,
485                 [in,range(0,1000)] uint32 num_rids,
486                 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
487                 [out]         lsa_Strings names,
488                 [out]         samr_Ids types
489                 );
490
491         /************************/
492         /* Function    0x13     */
493         NTSTATUS samr_OpenGroup(
494                 [in,ref]      policy_handle *domain_handle,
495                 [in]          samr_GroupAccessMask access_mask,
496                 [in]          uint32 rid,
497                 [out,ref]     policy_handle *group_handle
498                 );
499
500         /* Group attributes */
501         typedef [public,bitmap32bit] bitmap {
502                 SE_GROUP_MANDATORY              = 0x00000001,
503                 SE_GROUP_ENABLED_BY_DEFAULT     = 0x00000002,
504                 SE_GROUP_ENABLED                = 0x00000004,
505                 SE_GROUP_OWNER                  = 0x00000008,
506                 SE_GROUP_USE_FOR_DENY_ONLY      = 0x00000010,
507                 SE_GROUP_RESOURCE               = 0x20000000,
508                 SE_GROUP_LOGON_ID               = 0xC0000000
509         } samr_GroupAttrs;
510
511         /************************/
512         /* Function    0x14     */
513
514         typedef struct {
515                 lsa_String name;
516                 samr_GroupAttrs attributes;
517                 uint32 num_members;
518                 lsa_String description;
519         } samr_GroupInfoAll;
520
521         typedef struct {
522                 samr_GroupAttrs attributes;
523         } samr_GroupInfoAttributes;
524
525         typedef struct {
526                 lsa_String description;
527         } samr_GroupInfoDescription;
528
529         typedef enum {
530                 GROUPINFOALL          = 1,
531                 GROUPINFONAME         = 2,
532                 GROUPINFOATTRIBUTES   = 3,
533                 GROUPINFODESCRIPTION  = 4,
534                 GROUPINFOALL2         = 5
535         } samr_GroupInfoEnum;
536
537         typedef [switch_type(samr_GroupInfoEnum)] union {
538                 [case(GROUPINFOALL)]         samr_GroupInfoAll        all;
539                 [case(GROUPINFONAME)]        lsa_String               name;
540                 [case(GROUPINFOATTRIBUTES)]  samr_GroupInfoAttributes attributes;
541                 [case(GROUPINFODESCRIPTION)] lsa_String               description;
542                 [case(GROUPINFOALL2)]        samr_GroupInfoAll        all2;
543         } samr_GroupInfo;
544
545         NTSTATUS samr_QueryGroupInfo(
546                 [in,ref]                  policy_handle *group_handle,
547                 [in]                      samr_GroupInfoEnum level,
548                 [out,switch_is(level),unique] samr_GroupInfo *info
549                 );
550
551         /************************/
552         /* Function    0x15     */
553         NTSTATUS samr_SetGroupInfo(
554                 [in,ref]                  policy_handle *group_handle,
555                 [in]                      samr_GroupInfoEnum level,
556                 [in,switch_is(level),ref] samr_GroupInfo *info
557                 );
558
559         /************************/
560         /* Function    0x16     */
561         NTSTATUS samr_AddGroupMember(
562                 [in,ref]                  policy_handle *group_handle,
563                 [in]                      uint32 rid,
564                 [in]                      uint32 flags
565                 );
566
567         /************************/
568         /* Function    0x17     */
569         NTSTATUS samr_DeleteDomainGroup(
570                 [in,out,ref]   policy_handle *group_handle
571                 );
572
573         /************************/
574         /* Function    0x18     */
575         NTSTATUS samr_DeleteGroupMember(
576                 [in,ref]                  policy_handle *group_handle,
577                 [in]                      uint32 rid
578                 );
579
580
581         /************************/
582         /* Function    0x19     */
583         typedef struct {
584                 uint32 count;
585                 [size_is(count)] uint32 *rids;
586                 [size_is(count)] uint32 *types;
587         } samr_RidTypeArray;
588
589         NTSTATUS samr_QueryGroupMember(
590                 [in,ref]  policy_handle *group_handle,
591                 [out,unique] samr_RidTypeArray *rids
592                 );
593
594
595         /************************/
596         /* Function    0x1a     */
597
598         /*
599           win2003 seems to accept any data at all for the two integers
600           below, and doesn't seem to do anything with them that I can
601           see. Weird. I really expected the first integer to be a rid
602           and the second to be the attributes for that rid member.
603         */
604         NTSTATUS samr_SetMemberAttributesOfGroup(
605                 [in,ref]  policy_handle *group_handle,
606                 [in]      uint32 unknown1,
607                 [in]      uint32 unknown2
608                 );
609
610
611         /************************/
612         /* Function    0x1b     */
613         NTSTATUS samr_OpenAlias (
614                 [in,ref]      policy_handle *domain_handle,
615                 [in]          samr_AliasAccessMask access_mask,
616                 [in]          uint32 rid,
617                 [out,ref]     policy_handle *alias_handle
618                 );
619
620
621         /************************/
622         /* Function    0x1c     */
623
624         typedef struct {
625                 lsa_String name;
626                 uint32 num_members;
627                 lsa_String description;
628         } samr_AliasInfoAll;
629
630         typedef enum {
631                 ALIASINFOALL          = 1,
632                 ALIASINFONAME         = 2,
633                 ALIASINFODESCRIPTION  = 3
634         } samr_AliasInfoEnum;
635
636         typedef [switch_type(samr_AliasInfoEnum)] union {
637                 [case(ALIASINFOALL)] samr_AliasInfoAll all;
638                 [case(ALIASINFONAME)] lsa_String name;
639                 [case(ALIASINFODESCRIPTION)] lsa_String description;
640         } samr_AliasInfo;
641
642         NTSTATUS samr_QueryAliasInfo(
643                 [in,ref]                  policy_handle  *alias_handle,
644                 [in]                      samr_AliasInfoEnum      level,
645                 [out,switch_is(level),unique] samr_AliasInfo *info
646                 );
647
648         /************************/
649         /* Function    0x1d     */
650         NTSTATUS samr_SetAliasInfo(
651                 [in,ref]                  policy_handle  *alias_handle,
652                 [in]                      samr_AliasInfoEnum      level,
653                 [in,switch_is(level),ref] samr_AliasInfo *info
654                 );
655
656         /************************/
657         /* Function    0x1e     */
658         NTSTATUS samr_DeleteDomAlias(
659                 [in,out,ref]  policy_handle *alias_handle
660                 );
661
662         /************************/
663         /* Function    0x1f     */
664         NTSTATUS samr_AddAliasMember(
665                 [in,ref]  policy_handle *alias_handle,
666                 [in,ref]  dom_sid2      *sid
667                 );
668
669         /************************/
670         /* Function    0x20     */
671         NTSTATUS samr_DeleteAliasMember(
672                 [in,ref] policy_handle *alias_handle,
673                 [in,ref] dom_sid2      *sid
674                 );
675
676         /************************/
677         /* Function    0x21     */
678         NTSTATUS samr_GetMembersInAlias(
679                 [in,ref]   policy_handle *alias_handle,
680                 [out,ref]  lsa_SidArray    *sids
681                 );
682
683         /************************/
684         /* Function    0x22     */
685         [public] NTSTATUS samr_OpenUser(
686                 [in,ref]      policy_handle *domain_handle,
687                 [in]          samr_UserAccessMask access_mask,
688                 [in]          uint32 rid,
689                 [out,ref]     policy_handle *user_handle
690                 );
691
692         /************************/
693         /* Function    0x23     */
694         NTSTATUS samr_DeleteUser(
695                 [in,out,ref]   policy_handle *user_handle
696                 );
697
698         /************************/
699         /* Function    0x24     */
700         typedef struct {
701                 lsa_String account_name;
702                 lsa_String full_name;
703                 uint32 primary_gid;
704                 lsa_String description;
705                 lsa_String comment;
706         } samr_UserInfo1;
707
708         typedef struct {
709                 lsa_String comment;
710                 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
711                 uint16 country_code;
712                 uint16 code_page;
713         } samr_UserInfo2;
714
715         /* this is also used in samr and netlogon */
716         typedef [public, flag(NDR_PAHEX)] struct {
717                 uint16 units_per_week;
718                 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
719         } samr_LogonHours;
720
721         typedef struct {
722                 lsa_String account_name;
723                 lsa_String full_name;
724                 uint32 rid;
725                 uint32 primary_gid;
726                 lsa_String home_directory;
727                 lsa_String home_drive;
728                 lsa_String logon_script;
729                 lsa_String profile_path;
730                 lsa_String workstations;
731                 NTTIME last_logon;
732                 NTTIME last_logoff;
733                 NTTIME last_password_change;
734                 NTTIME allow_password_change;
735                 NTTIME force_password_change;
736                 samr_LogonHours logon_hours;
737                 uint16 bad_password_count;
738                 uint16 logon_count;
739                 samr_AcctFlags acct_flags;
740         } samr_UserInfo3;
741
742         typedef struct {
743                 samr_LogonHours logon_hours;
744         } samr_UserInfo4;
745
746         typedef struct {
747                 lsa_String account_name;
748                 lsa_String full_name;
749                 uint32 rid;
750                 uint32 primary_gid;
751                 lsa_String home_directory;
752                 lsa_String home_drive;
753                 lsa_String logon_script;
754                 lsa_String profile_path;
755                 lsa_String description;
756                 lsa_String workstations;
757                 NTTIME last_logon;
758                 NTTIME last_logoff;
759                 samr_LogonHours logon_hours;
760                 uint16 bad_password_count;
761                 uint16 logon_count;
762                 NTTIME last_password_change;
763                 NTTIME acct_expiry;
764                 samr_AcctFlags acct_flags;
765         } samr_UserInfo5;
766
767         typedef struct {
768                 lsa_String account_name;
769                 lsa_String full_name;
770         } samr_UserInfo6;
771
772         typedef struct {
773                 lsa_String account_name;
774         } samr_UserInfo7;
775
776         typedef struct {
777                 lsa_String full_name;
778         } samr_UserInfo8;
779
780         typedef struct {
781                 uint32 primary_gid;
782         } samr_UserInfo9;
783
784         typedef struct {
785                 lsa_String home_directory;
786                 lsa_String home_drive;
787         } samr_UserInfo10;
788
789         typedef struct {
790                 lsa_String logon_script;
791         } samr_UserInfo11;
792
793         typedef struct {
794                 lsa_String profile_path;
795         } samr_UserInfo12;
796
797         typedef struct {
798                 lsa_String description;
799         } samr_UserInfo13;
800
801         typedef struct {
802                 lsa_String workstations;
803         } samr_UserInfo14;
804
805         typedef struct {
806                 samr_AcctFlags acct_flags;
807         } samr_UserInfo16;
808
809         typedef struct {
810                 NTTIME acct_expiry;
811         } samr_UserInfo17;
812
813         typedef [public, flag(NDR_PAHEX)] struct {
814                 uint8 hash[16];
815         } samr_Password;
816
817         typedef struct {
818                 samr_Password lm_pwd;
819                 samr_Password nt_pwd;
820                 boolean8 lm_pwd_active;
821                 boolean8 nt_pwd_active;
822         } samr_UserInfo18;
823
824         typedef struct {
825                 lsa_BinaryString parameters;
826         } samr_UserInfo20;
827
828         /* this defines the bits used for fields_present in info21 */
829         typedef [bitmap32bit] bitmap {
830                 SAMR_FIELD_ACCOUNT_NAME     = 0x00000001,
831                 SAMR_FIELD_FULL_NAME        = 0x00000002,
832                 SAMR_FIELD_RID              = 0x00000004,
833                 SAMR_FIELD_PRIMARY_GID      = 0x00000008,
834                 SAMR_FIELD_DESCRIPTION      = 0x00000010,
835                 SAMR_FIELD_COMMENT          = 0x00000020,
836                 SAMR_FIELD_HOME_DIRECTORY   = 0x00000040,
837                 SAMR_FIELD_HOME_DRIVE       = 0x00000080,
838                 SAMR_FIELD_LOGON_SCRIPT     = 0x00000100,
839                 SAMR_FIELD_PROFILE_PATH     = 0x00000200,
840                 SAMR_FIELD_WORKSTATIONS     = 0x00000400,
841                 SAMR_FIELD_LAST_LOGON       = 0x00000800,
842                 SAMR_FIELD_LAST_LOGOFF      = 0x00001000,
843                 SAMR_FIELD_LOGON_HOURS      = 0x00002000,
844                 SAMR_FIELD_BAD_PWD_COUNT    = 0x00004000,
845                 SAMR_FIELD_NUM_LOGONS       = 0x00008000,
846                 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
847                 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
848                 SAMR_FIELD_LAST_PWD_CHANGE  = 0x00040000,
849                 SAMR_FIELD_ACCT_EXPIRY      = 0x00080000,
850                 SAMR_FIELD_ACCT_FLAGS       = 0x00100000,
851                 SAMR_FIELD_PARAMETERS       = 0x00200000,
852                 SAMR_FIELD_COUNTRY_CODE     = 0x00400000,
853                 SAMR_FIELD_CODE_PAGE        = 0x00800000,
854                 SAMR_FIELD_PASSWORD         = 0x01000000, /* either of these */
855                 SAMR_FIELD_PASSWORD2        = 0x02000000, /* two bits seems to work */
856                 SAMR_FIELD_PRIVATE_DATA     = 0x04000000,
857                 SAMR_FIELD_EXPIRED_FLAG     = 0x08000000,
858                 SAMR_FIELD_SEC_DESC         = 0x10000000,
859                 SAMR_FIELD_OWF_PWD          = 0x20000000
860         } samr_FieldsPresent;
861
862         /* used for 'password_expired' in samr_UserInfo21 */
863         const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
864         const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
865
866         typedef struct {
867                 NTTIME last_logon;
868                 NTTIME last_logoff;
869                 NTTIME last_password_change;
870                 NTTIME acct_expiry;
871                 NTTIME allow_password_change;
872                 NTTIME force_password_change;
873                 lsa_String account_name;
874                 lsa_String full_name;
875                 lsa_String home_directory;
876                 lsa_String home_drive;
877                 lsa_String logon_script;
878                 lsa_String profile_path;
879                 lsa_String description;
880                 lsa_String workstations;
881                 lsa_String comment;
882                 lsa_BinaryString parameters;
883                 lsa_String unknown1;
884                 lsa_String unknown2;
885                 lsa_String unknown3;
886                 uint32 buf_count;
887                 [size_is(buf_count)] uint8 *buffer;
888                 uint32 rid;
889                 uint32 primary_gid;
890                 samr_AcctFlags acct_flags;
891                 samr_FieldsPresent fields_present;
892                 samr_LogonHours logon_hours;
893                 uint16 bad_password_count;
894                 uint16 logon_count;
895                 uint16 country_code;
896                 uint16 code_page;
897                 uint8  nt_password_set;
898                 uint8  lm_password_set;
899                 uint8  password_expired;
900                 uint8  unknown4;
901         } samr_UserInfo21;
902
903         typedef [public, flag(NDR_PAHEX)] struct {
904                 uint8 data[516];
905         } samr_CryptPassword;
906
907         typedef struct {
908                 samr_UserInfo21 info;
909                 samr_CryptPassword password;
910         } samr_UserInfo23;
911
912         typedef struct {
913                 samr_CryptPassword password;
914                 uint8 pw_len;
915         } samr_UserInfo24;
916
917         typedef [flag(NDR_PAHEX)] struct {
918                 uint8 data[532];
919         } samr_CryptPasswordEx;
920
921         typedef struct {
922                 samr_UserInfo21 info;
923                 samr_CryptPasswordEx password;
924         } samr_UserInfo25;
925
926         typedef struct {
927                 samr_CryptPasswordEx password;
928                 uint8 pw_len;
929         } samr_UserInfo26;
930
931         typedef [switch_type(uint16)] union {
932                 [case(1)] samr_UserInfo1 info1;
933                 [case(2)] samr_UserInfo2 info2;
934                 [case(3)] samr_UserInfo3 info3;
935                 [case(4)] samr_UserInfo4 info4;
936                 [case(5)] samr_UserInfo5 info5;
937                 [case(6)] samr_UserInfo6 info6;
938                 [case(7)] samr_UserInfo7 info7;
939                 [case(8)] samr_UserInfo8 info8;
940                 [case(9)] samr_UserInfo9 info9;
941                 [case(10)] samr_UserInfo10 info10;
942                 [case(11)] samr_UserInfo11 info11;
943                 [case(12)] samr_UserInfo12 info12;
944                 [case(13)] samr_UserInfo13 info13;
945                 [case(14)] samr_UserInfo14 info14;
946                 [case(16)] samr_UserInfo16 info16;
947                 [case(17)] samr_UserInfo17 info17;
948                 [case(18)] samr_UserInfo18 info18;
949                 [case(20)] samr_UserInfo20 info20;
950                 [case(21)] samr_UserInfo21 info21;
951                 [case(23)] samr_UserInfo23 info23;
952                 [case(24)] samr_UserInfo24 info24;
953                 [case(25)] samr_UserInfo25 info25;
954                 [case(26)] samr_UserInfo26 info26;
955         } samr_UserInfo;
956
957         [public] NTSTATUS samr_QueryUserInfo(
958                 [in,ref]                  policy_handle *user_handle,
959                 [in]                      uint16 level,
960                 [out,unique,switch_is(level)] samr_UserInfo *info
961                 );
962
963
964         /************************/
965         /* Function    0x25     */
966         [public] NTSTATUS samr_SetUserInfo(
967                 [in,ref]                   policy_handle *user_handle,
968                 [in]                       uint16 level,
969                 [in,ref,switch_is(level)]  samr_UserInfo *info
970                 );
971
972         /************************/
973         /* Function    0x26     */
974         /*
975           this is a password change interface that doesn't give
976           the server the plaintext password. Depricated.
977         */
978         NTSTATUS samr_ChangePasswordUser(
979                 [in,ref]    policy_handle *user_handle,
980                 [in]        boolean8 lm_present,
981                 [in,unique] samr_Password *old_lm_crypted,
982                 [in,unique] samr_Password *new_lm_crypted,
983                 [in]        boolean8 nt_present,
984                 [in,unique] samr_Password *old_nt_crypted,
985                 [in,unique] samr_Password *new_nt_crypted,
986                 [in]        boolean8 cross1_present,
987                 [in,unique] samr_Password *nt_cross,
988                 [in]        boolean8 cross2_present,
989                 [in,unique] samr_Password *lm_cross
990                 );
991
992         /************************/
993         /* Function    0x27     */
994
995         typedef [public] struct {
996                 uint32 rid;
997                 samr_GroupAttrs attributes;
998         } samr_RidWithAttribute;
999
1000         typedef [public] struct {
1001                 uint32     count;
1002                 [size_is(count)] samr_RidWithAttribute *rids;
1003         } samr_RidWithAttributeArray;
1004
1005         NTSTATUS samr_GetGroupsForUser(
1006                 [in,ref]   policy_handle *user_handle,
1007                 [out,unique] samr_RidWithAttributeArray  *rids
1008                 );
1009
1010         /************************/
1011         /* Function    0x28     */
1012
1013         typedef struct {
1014                 uint32    idx;
1015                 uint32    rid;
1016                 samr_AcctFlags acct_flags;
1017                 lsa_String account_name;
1018                 lsa_String description;
1019                 lsa_String full_name;
1020         } samr_DispEntryGeneral;
1021
1022         typedef struct {
1023                 uint32 count;
1024                 [size_is(count)] samr_DispEntryGeneral *entries;
1025         } samr_DispInfoGeneral;
1026
1027         typedef struct {
1028                 uint32    idx;
1029                 uint32    rid;
1030                 samr_AcctFlags acct_flags;
1031                 lsa_String account_name;
1032                 lsa_String description;
1033         } samr_DispEntryFull;
1034
1035         typedef struct {
1036                 uint32 count;
1037                 [size_is(count)] samr_DispEntryFull *entries;
1038         } samr_DispInfoFull;
1039
1040         typedef struct {
1041                 uint32    idx;
1042                 uint32    rid;
1043                 samr_GroupAttrs acct_flags;
1044                 lsa_String account_name;
1045                 lsa_String description;
1046         } samr_DispEntryFullGroup;
1047
1048         typedef struct {
1049                 uint32 count;
1050                 [size_is(count)] samr_DispEntryFullGroup *entries;
1051         } samr_DispInfoFullGroups;
1052
1053         typedef struct {
1054                 uint32    idx;
1055                 lsa_AsciiStringLarge account_name;
1056         } samr_DispEntryAscii;
1057
1058         typedef struct {
1059                 uint32 count;
1060                 [size_is(count)] samr_DispEntryAscii *entries;
1061         } samr_DispInfoAscii;
1062
1063         typedef [switch_type(uint16)] union {
1064                 [case(1)] samr_DispInfoGeneral info1;/* users */
1065                 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1066                 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1067                 [case(4)] samr_DispInfoAscii info4; /* users */
1068                 [case(5)] samr_DispInfoAscii info5; /* groups */
1069         } samr_DispInfo;
1070
1071         NTSTATUS samr_QueryDisplayInfo(
1072                 [in,ref]    policy_handle *domain_handle,
1073                 [in]        uint16 level,
1074                 [in]        uint32 start_idx,
1075                 [in]        uint32 max_entries,
1076                 [in]        uint32 buf_size,
1077                 [out]       uint32 total_size,
1078                 [out]       uint32 returned_size,
1079                 [out,switch_is(level)] samr_DispInfo info
1080                 );
1081
1082
1083         /************************/
1084         /* Function    0x29     */
1085
1086         /*
1087           this seems to be an alphabetic search function. The returned index
1088           is the index for samr_QueryDisplayInfo needed to get names occurring
1089           after the specified name. The supplied name does not need to exist
1090           in the database (for example you can supply just a first letter for
1091           searching starting at that letter)
1092
1093           The level corresponds to the samr_QueryDisplayInfo level
1094         */
1095         NTSTATUS samr_GetDisplayEnumerationIndex(
1096                 [in,ref]    policy_handle *domain_handle,
1097                 [in]        uint16 level,
1098                 [in]        lsa_String name,
1099                 [out]       uint32 idx
1100                 );
1101
1102
1103
1104         /************************/
1105         /* Function    0x2a     */
1106
1107         /*
1108           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1109         */
1110         NTSTATUS samr_TestPrivateFunctionsDomain(
1111                 [in,ref]    policy_handle *domain_handle
1112                 );
1113
1114
1115         /************************/
1116         /* Function    0x2b     */
1117
1118         /*
1119           w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1120         */
1121         NTSTATUS samr_TestPrivateFunctionsUser(
1122                 [in,ref]    policy_handle *user_handle
1123                 );
1124
1125
1126         /************************/
1127         /* Function    0x2c     */
1128
1129         typedef struct {
1130                 uint16 min_password_length;
1131                 samr_PasswordProperties password_properties;
1132         } samr_PwInfo;
1133
1134         [public] NTSTATUS samr_GetUserPwInfo(
1135                 [in,ref]    policy_handle *user_handle,
1136                 [out]       samr_PwInfo info
1137                 );
1138
1139         /************************/
1140         /* Function    0x2d     */
1141         NTSTATUS samr_RemoveMemberFromForeignDomain(
1142                 [in,ref]    policy_handle *domain_handle,
1143                 [in,ref]    dom_sid2 *sid
1144                 );
1145
1146         /************************/
1147         /* Function    0x2e     */
1148
1149         /*
1150           how is this different from QueryDomainInfo ??
1151         */
1152         NTSTATUS samr_QueryDomainInfo2(
1153                 [in,ref]      policy_handle *domain_handle,
1154                 [in]          uint16 level,
1155                 [out,unique,switch_is(level)] samr_DomainInfo *info
1156                 );
1157
1158         /************************/
1159         /* Function    0x2f     */
1160
1161         /*
1162           how is this different from QueryUserInfo ??
1163         */
1164         NTSTATUS samr_QueryUserInfo2(
1165                 [in,ref]                  policy_handle *user_handle,
1166                 [in]                      uint16 level,
1167                 [out,unique,switch_is(level)]    samr_UserInfo *info
1168                 );
1169
1170         /************************/
1171         /* Function    0x30     */
1172
1173         /*
1174           how is this different from QueryDisplayInfo??
1175         */
1176         NTSTATUS samr_QueryDisplayInfo2(
1177                 [in,ref]    policy_handle *domain_handle,
1178                 [in]        uint16 level,
1179                 [in]        uint32 start_idx,
1180                 [in]        uint32 max_entries,
1181                 [in]        uint32 buf_size,
1182                 [out]       uint32 total_size,
1183                 [out]       uint32 returned_size,
1184                 [out,switch_is(level)] samr_DispInfo info
1185                 );
1186
1187         /************************/
1188         /* Function    0x31     */
1189
1190         /*
1191           how is this different from GetDisplayEnumerationIndex ??
1192         */
1193         NTSTATUS samr_GetDisplayEnumerationIndex2(
1194                 [in,ref]    policy_handle *domain_handle,
1195                 [in]        uint16 level,
1196                 [in]        lsa_String name,
1197                 [out]       uint32 idx
1198                 );
1199
1200
1201         /************************/
1202         /* Function    0x32     */
1203         NTSTATUS samr_CreateUser2(
1204                 [in,ref]      policy_handle *domain_handle,
1205                 [in,ref]      lsa_String *account_name,
1206                 [in]          samr_AcctFlags acct_flags,
1207                 [in]          samr_UserAccessMask access_mask,
1208                 [out,ref]     policy_handle *user_handle,
1209                 [out,ref]     uint32 *access_granted,
1210                 [out,ref]     uint32 *rid
1211                 );
1212
1213
1214         /************************/
1215         /* Function    0x33     */
1216
1217         /*
1218           another duplicate. There must be a reason ....
1219         */
1220         NTSTATUS samr_QueryDisplayInfo3(
1221                 [in,ref]    policy_handle *domain_handle,
1222                 [in]        uint16 level,
1223                 [in]        uint32 start_idx,
1224                 [in]        uint32 max_entries,
1225                 [in]        uint32 buf_size,
1226                 [out]       uint32 total_size,
1227                 [out]       uint32 returned_size,
1228                 [out,switch_is(level)] samr_DispInfo info
1229                 );
1230
1231         /************************/
1232         /* Function    0x34     */
1233         NTSTATUS samr_AddMultipleMembersToAlias(
1234                 [in,ref]    policy_handle *alias_handle,
1235                 [in,ref]    lsa_SidArray *sids
1236                 );
1237
1238         /************************/
1239         /* Function    0x35     */
1240         NTSTATUS samr_RemoveMultipleMembersFromAlias(
1241                 [in,ref]    policy_handle *alias_handle,
1242                 [in,ref]    lsa_SidArray *sids
1243                 );
1244
1245         /************************/
1246         /* Function    0x36     */
1247
1248         NTSTATUS samr_OemChangePasswordUser2(
1249                 [in,unique]       lsa_AsciiString *server,
1250                 [in,ref]          lsa_AsciiString *account,
1251                 [in,unique]       samr_CryptPassword *password,
1252                 [in,unique]       samr_Password *hash
1253                 );
1254
1255         /************************/
1256         /* Function    0x37     */
1257         NTSTATUS samr_ChangePasswordUser2(
1258                 [in,unique]       lsa_String *server,
1259                 [in,ref]          lsa_String *account,
1260                 [in,unique]       samr_CryptPassword *nt_password,
1261                 [in,unique]       samr_Password *nt_verifier,
1262                 [in]              boolean8 lm_change,
1263                 [in,unique]       samr_CryptPassword *lm_password,
1264                 [in,unique]       samr_Password *lm_verifier
1265                 );
1266
1267         /************************/
1268         /* Function    0x38     */
1269         NTSTATUS samr_GetDomPwInfo(
1270                 [in,unique] lsa_String *domain_name,
1271                 [out]       samr_PwInfo info
1272                 );
1273
1274         /************************/
1275         /* Function    0x39     */
1276         NTSTATUS samr_Connect2(
1277                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1278                 [in] samr_ConnectAccessMask access_mask,
1279                 [out,ref]  policy_handle *connect_handle
1280                 );
1281
1282         /************************/
1283         /* Function    0x3a     */
1284         /*
1285           seems to be an exact alias for samr_SetUserInfo()
1286         */
1287         [public] NTSTATUS samr_SetUserInfo2(
1288                 [in,ref]                   policy_handle *user_handle,
1289                 [in]                       uint16 level,
1290                 [in,ref,switch_is(level)]  samr_UserInfo *info
1291                 );
1292
1293         /************************/
1294         /* Function    0x3b     */
1295         /*
1296           this one is mysterious. I have a few guesses, but nothing working yet
1297         */
1298         NTSTATUS samr_SetBootKeyInformation(
1299                 [in,ref]   policy_handle *connect_handle,
1300                 [in]       uint32 unknown1,
1301                 [in]       uint32 unknown2,
1302                 [in]       uint32 unknown3
1303                 );
1304
1305         /************************/
1306         /* Function    0x3c     */
1307         NTSTATUS samr_GetBootKeyInformation(
1308                 [in,ref]   policy_handle *domain_handle,
1309                 [out]      uint32 unknown
1310                 );
1311
1312         /************************/
1313         /* Function    0x3d     */
1314         NTSTATUS samr_Connect3(
1315                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1316                 /* this unknown value seems to be completely ignored by w2k3 */
1317                 [in] uint32 unknown,
1318                 [in] samr_ConnectAccessMask access_mask,
1319                 [out,ref]  policy_handle *connect_handle
1320                 );
1321
1322         /************************/
1323         /* Function    0x3e     */
1324
1325         typedef enum {
1326                 SAMR_CONNECT_PRE_W2K    = 1,
1327                 SAMR_CONNECT_W2K        = 2,
1328                 SAMR_CONNECT_AFTER_W2K  = 3
1329         } samr_ConnectVersion;
1330
1331         NTSTATUS samr_Connect4(
1332                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1333                 [in] samr_ConnectVersion client_version,
1334                 [in] samr_ConnectAccessMask access_mask,
1335                 [out,ref]  policy_handle *connect_handle
1336                 );
1337
1338         /************************/
1339         /* Function    0x3f     */
1340
1341         typedef enum samr_RejectReason samr_RejectReason;
1342
1343         typedef struct {
1344                 samr_RejectReason reason;
1345                 uint32 unknown1;
1346                 uint32 unknown2;
1347         } samr_ChangeReject;
1348
1349         NTSTATUS samr_ChangePasswordUser3(
1350                 [in,unique]       lsa_String *server,
1351                 [in,ref]          lsa_String *account,
1352                 [in,unique]       samr_CryptPassword *nt_password,
1353                 [in,unique]       samr_Password *nt_verifier,
1354                 [in]              boolean8 lm_change,
1355                 [in,unique]       samr_CryptPassword *lm_password,
1356                 [in,unique]       samr_Password *lm_verifier,
1357                 [in,unique]       samr_CryptPassword *password3,
1358                 [out,unique]      samr_DomInfo1 *dominfo,
1359                 [out,unique]      samr_ChangeReject *reject
1360                 );
1361
1362         /************************/
1363         /* Function    0x40      */
1364
1365         typedef struct {
1366                 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1367                 uint32         unknown2; /* w2k3 gives 0 */
1368         } samr_ConnectInfo1;
1369
1370         typedef union {
1371                 [case(1)]  samr_ConnectInfo1 info1;
1372         } samr_ConnectInfo;
1373
1374         [public] NTSTATUS samr_Connect5(
1375                 [in,unique,string,charset(UTF16)] uint16 *system_name,
1376                 [in]       samr_ConnectAccessMask  access_mask,
1377                 [in,out]   uint32             level,
1378                 [in,out,switch_is(level),ref] samr_ConnectInfo *info,
1379                 [out,ref]  policy_handle      *connect_handle
1380                 );
1381
1382         /************************/
1383         /* Function    0x41     */
1384         NTSTATUS samr_RidToSid(
1385                 [in,ref]    policy_handle *domain_handle,
1386                 [in]        uint32        rid,
1387                 [out,unique] dom_sid2      *sid
1388                 );
1389
1390
1391         /************************/
1392         /* Function    0x42     */
1393
1394         /*
1395           this should set the DSRM password for the server, which is used
1396           when booting into Directory Services Recovery Mode on a DC. Win2003
1397           gives me NT_STATUS_NOT_SUPPORTED
1398         */
1399
1400         NTSTATUS samr_SetDsrmPassword(
1401                 [in,unique] lsa_String *name,
1402                 [in]       uint32 unknown,
1403                 [in,unique] samr_Password *hash
1404                 );
1405
1406
1407         /************************/
1408         /* Function    0x43     */
1409         /************************/
1410         typedef [bitmap32bit] bitmap {
1411                 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET           = 0x00000001,
1412                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME           = 0x00000002,
1413                 SAMR_VALIDATE_FIELD_LOCKOUT_TIME                = 0x00000004,
1414                 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT          = 0x00000008,
1415                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH     = 0x00000010,
1416                 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY            = 0x00000020
1417         } samr_ValidateFieldsPresent;
1418
1419         typedef enum {
1420                 NetValidateAuthentication = 1,
1421                 NetValidatePasswordChange= 2,
1422                 NetValidatePasswordReset = 3
1423         } samr_ValidatePasswordLevel;
1424
1425         /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1426          * identified the mapping of
1427          * - NERR_PasswordFilterError
1428          * - NERR_PasswordExpired and
1429          * - NERR_PasswordCantChange
1430          * yet - Guenther
1431          */
1432
1433         typedef enum {
1434                 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1435                 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1436                 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1437                 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1438                 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1439                 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1440                 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1441                 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1442                 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1443         } samr_ValidationStatus;
1444
1445         typedef struct {
1446                 uint32 length;
1447                 [size_is(length)] uint8 *data;
1448         } samr_ValidationBlob;
1449
1450         typedef struct {
1451                 samr_ValidateFieldsPresent fields_present;
1452                 NTTIME_hyper last_password_change;
1453                 NTTIME_hyper bad_password_time;
1454                 NTTIME_hyper lockout_time;
1455                 uint32 bad_pwd_count;
1456                 uint32 pwd_history_len;
1457                 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1458         } samr_ValidatePasswordInfo;
1459
1460         typedef struct {
1461                 samr_ValidatePasswordInfo info;
1462                 samr_ValidationStatus status;
1463         } samr_ValidatePasswordRepCtr;
1464
1465         typedef [switch_type(uint16)] union {
1466                 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1467                 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1468                 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1469         } samr_ValidatePasswordRep;
1470
1471         typedef struct {
1472                 samr_ValidatePasswordInfo info;
1473                 lsa_StringLarge password;
1474                 lsa_StringLarge account;
1475                 samr_ValidationBlob hash;
1476                 boolean8 pwd_must_change_at_next_logon;
1477                 boolean8 clear_lockout;
1478         } samr_ValidatePasswordReq3;
1479
1480         typedef struct {
1481                 samr_ValidatePasswordInfo info;
1482                 lsa_StringLarge password;
1483                 lsa_StringLarge account;
1484                 samr_ValidationBlob hash;
1485                 boolean8 password_matched;
1486         } samr_ValidatePasswordReq2;
1487
1488         typedef struct {
1489                 samr_ValidatePasswordInfo info;
1490                 boolean8 password_matched;
1491         } samr_ValidatePasswordReq1;
1492
1493         typedef [switch_type(uint16)] union {
1494                 [case(1)] samr_ValidatePasswordReq1 req1;
1495                 [case(2)] samr_ValidatePasswordReq2 req2;
1496                 [case(3)] samr_ValidatePasswordReq3 req3;
1497         } samr_ValidatePasswordReq;
1498
1499         NTSTATUS samr_ValidatePassword(
1500                 [in] samr_ValidatePasswordLevel level,
1501                 [in,switch_is(level)] samr_ValidatePasswordReq req,
1502                 [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep
1503                 );
1504 }