samr: fix samr_UserInfo24 and samr_UserInfo26.
[Samba.git] / source / librpc / idl / samr.idl
blob4c708981b7925b87129c68c484050c026699a4db
1 #include "idl_types.h"
3 /*
4 samr interface definition
5 */
6 import "misc.idl", "lsa.idl", "security.idl";
8 /*
9 Thanks to Todd Sabin for some information from his samr.idl in acltools
12 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
13 version(1.0),
14 endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
15 pointer_default(unique)
16 ] interface samr
18 typedef bitmap security_secinfo security_secinfo;
20 /* account control (acct_flags) bits */
21 typedef [public,bitmap32bit] bitmap {
22 ACB_DISABLED = 0x00000001, /* 1 = User account disabled */
23 ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */
24 ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */
25 ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */
26 ACB_NORMAL = 0x00000010, /* 1 = Normal user account */
27 ACB_MNS = 0x00000020, /* 1 = MNS logon user account */
28 ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */
29 ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */
30 ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */
31 ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */
32 ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */
33 ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encryped text password is allowed */
34 ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */
35 ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */
36 ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */
37 ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
38 ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
39 ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
40 ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */
41 } samr_AcctFlags;
43 /* SAM server specific access rights */
45 typedef [bitmap32bit] bitmap {
46 SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
47 SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
48 SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
49 SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
50 SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
51 SAMR_ACCESS_OPEN_DOMAIN = 0x00000020
52 } samr_ConnectAccessMask;
54 const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
56 const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
57 (STANDARD_RIGHTS_REQUIRED_ACCESS |
58 SAMR_ACCESS_ALL_ACCESS);
60 const int GENERIC_RIGHTS_SAM_READ =
61 (STANDARD_RIGHTS_READ_ACCESS |
62 SAMR_ACCESS_ENUM_DOMAINS);
64 const int GENERIC_RIGHTS_SAM_WRITE =
65 (STANDARD_RIGHTS_WRITE_ACCESS |
66 SAMR_ACCESS_CREATE_DOMAIN |
67 SAMR_ACCESS_INITIALIZE_SERVER |
68 SAMR_ACCESS_SHUTDOWN_SERVER);
70 const int GENERIC_RIGHTS_SAM_EXECUTE =
71 (STANDARD_RIGHTS_EXECUTE_ACCESS |
72 SAMR_ACCESS_OPEN_DOMAIN |
73 SAMR_ACCESS_CONNECT_TO_SERVER);
75 /* User Object specific access rights */
77 typedef [bitmap32bit] bitmap {
78 SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
79 SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
80 SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
81 SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
82 SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
83 SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
84 SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
85 SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
86 SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
87 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
88 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
89 } samr_UserAccessMask;
91 const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF;
93 const int GENERIC_RIGHTS_USER_ALL_ACCESS =
94 (STANDARD_RIGHTS_REQUIRED_ACCESS |
95 SAMR_USER_ACCESS_ALL_ACCESS); /* 0x000f07ff */
97 const int GENERIC_RIGHTS_USER_READ =
98 (STANDARD_RIGHTS_READ_ACCESS |
99 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP |
100 SAMR_USER_ACCESS_GET_GROUPS |
101 SAMR_USER_ACCESS_GET_ATTRIBUTES |
102 SAMR_USER_ACCESS_GET_LOGONINFO |
103 SAMR_USER_ACCESS_GET_LOCALE); /* 0x0002031a */
105 const int GENERIC_RIGHTS_USER_WRITE =
106 (STANDARD_RIGHTS_WRITE_ACCESS |
107 SAMR_USER_ACCESS_CHANGE_PASSWORD |
108 SAMR_USER_ACCESS_SET_LOC_COM |
109 SAMR_USER_ACCESS_SET_ATTRIBUTES |
110 SAMR_USER_ACCESS_SET_PASSWORD |
111 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP); /* 0x000204e4 */
113 const int GENERIC_RIGHTS_USER_EXECUTE =
114 (STANDARD_RIGHTS_EXECUTE_ACCESS |
115 SAMR_USER_ACCESS_CHANGE_PASSWORD |
116 SAMR_USER_ACCESS_GET_NAME_ETC); /* 0x00020041 */
118 /* Domain Object specific access rights */
120 typedef [bitmap32bit] bitmap {
121 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
122 SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
123 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
124 SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
125 SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
126 SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
127 SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
128 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
129 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
130 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
131 SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
132 } samr_DomainAccessMask;
134 const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF;
136 const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS =
137 (STANDARD_RIGHTS_REQUIRED_ACCESS |
138 SAMR_DOMAIN_ACCESS_ALL_ACCESS);
140 const int GENERIC_RIGHTS_DOMAIN_READ =
141 (STANDARD_RIGHTS_READ_ACCESS |
142 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS |
143 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2);
145 const int GENERIC_RIGHTS_DOMAIN_WRITE =
146 (STANDARD_RIGHTS_WRITE_ACCESS |
147 SAMR_DOMAIN_ACCESS_SET_INFO_3 |
148 SAMR_DOMAIN_ACCESS_CREATE_ALIAS |
149 SAMR_DOMAIN_ACCESS_CREATE_GROUP |
150 SAMR_DOMAIN_ACCESS_CREATE_USER |
151 SAMR_DOMAIN_ACCESS_SET_INFO_2 |
152 SAMR_DOMAIN_ACCESS_SET_INFO_1);
154 const int GENERIC_RIGHTS_DOMAIN_EXECUTE =
155 (STANDARD_RIGHTS_EXECUTE_ACCESS |
156 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT |
157 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS |
158 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1);
160 /* Group Object specific access rights */
162 typedef [bitmap32bit] bitmap {
163 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
164 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
165 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
166 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
167 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
168 } samr_GroupAccessMask;
170 const int SAMR_GROUP_ACCESS_ALL_ACCESS = 0x0000001F;
172 const int GENERIC_RIGHTS_GROUP_ALL_ACCESS =
173 (STANDARD_RIGHTS_REQUIRED_ACCESS |
174 SAMR_GROUP_ACCESS_ALL_ACCESS); /* 0x000f001f */
176 const int GENERIC_RIGHTS_GROUP_READ =
177 (STANDARD_RIGHTS_READ_ACCESS |
178 SAMR_GROUP_ACCESS_GET_MEMBERS); /* 0x00020010 */
180 const int GENERIC_RIGHTS_GROUP_WRITE =
181 (STANDARD_RIGHTS_WRITE_ACCESS |
182 SAMR_GROUP_ACCESS_REMOVE_MEMBER |
183 SAMR_GROUP_ACCESS_ADD_MEMBER |
184 SAMR_GROUP_ACCESS_SET_INFO); /* 0x0002000e */
186 const int GENERIC_RIGHTS_GROUP_EXECUTE =
187 (STANDARD_RIGHTS_EXECUTE_ACCESS |
188 SAMR_GROUP_ACCESS_LOOKUP_INFO); /* 0x00020001 */
190 /* Alias Object specific access rights */
192 typedef [bitmap32bit] bitmap {
193 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
194 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
195 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
196 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
197 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
198 } samr_AliasAccessMask;
200 const int SAMR_ALIAS_ACCESS_ALL_ACCESS = 0x0000001F;
202 const int GENERIC_RIGHTS_ALIAS_ALL_ACCESS =
203 (STANDARD_RIGHTS_REQUIRED_ACCESS |
204 SAMR_ALIAS_ACCESS_ALL_ACCESS); /* 0x000f001f */
206 const int GENERIC_RIGHTS_ALIAS_READ =
207 (STANDARD_RIGHTS_READ_ACCESS |
208 SAMR_ALIAS_ACCESS_GET_MEMBERS); /* 0x00020004 */
210 const int GENERIC_RIGHTS_ALIAS_WRITE =
211 (STANDARD_RIGHTS_WRITE_ACCESS |
212 SAMR_ALIAS_ACCESS_REMOVE_MEMBER |
213 SAMR_ALIAS_ACCESS_ADD_MEMBER |
214 SAMR_ALIAS_ACCESS_SET_INFO); /* 0x00020013 */
216 const int GENERIC_RIGHTS_ALIAS_EXECUTE =
217 (STANDARD_RIGHTS_EXECUTE_ACCESS |
218 SAMR_ALIAS_ACCESS_LOOKUP_INFO); /* 0x00020008 */
220 /******************/
221 /* Function: 0x00 */
222 NTSTATUS samr_Connect (
223 /* notice the lack of [string] */
224 [in,unique] uint16 *system_name,
225 [in] samr_ConnectAccessMask access_mask,
226 [out,ref] policy_handle *connect_handle
230 /******************/
231 /* Function: 0x01 */
232 [public] NTSTATUS samr_Close (
233 [in,out,ref] policy_handle *handle
236 /******************/
237 /* Function: 0x02 */
239 NTSTATUS samr_SetSecurity (
240 [in,ref] policy_handle *handle,
241 [in] security_secinfo sec_info,
242 [in,ref] sec_desc_buf *sdbuf
245 /******************/
246 /* Function: 0x03 */
248 NTSTATUS samr_QuerySecurity (
249 [in,ref] policy_handle *handle,
250 [in] security_secinfo sec_info,
251 [out,ref] sec_desc_buf **sdbuf
254 /******************/
255 /* Function: 0x04 */
258 shutdown the SAM - once you call this the SAM will be dead
260 NTSTATUS samr_Shutdown (
261 [in,ref] policy_handle *connect_handle
264 /******************/
265 /* Function: 0x05 */
266 NTSTATUS samr_LookupDomain (
267 [in,ref] policy_handle *connect_handle,
268 [in,ref] lsa_String *domain_name,
269 [out,ref] dom_sid2 **sid
273 /******************/
274 /* Function: 0x06 */
276 typedef struct {
277 uint32 idx;
278 lsa_String name;
279 } samr_SamEntry;
281 typedef struct {
282 uint32 count;
283 [size_is(count)] samr_SamEntry *entries;
284 } samr_SamArray;
286 NTSTATUS samr_EnumDomains (
287 [in] policy_handle *connect_handle,
288 [in,out,ref] uint32 *resume_handle,
289 [out,ref] samr_SamArray **sam,
290 [in] uint32 buf_size,
291 [out,ref] uint32 *num_entries
295 /************************/
296 /* Function 0x07 */
297 [public] NTSTATUS samr_OpenDomain(
298 [in,ref] policy_handle *connect_handle,
299 [in] samr_DomainAccessMask access_mask,
300 [in,ref] dom_sid2 *sid,
301 [out,ref] policy_handle *domain_handle
304 /************************/
305 /* Function 0x08 */
306 /* server roles */
307 typedef [v1_enum] enum {
308 SAMR_ROLE_STANDALONE = 0,
309 SAMR_ROLE_DOMAIN_MEMBER = 1,
310 SAMR_ROLE_DOMAIN_BDC = 2,
311 SAMR_ROLE_DOMAIN_PDC = 3
312 } samr_Role;
314 /* password properties flags */
315 typedef [public,bitmap32bit] bitmap {
316 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
317 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
318 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
319 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
320 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
321 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
322 } samr_PasswordProperties;
324 typedef struct {
325 uint16 min_password_length;
326 uint16 password_history_length;
327 samr_PasswordProperties password_properties;
328 /* yes, these are signed. They are in negative 100ns */
329 dlong max_password_age;
330 dlong min_password_age;
331 } samr_DomInfo1;
333 typedef struct {
334 NTTIME force_logoff_time;
335 lsa_String comment;
336 lsa_String domain_name;
337 lsa_String primary; /* PDC name if this is a BDC */
338 udlong sequence_num;
339 uint32 unknown2;
340 samr_Role role;
341 uint32 unknown3;
342 uint32 num_users;
343 uint32 num_groups;
344 uint32 num_aliases;
345 } samr_DomInfo2;
347 typedef struct {
348 NTTIME force_logoff_time;
349 } samr_DomInfo3;
351 typedef struct {
352 lsa_String comment;
353 } samr_DomInfo4;
355 typedef struct {
356 lsa_String domain_name;
357 } samr_DomInfo5;
359 typedef struct {
360 lsa_String primary;
361 } samr_DomInfo6;
363 typedef struct {
364 samr_Role role;
365 } samr_DomInfo7;
367 typedef struct {
368 hyper sequence_num;
369 NTTIME domain_create_time;
370 } samr_DomInfo8;
372 typedef struct {
373 uint32 unknown; /* w2k3 returns 1 */
374 } samr_DomInfo9;
376 typedef struct {
377 samr_DomInfo2 info2;
378 hyper lockout_duration;
379 hyper lockout_window;
380 uint16 lockout_threshold;
381 } samr_DomInfo11;
383 typedef struct {
384 hyper lockout_duration;
385 hyper lockout_window;
386 uint16 lockout_threshold;
387 } samr_DomInfo12;
389 typedef struct {
390 hyper sequence_num;
391 NTTIME domain_create_time;
392 uint32 unknown1;
393 uint32 unknown2;
394 } samr_DomInfo13;
396 typedef [switch_type(uint16)] union {
397 [case(1)] samr_DomInfo1 info1;
398 [case(2)] samr_DomInfo2 info2;
399 [case(3)] samr_DomInfo3 info3;
400 [case(4)] samr_DomInfo4 info4;
401 [case(5)] samr_DomInfo5 info5;
402 [case(6)] samr_DomInfo6 info6;
403 [case(7)] samr_DomInfo7 info7;
404 [case(8)] samr_DomInfo8 info8;
405 [case(9)] samr_DomInfo9 info9;
406 [case(11)] samr_DomInfo11 info11;
407 [case(12)] samr_DomInfo12 info12;
408 [case(13)] samr_DomInfo13 info13;
409 } samr_DomainInfo;
411 NTSTATUS samr_QueryDomainInfo(
412 [in,ref] policy_handle *domain_handle,
413 [in] uint16 level,
414 [out,ref,switch_is(level)] samr_DomainInfo **info
417 /************************/
418 /* Function 0x09 */
420 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
421 call in w2k3
423 NTSTATUS samr_SetDomainInfo(
424 [in,ref] policy_handle *domain_handle,
425 [in] uint16 level,
426 [in,switch_is(level),ref] samr_DomainInfo *info
430 /************************/
431 /* Function 0x0a */
432 NTSTATUS samr_CreateDomainGroup(
433 [in,ref] policy_handle *domain_handle,
434 [in,ref] lsa_String *name,
435 [in] samr_GroupAccessMask access_mask,
436 [out,ref] policy_handle *group_handle,
437 [out,ref] uint32 *rid
441 /************************/
442 /* Function 0x0b */
444 const int MAX_SAM_ENTRIES_W2K = 0x400; /* 1024 */
445 const int MAX_SAM_ENTRIES_W95 = 50;
447 NTSTATUS samr_EnumDomainGroups(
448 [in] policy_handle *domain_handle,
449 [in,out,ref] uint32 *resume_handle,
450 [out,ref] samr_SamArray **sam,
451 [in] uint32 max_size,
452 [out,ref] uint32 *num_entries
455 /************************/
456 /* Function 0x0c */
457 NTSTATUS samr_CreateUser(
458 [in,ref] policy_handle *domain_handle,
459 [in,ref] lsa_String *account_name,
460 [in] samr_UserAccessMask access_mask,
461 [out,ref] policy_handle *user_handle,
462 [out,ref] uint32 *rid
465 /************************/
466 /* Function 0x0d */
469 /* w2k3 treats max_size as max_users*54 and sets the
470 resume_handle as the rid of the last user sent
472 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
474 NTSTATUS samr_EnumDomainUsers(
475 [in] policy_handle *domain_handle,
476 [in,out,ref] uint32 *resume_handle,
477 [in] samr_AcctFlags acct_flags,
478 [out,ref] samr_SamArray **sam,
479 [in] uint32 max_size,
480 [out,ref] uint32 *num_entries
483 /************************/
484 /* Function 0x0e */
485 NTSTATUS samr_CreateDomAlias(
486 [in,ref] policy_handle *domain_handle,
487 [in,ref] lsa_String *alias_name,
488 [in] samr_AliasAccessMask access_mask,
489 [out,ref] policy_handle *alias_handle,
490 [out,ref] uint32 *rid
493 /************************/
494 /* Function 0x0f */
495 NTSTATUS samr_EnumDomainAliases(
496 [in] policy_handle *domain_handle,
497 [in,out,ref] uint32 *resume_handle,
498 [out,ref] samr_SamArray **sam,
499 [in] uint32 max_size,
500 [out,ref] uint32 *num_entries
503 /************************/
504 /* Function 0x10 */
506 typedef struct {
507 [range(0,1024)] uint32 count;
508 [size_is(count)] uint32 *ids;
509 } samr_Ids;
511 NTSTATUS samr_GetAliasMembership(
512 [in,ref] policy_handle *domain_handle,
513 [in,ref] lsa_SidArray *sids,
514 [out,ref] samr_Ids *rids
517 /************************/
518 /* Function 0x11 */
520 [public] NTSTATUS samr_LookupNames(
521 [in,ref] policy_handle *domain_handle,
522 [in,range(0,1000)] uint32 num_names,
523 [in,size_is(1000),length_is(num_names)] lsa_String names[],
524 [out,ref] samr_Ids *rids,
525 [out,ref] samr_Ids *types
529 /************************/
530 /* Function 0x12 */
531 NTSTATUS samr_LookupRids(
532 [in,ref] policy_handle *domain_handle,
533 [in,range(0,1000)] uint32 num_rids,
534 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
535 [out,ref] lsa_Strings *names,
536 [out,ref] samr_Ids *types
539 /************************/
540 /* Function 0x13 */
541 NTSTATUS samr_OpenGroup(
542 [in,ref] policy_handle *domain_handle,
543 [in] samr_GroupAccessMask access_mask,
544 [in] uint32 rid,
545 [out,ref] policy_handle *group_handle
548 /* Group attributes */
549 typedef [public,bitmap32bit] bitmap {
550 SE_GROUP_MANDATORY = 0x00000001,
551 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
552 SE_GROUP_ENABLED = 0x00000004,
553 SE_GROUP_OWNER = 0x00000008,
554 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
555 SE_GROUP_RESOURCE = 0x20000000,
556 SE_GROUP_LOGON_ID = 0xC0000000
557 } samr_GroupAttrs;
559 /************************/
560 /* Function 0x14 */
562 typedef struct {
563 lsa_String name;
564 samr_GroupAttrs attributes;
565 uint32 num_members;
566 lsa_String description;
567 } samr_GroupInfoAll;
569 typedef struct {
570 samr_GroupAttrs attributes;
571 } samr_GroupInfoAttributes;
573 typedef struct {
574 lsa_String description;
575 } samr_GroupInfoDescription;
577 typedef enum {
578 GROUPINFOALL = 1,
579 GROUPINFONAME = 2,
580 GROUPINFOATTRIBUTES = 3,
581 GROUPINFODESCRIPTION = 4,
582 GROUPINFOALL2 = 5
583 } samr_GroupInfoEnum;
585 typedef [switch_type(samr_GroupInfoEnum)] union {
586 [case(GROUPINFOALL)] samr_GroupInfoAll all;
587 [case(GROUPINFONAME)] lsa_String name;
588 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
589 [case(GROUPINFODESCRIPTION)] lsa_String description;
590 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
591 } samr_GroupInfo;
593 NTSTATUS samr_QueryGroupInfo(
594 [in,ref] policy_handle *group_handle,
595 [in] samr_GroupInfoEnum level,
596 [out,ref,switch_is(level)] samr_GroupInfo **info
599 /************************/
600 /* Function 0x15 */
601 NTSTATUS samr_SetGroupInfo(
602 [in,ref] policy_handle *group_handle,
603 [in] samr_GroupInfoEnum level,
604 [in,switch_is(level),ref] samr_GroupInfo *info
607 /************************/
608 /* Function 0x16 */
609 NTSTATUS samr_AddGroupMember(
610 [in,ref] policy_handle *group_handle,
611 [in] uint32 rid,
612 [in] uint32 flags
615 /************************/
616 /* Function 0x17 */
617 NTSTATUS samr_DeleteDomainGroup(
618 [in,out,ref] policy_handle *group_handle
621 /************************/
622 /* Function 0x18 */
623 NTSTATUS samr_DeleteGroupMember(
624 [in,ref] policy_handle *group_handle,
625 [in] uint32 rid
629 /************************/
630 /* Function 0x19 */
631 typedef struct {
632 uint32 count;
633 [size_is(count)] uint32 *rids;
634 [size_is(count)] uint32 *types;
635 } samr_RidTypeArray;
637 NTSTATUS samr_QueryGroupMember(
638 [in,ref] policy_handle *group_handle,
639 [out,ref] samr_RidTypeArray **rids
643 /************************/
644 /* Function 0x1a */
647 win2003 seems to accept any data at all for the two integers
648 below, and doesn't seem to do anything with them that I can
649 see. Weird. I really expected the first integer to be a rid
650 and the second to be the attributes for that rid member.
652 NTSTATUS samr_SetMemberAttributesOfGroup(
653 [in,ref] policy_handle *group_handle,
654 [in] uint32 unknown1,
655 [in] uint32 unknown2
659 /************************/
660 /* Function 0x1b */
661 NTSTATUS samr_OpenAlias (
662 [in,ref] policy_handle *domain_handle,
663 [in] samr_AliasAccessMask access_mask,
664 [in] uint32 rid,
665 [out,ref] policy_handle *alias_handle
669 /************************/
670 /* Function 0x1c */
672 typedef struct {
673 lsa_String name;
674 uint32 num_members;
675 lsa_String description;
676 } samr_AliasInfoAll;
678 typedef enum {
679 ALIASINFOALL = 1,
680 ALIASINFONAME = 2,
681 ALIASINFODESCRIPTION = 3
682 } samr_AliasInfoEnum;
684 typedef [switch_type(samr_AliasInfoEnum)] union {
685 [case(ALIASINFOALL)] samr_AliasInfoAll all;
686 [case(ALIASINFONAME)] lsa_String name;
687 [case(ALIASINFODESCRIPTION)] lsa_String description;
688 } samr_AliasInfo;
690 NTSTATUS samr_QueryAliasInfo(
691 [in,ref] policy_handle *alias_handle,
692 [in] samr_AliasInfoEnum level,
693 [out,ref,switch_is(level)] samr_AliasInfo **info
696 /************************/
697 /* Function 0x1d */
698 NTSTATUS samr_SetAliasInfo(
699 [in,ref] policy_handle *alias_handle,
700 [in] samr_AliasInfoEnum level,
701 [in,switch_is(level),ref] samr_AliasInfo *info
704 /************************/
705 /* Function 0x1e */
706 NTSTATUS samr_DeleteDomAlias(
707 [in,out,ref] policy_handle *alias_handle
710 /************************/
711 /* Function 0x1f */
712 NTSTATUS samr_AddAliasMember(
713 [in,ref] policy_handle *alias_handle,
714 [in,ref] dom_sid2 *sid
717 /************************/
718 /* Function 0x20 */
719 NTSTATUS samr_DeleteAliasMember(
720 [in,ref] policy_handle *alias_handle,
721 [in,ref] dom_sid2 *sid
724 /************************/
725 /* Function 0x21 */
726 NTSTATUS samr_GetMembersInAlias(
727 [in,ref] policy_handle *alias_handle,
728 [out,ref] lsa_SidArray *sids
731 /************************/
732 /* Function 0x22 */
733 [public] NTSTATUS samr_OpenUser(
734 [in,ref] policy_handle *domain_handle,
735 [in] samr_UserAccessMask access_mask,
736 [in] uint32 rid,
737 [out,ref] policy_handle *user_handle
740 /************************/
741 /* Function 0x23 */
742 NTSTATUS samr_DeleteUser(
743 [in,out,ref] policy_handle *user_handle
746 /************************/
747 /* Function 0x24 */
748 typedef struct {
749 lsa_String account_name;
750 lsa_String full_name;
751 uint32 primary_gid;
752 lsa_String description;
753 lsa_String comment;
754 } samr_UserInfo1;
756 typedef struct {
757 lsa_String comment;
758 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
759 uint16 country_code;
760 uint16 code_page;
761 } samr_UserInfo2;
763 /* this is also used in samr and netlogon */
764 typedef [public, flag(NDR_PAHEX)] struct {
765 uint16 units_per_week;
766 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
767 } samr_LogonHours;
769 typedef struct {
770 lsa_String account_name;
771 lsa_String full_name;
772 uint32 rid;
773 uint32 primary_gid;
774 lsa_String home_directory;
775 lsa_String home_drive;
776 lsa_String logon_script;
777 lsa_String profile_path;
778 lsa_String workstations;
779 NTTIME last_logon;
780 NTTIME last_logoff;
781 NTTIME last_password_change;
782 NTTIME allow_password_change;
783 NTTIME force_password_change;
784 samr_LogonHours logon_hours;
785 uint16 bad_password_count;
786 uint16 logon_count;
787 samr_AcctFlags acct_flags;
788 } samr_UserInfo3;
790 typedef struct {
791 samr_LogonHours logon_hours;
792 } samr_UserInfo4;
794 typedef struct {
795 lsa_String account_name;
796 lsa_String full_name;
797 uint32 rid;
798 uint32 primary_gid;
799 lsa_String home_directory;
800 lsa_String home_drive;
801 lsa_String logon_script;
802 lsa_String profile_path;
803 lsa_String description;
804 lsa_String workstations;
805 NTTIME last_logon;
806 NTTIME last_logoff;
807 samr_LogonHours logon_hours;
808 uint16 bad_password_count;
809 uint16 logon_count;
810 NTTIME last_password_change;
811 NTTIME acct_expiry;
812 samr_AcctFlags acct_flags;
813 } samr_UserInfo5;
815 typedef struct {
816 lsa_String account_name;
817 lsa_String full_name;
818 } samr_UserInfo6;
820 typedef struct {
821 lsa_String account_name;
822 } samr_UserInfo7;
824 typedef struct {
825 lsa_String full_name;
826 } samr_UserInfo8;
828 typedef struct {
829 uint32 primary_gid;
830 } samr_UserInfo9;
832 typedef struct {
833 lsa_String home_directory;
834 lsa_String home_drive;
835 } samr_UserInfo10;
837 typedef struct {
838 lsa_String logon_script;
839 } samr_UserInfo11;
841 typedef struct {
842 lsa_String profile_path;
843 } samr_UserInfo12;
845 typedef struct {
846 lsa_String description;
847 } samr_UserInfo13;
849 typedef struct {
850 lsa_String workstations;
851 } samr_UserInfo14;
853 typedef struct {
854 samr_AcctFlags acct_flags;
855 } samr_UserInfo16;
857 typedef struct {
858 NTTIME acct_expiry;
859 } samr_UserInfo17;
861 typedef [public, flag(NDR_PAHEX)] struct {
862 uint8 hash[16];
863 } samr_Password;
865 typedef struct {
866 samr_Password lm_pwd;
867 samr_Password nt_pwd;
868 boolean8 lm_pwd_active;
869 boolean8 nt_pwd_active;
870 } samr_UserInfo18;
872 typedef struct {
873 lsa_BinaryString parameters;
874 } samr_UserInfo20;
876 /* this defines the bits used for fields_present in info21 */
877 typedef [bitmap32bit] bitmap {
878 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
879 SAMR_FIELD_FULL_NAME = 0x00000002,
880 SAMR_FIELD_RID = 0x00000004,
881 SAMR_FIELD_PRIMARY_GID = 0x00000008,
882 SAMR_FIELD_DESCRIPTION = 0x00000010,
883 SAMR_FIELD_COMMENT = 0x00000020,
884 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
885 SAMR_FIELD_HOME_DRIVE = 0x00000080,
886 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
887 SAMR_FIELD_PROFILE_PATH = 0x00000200,
888 SAMR_FIELD_WORKSTATIONS = 0x00000400,
889 SAMR_FIELD_LAST_LOGON = 0x00000800,
890 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
891 SAMR_FIELD_LOGON_HOURS = 0x00002000,
892 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
893 SAMR_FIELD_NUM_LOGONS = 0x00008000,
894 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
895 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
896 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
897 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
898 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
899 SAMR_FIELD_PARAMETERS = 0x00200000,
900 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
901 SAMR_FIELD_CODE_PAGE = 0x00800000,
902 SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
903 SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
904 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
905 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
906 SAMR_FIELD_SEC_DESC = 0x10000000,
907 SAMR_FIELD_OWF_PWD = 0x20000000
908 } samr_FieldsPresent;
910 /* used for 'password_expired' in samr_UserInfo21 */
911 const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
912 const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
914 typedef struct {
915 NTTIME last_logon;
916 NTTIME last_logoff;
917 NTTIME last_password_change;
918 NTTIME acct_expiry;
919 NTTIME allow_password_change;
920 NTTIME force_password_change;
921 lsa_String account_name;
922 lsa_String full_name;
923 lsa_String home_directory;
924 lsa_String home_drive;
925 lsa_String logon_script;
926 lsa_String profile_path;
927 lsa_String description;
928 lsa_String workstations;
929 lsa_String comment;
930 lsa_BinaryString parameters;
931 lsa_String unknown1;
932 lsa_String unknown2;
933 lsa_String unknown3;
934 uint32 buf_count;
935 [size_is(buf_count)] uint8 *buffer;
936 uint32 rid;
937 uint32 primary_gid;
938 samr_AcctFlags acct_flags;
939 samr_FieldsPresent fields_present;
940 samr_LogonHours logon_hours;
941 uint16 bad_password_count;
942 uint16 logon_count;
943 uint16 country_code;
944 uint16 code_page;
945 uint8 nt_password_set;
946 uint8 lm_password_set;
947 uint8 password_expired;
948 uint8 unknown4;
949 } samr_UserInfo21;
951 typedef [public, flag(NDR_PAHEX)] struct {
952 uint8 data[516];
953 } samr_CryptPassword;
955 typedef struct {
956 samr_UserInfo21 info;
957 samr_CryptPassword password;
958 } samr_UserInfo23;
960 typedef struct {
961 samr_CryptPassword password;
962 uint8 password_expired;
963 } samr_UserInfo24;
965 typedef [flag(NDR_PAHEX)] struct {
966 uint8 data[532];
967 } samr_CryptPasswordEx;
969 typedef struct {
970 samr_UserInfo21 info;
971 samr_CryptPasswordEx password;
972 } samr_UserInfo25;
974 typedef struct {
975 samr_CryptPasswordEx password;
976 uint8 password_expired;
977 } samr_UserInfo26;
979 typedef [switch_type(uint16)] union {
980 [case(1)] samr_UserInfo1 info1;
981 [case(2)] samr_UserInfo2 info2;
982 [case(3)] samr_UserInfo3 info3;
983 [case(4)] samr_UserInfo4 info4;
984 [case(5)] samr_UserInfo5 info5;
985 [case(6)] samr_UserInfo6 info6;
986 [case(7)] samr_UserInfo7 info7;
987 [case(8)] samr_UserInfo8 info8;
988 [case(9)] samr_UserInfo9 info9;
989 [case(10)] samr_UserInfo10 info10;
990 [case(11)] samr_UserInfo11 info11;
991 [case(12)] samr_UserInfo12 info12;
992 [case(13)] samr_UserInfo13 info13;
993 [case(14)] samr_UserInfo14 info14;
994 [case(16)] samr_UserInfo16 info16;
995 [case(17)] samr_UserInfo17 info17;
996 [case(18)] samr_UserInfo18 info18;
997 [case(20)] samr_UserInfo20 info20;
998 [case(21)] samr_UserInfo21 info21;
999 [case(23)] samr_UserInfo23 info23;
1000 [case(24)] samr_UserInfo24 info24;
1001 [case(25)] samr_UserInfo25 info25;
1002 [case(26)] samr_UserInfo26 info26;
1003 } samr_UserInfo;
1005 [public] NTSTATUS samr_QueryUserInfo(
1006 [in,ref] policy_handle *user_handle,
1007 [in] uint16 level,
1008 [out,ref,switch_is(level)] samr_UserInfo **info
1012 /************************/
1013 /* Function 0x25 */
1014 [public] NTSTATUS samr_SetUserInfo(
1015 [in,ref] policy_handle *user_handle,
1016 [in] uint16 level,
1017 [in,ref,switch_is(level)] samr_UserInfo *info
1020 /************************/
1021 /* Function 0x26 */
1023 this is a password change interface that doesn't give
1024 the server the plaintext password. Depricated.
1026 NTSTATUS samr_ChangePasswordUser(
1027 [in,ref] policy_handle *user_handle,
1028 [in] boolean8 lm_present,
1029 [in,unique] samr_Password *old_lm_crypted,
1030 [in,unique] samr_Password *new_lm_crypted,
1031 [in] boolean8 nt_present,
1032 [in,unique] samr_Password *old_nt_crypted,
1033 [in,unique] samr_Password *new_nt_crypted,
1034 [in] boolean8 cross1_present,
1035 [in,unique] samr_Password *nt_cross,
1036 [in] boolean8 cross2_present,
1037 [in,unique] samr_Password *lm_cross
1040 /************************/
1041 /* Function 0x27 */
1043 typedef [public] struct {
1044 uint32 rid;
1045 samr_GroupAttrs attributes;
1046 } samr_RidWithAttribute;
1048 typedef [public] struct {
1049 uint32 count;
1050 [size_is(count)] samr_RidWithAttribute *rids;
1051 } samr_RidWithAttributeArray;
1053 NTSTATUS samr_GetGroupsForUser(
1054 [in,ref] policy_handle *user_handle,
1055 [out,ref] samr_RidWithAttributeArray **rids
1058 /************************/
1059 /* Function 0x28 */
1061 typedef struct {
1062 uint32 idx;
1063 uint32 rid;
1064 samr_AcctFlags acct_flags;
1065 lsa_String account_name;
1066 lsa_String description;
1067 lsa_String full_name;
1068 } samr_DispEntryGeneral;
1070 typedef struct {
1071 uint32 count;
1072 [size_is(count)] samr_DispEntryGeneral *entries;
1073 } samr_DispInfoGeneral;
1075 typedef struct {
1076 uint32 idx;
1077 uint32 rid;
1078 samr_AcctFlags acct_flags;
1079 lsa_String account_name;
1080 lsa_String description;
1081 } samr_DispEntryFull;
1083 typedef struct {
1084 uint32 count;
1085 [size_is(count)] samr_DispEntryFull *entries;
1086 } samr_DispInfoFull;
1088 typedef struct {
1089 uint32 idx;
1090 uint32 rid;
1091 samr_GroupAttrs acct_flags;
1092 lsa_String account_name;
1093 lsa_String description;
1094 } samr_DispEntryFullGroup;
1096 typedef struct {
1097 uint32 count;
1098 [size_is(count)] samr_DispEntryFullGroup *entries;
1099 } samr_DispInfoFullGroups;
1101 typedef struct {
1102 uint32 idx;
1103 lsa_AsciiStringLarge account_name;
1104 } samr_DispEntryAscii;
1106 typedef struct {
1107 uint32 count;
1108 [size_is(count)] samr_DispEntryAscii *entries;
1109 } samr_DispInfoAscii;
1111 typedef [switch_type(uint16)] union {
1112 [case(1)] samr_DispInfoGeneral info1;/* users */
1113 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1114 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1115 [case(4)] samr_DispInfoAscii info4; /* users */
1116 [case(5)] samr_DispInfoAscii info5; /* groups */
1117 } samr_DispInfo;
1119 NTSTATUS samr_QueryDisplayInfo(
1120 [in,ref] policy_handle *domain_handle,
1121 [in] uint16 level,
1122 [in] uint32 start_idx,
1123 [in] uint32 max_entries,
1124 [in] uint32 buf_size,
1125 [out,ref] uint32 *total_size,
1126 [out,ref] uint32 *returned_size,
1127 [out,ref,switch_is(level)] samr_DispInfo *info
1131 /************************/
1132 /* Function 0x29 */
1135 this seems to be an alphabetic search function. The returned index
1136 is the index for samr_QueryDisplayInfo needed to get names occurring
1137 after the specified name. The supplied name does not need to exist
1138 in the database (for example you can supply just a first letter for
1139 searching starting at that letter)
1141 The level corresponds to the samr_QueryDisplayInfo level
1143 NTSTATUS samr_GetDisplayEnumerationIndex(
1144 [in,ref] policy_handle *domain_handle,
1145 [in] uint16 level,
1146 [in,ref] lsa_String *name,
1147 [out,ref] uint32 *idx
1152 /************************/
1153 /* Function 0x2a */
1156 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1158 NTSTATUS samr_TestPrivateFunctionsDomain(
1159 [in,ref] policy_handle *domain_handle
1163 /************************/
1164 /* Function 0x2b */
1167 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1169 NTSTATUS samr_TestPrivateFunctionsUser(
1170 [in,ref] policy_handle *user_handle
1174 /************************/
1175 /* Function 0x2c */
1177 typedef struct {
1178 uint16 min_password_length;
1179 samr_PasswordProperties password_properties;
1180 } samr_PwInfo;
1182 [public] NTSTATUS samr_GetUserPwInfo(
1183 [in,ref] policy_handle *user_handle,
1184 [out,ref] samr_PwInfo *info
1187 /************************/
1188 /* Function 0x2d */
1189 NTSTATUS samr_RemoveMemberFromForeignDomain(
1190 [in,ref] policy_handle *domain_handle,
1191 [in,ref] dom_sid2 *sid
1194 /************************/
1195 /* Function 0x2e */
1198 how is this different from QueryDomainInfo ??
1200 NTSTATUS samr_QueryDomainInfo2(
1201 [in,ref] policy_handle *domain_handle,
1202 [in] uint16 level,
1203 [out,ref,switch_is(level)] samr_DomainInfo **info
1206 /************************/
1207 /* Function 0x2f */
1210 how is this different from QueryUserInfo ??
1212 NTSTATUS samr_QueryUserInfo2(
1213 [in,ref] policy_handle *user_handle,
1214 [in] uint16 level,
1215 [out,ref,switch_is(level)] samr_UserInfo *info
1218 /************************/
1219 /* Function 0x30 */
1222 how is this different from QueryDisplayInfo??
1224 NTSTATUS samr_QueryDisplayInfo2(
1225 [in,ref] policy_handle *domain_handle,
1226 [in] uint16 level,
1227 [in] uint32 start_idx,
1228 [in] uint32 max_entries,
1229 [in] uint32 buf_size,
1230 [out,ref] uint32 *total_size,
1231 [out,ref] uint32 *returned_size,
1232 [out,ref,switch_is(level)] samr_DispInfo *info
1235 /************************/
1236 /* Function 0x31 */
1239 how is this different from GetDisplayEnumerationIndex ??
1241 NTSTATUS samr_GetDisplayEnumerationIndex2(
1242 [in,ref] policy_handle *domain_handle,
1243 [in] uint16 level,
1244 [in,ref] lsa_String *name,
1245 [out,ref] uint32 *idx
1249 /************************/
1250 /* Function 0x32 */
1251 NTSTATUS samr_CreateUser2(
1252 [in,ref] policy_handle *domain_handle,
1253 [in,ref] lsa_String *account_name,
1254 [in] samr_AcctFlags acct_flags,
1255 [in] samr_UserAccessMask access_mask,
1256 [out,ref] policy_handle *user_handle,
1257 [out,ref] uint32 *access_granted,
1258 [out,ref] uint32 *rid
1262 /************************/
1263 /* Function 0x33 */
1266 another duplicate. There must be a reason ....
1268 NTSTATUS samr_QueryDisplayInfo3(
1269 [in,ref] policy_handle *domain_handle,
1270 [in] uint16 level,
1271 [in] uint32 start_idx,
1272 [in] uint32 max_entries,
1273 [in] uint32 buf_size,
1274 [out,ref] uint32 *total_size,
1275 [out,ref] uint32 *returned_size,
1276 [out,ref,switch_is(level)] samr_DispInfo *info
1279 /************************/
1280 /* Function 0x34 */
1281 NTSTATUS samr_AddMultipleMembersToAlias(
1282 [in,ref] policy_handle *alias_handle,
1283 [in,ref] lsa_SidArray *sids
1286 /************************/
1287 /* Function 0x35 */
1288 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1289 [in,ref] policy_handle *alias_handle,
1290 [in,ref] lsa_SidArray *sids
1293 /************************/
1294 /* Function 0x36 */
1296 NTSTATUS samr_OemChangePasswordUser2(
1297 [in,unique] lsa_AsciiString *server,
1298 [in,ref] lsa_AsciiString *account,
1299 [in,unique] samr_CryptPassword *password,
1300 [in,unique] samr_Password *hash
1303 /************************/
1304 /* Function 0x37 */
1305 NTSTATUS samr_ChangePasswordUser2(
1306 [in,unique] lsa_String *server,
1307 [in,ref] lsa_String *account,
1308 [in,unique] samr_CryptPassword *nt_password,
1309 [in,unique] samr_Password *nt_verifier,
1310 [in] boolean8 lm_change,
1311 [in,unique] samr_CryptPassword *lm_password,
1312 [in,unique] samr_Password *lm_verifier
1315 /************************/
1316 /* Function 0x38 */
1317 NTSTATUS samr_GetDomPwInfo(
1318 [in,unique] lsa_String *domain_name,
1319 [out,ref] samr_PwInfo *info
1322 /************************/
1323 /* Function 0x39 */
1324 NTSTATUS samr_Connect2(
1325 [in,unique,string,charset(UTF16)] uint16 *system_name,
1326 [in] samr_ConnectAccessMask access_mask,
1327 [out,ref] policy_handle *connect_handle
1330 /************************/
1331 /* Function 0x3a */
1333 seems to be an exact alias for samr_SetUserInfo()
1335 [public] NTSTATUS samr_SetUserInfo2(
1336 [in,ref] policy_handle *user_handle,
1337 [in] uint16 level,
1338 [in,ref,switch_is(level)] samr_UserInfo *info
1341 /************************/
1342 /* Function 0x3b */
1344 this one is mysterious. I have a few guesses, but nothing working yet
1346 NTSTATUS samr_SetBootKeyInformation(
1347 [in,ref] policy_handle *connect_handle,
1348 [in] uint32 unknown1,
1349 [in] uint32 unknown2,
1350 [in] uint32 unknown3
1353 /************************/
1354 /* Function 0x3c */
1355 NTSTATUS samr_GetBootKeyInformation(
1356 [in,ref] policy_handle *domain_handle,
1357 [out,ref] uint32 *unknown
1360 /************************/
1361 /* Function 0x3d */
1362 NTSTATUS samr_Connect3(
1363 [in,unique,string,charset(UTF16)] uint16 *system_name,
1364 /* this unknown value seems to be completely ignored by w2k3 */
1365 [in] uint32 unknown,
1366 [in] samr_ConnectAccessMask access_mask,
1367 [out,ref] policy_handle *connect_handle
1370 /************************/
1371 /* Function 0x3e */
1373 typedef enum {
1374 SAMR_CONNECT_PRE_W2K = 1,
1375 SAMR_CONNECT_W2K = 2,
1376 SAMR_CONNECT_AFTER_W2K = 3
1377 } samr_ConnectVersion;
1379 NTSTATUS samr_Connect4(
1380 [in,unique,string,charset(UTF16)] uint16 *system_name,
1381 [in] samr_ConnectVersion client_version,
1382 [in] samr_ConnectAccessMask access_mask,
1383 [out,ref] policy_handle *connect_handle
1386 /************************/
1387 /* Function 0x3f */
1389 typedef enum samr_RejectReason samr_RejectReason;
1391 typedef struct {
1392 samr_RejectReason reason;
1393 uint32 unknown1;
1394 uint32 unknown2;
1395 } samr_ChangeReject;
1397 NTSTATUS samr_ChangePasswordUser3(
1398 [in,unique] lsa_String *server,
1399 [in,ref] lsa_String *account,
1400 [in,unique] samr_CryptPassword *nt_password,
1401 [in,unique] samr_Password *nt_verifier,
1402 [in] boolean8 lm_change,
1403 [in,unique] samr_CryptPassword *lm_password,
1404 [in,unique] samr_Password *lm_verifier,
1405 [in,unique] samr_CryptPassword *password3,
1406 [out,ref] samr_DomInfo1 **dominfo,
1407 [out,ref] samr_ChangeReject **reject
1410 /************************/
1411 /* Function 0x40 */
1413 typedef struct {
1414 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1415 uint32 unknown2; /* w2k3 gives 0 */
1416 } samr_ConnectInfo1;
1418 typedef union {
1419 [case(1)] samr_ConnectInfo1 info1;
1420 } samr_ConnectInfo;
1422 [public] NTSTATUS samr_Connect5(
1423 [in,unique,string,charset(UTF16)] uint16 *system_name,
1424 [in] samr_ConnectAccessMask access_mask,
1425 [in] uint32 level_in,
1426 [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
1427 [out,ref] uint32 *level_out,
1428 [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
1429 [out,ref] policy_handle *connect_handle
1432 /************************/
1433 /* Function 0x41 */
1434 NTSTATUS samr_RidToSid(
1435 [in,ref] policy_handle *domain_handle,
1436 [in] uint32 rid,
1437 [out,ref] dom_sid2 *sid
1441 /************************/
1442 /* Function 0x42 */
1445 this should set the DSRM password for the server, which is used
1446 when booting into Directory Services Recovery Mode on a DC. Win2003
1447 gives me NT_STATUS_NOT_SUPPORTED
1450 NTSTATUS samr_SetDsrmPassword(
1451 [in,unique] lsa_String *name,
1452 [in] uint32 unknown,
1453 [in,unique] samr_Password *hash
1457 /************************/
1458 /* Function 0x43 */
1459 /************************/
1460 typedef [bitmap32bit] bitmap {
1461 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1462 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1463 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1464 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1465 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1466 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1467 } samr_ValidateFieldsPresent;
1469 typedef enum {
1470 NetValidateAuthentication = 1,
1471 NetValidatePasswordChange= 2,
1472 NetValidatePasswordReset = 3
1473 } samr_ValidatePasswordLevel;
1475 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1476 * identified the mapping of
1477 * - NERR_PasswordFilterError
1478 * - NERR_PasswordExpired and
1479 * - NERR_PasswordCantChange
1480 * yet - Guenther
1483 typedef enum {
1484 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1485 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1486 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1487 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1488 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1489 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1490 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1491 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1492 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1493 } samr_ValidationStatus;
1495 typedef struct {
1496 uint32 length;
1497 [size_is(length)] uint8 *data;
1498 } samr_ValidationBlob;
1500 typedef struct {
1501 samr_ValidateFieldsPresent fields_present;
1502 NTTIME_hyper last_password_change;
1503 NTTIME_hyper bad_password_time;
1504 NTTIME_hyper lockout_time;
1505 uint32 bad_pwd_count;
1506 uint32 pwd_history_len;
1507 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1508 } samr_ValidatePasswordInfo;
1510 typedef struct {
1511 samr_ValidatePasswordInfo info;
1512 samr_ValidationStatus status;
1513 } samr_ValidatePasswordRepCtr;
1515 typedef [switch_type(uint16)] union {
1516 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1517 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1518 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1519 } samr_ValidatePasswordRep;
1521 typedef struct {
1522 samr_ValidatePasswordInfo info;
1523 lsa_StringLarge password;
1524 lsa_StringLarge account;
1525 samr_ValidationBlob hash;
1526 boolean8 pwd_must_change_at_next_logon;
1527 boolean8 clear_lockout;
1528 } samr_ValidatePasswordReq3;
1530 typedef struct {
1531 samr_ValidatePasswordInfo info;
1532 lsa_StringLarge password;
1533 lsa_StringLarge account;
1534 samr_ValidationBlob hash;
1535 boolean8 password_matched;
1536 } samr_ValidatePasswordReq2;
1538 typedef struct {
1539 samr_ValidatePasswordInfo info;
1540 boolean8 password_matched;
1541 } samr_ValidatePasswordReq1;
1543 typedef [switch_type(uint16)] union {
1544 [case(1)] samr_ValidatePasswordReq1 req1;
1545 [case(2)] samr_ValidatePasswordReq2 req2;
1546 [case(3)] samr_ValidatePasswordReq3 req3;
1547 } samr_ValidatePasswordReq;
1549 NTSTATUS samr_ValidatePassword(
1550 [in] samr_ValidatePasswordLevel level,
1551 [in,switch_is(level)] samr_ValidatePasswordReq req,
1552 [out,ref,switch_is(level)] samr_ValidatePasswordRep *rep