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