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