samr: fix samr_UserInfo18. It also contains password_expired, thanks metze.
[Samba.git] / librpc / idl / samr.idl
blob91764e3e9abb6e81cc69e3af7d33ba62ae193b59
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 /* SAM database types */
21 typedef [public,v1_enum] enum {
22 SAM_DATABASE_DOMAIN = 0, /* Domain users and groups */
23 SAM_DATABASE_BUILTIN = 1, /* BUILTIN users and groups */
24 SAM_DATABASE_PRIVS = 2 /* Privileges */
25 } netr_SamDatabaseID;
27 typedef [public,v1_enum] enum {
28 SAMR_REJECT_OTHER = 0,
29 SAMR_REJECT_TOO_SHORT = 1,
30 SAMR_REJECT_IN_HISTORY = 2,
31 SAMR_REJECT_COMPLEXITY = 5
32 } samr_RejectReason;
36 /* account control (acct_flags) bits */
37 typedef [public,bitmap32bit] bitmap {
38 ACB_DISABLED = 0x00000001, /* 1 = User account disabled */
39 ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */
40 ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */
41 ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */
42 ACB_NORMAL = 0x00000010, /* 1 = Normal user account */
43 ACB_MNS = 0x00000020, /* 1 = MNS logon user account */
44 ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */
45 ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */
46 ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */
47 ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */
48 ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */
49 ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encryped text password is allowed */
50 ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */
51 ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */
52 ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */
53 ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
54 ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
55 ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
56 ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */
57 } samr_AcctFlags;
59 /* SAM server specific access rights */
61 typedef [bitmap32bit] bitmap {
62 SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
63 SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
64 SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
65 SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
66 SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
67 SAMR_ACCESS_OPEN_DOMAIN = 0x00000020
68 } samr_ConnectAccessMask;
70 const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
72 const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
73 (STANDARD_RIGHTS_REQUIRED_ACCESS |
74 SAMR_ACCESS_ALL_ACCESS);
76 const int GENERIC_RIGHTS_SAM_READ =
77 (STANDARD_RIGHTS_READ_ACCESS |
78 SAMR_ACCESS_ENUM_DOMAINS);
80 const int GENERIC_RIGHTS_SAM_WRITE =
81 (STANDARD_RIGHTS_WRITE_ACCESS |
82 SAMR_ACCESS_CREATE_DOMAIN |
83 SAMR_ACCESS_INITIALIZE_SERVER |
84 SAMR_ACCESS_SHUTDOWN_SERVER);
86 const int GENERIC_RIGHTS_SAM_EXECUTE =
87 (STANDARD_RIGHTS_EXECUTE_ACCESS |
88 SAMR_ACCESS_OPEN_DOMAIN |
89 SAMR_ACCESS_CONNECT_TO_SERVER);
91 /* User Object specific access rights */
93 typedef [bitmap32bit] bitmap {
94 SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
95 SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
96 SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
97 SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
98 SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
99 SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
100 SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
101 SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
102 SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
103 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
104 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
105 } samr_UserAccessMask;
107 const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF;
109 const int GENERIC_RIGHTS_USER_ALL_ACCESS =
110 (STANDARD_RIGHTS_REQUIRED_ACCESS |
111 SAMR_USER_ACCESS_ALL_ACCESS); /* 0x000f07ff */
113 const int GENERIC_RIGHTS_USER_READ =
114 (STANDARD_RIGHTS_READ_ACCESS |
115 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP |
116 SAMR_USER_ACCESS_GET_GROUPS |
117 SAMR_USER_ACCESS_GET_ATTRIBUTES |
118 SAMR_USER_ACCESS_GET_LOGONINFO |
119 SAMR_USER_ACCESS_GET_LOCALE); /* 0x0002031a */
121 const int GENERIC_RIGHTS_USER_WRITE =
122 (STANDARD_RIGHTS_WRITE_ACCESS |
123 SAMR_USER_ACCESS_CHANGE_PASSWORD |
124 SAMR_USER_ACCESS_SET_LOC_COM |
125 SAMR_USER_ACCESS_SET_ATTRIBUTES |
126 SAMR_USER_ACCESS_SET_PASSWORD |
127 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP); /* 0x000204e4 */
129 const int GENERIC_RIGHTS_USER_EXECUTE =
130 (STANDARD_RIGHTS_EXECUTE_ACCESS |
131 SAMR_USER_ACCESS_CHANGE_PASSWORD |
132 SAMR_USER_ACCESS_GET_NAME_ETC); /* 0x00020041 */
134 /* Domain Object specific access rights */
136 typedef [bitmap32bit] bitmap {
137 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
138 SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
139 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
140 SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
141 SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
142 SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
143 SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
144 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
145 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
146 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
147 SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
148 } samr_DomainAccessMask;
150 const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF;
152 const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS =
153 (STANDARD_RIGHTS_REQUIRED_ACCESS |
154 SAMR_DOMAIN_ACCESS_ALL_ACCESS);
156 const int GENERIC_RIGHTS_DOMAIN_READ =
157 (STANDARD_RIGHTS_READ_ACCESS |
158 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS |
159 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2);
161 const int GENERIC_RIGHTS_DOMAIN_WRITE =
162 (STANDARD_RIGHTS_WRITE_ACCESS |
163 SAMR_DOMAIN_ACCESS_SET_INFO_3 |
164 SAMR_DOMAIN_ACCESS_CREATE_ALIAS |
165 SAMR_DOMAIN_ACCESS_CREATE_GROUP |
166 SAMR_DOMAIN_ACCESS_CREATE_USER |
167 SAMR_DOMAIN_ACCESS_SET_INFO_2 |
168 SAMR_DOMAIN_ACCESS_SET_INFO_1);
170 const int GENERIC_RIGHTS_DOMAIN_EXECUTE =
171 (STANDARD_RIGHTS_EXECUTE_ACCESS |
172 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT |
173 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS |
174 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1);
176 /* Group Object specific access rights */
178 typedef [bitmap32bit] bitmap {
179 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
180 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
181 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
182 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
183 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
184 } samr_GroupAccessMask;
186 const int SAMR_GROUP_ACCESS_ALL_ACCESS = 0x0000001F;
188 const int GENERIC_RIGHTS_GROUP_ALL_ACCESS =
189 (STANDARD_RIGHTS_REQUIRED_ACCESS |
190 SAMR_GROUP_ACCESS_ALL_ACCESS); /* 0x000f001f */
192 const int GENERIC_RIGHTS_GROUP_READ =
193 (STANDARD_RIGHTS_READ_ACCESS |
194 SAMR_GROUP_ACCESS_GET_MEMBERS); /* 0x00020010 */
196 const int GENERIC_RIGHTS_GROUP_WRITE =
197 (STANDARD_RIGHTS_WRITE_ACCESS |
198 SAMR_GROUP_ACCESS_REMOVE_MEMBER |
199 SAMR_GROUP_ACCESS_ADD_MEMBER |
200 SAMR_GROUP_ACCESS_SET_INFO); /* 0x0002000e */
202 const int GENERIC_RIGHTS_GROUP_EXECUTE =
203 (STANDARD_RIGHTS_EXECUTE_ACCESS |
204 SAMR_GROUP_ACCESS_LOOKUP_INFO); /* 0x00020001 */
206 /* Alias Object specific access rights */
208 typedef [bitmap32bit] bitmap {
209 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
210 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
211 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
212 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
213 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
214 } samr_AliasAccessMask;
216 const int SAMR_ALIAS_ACCESS_ALL_ACCESS = 0x0000001F;
218 const int GENERIC_RIGHTS_ALIAS_ALL_ACCESS =
219 (STANDARD_RIGHTS_REQUIRED_ACCESS |
220 SAMR_ALIAS_ACCESS_ALL_ACCESS); /* 0x000f001f */
222 const int GENERIC_RIGHTS_ALIAS_READ =
223 (STANDARD_RIGHTS_READ_ACCESS |
224 SAMR_ALIAS_ACCESS_GET_MEMBERS); /* 0x00020004 */
226 const int GENERIC_RIGHTS_ALIAS_WRITE =
227 (STANDARD_RIGHTS_WRITE_ACCESS |
228 SAMR_ALIAS_ACCESS_REMOVE_MEMBER |
229 SAMR_ALIAS_ACCESS_ADD_MEMBER |
230 SAMR_ALIAS_ACCESS_SET_INFO); /* 0x00020013 */
232 const int GENERIC_RIGHTS_ALIAS_EXECUTE =
233 (STANDARD_RIGHTS_EXECUTE_ACCESS |
234 SAMR_ALIAS_ACCESS_LOOKUP_INFO); /* 0x00020008 */
236 /******************/
237 /* Function: 0x00 */
238 NTSTATUS samr_Connect (
239 /* notice the lack of [string] */
240 [in,unique] uint16 *system_name,
241 [in] samr_ConnectAccessMask access_mask,
242 [out,ref] policy_handle *connect_handle
246 /******************/
247 /* Function: 0x01 */
248 [public] NTSTATUS samr_Close (
249 [in,out,ref] policy_handle *handle
252 /******************/
253 /* Function: 0x02 */
255 NTSTATUS samr_SetSecurity (
256 [in,ref] policy_handle *handle,
257 [in] security_secinfo sec_info,
258 [in,ref] sec_desc_buf *sdbuf
261 /******************/
262 /* Function: 0x03 */
264 NTSTATUS samr_QuerySecurity (
265 [in,ref] policy_handle *handle,
266 [in] security_secinfo sec_info,
267 [out,ref] sec_desc_buf **sdbuf
270 /******************/
271 /* Function: 0x04 */
274 shutdown the SAM - once you call this the SAM will be dead
276 NTSTATUS samr_Shutdown (
277 [in,ref] policy_handle *connect_handle
280 /******************/
281 /* Function: 0x05 */
282 NTSTATUS samr_LookupDomain (
283 [in,ref] policy_handle *connect_handle,
284 [in,ref] lsa_String *domain_name,
285 [out,ref] dom_sid2 **sid
289 /******************/
290 /* Function: 0x06 */
292 typedef struct {
293 uint32 idx;
294 lsa_String name;
295 } samr_SamEntry;
297 typedef struct {
298 uint32 count;
299 [size_is(count)] samr_SamEntry *entries;
300 } samr_SamArray;
302 NTSTATUS samr_EnumDomains (
303 [in] policy_handle *connect_handle,
304 [in,out,ref] uint32 *resume_handle,
305 [out,ref] samr_SamArray **sam,
306 [in] uint32 buf_size,
307 [out,ref] uint32 *num_entries
311 /************************/
312 /* Function 0x07 */
313 [public] NTSTATUS samr_OpenDomain(
314 [in,ref] policy_handle *connect_handle,
315 [in] samr_DomainAccessMask access_mask,
316 [in,ref] dom_sid2 *sid,
317 [out,ref] policy_handle *domain_handle
320 /************************/
321 /* Function 0x08 */
322 /* server roles */
323 typedef [v1_enum] enum {
324 SAMR_ROLE_STANDALONE = 0,
325 SAMR_ROLE_DOMAIN_MEMBER = 1,
326 SAMR_ROLE_DOMAIN_BDC = 2,
327 SAMR_ROLE_DOMAIN_PDC = 3
328 } samr_Role;
330 /* password properties flags */
331 typedef [public,bitmap32bit] bitmap {
332 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
333 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
334 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
335 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
336 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
337 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
338 } samr_PasswordProperties;
340 typedef [v1_enum] enum {
341 DOMAIN_SERVER_ENABLED = 1,
342 DOMAIN_SERVER_DISABLED = 2
343 } samr_DomainServerState;
345 typedef struct {
346 uint16 min_password_length;
347 uint16 password_history_length;
348 samr_PasswordProperties password_properties;
349 /* yes, these are signed. They are in negative 100ns */
350 dlong max_password_age;
351 dlong min_password_age;
352 } samr_DomInfo1;
354 typedef struct {
355 NTTIME force_logoff_time;
356 lsa_String oem_information; /* comment */
357 lsa_String domain_name;
358 lsa_String primary; /* PDC name if this is a BDC */
359 udlong sequence_num;
360 samr_DomainServerState domain_server_state;
361 samr_Role role;
362 uint32 unknown3;
363 uint32 num_users;
364 uint32 num_groups;
365 uint32 num_aliases;
366 } samr_DomGeneralInformation;
368 typedef struct {
369 NTTIME force_logoff_time;
370 } samr_DomInfo3;
372 typedef struct {
373 lsa_String oem_information; /* comment */
374 } samr_DomOEMInformation;
376 typedef struct {
377 lsa_String domain_name;
378 } samr_DomInfo5;
380 typedef struct {
381 lsa_String primary;
382 } samr_DomInfo6;
384 typedef struct {
385 samr_Role role;
386 } samr_DomInfo7;
388 typedef struct {
389 hyper sequence_num;
390 NTTIME domain_create_time;
391 } samr_DomInfo8;
393 typedef struct {
394 samr_DomainServerState domain_server_state;
395 } samr_DomInfo9;
397 typedef struct {
398 samr_DomGeneralInformation general;
399 hyper lockout_duration;
400 hyper lockout_window;
401 uint16 lockout_threshold;
402 } samr_DomGeneralInformation2;
404 typedef struct {
405 hyper lockout_duration;
406 hyper lockout_window;
407 uint16 lockout_threshold;
408 } samr_DomInfo12;
410 typedef struct {
411 hyper sequence_num;
412 NTTIME domain_create_time;
413 hyper modified_count_at_last_promotion;
414 } samr_DomInfo13;
416 typedef [switch_type(uint16)] union {
417 [case(1)] samr_DomInfo1 info1;
418 [case(2)] samr_DomGeneralInformation general;
419 [case(3)] samr_DomInfo3 info3;
420 [case(4)] samr_DomOEMInformation oem;
421 [case(5)] samr_DomInfo5 info5;
422 [case(6)] samr_DomInfo6 info6;
423 [case(7)] samr_DomInfo7 info7;
424 [case(8)] samr_DomInfo8 info8;
425 [case(9)] samr_DomInfo9 info9;
426 [case(11)] samr_DomGeneralInformation2 general2;
427 [case(12)] samr_DomInfo12 info12;
428 [case(13)] samr_DomInfo13 info13;
429 } samr_DomainInfo;
431 NTSTATUS samr_QueryDomainInfo(
432 [in,ref] policy_handle *domain_handle,
433 [in] uint16 level,
434 [out,ref,switch_is(level)] samr_DomainInfo **info
437 /************************/
438 /* Function 0x09 */
440 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
441 call in w2k3
443 NTSTATUS samr_SetDomainInfo(
444 [in,ref] policy_handle *domain_handle,
445 [in] uint16 level,
446 [in,switch_is(level),ref] samr_DomainInfo *info
450 /************************/
451 /* Function 0x0a */
452 NTSTATUS samr_CreateDomainGroup(
453 [in,ref] policy_handle *domain_handle,
454 [in,ref] lsa_String *name,
455 [in] samr_GroupAccessMask access_mask,
456 [out,ref] policy_handle *group_handle,
457 [out,ref] uint32 *rid
461 /************************/
462 /* Function 0x0b */
463 NTSTATUS samr_EnumDomainGroups(
464 [in] policy_handle *domain_handle,
465 [in,out,ref] uint32 *resume_handle,
466 [out,ref] samr_SamArray **sam,
467 [in] uint32 max_size,
468 [out,ref] uint32 *num_entries
471 /************************/
472 /* Function 0x0c */
473 NTSTATUS samr_CreateUser(
474 [in,ref] policy_handle *domain_handle,
475 [in,ref] lsa_String *account_name,
476 [in] samr_UserAccessMask access_mask,
477 [out,ref] policy_handle *user_handle,
478 [out,ref] uint32 *rid
481 /************************/
482 /* Function 0x0d */
485 /* w2k3 treats max_size as max_users*54 and sets the
486 resume_handle as the rid of the last user sent
488 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
490 NTSTATUS samr_EnumDomainUsers(
491 [in] policy_handle *domain_handle,
492 [in,out,ref] uint32 *resume_handle,
493 [in] samr_AcctFlags acct_flags,
494 [out,ref] samr_SamArray **sam,
495 [in] uint32 max_size,
496 [out,ref] uint32 *num_entries
499 /************************/
500 /* Function 0x0e */
501 NTSTATUS samr_CreateDomAlias(
502 [in,ref] policy_handle *domain_handle,
503 [in,ref] lsa_String *alias_name,
504 [in] samr_AliasAccessMask access_mask,
505 [out,ref] policy_handle *alias_handle,
506 [out,ref] uint32 *rid
509 /************************/
510 /* Function 0x0f */
511 NTSTATUS samr_EnumDomainAliases(
512 [in] policy_handle *domain_handle,
513 [in,out,ref] uint32 *resume_handle,
514 [out,ref] samr_SamArray **sam,
515 [in] uint32 max_size,
516 [out,ref] uint32 *num_entries
519 /************************/
520 /* Function 0x10 */
522 typedef struct {
523 [range(0,1024)] uint32 count;
524 [size_is(count)] uint32 *ids;
525 } samr_Ids;
527 NTSTATUS samr_GetAliasMembership(
528 [in,ref] policy_handle *domain_handle,
529 [in,ref] lsa_SidArray *sids,
530 [out,ref] samr_Ids *rids
533 /************************/
534 /* Function 0x11 */
536 [public] NTSTATUS samr_LookupNames(
537 [in,ref] policy_handle *domain_handle,
538 [in,range(0,1000)] uint32 num_names,
539 [in,size_is(1000),length_is(num_names)] lsa_String names[],
540 [out,ref] samr_Ids *rids,
541 [out,ref] samr_Ids *types
545 /************************/
546 /* Function 0x12 */
547 NTSTATUS samr_LookupRids(
548 [in,ref] policy_handle *domain_handle,
549 [in,range(0,1000)] uint32 num_rids,
550 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
551 [out,ref] lsa_Strings *names,
552 [out,ref] samr_Ids *types
555 /************************/
556 /* Function 0x13 */
557 NTSTATUS samr_OpenGroup(
558 [in,ref] policy_handle *domain_handle,
559 [in] samr_GroupAccessMask access_mask,
560 [in] uint32 rid,
561 [out,ref] policy_handle *group_handle
564 /* Group attributes */
565 typedef [public,bitmap32bit] bitmap {
566 SE_GROUP_MANDATORY = 0x00000001,
567 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
568 SE_GROUP_ENABLED = 0x00000004,
569 SE_GROUP_OWNER = 0x00000008,
570 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
571 SE_GROUP_RESOURCE = 0x20000000,
572 SE_GROUP_LOGON_ID = 0xC0000000
573 } samr_GroupAttrs;
575 /************************/
576 /* Function 0x14 */
578 typedef struct {
579 lsa_String name;
580 samr_GroupAttrs attributes;
581 uint32 num_members;
582 lsa_String description;
583 } samr_GroupInfoAll;
585 typedef struct {
586 samr_GroupAttrs attributes;
587 } samr_GroupInfoAttributes;
589 typedef struct {
590 lsa_String description;
591 } samr_GroupInfoDescription;
593 typedef enum {
594 GROUPINFOALL = 1,
595 GROUPINFONAME = 2,
596 GROUPINFOATTRIBUTES = 3,
597 GROUPINFODESCRIPTION = 4,
598 GROUPINFOALL2 = 5
599 } samr_GroupInfoEnum;
601 typedef [switch_type(samr_GroupInfoEnum)] union {
602 [case(GROUPINFOALL)] samr_GroupInfoAll all;
603 [case(GROUPINFONAME)] lsa_String name;
604 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
605 [case(GROUPINFODESCRIPTION)] lsa_String description;
606 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
607 } samr_GroupInfo;
609 NTSTATUS samr_QueryGroupInfo(
610 [in,ref] policy_handle *group_handle,
611 [in] samr_GroupInfoEnum level,
612 [out,ref,switch_is(level)] samr_GroupInfo **info
615 /************************/
616 /* Function 0x15 */
617 NTSTATUS samr_SetGroupInfo(
618 [in,ref] policy_handle *group_handle,
619 [in] samr_GroupInfoEnum level,
620 [in,switch_is(level),ref] samr_GroupInfo *info
623 /************************/
624 /* Function 0x16 */
625 NTSTATUS samr_AddGroupMember(
626 [in,ref] policy_handle *group_handle,
627 [in] uint32 rid,
628 [in] uint32 flags
631 /************************/
632 /* Function 0x17 */
633 NTSTATUS samr_DeleteDomainGroup(
634 [in,out,ref] policy_handle *group_handle
637 /************************/
638 /* Function 0x18 */
639 NTSTATUS samr_DeleteGroupMember(
640 [in,ref] policy_handle *group_handle,
641 [in] uint32 rid
645 /************************/
646 /* Function 0x19 */
647 typedef struct {
648 uint32 count;
649 [size_is(count)] uint32 *rids;
650 [size_is(count)] uint32 *types;
651 } samr_RidTypeArray;
653 NTSTATUS samr_QueryGroupMember(
654 [in,ref] policy_handle *group_handle,
655 [out,ref] samr_RidTypeArray **rids
659 /************************/
660 /* Function 0x1a */
663 win2003 seems to accept any data at all for the two integers
664 below, and doesn't seem to do anything with them that I can
665 see. Weird. I really expected the first integer to be a rid
666 and the second to be the attributes for that rid member.
668 NTSTATUS samr_SetMemberAttributesOfGroup(
669 [in,ref] policy_handle *group_handle,
670 [in] uint32 unknown1,
671 [in] uint32 unknown2
675 /************************/
676 /* Function 0x1b */
677 NTSTATUS samr_OpenAlias (
678 [in,ref] policy_handle *domain_handle,
679 [in] samr_AliasAccessMask access_mask,
680 [in] uint32 rid,
681 [out,ref] policy_handle *alias_handle
685 /************************/
686 /* Function 0x1c */
688 typedef struct {
689 lsa_String name;
690 uint32 num_members;
691 lsa_String description;
692 } samr_AliasInfoAll;
694 typedef enum {
695 ALIASINFOALL = 1,
696 ALIASINFONAME = 2,
697 ALIASINFODESCRIPTION = 3
698 } samr_AliasInfoEnum;
700 typedef [switch_type(samr_AliasInfoEnum)] union {
701 [case(ALIASINFOALL)] samr_AliasInfoAll all;
702 [case(ALIASINFONAME)] lsa_String name;
703 [case(ALIASINFODESCRIPTION)] lsa_String description;
704 } samr_AliasInfo;
706 NTSTATUS samr_QueryAliasInfo(
707 [in,ref] policy_handle *alias_handle,
708 [in] samr_AliasInfoEnum level,
709 [out,ref,switch_is(level)] samr_AliasInfo **info
712 /************************/
713 /* Function 0x1d */
714 NTSTATUS samr_SetAliasInfo(
715 [in,ref] policy_handle *alias_handle,
716 [in] samr_AliasInfoEnum level,
717 [in,switch_is(level),ref] samr_AliasInfo *info
720 /************************/
721 /* Function 0x1e */
722 NTSTATUS samr_DeleteDomAlias(
723 [in,out,ref] policy_handle *alias_handle
726 /************************/
727 /* Function 0x1f */
728 NTSTATUS samr_AddAliasMember(
729 [in,ref] policy_handle *alias_handle,
730 [in,ref] dom_sid2 *sid
733 /************************/
734 /* Function 0x20 */
735 NTSTATUS samr_DeleteAliasMember(
736 [in,ref] policy_handle *alias_handle,
737 [in,ref] dom_sid2 *sid
740 /************************/
741 /* Function 0x21 */
742 NTSTATUS samr_GetMembersInAlias(
743 [in,ref] policy_handle *alias_handle,
744 [out,ref] lsa_SidArray *sids
747 /************************/
748 /* Function 0x22 */
749 [public] NTSTATUS samr_OpenUser(
750 [in,ref] policy_handle *domain_handle,
751 [in] samr_UserAccessMask access_mask,
752 [in] uint32 rid,
753 [out,ref] policy_handle *user_handle
756 /************************/
757 /* Function 0x23 */
758 NTSTATUS samr_DeleteUser(
759 [in,out,ref] policy_handle *user_handle
762 /************************/
763 /* Function 0x24 */
764 typedef struct {
765 lsa_String account_name;
766 lsa_String full_name;
767 uint32 primary_gid;
768 lsa_String description;
769 lsa_String comment;
770 } samr_UserInfo1;
772 typedef struct {
773 lsa_String comment;
774 lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
775 uint16 country_code;
776 uint16 code_page;
777 } samr_UserInfo2;
779 /* this is also used in samr and netlogon */
780 typedef [public, flag(NDR_PAHEX)] struct {
781 uint16 units_per_week;
782 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
783 } samr_LogonHours;
785 typedef struct {
786 lsa_String account_name;
787 lsa_String full_name;
788 uint32 rid;
789 uint32 primary_gid;
790 lsa_String home_directory;
791 lsa_String home_drive;
792 lsa_String logon_script;
793 lsa_String profile_path;
794 lsa_String workstations;
795 NTTIME last_logon;
796 NTTIME last_logoff;
797 NTTIME last_password_change;
798 NTTIME allow_password_change;
799 NTTIME force_password_change;
800 samr_LogonHours logon_hours;
801 uint16 bad_password_count;
802 uint16 logon_count;
803 samr_AcctFlags acct_flags;
804 } samr_UserInfo3;
806 typedef struct {
807 samr_LogonHours logon_hours;
808 } samr_UserInfo4;
810 typedef struct {
811 lsa_String account_name;
812 lsa_String full_name;
813 uint32 rid;
814 uint32 primary_gid;
815 lsa_String home_directory;
816 lsa_String home_drive;
817 lsa_String logon_script;
818 lsa_String profile_path;
819 lsa_String description;
820 lsa_String workstations;
821 NTTIME last_logon;
822 NTTIME last_logoff;
823 samr_LogonHours logon_hours;
824 uint16 bad_password_count;
825 uint16 logon_count;
826 NTTIME last_password_change;
827 NTTIME acct_expiry;
828 samr_AcctFlags acct_flags;
829 } samr_UserInfo5;
831 typedef struct {
832 lsa_String account_name;
833 lsa_String full_name;
834 } samr_UserInfo6;
836 typedef struct {
837 lsa_String account_name;
838 } samr_UserInfo7;
840 typedef struct {
841 lsa_String full_name;
842 } samr_UserInfo8;
844 typedef struct {
845 uint32 primary_gid;
846 } samr_UserInfo9;
848 typedef struct {
849 lsa_String home_directory;
850 lsa_String home_drive;
851 } samr_UserInfo10;
853 typedef struct {
854 lsa_String logon_script;
855 } samr_UserInfo11;
857 typedef struct {
858 lsa_String profile_path;
859 } samr_UserInfo12;
861 typedef struct {
862 lsa_String description;
863 } samr_UserInfo13;
865 typedef struct {
866 lsa_String workstations;
867 } samr_UserInfo14;
869 typedef struct {
870 samr_AcctFlags acct_flags;
871 } samr_UserInfo16;
873 typedef struct {
874 NTTIME acct_expiry;
875 } samr_UserInfo17;
877 typedef [public, flag(NDR_PAHEX)] struct {
878 uint8 hash[16];
879 } samr_Password;
881 typedef struct {
882 samr_Password lm_pwd;
883 samr_Password nt_pwd;
884 boolean8 lm_pwd_active;
885 boolean8 nt_pwd_active;
886 uint8 password_expired;
887 } samr_UserInfo18;
889 typedef struct {
890 lsa_BinaryString parameters;
891 } samr_UserInfo20;
893 /* this defines the bits used for fields_present in info21 */
894 typedef [bitmap32bit] bitmap {
895 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
896 SAMR_FIELD_FULL_NAME = 0x00000002,
897 SAMR_FIELD_RID = 0x00000004,
898 SAMR_FIELD_PRIMARY_GID = 0x00000008,
899 SAMR_FIELD_DESCRIPTION = 0x00000010,
900 SAMR_FIELD_COMMENT = 0x00000020,
901 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
902 SAMR_FIELD_HOME_DRIVE = 0x00000080,
903 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
904 SAMR_FIELD_PROFILE_PATH = 0x00000200,
905 SAMR_FIELD_WORKSTATIONS = 0x00000400,
906 SAMR_FIELD_LAST_LOGON = 0x00000800,
907 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
908 SAMR_FIELD_LOGON_HOURS = 0x00002000,
909 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
910 SAMR_FIELD_NUM_LOGONS = 0x00008000,
911 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
912 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
913 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
914 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
915 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
916 SAMR_FIELD_PARAMETERS = 0x00200000,
917 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
918 SAMR_FIELD_CODE_PAGE = 0x00800000,
919 SAMR_FIELD_NT_PASSWORD_PRESENT = 0x01000000, /* either of these */
920 SAMR_FIELD_LM_PASSWORD_PRESENT = 0x02000000, /* two bits seems to work */
921 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
922 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
923 SAMR_FIELD_SEC_DESC = 0x10000000,
924 SAMR_FIELD_OWF_PWD = 0x20000000
925 } samr_FieldsPresent;
927 /* used for 'password_expired' in samr_UserInfo21 */
928 const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
929 const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
931 typedef struct {
932 NTTIME last_logon;
933 NTTIME last_logoff;
934 NTTIME last_password_change;
935 NTTIME acct_expiry;
936 NTTIME allow_password_change;
937 NTTIME force_password_change;
938 lsa_String account_name;
939 lsa_String full_name;
940 lsa_String home_directory;
941 lsa_String home_drive;
942 lsa_String logon_script;
943 lsa_String profile_path;
944 lsa_String description;
945 lsa_String workstations;
946 lsa_String comment;
947 lsa_BinaryString parameters;
948 lsa_BinaryString lm_owf_password;
949 lsa_BinaryString nt_owf_password;
950 lsa_String unknown3;
951 uint32 buf_count;
952 [size_is(buf_count)] uint8 *buffer;
953 uint32 rid;
954 uint32 primary_gid;
955 samr_AcctFlags acct_flags;
956 samr_FieldsPresent fields_present;
957 samr_LogonHours logon_hours;
958 uint16 bad_password_count;
959 uint16 logon_count;
960 uint16 country_code;
961 uint16 code_page;
962 uint8 lm_password_set;
963 uint8 nt_password_set;
964 uint8 password_expired;
965 uint8 unknown4;
966 } samr_UserInfo21;
968 typedef [public, flag(NDR_PAHEX)] struct {
969 uint8 data[516];
970 } samr_CryptPassword;
972 typedef struct {
973 samr_UserInfo21 info;
974 samr_CryptPassword password;
975 } samr_UserInfo23;
977 typedef struct {
978 samr_CryptPassword password;
979 uint8 password_expired;
980 } samr_UserInfo24;
982 typedef [flag(NDR_PAHEX)] struct {
983 uint8 data[532];
984 } samr_CryptPasswordEx;
986 typedef struct {
987 samr_UserInfo21 info;
988 samr_CryptPasswordEx password;
989 } samr_UserInfo25;
991 typedef struct {
992 samr_CryptPasswordEx password;
993 uint8 password_expired;
994 } samr_UserInfo26;
996 typedef [switch_type(uint16)] union {
997 [case(1)] samr_UserInfo1 info1;
998 [case(2)] samr_UserInfo2 info2;
999 [case(3)] samr_UserInfo3 info3;
1000 [case(4)] samr_UserInfo4 info4;
1001 [case(5)] samr_UserInfo5 info5;
1002 [case(6)] samr_UserInfo6 info6;
1003 [case(7)] samr_UserInfo7 info7;
1004 [case(8)] samr_UserInfo8 info8;
1005 [case(9)] samr_UserInfo9 info9;
1006 [case(10)] samr_UserInfo10 info10;
1007 [case(11)] samr_UserInfo11 info11;
1008 [case(12)] samr_UserInfo12 info12;
1009 [case(13)] samr_UserInfo13 info13;
1010 [case(14)] samr_UserInfo14 info14;
1011 [case(16)] samr_UserInfo16 info16;
1012 [case(17)] samr_UserInfo17 info17;
1013 [case(18)] samr_UserInfo18 info18;
1014 [case(20)] samr_UserInfo20 info20;
1015 [case(21)] samr_UserInfo21 info21;
1016 [case(23)] samr_UserInfo23 info23;
1017 [case(24)] samr_UserInfo24 info24;
1018 [case(25)] samr_UserInfo25 info25;
1019 [case(26)] samr_UserInfo26 info26;
1020 } samr_UserInfo;
1022 [public] NTSTATUS samr_QueryUserInfo(
1023 [in,ref] policy_handle *user_handle,
1024 [in] uint16 level,
1025 [out,ref,switch_is(level)] samr_UserInfo **info
1029 /************************/
1030 /* Function 0x25 */
1031 [public] NTSTATUS samr_SetUserInfo(
1032 [in,ref] policy_handle *user_handle,
1033 [in] uint16 level,
1034 [in,ref,switch_is(level)] samr_UserInfo *info
1037 /************************/
1038 /* Function 0x26 */
1040 this is a password change interface that doesn't give
1041 the server the plaintext password. Depricated.
1043 NTSTATUS samr_ChangePasswordUser(
1044 [in,ref] policy_handle *user_handle,
1045 [in] boolean8 lm_present,
1046 [in,unique] samr_Password *old_lm_crypted,
1047 [in,unique] samr_Password *new_lm_crypted,
1048 [in] boolean8 nt_present,
1049 [in,unique] samr_Password *old_nt_crypted,
1050 [in,unique] samr_Password *new_nt_crypted,
1051 [in] boolean8 cross1_present,
1052 [in,unique] samr_Password *nt_cross,
1053 [in] boolean8 cross2_present,
1054 [in,unique] samr_Password *lm_cross
1057 /************************/
1058 /* Function 0x27 */
1060 typedef [public] struct {
1061 uint32 rid;
1062 samr_GroupAttrs attributes;
1063 } samr_RidWithAttribute;
1065 typedef [public] struct {
1066 uint32 count;
1067 [size_is(count)] samr_RidWithAttribute *rids;
1068 } samr_RidWithAttributeArray;
1070 NTSTATUS samr_GetGroupsForUser(
1071 [in,ref] policy_handle *user_handle,
1072 [out,ref] samr_RidWithAttributeArray **rids
1075 /************************/
1076 /* Function 0x28 */
1078 typedef struct {
1079 uint32 idx;
1080 uint32 rid;
1081 samr_AcctFlags acct_flags;
1082 lsa_String account_name;
1083 lsa_String description;
1084 lsa_String full_name;
1085 } samr_DispEntryGeneral;
1087 typedef struct {
1088 uint32 count;
1089 [size_is(count)] samr_DispEntryGeneral *entries;
1090 } samr_DispInfoGeneral;
1092 typedef struct {
1093 uint32 idx;
1094 uint32 rid;
1095 samr_AcctFlags acct_flags;
1096 lsa_String account_name;
1097 lsa_String description;
1098 } samr_DispEntryFull;
1100 typedef struct {
1101 uint32 count;
1102 [size_is(count)] samr_DispEntryFull *entries;
1103 } samr_DispInfoFull;
1105 typedef struct {
1106 uint32 idx;
1107 uint32 rid;
1108 samr_GroupAttrs acct_flags;
1109 lsa_String account_name;
1110 lsa_String description;
1111 } samr_DispEntryFullGroup;
1113 typedef struct {
1114 uint32 count;
1115 [size_is(count)] samr_DispEntryFullGroup *entries;
1116 } samr_DispInfoFullGroups;
1118 typedef struct {
1119 uint32 idx;
1120 lsa_AsciiStringLarge account_name;
1121 } samr_DispEntryAscii;
1123 typedef struct {
1124 uint32 count;
1125 [size_is(count)] samr_DispEntryAscii *entries;
1126 } samr_DispInfoAscii;
1128 typedef [switch_type(uint16)] union {
1129 [case(1)] samr_DispInfoGeneral info1;/* users */
1130 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1131 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1132 [case(4)] samr_DispInfoAscii info4; /* users */
1133 [case(5)] samr_DispInfoAscii info5; /* groups */
1134 } samr_DispInfo;
1136 NTSTATUS samr_QueryDisplayInfo(
1137 [in,ref] policy_handle *domain_handle,
1138 [in] uint16 level,
1139 [in] uint32 start_idx,
1140 [in] uint32 max_entries,
1141 [in] uint32 buf_size,
1142 [out,ref] uint32 *total_size,
1143 [out,ref] uint32 *returned_size,
1144 [out,ref,switch_is(level)] samr_DispInfo *info
1148 /************************/
1149 /* Function 0x29 */
1152 this seems to be an alphabetic search function. The returned index
1153 is the index for samr_QueryDisplayInfo needed to get names occurring
1154 after the specified name. The supplied name does not need to exist
1155 in the database (for example you can supply just a first letter for
1156 searching starting at that letter)
1158 The level corresponds to the samr_QueryDisplayInfo level
1160 NTSTATUS samr_GetDisplayEnumerationIndex(
1161 [in,ref] policy_handle *domain_handle,
1162 [in] uint16 level,
1163 [in,ref] lsa_String *name,
1164 [out,ref] uint32 *idx
1169 /************************/
1170 /* Function 0x2a */
1173 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1175 NTSTATUS samr_TestPrivateFunctionsDomain(
1176 [in,ref] policy_handle *domain_handle
1180 /************************/
1181 /* Function 0x2b */
1184 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1186 NTSTATUS samr_TestPrivateFunctionsUser(
1187 [in,ref] policy_handle *user_handle
1191 /************************/
1192 /* Function 0x2c */
1194 typedef struct {
1195 uint16 min_password_length;
1196 samr_PasswordProperties password_properties;
1197 } samr_PwInfo;
1199 [public] NTSTATUS samr_GetUserPwInfo(
1200 [in,ref] policy_handle *user_handle,
1201 [out,ref] samr_PwInfo *info
1204 /************************/
1205 /* Function 0x2d */
1206 NTSTATUS samr_RemoveMemberFromForeignDomain(
1207 [in,ref] policy_handle *domain_handle,
1208 [in,ref] dom_sid2 *sid
1211 /************************/
1212 /* Function 0x2e */
1215 how is this different from QueryDomainInfo ??
1217 NTSTATUS samr_QueryDomainInfo2(
1218 [in,ref] policy_handle *domain_handle,
1219 [in] uint16 level,
1220 [out,ref,switch_is(level)] samr_DomainInfo **info
1223 /************************/
1224 /* Function 0x2f */
1227 how is this different from QueryUserInfo ??
1229 NTSTATUS samr_QueryUserInfo2(
1230 [in,ref] policy_handle *user_handle,
1231 [in] uint16 level,
1232 [out,ref,switch_is(level)] samr_UserInfo **info
1235 /************************/
1236 /* Function 0x30 */
1239 how is this different from QueryDisplayInfo??
1241 NTSTATUS samr_QueryDisplayInfo2(
1242 [in,ref] policy_handle *domain_handle,
1243 [in] uint16 level,
1244 [in] uint32 start_idx,
1245 [in] uint32 max_entries,
1246 [in] uint32 buf_size,
1247 [out,ref] uint32 *total_size,
1248 [out,ref] uint32 *returned_size,
1249 [out,ref,switch_is(level)] samr_DispInfo *info
1252 /************************/
1253 /* Function 0x31 */
1256 how is this different from GetDisplayEnumerationIndex ??
1258 NTSTATUS samr_GetDisplayEnumerationIndex2(
1259 [in,ref] policy_handle *domain_handle,
1260 [in] uint16 level,
1261 [in,ref] lsa_String *name,
1262 [out,ref] uint32 *idx
1266 /************************/
1267 /* Function 0x32 */
1268 NTSTATUS samr_CreateUser2(
1269 [in,ref] policy_handle *domain_handle,
1270 [in,ref] lsa_String *account_name,
1271 [in] samr_AcctFlags acct_flags,
1272 [in] samr_UserAccessMask access_mask,
1273 [out,ref] policy_handle *user_handle,
1274 [out,ref] uint32 *access_granted,
1275 [out,ref] uint32 *rid
1279 /************************/
1280 /* Function 0x33 */
1283 another duplicate. There must be a reason ....
1285 NTSTATUS samr_QueryDisplayInfo3(
1286 [in,ref] policy_handle *domain_handle,
1287 [in] uint16 level,
1288 [in] uint32 start_idx,
1289 [in] uint32 max_entries,
1290 [in] uint32 buf_size,
1291 [out,ref] uint32 *total_size,
1292 [out,ref] uint32 *returned_size,
1293 [out,ref,switch_is(level)] samr_DispInfo *info
1296 /************************/
1297 /* Function 0x34 */
1298 NTSTATUS samr_AddMultipleMembersToAlias(
1299 [in,ref] policy_handle *alias_handle,
1300 [in,ref] lsa_SidArray *sids
1303 /************************/
1304 /* Function 0x35 */
1305 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1306 [in,ref] policy_handle *alias_handle,
1307 [in,ref] lsa_SidArray *sids
1310 /************************/
1311 /* Function 0x36 */
1313 NTSTATUS samr_OemChangePasswordUser2(
1314 [in,unique] lsa_AsciiString *server,
1315 [in,ref] lsa_AsciiString *account,
1316 [in,unique] samr_CryptPassword *password,
1317 [in,unique] samr_Password *hash
1320 /************************/
1321 /* Function 0x37 */
1322 NTSTATUS samr_ChangePasswordUser2(
1323 [in,unique] lsa_String *server,
1324 [in,ref] lsa_String *account,
1325 [in,unique] samr_CryptPassword *nt_password,
1326 [in,unique] samr_Password *nt_verifier,
1327 [in] boolean8 lm_change,
1328 [in,unique] samr_CryptPassword *lm_password,
1329 [in,unique] samr_Password *lm_verifier
1332 /************************/
1333 /* Function 0x38 */
1334 NTSTATUS samr_GetDomPwInfo(
1335 [in,unique] lsa_String *domain_name,
1336 [out,ref] samr_PwInfo *info
1339 /************************/
1340 /* Function 0x39 */
1341 NTSTATUS samr_Connect2(
1342 [in,unique,string,charset(UTF16)] uint16 *system_name,
1343 [in] samr_ConnectAccessMask access_mask,
1344 [out,ref] policy_handle *connect_handle
1347 /************************/
1348 /* Function 0x3a */
1350 seems to be an exact alias for samr_SetUserInfo()
1352 [public] NTSTATUS samr_SetUserInfo2(
1353 [in,ref] policy_handle *user_handle,
1354 [in] uint16 level,
1355 [in,ref,switch_is(level)] samr_UserInfo *info
1358 /************************/
1359 /* Function 0x3b */
1361 this one is mysterious. I have a few guesses, but nothing working yet
1363 NTSTATUS samr_SetBootKeyInformation(
1364 [in,ref] policy_handle *connect_handle,
1365 [in] uint32 unknown1,
1366 [in] uint32 unknown2,
1367 [in] uint32 unknown3
1370 /************************/
1371 /* Function 0x3c */
1372 NTSTATUS samr_GetBootKeyInformation(
1373 [in,ref] policy_handle *domain_handle,
1374 [out,ref] uint32 *unknown
1377 /************************/
1378 /* Function 0x3d */
1379 NTSTATUS samr_Connect3(
1380 [in,unique,string,charset(UTF16)] uint16 *system_name,
1381 /* this unknown value seems to be completely ignored by w2k3 */
1382 [in] uint32 unknown,
1383 [in] samr_ConnectAccessMask access_mask,
1384 [out,ref] policy_handle *connect_handle
1387 /************************/
1388 /* Function 0x3e */
1390 typedef enum {
1391 SAMR_CONNECT_PRE_W2K = 1,
1392 SAMR_CONNECT_W2K = 2,
1393 SAMR_CONNECT_AFTER_W2K = 3
1394 } samr_ConnectVersion;
1396 NTSTATUS samr_Connect4(
1397 [in,unique,string,charset(UTF16)] uint16 *system_name,
1398 [in] samr_ConnectVersion client_version,
1399 [in] samr_ConnectAccessMask access_mask,
1400 [out,ref] policy_handle *connect_handle
1403 /************************/
1404 /* Function 0x3f */
1406 typedef enum samr_RejectReason samr_RejectReason;
1408 typedef struct {
1409 samr_RejectReason reason;
1410 uint32 unknown1;
1411 uint32 unknown2;
1412 } samr_ChangeReject;
1414 NTSTATUS samr_ChangePasswordUser3(
1415 [in,unique] lsa_String *server,
1416 [in,ref] lsa_String *account,
1417 [in,unique] samr_CryptPassword *nt_password,
1418 [in,unique] samr_Password *nt_verifier,
1419 [in] boolean8 lm_change,
1420 [in,unique] samr_CryptPassword *lm_password,
1421 [in,unique] samr_Password *lm_verifier,
1422 [in,unique] samr_CryptPassword *password3,
1423 [out,ref] samr_DomInfo1 **dominfo,
1424 [out,ref] samr_ChangeReject **reject
1427 /************************/
1428 /* Function 0x40 */
1430 typedef struct {
1431 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1432 uint32 unknown2; /* w2k3 gives 0 */
1433 } samr_ConnectInfo1;
1435 typedef union {
1436 [case(1)] samr_ConnectInfo1 info1;
1437 } samr_ConnectInfo;
1439 [public] NTSTATUS samr_Connect5(
1440 [in,unique,string,charset(UTF16)] uint16 *system_name,
1441 [in] samr_ConnectAccessMask access_mask,
1442 [in] uint32 level_in,
1443 [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
1444 [out,ref] uint32 *level_out,
1445 [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
1446 [out,ref] policy_handle *connect_handle
1449 /************************/
1450 /* Function 0x41 */
1451 NTSTATUS samr_RidToSid(
1452 [in,ref] policy_handle *domain_handle,
1453 [in] uint32 rid,
1454 [out,ref] dom_sid2 **sid
1457 /************************/
1458 /* Function 0x42 */
1461 this should set the DSRM password for the server, which is used
1462 when booting into Directory Services Recovery Mode on a DC. Win2003
1463 gives me NT_STATUS_NOT_SUPPORTED
1466 NTSTATUS samr_SetDsrmPassword(
1467 [in,unique] lsa_String *name,
1468 [in] uint32 unknown,
1469 [in,unique] samr_Password *hash
1473 /************************/
1474 /* Function 0x43 */
1475 /************************/
1476 typedef [bitmap32bit] bitmap {
1477 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1478 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1479 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1480 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1481 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1482 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1483 } samr_ValidateFieldsPresent;
1485 typedef enum {
1486 NetValidateAuthentication = 1,
1487 NetValidatePasswordChange= 2,
1488 NetValidatePasswordReset = 3
1489 } samr_ValidatePasswordLevel;
1491 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1492 * identified the mapping of
1493 * - NERR_PasswordFilterError
1494 * - NERR_PasswordExpired and
1495 * - NERR_PasswordCantChange
1496 * yet - Guenther
1499 typedef enum {
1500 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1501 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1502 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1503 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1504 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1505 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1506 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1507 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1508 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
1509 } samr_ValidationStatus;
1511 typedef struct {
1512 uint32 length;
1513 [size_is(length)] uint8 *data;
1514 } samr_ValidationBlob;
1516 typedef struct {
1517 samr_ValidateFieldsPresent fields_present;
1518 NTTIME_hyper last_password_change;
1519 NTTIME_hyper bad_password_time;
1520 NTTIME_hyper lockout_time;
1521 uint32 bad_pwd_count;
1522 uint32 pwd_history_len;
1523 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1524 } samr_ValidatePasswordInfo;
1526 typedef struct {
1527 samr_ValidatePasswordInfo info;
1528 samr_ValidationStatus status;
1529 } samr_ValidatePasswordRepCtr;
1531 typedef [switch_type(uint16)] union {
1532 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1533 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1534 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1535 } samr_ValidatePasswordRep;
1537 typedef struct {
1538 samr_ValidatePasswordInfo info;
1539 lsa_StringLarge password;
1540 lsa_StringLarge account;
1541 samr_ValidationBlob hash;
1542 boolean8 pwd_must_change_at_next_logon;
1543 boolean8 clear_lockout;
1544 } samr_ValidatePasswordReq3;
1546 typedef struct {
1547 samr_ValidatePasswordInfo info;
1548 lsa_StringLarge password;
1549 lsa_StringLarge account;
1550 samr_ValidationBlob hash;
1551 boolean8 password_matched;
1552 } samr_ValidatePasswordReq2;
1554 typedef struct {
1555 samr_ValidatePasswordInfo info;
1556 boolean8 password_matched;
1557 } samr_ValidatePasswordReq1;
1559 typedef [switch_type(uint16)] union {
1560 [case(1)] samr_ValidatePasswordReq1 req1;
1561 [case(2)] samr_ValidatePasswordReq2 req2;
1562 [case(3)] samr_ValidatePasswordReq3 req3;
1563 } samr_ValidatePasswordReq;
1565 NTSTATUS samr_ValidatePassword(
1566 [in] samr_ValidatePasswordLevel level,
1567 [in,switch_is(level)] samr_ValidatePasswordReq *req,
1568 [out,ref,switch_is(level)] samr_ValidatePasswordRep **rep