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