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