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