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