4 samr interface definition
6 import "misc.idl", "lsa.idl", "security.idl";
9 Thanks to Todd Sabin for some information from his samr.idl in acltools
12 [ uuid("12345778-1234-abcd-ef00-0123456789ac"),
14 endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
15 pointer_default(unique)
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 */
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 typedef [bitmap32bit] bitmap {
161 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
162 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
163 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
164 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
165 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
166 } samr_GroupAccessMask;
168 typedef [bitmap32bit] bitmap {
169 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
170 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
171 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
172 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
173 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
174 } samr_AliasAccessMask;
178 NTSTATUS samr_Connect (
179 /* notice the lack of [string] */
180 [in,unique] uint16 *system_name,
181 [in] samr_ConnectAccessMask access_mask,
182 [out,ref] policy_handle *connect_handle
188 [public] NTSTATUS samr_Close (
189 [in,out,ref] policy_handle *handle
195 NTSTATUS samr_SetSecurity (
196 [in,ref] policy_handle *handle,
197 [in] security_secinfo sec_info,
198 [in,ref] sec_desc_buf *sdbuf
204 NTSTATUS samr_QuerySecurity (
205 [in,ref] policy_handle *handle,
206 [in] security_secinfo sec_info,
207 [out,unique] sec_desc_buf *sdbuf
214 shutdown the SAM - once you call this the SAM will be dead
216 NTSTATUS samr_Shutdown (
217 [in,ref] policy_handle *connect_handle
222 NTSTATUS samr_LookupDomain (
223 [in,ref] policy_handle *connect_handle,
224 [in,ref] lsa_String *domain_name,
225 [out,unique] dom_sid2 *sid
239 [size_is(count)] samr_SamEntry *entries;
242 NTSTATUS samr_EnumDomains (
243 [in,ref] policy_handle *connect_handle,
244 [in,out,ref] uint32 *resume_handle,
245 [in] uint32 buf_size,
246 [out,unique] samr_SamArray *sam,
247 [out] uint32 num_entries
251 /************************/
253 [public] NTSTATUS samr_OpenDomain(
254 [in,ref] policy_handle *connect_handle,
255 [in] samr_DomainAccessMask access_mask,
256 [in,ref] dom_sid2 *sid,
257 [out,ref] policy_handle *domain_handle
260 /************************/
263 typedef [v1_enum] enum {
264 SAMR_ROLE_STANDALONE = 0,
265 SAMR_ROLE_DOMAIN_MEMBER = 1,
266 SAMR_ROLE_DOMAIN_BDC = 2,
267 SAMR_ROLE_DOMAIN_PDC = 3
270 /* password properties flags */
271 typedef [public,bitmap32bit] bitmap {
272 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
273 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
274 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
275 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
276 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
277 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
278 } samr_PasswordProperties;
281 uint16 min_password_length;
282 uint16 password_history_length;
283 samr_PasswordProperties password_properties;
284 /* yes, these are signed. They are in negative 100ns */
285 dlong max_password_age;
286 dlong min_password_age;
290 NTTIME force_logoff_time;
291 lsa_String oem_information; /* comment */
292 lsa_String domain_name;
293 lsa_String primary; /* PDC name if this is a BDC */
301 } samr_DomGeneralInformation;
304 NTTIME force_logoff_time;
308 lsa_String oem_information; /* comment */
309 } samr_DomOEMInformation;
312 lsa_String domain_name;
325 NTTIME domain_create_time;
329 uint32 unknown; /* w2k3 returns 1 */
333 samr_DomGeneralInformation general;
334 hyper lockout_duration;
335 hyper lockout_window;
336 uint16 lockout_threshold;
337 } samr_DomGeneralInformation2;
340 hyper lockout_duration;
341 hyper lockout_window;
342 uint16 lockout_threshold;
347 NTTIME domain_create_time;
352 typedef [switch_type(uint16)] union {
353 [case(1)] samr_DomInfo1 info1;
354 [case(2)] samr_DomGeneralInformation general;
355 [case(3)] samr_DomInfo3 info3;
356 [case(4)] samr_DomOEMInformation oem;
357 [case(5)] samr_DomInfo5 info5;
358 [case(6)] samr_DomInfo6 info6;
359 [case(7)] samr_DomInfo7 info7;
360 [case(8)] samr_DomInfo8 info8;
361 [case(9)] samr_DomInfo9 info9;
362 [case(11)] samr_DomGeneralInformation2 general2;
363 [case(12)] samr_DomInfo12 info12;
364 [case(13)] samr_DomInfo13 info13;
367 NTSTATUS samr_QueryDomainInfo(
368 [in,ref] policy_handle *domain_handle,
370 [out,switch_is(level),unique] samr_DomainInfo *info
373 /************************/
376 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
379 NTSTATUS samr_SetDomainInfo(
380 [in,ref] policy_handle *domain_handle,
382 [in,switch_is(level),ref] samr_DomainInfo *info
386 /************************/
388 NTSTATUS samr_CreateDomainGroup(
389 [in,ref] policy_handle *domain_handle,
390 [in,ref] lsa_String *name,
391 [in] samr_GroupAccessMask access_mask,
392 [out,ref] policy_handle *group_handle,
393 [out,ref] uint32 *rid
397 /************************/
399 NTSTATUS samr_EnumDomainGroups(
400 [in,ref] policy_handle *domain_handle,
401 [in,out,ref] uint32 *resume_handle,
402 [in] uint32 max_size,
403 [out,unique] samr_SamArray *sam,
404 [out] uint32 num_entries
407 /************************/
409 NTSTATUS samr_CreateUser(
410 [in,ref] policy_handle *domain_handle,
411 [in,ref] lsa_String *account_name,
412 [in] samr_UserAccessMask access_mask,
413 [out,ref] policy_handle *user_handle,
414 [out,ref] uint32 *rid
417 /************************/
421 /* w2k3 treats max_size as max_users*54 and sets the
422 resume_handle as the rid of the last user sent
424 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
426 NTSTATUS samr_EnumDomainUsers(
427 [in,ref] policy_handle *domain_handle,
428 [in,out,ref] uint32 *resume_handle,
429 [in] samr_AcctFlags acct_flags,
430 [in] uint32 max_size,
431 [out,unique] samr_SamArray *sam,
432 [out] uint32 num_entries
435 /************************/
437 NTSTATUS samr_CreateDomAlias(
438 [in,ref] policy_handle *domain_handle,
439 [in,ref] lsa_String *alias_name,
440 [in] samr_AliasAccessMask access_mask,
441 [out,ref] policy_handle *alias_handle,
442 [out,ref] uint32 *rid
445 /************************/
447 NTSTATUS samr_EnumDomainAliases(
448 [in,ref] policy_handle *domain_handle,
449 [in,out,ref] uint32 *resume_handle,
450 [in] samr_AcctFlags acct_flags,
451 [out,unique] samr_SamArray *sam,
452 [out] uint32 num_entries
455 /************************/
459 [range(0,1024)] uint32 count;
460 [size_is(count)] uint32 *ids;
463 NTSTATUS samr_GetAliasMembership(
464 [in,ref] policy_handle *domain_handle,
465 [in,ref] lsa_SidArray *sids,
466 [out,ref] samr_Ids *rids
469 /************************/
472 [public] NTSTATUS samr_LookupNames(
473 [in,ref] policy_handle *domain_handle,
474 [in,range(0,1000)] uint32 num_names,
475 [in,size_is(1000),length_is(num_names)] lsa_String names[],
481 /************************/
483 NTSTATUS samr_LookupRids(
484 [in,ref] policy_handle *domain_handle,
485 [in,range(0,1000)] uint32 num_rids,
486 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
487 [out] lsa_Strings names,
491 /************************/
493 NTSTATUS samr_OpenGroup(
494 [in,ref] policy_handle *domain_handle,
495 [in] samr_GroupAccessMask access_mask,
497 [out,ref] policy_handle *group_handle
500 /* Group attributes */
501 typedef [public,bitmap32bit] bitmap {
502 SE_GROUP_MANDATORY = 0x00000001,
503 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
504 SE_GROUP_ENABLED = 0x00000004,
505 SE_GROUP_OWNER = 0x00000008,
506 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
507 SE_GROUP_RESOURCE = 0x20000000,
508 SE_GROUP_LOGON_ID = 0xC0000000
511 /************************/
516 samr_GroupAttrs attributes;
518 lsa_String description;
522 samr_GroupAttrs attributes;
523 } samr_GroupInfoAttributes;
526 lsa_String description;
527 } samr_GroupInfoDescription;
532 GROUPINFOATTRIBUTES = 3,
533 GROUPINFODESCRIPTION = 4,
535 } samr_GroupInfoEnum;
537 typedef [switch_type(samr_GroupInfoEnum)] union {
538 [case(GROUPINFOALL)] samr_GroupInfoAll all;
539 [case(GROUPINFONAME)] lsa_String name;
540 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
541 [case(GROUPINFODESCRIPTION)] lsa_String description;
542 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
545 NTSTATUS samr_QueryGroupInfo(
546 [in,ref] policy_handle *group_handle,
547 [in] samr_GroupInfoEnum level,
548 [out,switch_is(level),unique] samr_GroupInfo *info
551 /************************/
553 NTSTATUS samr_SetGroupInfo(
554 [in,ref] policy_handle *group_handle,
555 [in] samr_GroupInfoEnum level,
556 [in,switch_is(level),ref] samr_GroupInfo *info
559 /************************/
561 NTSTATUS samr_AddGroupMember(
562 [in,ref] policy_handle *group_handle,
567 /************************/
569 NTSTATUS samr_DeleteDomainGroup(
570 [in,out,ref] policy_handle *group_handle
573 /************************/
575 NTSTATUS samr_DeleteGroupMember(
576 [in,ref] policy_handle *group_handle,
581 /************************/
585 [size_is(count)] uint32 *rids;
586 [size_is(count)] uint32 *types;
589 NTSTATUS samr_QueryGroupMember(
590 [in,ref] policy_handle *group_handle,
591 [out,unique] samr_RidTypeArray *rids
595 /************************/
599 win2003 seems to accept any data at all for the two integers
600 below, and doesn't seem to do anything with them that I can
601 see. Weird. I really expected the first integer to be a rid
602 and the second to be the attributes for that rid member.
604 NTSTATUS samr_SetMemberAttributesOfGroup(
605 [in,ref] policy_handle *group_handle,
606 [in] uint32 unknown1,
611 /************************/
613 NTSTATUS samr_OpenAlias (
614 [in,ref] policy_handle *domain_handle,
615 [in] samr_AliasAccessMask access_mask,
617 [out,ref] policy_handle *alias_handle
621 /************************/
627 lsa_String description;
633 ALIASINFODESCRIPTION = 3
634 } samr_AliasInfoEnum;
636 typedef [switch_type(samr_AliasInfoEnum)] union {
637 [case(ALIASINFOALL)] samr_AliasInfoAll all;
638 [case(ALIASINFONAME)] lsa_String name;
639 [case(ALIASINFODESCRIPTION)] lsa_String description;
642 NTSTATUS samr_QueryAliasInfo(
643 [in,ref] policy_handle *alias_handle,
644 [in] samr_AliasInfoEnum level,
645 [out,switch_is(level),unique] samr_AliasInfo *info
648 /************************/
650 NTSTATUS samr_SetAliasInfo(
651 [in,ref] policy_handle *alias_handle,
652 [in] samr_AliasInfoEnum level,
653 [in,switch_is(level),ref] samr_AliasInfo *info
656 /************************/
658 NTSTATUS samr_DeleteDomAlias(
659 [in,out,ref] policy_handle *alias_handle
662 /************************/
664 NTSTATUS samr_AddAliasMember(
665 [in,ref] policy_handle *alias_handle,
666 [in,ref] dom_sid2 *sid
669 /************************/
671 NTSTATUS samr_DeleteAliasMember(
672 [in,ref] policy_handle *alias_handle,
673 [in,ref] dom_sid2 *sid
676 /************************/
678 NTSTATUS samr_GetMembersInAlias(
679 [in,ref] policy_handle *alias_handle,
680 [out,ref] lsa_SidArray *sids
683 /************************/
685 [public] NTSTATUS samr_OpenUser(
686 [in,ref] policy_handle *domain_handle,
687 [in] samr_UserAccessMask access_mask,
689 [out,ref] policy_handle *user_handle
692 /************************/
694 NTSTATUS samr_DeleteUser(
695 [in,out,ref] policy_handle *user_handle
698 /************************/
701 lsa_String account_name;
702 lsa_String full_name;
704 lsa_String description;
710 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
715 /* this is also used in samr and netlogon */
716 typedef [public, flag(NDR_PAHEX)] struct {
717 uint16 units_per_week;
718 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
722 lsa_String account_name;
723 lsa_String full_name;
726 lsa_String home_directory;
727 lsa_String home_drive;
728 lsa_String logon_script;
729 lsa_String profile_path;
730 lsa_String workstations;
733 NTTIME last_password_change;
734 NTTIME allow_password_change;
735 NTTIME force_password_change;
736 samr_LogonHours logon_hours;
737 uint16 bad_password_count;
739 samr_AcctFlags acct_flags;
743 samr_LogonHours logon_hours;
747 lsa_String account_name;
748 lsa_String full_name;
751 lsa_String home_directory;
752 lsa_String home_drive;
753 lsa_String logon_script;
754 lsa_String profile_path;
755 lsa_String description;
756 lsa_String workstations;
759 samr_LogonHours logon_hours;
760 uint16 bad_password_count;
762 NTTIME last_password_change;
764 samr_AcctFlags acct_flags;
768 lsa_String account_name;
769 lsa_String full_name;
773 lsa_String account_name;
777 lsa_String full_name;
785 lsa_String home_directory;
786 lsa_String home_drive;
790 lsa_String logon_script;
794 lsa_String profile_path;
798 lsa_String description;
802 lsa_String workstations;
806 samr_AcctFlags acct_flags;
813 typedef [public, flag(NDR_PAHEX)] struct {
818 samr_Password lm_pwd;
819 samr_Password nt_pwd;
820 boolean8 lm_pwd_active;
821 boolean8 nt_pwd_active;
825 lsa_BinaryString parameters;
828 /* this defines the bits used for fields_present in info21 */
829 typedef [bitmap32bit] bitmap {
830 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
831 SAMR_FIELD_FULL_NAME = 0x00000002,
832 SAMR_FIELD_RID = 0x00000004,
833 SAMR_FIELD_PRIMARY_GID = 0x00000008,
834 SAMR_FIELD_DESCRIPTION = 0x00000010,
835 SAMR_FIELD_COMMENT = 0x00000020,
836 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
837 SAMR_FIELD_HOME_DRIVE = 0x00000080,
838 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
839 SAMR_FIELD_PROFILE_PATH = 0x00000200,
840 SAMR_FIELD_WORKSTATIONS = 0x00000400,
841 SAMR_FIELD_LAST_LOGON = 0x00000800,
842 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
843 SAMR_FIELD_LOGON_HOURS = 0x00002000,
844 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
845 SAMR_FIELD_NUM_LOGONS = 0x00008000,
846 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
847 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
848 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
849 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
850 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
851 SAMR_FIELD_PARAMETERS = 0x00200000,
852 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
853 SAMR_FIELD_CODE_PAGE = 0x00800000,
854 SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
855 SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
856 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
857 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
858 SAMR_FIELD_SEC_DESC = 0x10000000,
859 SAMR_FIELD_OWF_PWD = 0x20000000
860 } samr_FieldsPresent;
862 /* used for 'password_expired' in samr_UserInfo21 */
863 const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
864 const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
869 NTTIME last_password_change;
871 NTTIME allow_password_change;
872 NTTIME force_password_change;
873 lsa_String account_name;
874 lsa_String full_name;
875 lsa_String home_directory;
876 lsa_String home_drive;
877 lsa_String logon_script;
878 lsa_String profile_path;
879 lsa_String description;
880 lsa_String workstations;
882 lsa_BinaryString parameters;
887 [size_is(buf_count)] uint8 *buffer;
890 samr_AcctFlags acct_flags;
891 samr_FieldsPresent fields_present;
892 samr_LogonHours logon_hours;
893 uint16 bad_password_count;
897 uint8 nt_password_set;
898 uint8 lm_password_set;
899 uint8 password_expired;
903 typedef [public, flag(NDR_PAHEX)] struct {
905 } samr_CryptPassword;
908 samr_UserInfo21 info;
909 samr_CryptPassword password;
913 samr_CryptPassword password;
917 typedef [flag(NDR_PAHEX)] struct {
919 } samr_CryptPasswordEx;
922 samr_UserInfo21 info;
923 samr_CryptPasswordEx password;
927 samr_CryptPasswordEx password;
931 typedef [switch_type(uint16)] union {
932 [case(1)] samr_UserInfo1 info1;
933 [case(2)] samr_UserInfo2 info2;
934 [case(3)] samr_UserInfo3 info3;
935 [case(4)] samr_UserInfo4 info4;
936 [case(5)] samr_UserInfo5 info5;
937 [case(6)] samr_UserInfo6 info6;
938 [case(7)] samr_UserInfo7 info7;
939 [case(8)] samr_UserInfo8 info8;
940 [case(9)] samr_UserInfo9 info9;
941 [case(10)] samr_UserInfo10 info10;
942 [case(11)] samr_UserInfo11 info11;
943 [case(12)] samr_UserInfo12 info12;
944 [case(13)] samr_UserInfo13 info13;
945 [case(14)] samr_UserInfo14 info14;
946 [case(16)] samr_UserInfo16 info16;
947 [case(17)] samr_UserInfo17 info17;
948 [case(18)] samr_UserInfo18 info18;
949 [case(20)] samr_UserInfo20 info20;
950 [case(21)] samr_UserInfo21 info21;
951 [case(23)] samr_UserInfo23 info23;
952 [case(24)] samr_UserInfo24 info24;
953 [case(25)] samr_UserInfo25 info25;
954 [case(26)] samr_UserInfo26 info26;
957 [public] NTSTATUS samr_QueryUserInfo(
958 [in,ref] policy_handle *user_handle,
960 [out,unique,switch_is(level)] samr_UserInfo *info
964 /************************/
966 [public] NTSTATUS samr_SetUserInfo(
967 [in,ref] policy_handle *user_handle,
969 [in,ref,switch_is(level)] samr_UserInfo *info
972 /************************/
975 this is a password change interface that doesn't give
976 the server the plaintext password. Depricated.
978 NTSTATUS samr_ChangePasswordUser(
979 [in,ref] policy_handle *user_handle,
980 [in] boolean8 lm_present,
981 [in,unique] samr_Password *old_lm_crypted,
982 [in,unique] samr_Password *new_lm_crypted,
983 [in] boolean8 nt_present,
984 [in,unique] samr_Password *old_nt_crypted,
985 [in,unique] samr_Password *new_nt_crypted,
986 [in] boolean8 cross1_present,
987 [in,unique] samr_Password *nt_cross,
988 [in] boolean8 cross2_present,
989 [in,unique] samr_Password *lm_cross
992 /************************/
995 typedef [public] struct {
997 samr_GroupAttrs attributes;
998 } samr_RidWithAttribute;
1000 typedef [public] struct {
1002 [size_is(count)] samr_RidWithAttribute *rids;
1003 } samr_RidWithAttributeArray;
1005 NTSTATUS samr_GetGroupsForUser(
1006 [in,ref] policy_handle *user_handle,
1007 [out,unique] samr_RidWithAttributeArray *rids
1010 /************************/
1016 samr_AcctFlags acct_flags;
1017 lsa_String account_name;
1018 lsa_String description;
1019 lsa_String full_name;
1020 } samr_DispEntryGeneral;
1024 [size_is(count)] samr_DispEntryGeneral *entries;
1025 } samr_DispInfoGeneral;
1030 samr_AcctFlags acct_flags;
1031 lsa_String account_name;
1032 lsa_String description;
1033 } samr_DispEntryFull;
1037 [size_is(count)] samr_DispEntryFull *entries;
1038 } samr_DispInfoFull;
1043 samr_GroupAttrs acct_flags;
1044 lsa_String account_name;
1045 lsa_String description;
1046 } samr_DispEntryFullGroup;
1050 [size_is(count)] samr_DispEntryFullGroup *entries;
1051 } samr_DispInfoFullGroups;
1055 lsa_AsciiStringLarge account_name;
1056 } samr_DispEntryAscii;
1060 [size_is(count)] samr_DispEntryAscii *entries;
1061 } samr_DispInfoAscii;
1063 typedef [switch_type(uint16)] union {
1064 [case(1)] samr_DispInfoGeneral info1;/* users */
1065 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1066 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1067 [case(4)] samr_DispInfoAscii info4; /* users */
1068 [case(5)] samr_DispInfoAscii info5; /* groups */
1071 NTSTATUS samr_QueryDisplayInfo(
1072 [in,ref] policy_handle *domain_handle,
1074 [in] uint32 start_idx,
1075 [in] uint32 max_entries,
1076 [in] uint32 buf_size,
1077 [out] uint32 total_size,
1078 [out] uint32 returned_size,
1079 [out,switch_is(level)] samr_DispInfo info
1083 /************************/
1087 this seems to be an alphabetic search function. The returned index
1088 is the index for samr_QueryDisplayInfo needed to get names occurring
1089 after the specified name. The supplied name does not need to exist
1090 in the database (for example you can supply just a first letter for
1091 searching starting at that letter)
1093 The level corresponds to the samr_QueryDisplayInfo level
1095 NTSTATUS samr_GetDisplayEnumerationIndex(
1096 [in,ref] policy_handle *domain_handle,
1098 [in] lsa_String name,
1104 /************************/
1108 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1110 NTSTATUS samr_TestPrivateFunctionsDomain(
1111 [in,ref] policy_handle *domain_handle
1115 /************************/
1119 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1121 NTSTATUS samr_TestPrivateFunctionsUser(
1122 [in,ref] policy_handle *user_handle
1126 /************************/
1130 uint16 min_password_length;
1131 samr_PasswordProperties password_properties;
1134 [public] NTSTATUS samr_GetUserPwInfo(
1135 [in,ref] policy_handle *user_handle,
1136 [out] samr_PwInfo info
1139 /************************/
1141 NTSTATUS samr_RemoveMemberFromForeignDomain(
1142 [in,ref] policy_handle *domain_handle,
1143 [in,ref] dom_sid2 *sid
1146 /************************/
1150 how is this different from QueryDomainInfo ??
1152 NTSTATUS samr_QueryDomainInfo2(
1153 [in,ref] policy_handle *domain_handle,
1155 [out,unique,switch_is(level)] samr_DomainInfo *info
1158 /************************/
1162 how is this different from QueryUserInfo ??
1164 NTSTATUS samr_QueryUserInfo2(
1165 [in,ref] policy_handle *user_handle,
1167 [out,unique,switch_is(level)] samr_UserInfo *info
1170 /************************/
1174 how is this different from QueryDisplayInfo??
1176 NTSTATUS samr_QueryDisplayInfo2(
1177 [in,ref] policy_handle *domain_handle,
1179 [in] uint32 start_idx,
1180 [in] uint32 max_entries,
1181 [in] uint32 buf_size,
1182 [out] uint32 total_size,
1183 [out] uint32 returned_size,
1184 [out,switch_is(level)] samr_DispInfo info
1187 /************************/
1191 how is this different from GetDisplayEnumerationIndex ??
1193 NTSTATUS samr_GetDisplayEnumerationIndex2(
1194 [in,ref] policy_handle *domain_handle,
1196 [in] lsa_String name,
1201 /************************/
1203 NTSTATUS samr_CreateUser2(
1204 [in,ref] policy_handle *domain_handle,
1205 [in,ref] lsa_String *account_name,
1206 [in] samr_AcctFlags acct_flags,
1207 [in] samr_UserAccessMask access_mask,
1208 [out,ref] policy_handle *user_handle,
1209 [out,ref] uint32 *access_granted,
1210 [out,ref] uint32 *rid
1214 /************************/
1218 another duplicate. There must be a reason ....
1220 NTSTATUS samr_QueryDisplayInfo3(
1221 [in,ref] policy_handle *domain_handle,
1223 [in] uint32 start_idx,
1224 [in] uint32 max_entries,
1225 [in] uint32 buf_size,
1226 [out] uint32 total_size,
1227 [out] uint32 returned_size,
1228 [out,switch_is(level)] samr_DispInfo info
1231 /************************/
1233 NTSTATUS samr_AddMultipleMembersToAlias(
1234 [in,ref] policy_handle *alias_handle,
1235 [in,ref] lsa_SidArray *sids
1238 /************************/
1240 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1241 [in,ref] policy_handle *alias_handle,
1242 [in,ref] lsa_SidArray *sids
1245 /************************/
1248 NTSTATUS samr_OemChangePasswordUser2(
1249 [in,unique] lsa_AsciiString *server,
1250 [in,ref] lsa_AsciiString *account,
1251 [in,unique] samr_CryptPassword *password,
1252 [in,unique] samr_Password *hash
1255 /************************/
1257 NTSTATUS samr_ChangePasswordUser2(
1258 [in,unique] lsa_String *server,
1259 [in,ref] lsa_String *account,
1260 [in,unique] samr_CryptPassword *nt_password,
1261 [in,unique] samr_Password *nt_verifier,
1262 [in] boolean8 lm_change,
1263 [in,unique] samr_CryptPassword *lm_password,
1264 [in,unique] samr_Password *lm_verifier
1267 /************************/
1269 NTSTATUS samr_GetDomPwInfo(
1270 [in,unique] lsa_String *domain_name,
1271 [out] samr_PwInfo info
1274 /************************/
1276 NTSTATUS samr_Connect2(
1277 [in,unique,string,charset(UTF16)] uint16 *system_name,
1278 [in] samr_ConnectAccessMask access_mask,
1279 [out,ref] policy_handle *connect_handle
1282 /************************/
1285 seems to be an exact alias for samr_SetUserInfo()
1287 [public] NTSTATUS samr_SetUserInfo2(
1288 [in,ref] policy_handle *user_handle,
1290 [in,ref,switch_is(level)] samr_UserInfo *info
1293 /************************/
1296 this one is mysterious. I have a few guesses, but nothing working yet
1298 NTSTATUS samr_SetBootKeyInformation(
1299 [in,ref] policy_handle *connect_handle,
1300 [in] uint32 unknown1,
1301 [in] uint32 unknown2,
1302 [in] uint32 unknown3
1305 /************************/
1307 NTSTATUS samr_GetBootKeyInformation(
1308 [in,ref] policy_handle *domain_handle,
1309 [out] uint32 unknown
1312 /************************/
1314 NTSTATUS samr_Connect3(
1315 [in,unique,string,charset(UTF16)] uint16 *system_name,
1316 /* this unknown value seems to be completely ignored by w2k3 */
1317 [in] uint32 unknown,
1318 [in] samr_ConnectAccessMask access_mask,
1319 [out,ref] policy_handle *connect_handle
1322 /************************/
1326 SAMR_CONNECT_PRE_W2K = 1,
1327 SAMR_CONNECT_W2K = 2,
1328 SAMR_CONNECT_AFTER_W2K = 3
1329 } samr_ConnectVersion;
1331 NTSTATUS samr_Connect4(
1332 [in,unique,string,charset(UTF16)] uint16 *system_name,
1333 [in] samr_ConnectVersion client_version,
1334 [in] samr_ConnectAccessMask access_mask,
1335 [out,ref] policy_handle *connect_handle
1338 /************************/
1341 typedef enum samr_RejectReason samr_RejectReason;
1344 samr_RejectReason reason;
1347 } samr_ChangeReject;
1349 NTSTATUS samr_ChangePasswordUser3(
1350 [in,unique] lsa_String *server,
1351 [in,ref] lsa_String *account,
1352 [in,unique] samr_CryptPassword *nt_password,
1353 [in,unique] samr_Password *nt_verifier,
1354 [in] boolean8 lm_change,
1355 [in,unique] samr_CryptPassword *lm_password,
1356 [in,unique] samr_Password *lm_verifier,
1357 [in,unique] samr_CryptPassword *password3,
1358 [out,unique] samr_DomInfo1 *dominfo,
1359 [out,unique] samr_ChangeReject *reject
1362 /************************/
1366 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1367 uint32 unknown2; /* w2k3 gives 0 */
1368 } samr_ConnectInfo1;
1371 [case(1)] samr_ConnectInfo1 info1;
1374 [public] NTSTATUS samr_Connect5(
1375 [in,unique,string,charset(UTF16)] uint16 *system_name,
1376 [in] samr_ConnectAccessMask access_mask,
1377 [in,out] uint32 level,
1378 [in,out,switch_is(level),ref] samr_ConnectInfo *info,
1379 [out,ref] policy_handle *connect_handle
1382 /************************/
1384 NTSTATUS samr_RidToSid(
1385 [in,ref] policy_handle *domain_handle,
1387 [out,unique] dom_sid2 *sid
1391 /************************/
1395 this should set the DSRM password for the server, which is used
1396 when booting into Directory Services Recovery Mode on a DC. Win2003
1397 gives me NT_STATUS_NOT_SUPPORTED
1400 NTSTATUS samr_SetDsrmPassword(
1401 [in,unique] lsa_String *name,
1402 [in] uint32 unknown,
1403 [in,unique] samr_Password *hash
1407 /************************/
1409 /************************/
1410 typedef [bitmap32bit] bitmap {
1411 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1412 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1413 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1414 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1415 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1416 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1417 } samr_ValidateFieldsPresent;
1420 NetValidateAuthentication = 1,
1421 NetValidatePasswordChange= 2,
1422 NetValidatePasswordReset = 3
1423 } samr_ValidatePasswordLevel;
1425 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1426 * identified the mapping of
1427 * - NERR_PasswordFilterError
1428 * - NERR_PasswordExpired and
1429 * - NERR_PasswordCantChange
1434 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1435 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1436 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1437 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1438 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1439 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1440 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1441 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1442 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1443 } samr_ValidationStatus;
1447 [size_is(length)] uint8 *data;
1448 } samr_ValidationBlob;
1451 samr_ValidateFieldsPresent fields_present;
1452 NTTIME_hyper last_password_change;
1453 NTTIME_hyper bad_password_time;
1454 NTTIME_hyper lockout_time;
1455 uint32 bad_pwd_count;
1456 uint32 pwd_history_len;
1457 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1458 } samr_ValidatePasswordInfo;
1461 samr_ValidatePasswordInfo info;
1462 samr_ValidationStatus status;
1463 } samr_ValidatePasswordRepCtr;
1465 typedef [switch_type(uint16)] union {
1466 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1467 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1468 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1469 } samr_ValidatePasswordRep;
1472 samr_ValidatePasswordInfo info;
1473 lsa_StringLarge password;
1474 lsa_StringLarge account;
1475 samr_ValidationBlob hash;
1476 boolean8 pwd_must_change_at_next_logon;
1477 boolean8 clear_lockout;
1478 } samr_ValidatePasswordReq3;
1481 samr_ValidatePasswordInfo info;
1482 lsa_StringLarge password;
1483 lsa_StringLarge account;
1484 samr_ValidationBlob hash;
1485 boolean8 password_matched;
1486 } samr_ValidatePasswordReq2;
1489 samr_ValidatePasswordInfo info;
1490 boolean8 password_matched;
1491 } samr_ValidatePasswordReq1;
1493 typedef [switch_type(uint16)] union {
1494 [case(1)] samr_ValidatePasswordReq1 req1;
1495 [case(2)] samr_ValidatePasswordReq2 req2;
1496 [case(3)] samr_ValidatePasswordReq3 req3;
1497 } samr_ValidatePasswordReq;
1499 NTSTATUS samr_ValidatePassword(
1500 [in] samr_ValidatePasswordLevel level,
1501 [in,switch_is(level)] samr_ValidatePasswordReq req,
1502 [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep