winbind: Fix --ping-dc error handling
[Samba.git] / librpc / idl / samr.idl
blobb9d1d34ae33f9a01d3e4615e276368f93e1b11bc
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_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION = 0x00040000,
41 ACB_NO_AUTH_DATA_REQD = 0x00080000, /* 1 = No authorization data required */
42 ACB_PARTIAL_SECRETS_ACCOUNT = 0x00100000,
43 ACB_USE_AES_KEYS = 0x00200000
44 } samr_AcctFlags;
46 /* SAM server specific access rights */
48 typedef [bitmap32bit] bitmap {
49 SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
50 SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
51 SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
52 SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
53 SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
54 SAMR_ACCESS_LOOKUP_DOMAIN = 0x00000020
55 } samr_ConnectAccessMask;
57 const int SAMR_ACCESS_ALL_ACCESS = 0x0000003F;
59 const int GENERIC_RIGHTS_SAM_ALL_ACCESS =
60 (STANDARD_RIGHTS_REQUIRED_ACCESS |
61 SAMR_ACCESS_ALL_ACCESS);
63 const int GENERIC_RIGHTS_SAM_READ =
64 (STANDARD_RIGHTS_READ_ACCESS |
65 SAMR_ACCESS_ENUM_DOMAINS);
67 const int GENERIC_RIGHTS_SAM_WRITE =
68 (STANDARD_RIGHTS_WRITE_ACCESS |
69 SAMR_ACCESS_CREATE_DOMAIN |
70 SAMR_ACCESS_INITIALIZE_SERVER |
71 SAMR_ACCESS_SHUTDOWN_SERVER);
73 const int GENERIC_RIGHTS_SAM_EXECUTE =
74 (STANDARD_RIGHTS_EXECUTE_ACCESS |
75 SAMR_ACCESS_LOOKUP_DOMAIN |
76 SAMR_ACCESS_CONNECT_TO_SERVER);
78 /* User Object specific access rights */
80 typedef [bitmap32bit] bitmap {
81 SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
82 SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
83 SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
84 SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
85 SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
86 SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
87 SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
88 SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
89 SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
90 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
91 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
92 } samr_UserAccessMask;
94 const int SAMR_USER_ACCESS_ALL_ACCESS = 0x000007FF;
96 const int GENERIC_RIGHTS_USER_ALL_ACCESS =
97 (STANDARD_RIGHTS_REQUIRED_ACCESS |
98 SAMR_USER_ACCESS_ALL_ACCESS); /* 0x000f07ff */
100 const int GENERIC_RIGHTS_USER_READ =
101 (STANDARD_RIGHTS_READ_ACCESS |
102 SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP |
103 SAMR_USER_ACCESS_GET_GROUPS |
104 SAMR_USER_ACCESS_GET_ATTRIBUTES |
105 SAMR_USER_ACCESS_GET_LOGONINFO |
106 SAMR_USER_ACCESS_GET_LOCALE); /* 0x0002031a */
108 const int GENERIC_RIGHTS_USER_WRITE =
109 (STANDARD_RIGHTS_WRITE_ACCESS |
110 SAMR_USER_ACCESS_CHANGE_PASSWORD |
111 SAMR_USER_ACCESS_SET_LOC_COM |
112 SAMR_USER_ACCESS_SET_ATTRIBUTES |
113 SAMR_USER_ACCESS_SET_PASSWORD |
114 SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP); /* 0x000204e4 */
116 const int GENERIC_RIGHTS_USER_EXECUTE =
117 (STANDARD_RIGHTS_EXECUTE_ACCESS |
118 SAMR_USER_ACCESS_CHANGE_PASSWORD |
119 SAMR_USER_ACCESS_GET_NAME_ETC); /* 0x00020041 */
121 /* Domain Object specific access rights */
123 typedef [bitmap32bit] bitmap {
124 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
125 SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
126 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
127 SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
128 SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
129 SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
130 SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
131 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
132 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
133 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
134 SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
135 } samr_DomainAccessMask;
137 const int SAMR_DOMAIN_ACCESS_ALL_ACCESS = 0x000007FF;
139 const int GENERIC_RIGHTS_DOMAIN_ALL_ACCESS =
140 (STANDARD_RIGHTS_REQUIRED_ACCESS |
141 SAMR_DOMAIN_ACCESS_ALL_ACCESS);
143 const int GENERIC_RIGHTS_DOMAIN_READ =
144 (STANDARD_RIGHTS_READ_ACCESS |
145 SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS |
146 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2);
148 const int GENERIC_RIGHTS_DOMAIN_WRITE =
149 (STANDARD_RIGHTS_WRITE_ACCESS |
150 SAMR_DOMAIN_ACCESS_SET_INFO_3 |
151 SAMR_DOMAIN_ACCESS_CREATE_ALIAS |
152 SAMR_DOMAIN_ACCESS_CREATE_GROUP |
153 SAMR_DOMAIN_ACCESS_CREATE_USER |
154 SAMR_DOMAIN_ACCESS_SET_INFO_2 |
155 SAMR_DOMAIN_ACCESS_SET_INFO_1);
157 const int GENERIC_RIGHTS_DOMAIN_EXECUTE =
158 (STANDARD_RIGHTS_EXECUTE_ACCESS |
159 SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT |
160 SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS |
161 SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1);
163 /* Group Object specific access rights */
165 typedef [bitmap32bit] bitmap {
166 SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
167 SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
168 SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
169 SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
170 SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
171 } samr_GroupAccessMask;
173 const int SAMR_GROUP_ACCESS_ALL_ACCESS = 0x0000001F;
175 const int GENERIC_RIGHTS_GROUP_ALL_ACCESS =
176 (STANDARD_RIGHTS_REQUIRED_ACCESS |
177 SAMR_GROUP_ACCESS_ALL_ACCESS); /* 0x000f001f */
179 const int GENERIC_RIGHTS_GROUP_READ =
180 (STANDARD_RIGHTS_READ_ACCESS |
181 SAMR_GROUP_ACCESS_GET_MEMBERS); /* 0x00020010 */
183 const int GENERIC_RIGHTS_GROUP_WRITE =
184 (STANDARD_RIGHTS_WRITE_ACCESS |
185 SAMR_GROUP_ACCESS_REMOVE_MEMBER |
186 SAMR_GROUP_ACCESS_ADD_MEMBER |
187 SAMR_GROUP_ACCESS_SET_INFO); /* 0x0002000e */
189 const int GENERIC_RIGHTS_GROUP_EXECUTE =
190 (STANDARD_RIGHTS_EXECUTE_ACCESS |
191 SAMR_GROUP_ACCESS_LOOKUP_INFO); /* 0x00020001 */
193 /* Alias Object specific access rights */
195 typedef [bitmap32bit] bitmap {
196 SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
197 SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
198 SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
199 SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
200 SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
201 } samr_AliasAccessMask;
203 const int SAMR_ALIAS_ACCESS_ALL_ACCESS = 0x0000001F;
205 const int GENERIC_RIGHTS_ALIAS_ALL_ACCESS =
206 (STANDARD_RIGHTS_REQUIRED_ACCESS |
207 SAMR_ALIAS_ACCESS_ALL_ACCESS); /* 0x000f001f */
209 const int GENERIC_RIGHTS_ALIAS_READ =
210 (STANDARD_RIGHTS_READ_ACCESS |
211 SAMR_ALIAS_ACCESS_GET_MEMBERS); /* 0x00020004 */
213 const int GENERIC_RIGHTS_ALIAS_WRITE =
214 (STANDARD_RIGHTS_WRITE_ACCESS |
215 SAMR_ALIAS_ACCESS_REMOVE_MEMBER |
216 SAMR_ALIAS_ACCESS_ADD_MEMBER |
217 SAMR_ALIAS_ACCESS_SET_INFO); /* 0x00020013 */
219 const int GENERIC_RIGHTS_ALIAS_EXECUTE =
220 (STANDARD_RIGHTS_EXECUTE_ACCESS |
221 SAMR_ALIAS_ACCESS_LOOKUP_INFO); /* 0x00020008 */
223 /******************/
224 /* Function: 0x00 */
225 NTSTATUS samr_Connect (
226 /* notice the lack of [string] */
227 [in,unique] uint16 *system_name,
228 [in] samr_ConnectAccessMask access_mask,
229 [out,ref] policy_handle *connect_handle
233 /******************/
234 /* Function: 0x01 */
235 [public] NTSTATUS samr_Close (
236 [in,out,ref] policy_handle *handle
239 /******************/
240 /* Function: 0x02 */
242 NTSTATUS samr_SetSecurity (
243 [in,ref] policy_handle *handle,
244 [in] security_secinfo sec_info,
245 [in,ref] sec_desc_buf *sdbuf
248 /******************/
249 /* Function: 0x03 */
251 NTSTATUS samr_QuerySecurity (
252 [in,ref] policy_handle *handle,
253 [in] security_secinfo sec_info,
254 [out,ref] sec_desc_buf **sdbuf
257 /******************/
258 /* Function: 0x04 */
261 shutdown the SAM - once you call this the SAM will be dead
263 NTSTATUS samr_Shutdown (
264 [in,ref] policy_handle *connect_handle
267 /******************/
268 /* Function: 0x05 */
269 NTSTATUS samr_LookupDomain (
270 [in,ref] policy_handle *connect_handle,
271 [in,ref] lsa_String *domain_name,
272 [out,ref] dom_sid2 **sid
276 /******************/
277 /* Function: 0x06 */
279 typedef struct {
280 uint32 idx;
281 lsa_String name;
282 } samr_SamEntry;
284 typedef struct {
285 uint32 count;
286 [size_is(count)] samr_SamEntry *entries;
287 } samr_SamArray;
289 NTSTATUS samr_EnumDomains (
290 [in,ref] policy_handle *connect_handle,
291 [in,out,ref] uint32 *resume_handle,
292 [out,ref] samr_SamArray **sam,
293 [in] uint32 buf_size,
294 [out,ref] uint32 *num_entries
298 /************************/
299 /* Function 0x07 */
300 [public] NTSTATUS samr_OpenDomain(
301 [in,ref] policy_handle *connect_handle,
302 [in] samr_DomainAccessMask access_mask,
303 [in,ref] dom_sid2 *sid,
304 [out,ref] policy_handle *domain_handle
307 /************************/
308 /* Function 0x08 */
310 typedef enum {
311 DomainPasswordInformation = 1,
312 DomainGeneralInformation = 2,
313 DomainLogoffInformation = 3,
314 DomainOemInformation = 4,
315 DomainNameInformation = 5,
316 DomainReplicationInformation = 6,
317 DomainServerRoleInformation = 7,
318 DomainModifiedInformation = 8,
319 DomainStateInformation = 9,
320 DomainUasInformation = 10,
321 DomainGeneralInformation2 = 11,
322 DomainLockoutInformation = 12,
323 DomainModifiedInformation2 = 13
324 } samr_DomainInfoClass;
326 /* server roles */
327 typedef [v1_enum] enum {
328 SAMR_ROLE_STANDALONE = 0,
329 SAMR_ROLE_DOMAIN_MEMBER = 1,
330 SAMR_ROLE_DOMAIN_BDC = 2,
331 SAMR_ROLE_DOMAIN_PDC = 3
332 } samr_Role;
334 /* password properties flags */
335 typedef [public,bitmap32bit] bitmap {
336 DOMAIN_PASSWORD_COMPLEX = 0x00000001,
337 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
338 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
339 DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
340 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
341 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
342 } samr_PasswordProperties;
344 typedef [v1_enum] enum {
345 DOMAIN_SERVER_ENABLED = 1,
346 DOMAIN_SERVER_DISABLED = 2
347 } samr_DomainServerState;
349 typedef struct {
350 uint16 min_password_length;
351 uint16 password_history_length;
352 samr_PasswordProperties password_properties;
353 /* yes, these are signed. They are in negative 100ns */
354 dlong max_password_age;
355 dlong min_password_age;
356 } samr_DomInfo1;
358 typedef struct {
359 NTTIME force_logoff_time;
360 lsa_String oem_information; /* comment */
361 lsa_String domain_name;
362 lsa_String primary; /* PDC name if this is a BDC */
363 udlong sequence_num;
364 samr_DomainServerState domain_server_state;
365 samr_Role role;
366 uint32 unknown3;
367 uint32 num_users;
368 uint32 num_groups;
369 uint32 num_aliases;
370 } samr_DomGeneralInformation;
372 typedef struct {
373 NTTIME force_logoff_time;
374 } samr_DomInfo3;
376 typedef struct {
377 lsa_String oem_information; /* comment */
378 } samr_DomOEMInformation;
380 typedef struct {
381 lsa_String domain_name;
382 } samr_DomInfo5;
384 typedef struct {
385 lsa_String primary;
386 } samr_DomInfo6;
388 typedef struct {
389 samr_Role role;
390 } samr_DomInfo7;
392 typedef struct {
393 hyper sequence_num;
394 NTTIME domain_create_time;
395 } samr_DomInfo8;
397 typedef struct {
398 samr_DomainServerState domain_server_state;
399 } samr_DomInfo9;
401 typedef struct {
402 samr_DomGeneralInformation general;
403 hyper lockout_duration;
404 hyper lockout_window;
405 uint16 lockout_threshold;
406 } samr_DomGeneralInformation2;
408 typedef struct {
409 hyper lockout_duration;
410 hyper lockout_window;
411 uint16 lockout_threshold;
412 } samr_DomInfo12;
414 typedef struct {
415 hyper sequence_num;
416 NTTIME domain_create_time;
417 hyper modified_count_at_last_promotion;
418 } samr_DomInfo13;
420 typedef [switch_type(uint16)] union {
421 [case(1)] samr_DomInfo1 info1;
422 [case(2)] samr_DomGeneralInformation general;
423 [case(3)] samr_DomInfo3 info3;
424 [case(4)] samr_DomOEMInformation oem;
425 [case(5)] samr_DomInfo5 info5;
426 [case(6)] samr_DomInfo6 info6;
427 [case(7)] samr_DomInfo7 info7;
428 [case(8)] samr_DomInfo8 info8;
429 [case(9)] samr_DomInfo9 info9;
430 [case(11)] samr_DomGeneralInformation2 general2;
431 [case(12)] samr_DomInfo12 info12;
432 [case(13)] samr_DomInfo13 info13;
433 } samr_DomainInfo;
435 NTSTATUS samr_QueryDomainInfo(
436 [in,ref] policy_handle *domain_handle,
437 [in] samr_DomainInfoClass level,
438 [out,ref,switch_is(level)] samr_DomainInfo **info
441 /************************/
442 /* Function 0x09 */
444 only levels 1, 3, 4, 6, 7, 9, 12 are valid for this
445 call in w2k3
447 NTSTATUS samr_SetDomainInfo(
448 [in,ref] policy_handle *domain_handle,
449 [in] samr_DomainInfoClass level,
450 [in,switch_is(level),ref] samr_DomainInfo *info
454 /************************/
455 /* Function 0x0a */
456 NTSTATUS samr_CreateDomainGroup(
457 [in,ref] policy_handle *domain_handle,
458 [in,ref] lsa_String *name,
459 [in] samr_GroupAccessMask access_mask,
460 [out,ref] policy_handle *group_handle,
461 [out,ref] uint32 *rid
465 /************************/
466 /* Function 0x0b */
467 NTSTATUS samr_EnumDomainGroups(
468 [in] policy_handle *domain_handle,
469 [in,out,ref] uint32 *resume_handle,
470 [out,ref] samr_SamArray **sam,
471 [in] uint32 max_size,
472 [out,ref] uint32 *num_entries
475 /************************/
476 /* Function 0x0c */
477 NTSTATUS samr_CreateUser(
478 [in,ref] policy_handle *domain_handle,
479 [in,ref] lsa_String *account_name,
480 [in] samr_UserAccessMask access_mask,
481 [out,ref] policy_handle *user_handle,
482 [out,ref] uint32 *rid
485 /************************/
486 /* Function 0x0d */
489 /* w2k3 treats max_size as max_users*54 and sets the
490 resume_handle as the rid of the last user sent
492 const int SAMR_ENUM_USERS_MULTIPLIER = 54;
494 NTSTATUS samr_EnumDomainUsers(
495 [in] policy_handle *domain_handle,
496 [in,out,ref] uint32 *resume_handle,
497 [in] samr_AcctFlags acct_flags,
498 [out,ref] samr_SamArray **sam,
499 [in] uint32 max_size,
500 [out,ref] uint32 *num_entries
503 /************************/
504 /* Function 0x0e */
505 NTSTATUS samr_CreateDomAlias(
506 [in,ref] policy_handle *domain_handle,
507 [in,ref] lsa_String *alias_name,
508 [in] samr_AliasAccessMask access_mask,
509 [out,ref] policy_handle *alias_handle,
510 [out,ref] uint32 *rid
513 /************************/
514 /* Function 0x0f */
515 NTSTATUS samr_EnumDomainAliases(
516 [in] policy_handle *domain_handle,
517 [in,out,ref] uint32 *resume_handle,
518 [out,ref] samr_SamArray **sam,
519 [in] uint32 max_size,
520 [out,ref] uint32 *num_entries
523 /************************/
524 /* Function 0x10 */
526 typedef struct {
527 [range(0,1024)] uint32 count;
528 [size_is(count)] uint32 *ids;
529 } samr_Ids;
531 NTSTATUS samr_GetAliasMembership(
532 [in,ref] policy_handle *domain_handle,
533 [in,ref] lsa_SidArray *sids,
534 [out,ref] samr_Ids *rids
537 /************************/
538 /* Function 0x11 */
540 [public] NTSTATUS samr_LookupNames(
541 [in,ref] policy_handle *domain_handle,
542 [in,range(0,1000)] uint32 num_names,
543 [in,size_is(1000),length_is(num_names)] lsa_String names[],
544 [out,ref] samr_Ids *rids,
545 [out,ref] samr_Ids *types
549 /************************/
550 /* Function 0x12 */
551 NTSTATUS samr_LookupRids(
552 [in,ref] policy_handle *domain_handle,
553 [in,range(0,1000)] uint32 num_rids,
554 [in,size_is(1000),length_is(num_rids)] uint32 rids[],
555 [out,ref] lsa_Strings *names,
556 [out,ref] samr_Ids *types
559 /************************/
560 /* Function 0x13 */
561 NTSTATUS samr_OpenGroup(
562 [in,ref] policy_handle *domain_handle,
563 [in] samr_GroupAccessMask access_mask,
564 [in] uint32 rid,
565 [out,ref] policy_handle *group_handle
568 /* Group attributes */
569 typedef [public,bitmap32bit] bitmap {
570 SE_GROUP_MANDATORY = 0x00000001,
571 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
572 SE_GROUP_ENABLED = 0x00000004,
573 SE_GROUP_OWNER = 0x00000008,
574 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
575 SE_GROUP_RESOURCE = 0x20000000,
576 SE_GROUP_LOGON_ID = 0xC0000000
577 } samr_GroupAttrs;
579 /************************/
580 /* Function 0x14 */
582 typedef struct {
583 lsa_String name;
584 samr_GroupAttrs attributes;
585 uint32 num_members;
586 lsa_String description;
587 } samr_GroupInfoAll;
589 typedef struct {
590 samr_GroupAttrs attributes;
591 } samr_GroupInfoAttributes;
593 typedef struct {
594 lsa_String description;
595 } samr_GroupInfoDescription;
597 typedef enum {
598 GROUPINFOALL = 1,
599 GROUPINFONAME = 2,
600 GROUPINFOATTRIBUTES = 3,
601 GROUPINFODESCRIPTION = 4,
602 GROUPINFOALL2 = 5
603 } samr_GroupInfoEnum;
605 typedef [switch_type(samr_GroupInfoEnum)] union {
606 [case(GROUPINFOALL)] samr_GroupInfoAll all;
607 [case(GROUPINFONAME)] lsa_String name;
608 [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
609 [case(GROUPINFODESCRIPTION)] lsa_String description;
610 [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
611 } samr_GroupInfo;
613 NTSTATUS samr_QueryGroupInfo(
614 [in,ref] policy_handle *group_handle,
615 [in] samr_GroupInfoEnum level,
616 [out,ref,switch_is(level)] samr_GroupInfo **info
619 /************************/
620 /* Function 0x15 */
621 NTSTATUS samr_SetGroupInfo(
622 [in,ref] policy_handle *group_handle,
623 [in] samr_GroupInfoEnum level,
624 [in,switch_is(level),ref] samr_GroupInfo *info
627 /************************/
628 /* Function 0x16 */
629 NTSTATUS samr_AddGroupMember(
630 [in,ref] policy_handle *group_handle,
631 [in] uint32 rid,
632 [in] uint32 flags
635 /************************/
636 /* Function 0x17 */
637 NTSTATUS samr_DeleteDomainGroup(
638 [in,out,ref] policy_handle *group_handle
641 /************************/
642 /* Function 0x18 */
643 NTSTATUS samr_DeleteGroupMember(
644 [in,ref] policy_handle *group_handle,
645 [in] uint32 rid
649 /************************/
650 /* Function 0x19 */
651 typedef struct {
652 uint32 count;
653 [size_is(count)] uint32 *rids;
654 [size_is(count)] samr_GroupAttrs *attributes;
655 } samr_RidAttrArray;
657 NTSTATUS samr_QueryGroupMember(
658 [in,ref] policy_handle *group_handle,
659 [out,ref] samr_RidAttrArray **rids
663 /************************/
664 /* Function 0x1a */
667 win2003 seems to accept any data at all for the two integers
668 below, and doesn't seem to do anything with them that I can
669 see. Weird. I really expected the first integer to be a rid
670 and the second to be the attributes for that rid member.
672 NTSTATUS samr_SetMemberAttributesOfGroup(
673 [in,ref] policy_handle *group_handle,
674 [in] uint32 unknown1,
675 [in] uint32 unknown2
679 /************************/
680 /* Function 0x1b */
681 NTSTATUS samr_OpenAlias (
682 [in,ref] policy_handle *domain_handle,
683 [in] samr_AliasAccessMask access_mask,
684 [in] uint32 rid,
685 [out,ref] policy_handle *alias_handle
689 /************************/
690 /* Function 0x1c */
692 typedef struct {
693 lsa_String name;
694 uint32 num_members;
695 lsa_String description;
696 } samr_AliasInfoAll;
698 typedef enum {
699 ALIASINFOALL = 1,
700 ALIASINFONAME = 2,
701 ALIASINFODESCRIPTION = 3
702 } samr_AliasInfoEnum;
704 typedef [switch_type(samr_AliasInfoEnum)] union {
705 [case(ALIASINFOALL)] samr_AliasInfoAll all;
706 [case(ALIASINFONAME)] lsa_String name;
707 [case(ALIASINFODESCRIPTION)] lsa_String description;
708 } samr_AliasInfo;
710 NTSTATUS samr_QueryAliasInfo(
711 [in,ref] policy_handle *alias_handle,
712 [in] samr_AliasInfoEnum level,
713 [out,ref,switch_is(level)] samr_AliasInfo **info
716 /************************/
717 /* Function 0x1d */
718 NTSTATUS samr_SetAliasInfo(
719 [in,ref] policy_handle *alias_handle,
720 [in] samr_AliasInfoEnum level,
721 [in,switch_is(level),ref] samr_AliasInfo *info
724 /************************/
725 /* Function 0x1e */
726 NTSTATUS samr_DeleteDomAlias(
727 [in,out,ref] policy_handle *alias_handle
730 /************************/
731 /* Function 0x1f */
732 NTSTATUS samr_AddAliasMember(
733 [in,ref] policy_handle *alias_handle,
734 [in,ref] dom_sid2 *sid
737 /************************/
738 /* Function 0x20 */
739 NTSTATUS samr_DeleteAliasMember(
740 [in,ref] policy_handle *alias_handle,
741 [in,ref] dom_sid2 *sid
744 /************************/
745 /* Function 0x21 */
746 NTSTATUS samr_GetMembersInAlias(
747 [in,ref] policy_handle *alias_handle,
748 [out,ref] lsa_SidArray *sids
751 /************************/
752 /* Function 0x22 */
753 [public] NTSTATUS samr_OpenUser(
754 [in,ref] policy_handle *domain_handle,
755 [in] samr_UserAccessMask access_mask,
756 [in] uint32 rid,
757 [out,ref] policy_handle *user_handle
760 /************************/
761 /* Function 0x23 */
762 NTSTATUS samr_DeleteUser(
763 [in,out,ref] policy_handle *user_handle
766 /************************/
767 /* Function 0x24 */
769 typedef enum {
770 UserGeneralInformation = 1,
771 UserPreferencesInformation = 2,
772 UserLogonInformation = 3,
773 UserLogonHoursInformation = 4,
774 UserAccountInformation = 5,
775 UserNameInformation = 6,
776 UserAccountNameInformation = 7,
777 UserFullNameInformation = 8,
778 UserPrimaryGroupInformation = 9,
779 UserHomeInformation = 10,
780 UserScriptInformation = 11,
781 UserProfileInformation = 12,
782 UserAdminCommentInformation = 13,
783 UserWorkStationsInformation = 14,
784 UserControlInformation = 16,
785 UserExpiresInformation = 17,
786 UserInternal1Information = 18,
787 UserParametersInformation = 20,
788 UserAllInformation = 21,
789 UserInternal4Information = 23,
790 UserInternal5Information = 24,
791 UserInternal4InformationNew = 25,
792 UserInternal5InformationNew = 26
793 } samr_UserInfoLevel;
795 typedef struct {
796 lsa_String account_name;
797 lsa_String full_name;
798 uint32 primary_gid;
799 lsa_String description;
800 lsa_String comment;
801 } samr_UserInfo1;
803 typedef struct {
804 lsa_String comment;
805 lsa_String reserved; /* settable, but doesn't stick. probably obsolete */
806 uint16 country_code;
807 uint16 code_page;
808 } samr_UserInfo2;
810 /* this is also used in samr and netlogon */
811 typedef [public, flag(NDR_PAHEX)] struct {
812 uint16 units_per_week;
813 [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
814 } samr_LogonHours;
816 typedef struct {
817 lsa_String account_name;
818 lsa_String full_name;
819 uint32 rid;
820 uint32 primary_gid;
821 lsa_String home_directory;
822 lsa_String home_drive;
823 lsa_String logon_script;
824 lsa_String profile_path;
825 lsa_String workstations;
826 NTTIME last_logon;
827 NTTIME last_logoff;
828 NTTIME last_password_change;
829 NTTIME allow_password_change;
830 NTTIME force_password_change;
831 samr_LogonHours logon_hours;
832 uint16 bad_password_count;
833 uint16 logon_count;
834 samr_AcctFlags acct_flags;
835 } samr_UserInfo3;
837 typedef struct {
838 samr_LogonHours logon_hours;
839 } samr_UserInfo4;
841 typedef struct {
842 lsa_String account_name;
843 lsa_String full_name;
844 uint32 rid;
845 uint32 primary_gid;
846 lsa_String home_directory;
847 lsa_String home_drive;
848 lsa_String logon_script;
849 lsa_String profile_path;
850 lsa_String description;
851 lsa_String workstations;
852 NTTIME last_logon;
853 NTTIME last_logoff;
854 samr_LogonHours logon_hours;
855 uint16 bad_password_count;
856 uint16 logon_count;
857 NTTIME last_password_change;
858 NTTIME acct_expiry;
859 samr_AcctFlags acct_flags;
860 } samr_UserInfo5;
862 typedef struct {
863 lsa_String account_name;
864 lsa_String full_name;
865 } samr_UserInfo6;
867 typedef struct {
868 lsa_String account_name;
869 } samr_UserInfo7;
871 typedef struct {
872 lsa_String full_name;
873 } samr_UserInfo8;
875 typedef struct {
876 uint32 primary_gid;
877 } samr_UserInfo9;
879 typedef struct {
880 lsa_String home_directory;
881 lsa_String home_drive;
882 } samr_UserInfo10;
884 typedef struct {
885 lsa_String logon_script;
886 } samr_UserInfo11;
888 typedef struct {
889 lsa_String profile_path;
890 } samr_UserInfo12;
892 typedef struct {
893 lsa_String description;
894 } samr_UserInfo13;
896 typedef struct {
897 lsa_String workstations;
898 } samr_UserInfo14;
900 typedef struct {
901 samr_AcctFlags acct_flags;
902 } samr_UserInfo16;
904 typedef struct {
905 NTTIME acct_expiry;
906 } samr_UserInfo17;
908 typedef [public, flag(NDR_PAHEX)] struct {
909 uint8 hash[16];
910 } samr_Password;
912 typedef struct {
913 samr_Password nt_pwd;
914 samr_Password lm_pwd;
915 boolean8 nt_pwd_active;
916 boolean8 lm_pwd_active;
917 uint8 password_expired;
918 } samr_UserInfo18;
920 typedef struct {
921 lsa_BinaryString parameters;
922 } samr_UserInfo20;
924 /* this defines the bits used for fields_present in info21 */
925 typedef [bitmap32bit] bitmap {
926 SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
927 SAMR_FIELD_FULL_NAME = 0x00000002,
928 SAMR_FIELD_RID = 0x00000004,
929 SAMR_FIELD_PRIMARY_GID = 0x00000008,
930 SAMR_FIELD_DESCRIPTION = 0x00000010,
931 SAMR_FIELD_COMMENT = 0x00000020,
932 SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
933 SAMR_FIELD_HOME_DRIVE = 0x00000080,
934 SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
935 SAMR_FIELD_PROFILE_PATH = 0x00000200,
936 SAMR_FIELD_WORKSTATIONS = 0x00000400,
937 SAMR_FIELD_LAST_LOGON = 0x00000800,
938 SAMR_FIELD_LAST_LOGOFF = 0x00001000,
939 SAMR_FIELD_LOGON_HOURS = 0x00002000,
940 SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
941 SAMR_FIELD_NUM_LOGONS = 0x00008000,
942 SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
943 SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
944 SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
945 SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
946 SAMR_FIELD_ACCT_FLAGS = 0x00100000,
947 SAMR_FIELD_PARAMETERS = 0x00200000,
948 SAMR_FIELD_COUNTRY_CODE = 0x00400000,
949 SAMR_FIELD_CODE_PAGE = 0x00800000,
950 SAMR_FIELD_NT_PASSWORD_PRESENT = 0x01000000, /* either of these */
951 SAMR_FIELD_LM_PASSWORD_PRESENT = 0x02000000, /* two bits seems to work */
952 SAMR_FIELD_PRIVATE_DATA = 0x04000000,
953 SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
954 SAMR_FIELD_SEC_DESC = 0x10000000,
955 SAMR_FIELD_OWF_PWD = 0x20000000
956 } samr_FieldsPresent;
958 /* used for 'password_expired' in samr_UserInfo21 */
959 const int PASS_MUST_CHANGE_AT_NEXT_LOGON = 0x01;
960 const int PASS_DONT_CHANGE_AT_NEXT_LOGON = 0x00;
962 typedef struct {
963 NTTIME last_logon;
964 NTTIME last_logoff;
965 NTTIME last_password_change;
966 NTTIME acct_expiry;
967 NTTIME allow_password_change;
968 NTTIME force_password_change;
969 lsa_String account_name;
970 lsa_String full_name;
971 lsa_String home_directory;
972 lsa_String home_drive;
973 lsa_String logon_script;
974 lsa_String profile_path;
975 lsa_String description;
976 lsa_String workstations;
977 lsa_String comment;
978 lsa_BinaryString parameters;
979 lsa_BinaryString lm_owf_password;
980 lsa_BinaryString nt_owf_password;
981 lsa_String private_data;
982 uint32 buf_count;
983 [size_is(buf_count)] uint8 *buffer;
984 uint32 rid;
985 uint32 primary_gid;
986 samr_AcctFlags acct_flags;
987 samr_FieldsPresent fields_present;
988 samr_LogonHours logon_hours;
989 uint16 bad_password_count;
990 uint16 logon_count;
991 uint16 country_code;
992 uint16 code_page;
993 uint8 lm_password_set;
994 uint8 nt_password_set;
995 uint8 password_expired;
996 uint8 private_data_sensitive;
997 } samr_UserInfo21;
999 typedef [public, flag(NDR_PAHEX)] struct {
1000 uint8 data[516];
1001 } samr_CryptPassword;
1003 typedef struct {
1004 samr_UserInfo21 info;
1005 samr_CryptPassword password;
1006 } samr_UserInfo23;
1008 typedef struct {
1009 samr_CryptPassword password;
1010 uint8 password_expired;
1011 } samr_UserInfo24;
1013 typedef [flag(NDR_PAHEX)] struct {
1014 uint8 data[532];
1015 } samr_CryptPasswordEx;
1017 typedef struct {
1018 samr_UserInfo21 info;
1019 samr_CryptPasswordEx password;
1020 } samr_UserInfo25;
1022 typedef struct {
1023 samr_CryptPasswordEx password;
1024 uint8 password_expired;
1025 } samr_UserInfo26;
1027 typedef [switch_type(uint16)] union {
1028 [case(1)] samr_UserInfo1 info1;
1029 [case(2)] samr_UserInfo2 info2;
1030 [case(3)] samr_UserInfo3 info3;
1031 [case(4)] samr_UserInfo4 info4;
1032 [case(5)] samr_UserInfo5 info5;
1033 [case(6)] samr_UserInfo6 info6;
1034 [case(7)] samr_UserInfo7 info7;
1035 [case(8)] samr_UserInfo8 info8;
1036 [case(9)] samr_UserInfo9 info9;
1037 [case(10)] samr_UserInfo10 info10;
1038 [case(11)] samr_UserInfo11 info11;
1039 [case(12)] samr_UserInfo12 info12;
1040 [case(13)] samr_UserInfo13 info13;
1041 [case(14)] samr_UserInfo14 info14;
1042 [case(16)] samr_UserInfo16 info16;
1043 [case(17)] samr_UserInfo17 info17;
1044 [case(18)] samr_UserInfo18 info18;
1045 [case(20)] samr_UserInfo20 info20;
1046 [case(21)] samr_UserInfo21 info21;
1047 [case(23)] samr_UserInfo23 info23;
1048 [case(24)] samr_UserInfo24 info24;
1049 [case(25)] samr_UserInfo25 info25;
1050 [case(26)] samr_UserInfo26 info26;
1051 } samr_UserInfo;
1053 [public] NTSTATUS samr_QueryUserInfo(
1054 [in,ref] policy_handle *user_handle,
1055 [in] samr_UserInfoLevel level,
1056 [out,ref,switch_is(level)] samr_UserInfo **info
1060 /************************/
1061 /* Function 0x25 */
1062 [public] NTSTATUS samr_SetUserInfo(
1063 [in,ref] policy_handle *user_handle,
1064 [in] samr_UserInfoLevel level,
1065 [in,ref,switch_is(level)] samr_UserInfo *info
1068 /************************/
1069 /* Function 0x26 */
1071 this is a password change interface that doesn't give
1072 the server the plaintext password. Depricated.
1074 NTSTATUS samr_ChangePasswordUser(
1075 [in,ref] policy_handle *user_handle,
1076 [in] boolean8 lm_present,
1077 [in,unique] samr_Password *old_lm_crypted,
1078 [in,unique] samr_Password *new_lm_crypted,
1079 [in] boolean8 nt_present,
1080 [in,unique] samr_Password *old_nt_crypted,
1081 [in,unique] samr_Password *new_nt_crypted,
1082 [in] boolean8 cross1_present,
1083 [in,unique] samr_Password *nt_cross,
1084 [in] boolean8 cross2_present,
1085 [in,unique] samr_Password *lm_cross
1088 /************************/
1089 /* Function 0x27 */
1091 typedef [public] struct {
1092 uint32 rid;
1093 samr_GroupAttrs attributes;
1094 } samr_RidWithAttribute;
1096 typedef [public] struct {
1097 uint32 count;
1098 [size_is(count)] samr_RidWithAttribute *rids;
1099 } samr_RidWithAttributeArray;
1101 NTSTATUS samr_GetGroupsForUser(
1102 [in,ref] policy_handle *user_handle,
1103 [out,ref] samr_RidWithAttributeArray **rids
1106 /************************/
1107 /* Function 0x28 */
1109 typedef struct {
1110 uint32 idx;
1111 uint32 rid;
1112 samr_AcctFlags acct_flags;
1113 lsa_String account_name;
1114 lsa_String description;
1115 lsa_String full_name;
1116 } samr_DispEntryGeneral;
1118 typedef struct {
1119 uint32 count;
1120 [size_is(count)] samr_DispEntryGeneral *entries;
1121 } samr_DispInfoGeneral;
1123 typedef struct {
1124 uint32 idx;
1125 uint32 rid;
1126 samr_AcctFlags acct_flags;
1127 lsa_String account_name;
1128 lsa_String description;
1129 } samr_DispEntryFull;
1131 typedef struct {
1132 uint32 count;
1133 [size_is(count)] samr_DispEntryFull *entries;
1134 } samr_DispInfoFull;
1136 typedef struct {
1137 uint32 idx;
1138 uint32 rid;
1139 samr_GroupAttrs acct_flags;
1140 lsa_String account_name;
1141 lsa_String description;
1142 } samr_DispEntryFullGroup;
1144 typedef struct {
1145 uint32 count;
1146 [size_is(count)] samr_DispEntryFullGroup *entries;
1147 } samr_DispInfoFullGroups;
1149 typedef struct {
1150 uint32 idx;
1151 lsa_AsciiStringLarge account_name;
1152 } samr_DispEntryAscii;
1154 typedef struct {
1155 uint32 count;
1156 [size_is(count)] samr_DispEntryAscii *entries;
1157 } samr_DispInfoAscii;
1159 typedef [switch_type(uint16)] union {
1160 [case(1)] samr_DispInfoGeneral info1;/* users */
1161 [case(2)] samr_DispInfoFull info2; /* trust accounts? */
1162 [case(3)] samr_DispInfoFullGroups info3; /* groups */
1163 [case(4)] samr_DispInfoAscii info4; /* users */
1164 [case(5)] samr_DispInfoAscii info5; /* groups */
1165 } samr_DispInfo;
1167 NTSTATUS samr_QueryDisplayInfo(
1168 [in,ref] policy_handle *domain_handle,
1169 [in] uint16 level,
1170 [in] uint32 start_idx,
1171 [in] uint32 max_entries,
1172 [in] uint32 buf_size,
1173 [out,ref] uint32 *total_size,
1174 [out,ref] uint32 *returned_size,
1175 [out,ref,switch_is(level)] samr_DispInfo *info
1179 /************************/
1180 /* Function 0x29 */
1183 this seems to be an alphabetic search function. The returned index
1184 is the index for samr_QueryDisplayInfo needed to get names occurring
1185 after the specified name. The supplied name does not need to exist
1186 in the database (for example you can supply just a first letter for
1187 searching starting at that letter)
1189 The level corresponds to the samr_QueryDisplayInfo level
1191 NTSTATUS samr_GetDisplayEnumerationIndex(
1192 [in,ref] policy_handle *domain_handle,
1193 [in] uint16 level,
1194 [in,ref] lsa_String *name,
1195 [out,ref] uint32 *idx
1200 /************************/
1201 /* Function 0x2a */
1204 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1206 NTSTATUS samr_TestPrivateFunctionsDomain(
1207 [in,ref] policy_handle *domain_handle
1211 /************************/
1212 /* Function 0x2b */
1215 w2k3 returns NT_STATUS_NOT_IMPLEMENTED for this
1217 NTSTATUS samr_TestPrivateFunctionsUser(
1218 [in,ref] policy_handle *user_handle
1222 /************************/
1223 /* Function 0x2c */
1225 typedef struct {
1226 uint16 min_password_length;
1227 samr_PasswordProperties password_properties;
1228 } samr_PwInfo;
1230 [public] NTSTATUS samr_GetUserPwInfo(
1231 [in,ref] policy_handle *user_handle,
1232 [out,ref] samr_PwInfo *info
1235 /************************/
1236 /* Function 0x2d */
1237 NTSTATUS samr_RemoveMemberFromForeignDomain(
1238 [in,ref] policy_handle *domain_handle,
1239 [in,ref] dom_sid2 *sid
1242 /************************/
1243 /* Function 0x2e */
1246 how is this different from QueryDomainInfo ??
1248 NTSTATUS samr_QueryDomainInfo2(
1249 [in,ref] policy_handle *domain_handle,
1250 [in] samr_DomainInfoClass level,
1251 [out,ref,switch_is(level)] samr_DomainInfo **info
1254 /************************/
1255 /* Function 0x2f */
1258 how is this different from QueryUserInfo ??
1260 NTSTATUS samr_QueryUserInfo2(
1261 [in,ref] policy_handle *user_handle,
1262 [in] samr_UserInfoLevel level,
1263 [out,ref,switch_is(level)] samr_UserInfo **info
1266 /************************/
1267 /* Function 0x30 */
1270 how is this different from QueryDisplayInfo??
1272 NTSTATUS samr_QueryDisplayInfo2(
1273 [in,ref] policy_handle *domain_handle,
1274 [in] uint16 level,
1275 [in] uint32 start_idx,
1276 [in] uint32 max_entries,
1277 [in] uint32 buf_size,
1278 [out,ref] uint32 *total_size,
1279 [out,ref] uint32 *returned_size,
1280 [out,ref,switch_is(level)] samr_DispInfo *info
1283 /************************/
1284 /* Function 0x31 */
1287 how is this different from GetDisplayEnumerationIndex ??
1289 NTSTATUS samr_GetDisplayEnumerationIndex2(
1290 [in,ref] policy_handle *domain_handle,
1291 [in] uint16 level,
1292 [in,ref] lsa_String *name,
1293 [out,ref] uint32 *idx
1297 /************************/
1298 /* Function 0x32 */
1299 NTSTATUS samr_CreateUser2(
1300 [in,ref] policy_handle *domain_handle,
1301 [in,ref] lsa_String *account_name,
1302 [in] samr_AcctFlags acct_flags,
1303 [in] samr_UserAccessMask access_mask,
1304 [out,ref] policy_handle *user_handle,
1305 [out,ref] uint32 *access_granted,
1306 [out,ref] uint32 *rid
1310 /************************/
1311 /* Function 0x33 */
1314 another duplicate. There must be a reason ....
1316 NTSTATUS samr_QueryDisplayInfo3(
1317 [in,ref] policy_handle *domain_handle,
1318 [in] uint16 level,
1319 [in] uint32 start_idx,
1320 [in] uint32 max_entries,
1321 [in] uint32 buf_size,
1322 [out,ref] uint32 *total_size,
1323 [out,ref] uint32 *returned_size,
1324 [out,ref,switch_is(level)] samr_DispInfo *info
1327 /************************/
1328 /* Function 0x34 */
1329 NTSTATUS samr_AddMultipleMembersToAlias(
1330 [in,ref] policy_handle *alias_handle,
1331 [in,ref] lsa_SidArray *sids
1334 /************************/
1335 /* Function 0x35 */
1336 NTSTATUS samr_RemoveMultipleMembersFromAlias(
1337 [in,ref] policy_handle *alias_handle,
1338 [in,ref] lsa_SidArray *sids
1341 /************************/
1342 /* Function 0x36 */
1344 NTSTATUS samr_OemChangePasswordUser2(
1345 [in,unique] lsa_AsciiString *server,
1346 [in,ref] lsa_AsciiString *account,
1347 [in,unique] samr_CryptPassword *password,
1348 [in,unique] samr_Password *hash
1351 /************************/
1352 /* Function 0x37 */
1353 NTSTATUS samr_ChangePasswordUser2(
1354 [in,unique] lsa_String *server,
1355 [in,ref] lsa_String *account,
1356 [in,unique] samr_CryptPassword *nt_password,
1357 [in,unique] samr_Password *nt_verifier,
1358 [in] boolean8 lm_change,
1359 [in,unique] samr_CryptPassword *lm_password,
1360 [in,unique] samr_Password *lm_verifier
1363 /************************/
1364 /* Function 0x38 */
1365 NTSTATUS samr_GetDomPwInfo(
1366 [in,unique] lsa_String *domain_name,
1367 [out,ref] samr_PwInfo *info
1370 /************************/
1371 /* Function 0x39 */
1372 NTSTATUS samr_Connect2(
1373 [in,unique,string,charset(UTF16)] uint16 *system_name,
1374 [in] samr_ConnectAccessMask access_mask,
1375 [out,ref] policy_handle *connect_handle
1378 /************************/
1379 /* Function 0x3a */
1381 seems to be an exact alias for samr_SetUserInfo()
1383 [public] NTSTATUS samr_SetUserInfo2(
1384 [in,ref] policy_handle *user_handle,
1385 [in] samr_UserInfoLevel level,
1386 [in,ref,switch_is(level)] samr_UserInfo *info
1389 /************************/
1390 /* Function 0x3b */
1392 this one is mysterious. I have a few guesses, but nothing working yet
1394 NTSTATUS samr_SetBootKeyInformation(
1395 [in,ref] policy_handle *connect_handle,
1396 [in] uint32 unknown1,
1397 [in] uint32 unknown2,
1398 [in] uint32 unknown3
1401 /************************/
1402 /* Function 0x3c */
1403 NTSTATUS samr_GetBootKeyInformation(
1404 [in,ref] policy_handle *domain_handle,
1405 [out,ref] uint32 *unknown
1408 /************************/
1409 /* Function 0x3d */
1410 NTSTATUS samr_Connect3(
1411 [in,unique,string,charset(UTF16)] uint16 *system_name,
1412 /* this unknown value seems to be completely ignored by w2k3 */
1413 [in] uint32 unknown,
1414 [in] samr_ConnectAccessMask access_mask,
1415 [out,ref] policy_handle *connect_handle
1418 /************************/
1419 /* Function 0x3e */
1421 typedef [v1_enum] enum {
1422 SAMR_CONNECT_PRE_W2K = 1,
1423 SAMR_CONNECT_W2K = 2,
1424 SAMR_CONNECT_AFTER_W2K = 3
1425 } samr_ConnectVersion;
1427 NTSTATUS samr_Connect4(
1428 [in,unique,string,charset(UTF16)] uint16 *system_name,
1429 [in] samr_ConnectVersion client_version,
1430 [in] samr_ConnectAccessMask access_mask,
1431 [out,ref] policy_handle *connect_handle
1434 /************************/
1435 /* Function 0x3f */
1437 typedef [public,v1_enum] enum {
1438 SAM_PWD_CHANGE_NO_ERROR = 0,
1439 SAM_PWD_CHANGE_PASSWORD_TOO_SHORT = 1,
1440 SAM_PWD_CHANGE_PWD_IN_HISTORY = 2,
1441 SAM_PWD_CHANGE_USERNAME_IN_PASSWORD = 3,
1442 SAM_PWD_CHANGE_FULLNAME_IN_PASSWORD = 4,
1443 SAM_PWD_CHANGE_NOT_COMPLEX = 5,
1444 SAM_PWD_CHANGE_MACHINE_NOT_DEFAULT = 6,
1445 SAM_PWD_CHANGE_FAILED_BY_FILTER = 7,
1446 SAM_PWD_CHANGE_PASSWORD_TOO_LONG = 8
1447 } samPwdChangeReason;
1449 typedef struct {
1450 samPwdChangeReason extendedFailureReason;
1451 lsa_String filterModuleName;
1452 } userPwdChangeFailureInformation;
1454 [public] NTSTATUS samr_ChangePasswordUser3(
1455 [in,unique] lsa_String *server,
1456 [in,ref] lsa_String *account,
1457 [in,unique] samr_CryptPassword *nt_password,
1458 [in,unique] samr_Password *nt_verifier,
1459 [in] boolean8 lm_change,
1460 [in,unique] samr_CryptPassword *lm_password,
1461 [in,unique] samr_Password *lm_verifier,
1462 [in,unique] samr_CryptPassword *password3,
1463 [out,ref] samr_DomInfo1 **dominfo,
1464 [out,ref] userPwdChangeFailureInformation **reject
1467 /************************/
1468 /* Function 0x40 */
1470 typedef struct {
1471 samr_ConnectVersion client_version; /* w2k3 gives 3 */
1472 uint32 unknown2; /* w2k3 gives 0 */
1473 } samr_ConnectInfo1;
1475 typedef union {
1476 [case(1)] samr_ConnectInfo1 info1;
1477 } samr_ConnectInfo;
1479 [public] NTSTATUS samr_Connect5(
1480 [in,unique,string,charset(UTF16)] uint16 *system_name,
1481 [in] samr_ConnectAccessMask access_mask,
1482 [in] uint32 level_in,
1483 [in,ref,switch_is(level_in)] samr_ConnectInfo *info_in,
1484 [out,ref] uint32 *level_out,
1485 [out,ref,switch_is(*level_out)] samr_ConnectInfo *info_out,
1486 [out,ref] policy_handle *connect_handle
1489 /************************/
1490 /* Function 0x41 */
1491 NTSTATUS samr_RidToSid(
1492 [in,ref] policy_handle *domain_handle,
1493 [in] uint32 rid,
1494 [out,ref] dom_sid2 **sid
1497 /************************/
1498 /* Function 0x42 */
1501 this should set the DSRM password for the server, which is used
1502 when booting into Directory Services Recovery Mode on a DC. Win2003
1503 gives me NT_STATUS_NOT_SUPPORTED
1506 NTSTATUS samr_SetDsrmPassword(
1507 [in,unique] lsa_String *name,
1508 [in] uint32 unknown,
1509 [in,unique] samr_Password *hash
1513 /************************/
1514 /* Function 0x43 */
1515 /************************/
1516 typedef [bitmap32bit] bitmap {
1517 SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
1518 SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
1519 SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
1520 SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
1521 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
1522 SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
1523 } samr_ValidateFieldsPresent;
1525 typedef enum {
1526 NetValidateAuthentication = 1,
1527 NetValidatePasswordChange= 2,
1528 NetValidatePasswordReset = 3
1529 } samr_ValidatePasswordLevel;
1531 /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
1532 * identified the mapping of
1533 * - NERR_PasswordFilterError
1534 * - NERR_PasswordExpired and
1535 * - NERR_PasswordCantChange
1536 * yet - Guenther
1539 typedef enum {
1540 SAMR_VALIDATION_STATUS_SUCCESS = 0,
1541 SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
1542 SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
1543 SAMR_VALIDATION_STATUS_PASSWORD_EXPIRED = 3,
1544 SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
1545 SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
1546 SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
1547 SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
1548 SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
1549 SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9,
1550 SAMR_VALIDATION_STATUS_PASSWORD_FILTER_ERROR = 10
1551 } samr_ValidationStatus;
1553 typedef struct {
1554 uint32 length;
1555 [size_is(length)] uint8 *data;
1556 } samr_ValidationBlob;
1558 typedef struct {
1559 samr_ValidateFieldsPresent fields_present;
1560 NTTIME_hyper last_password_change;
1561 NTTIME_hyper bad_password_time;
1562 NTTIME_hyper lockout_time;
1563 uint32 bad_pwd_count;
1564 uint32 pwd_history_len;
1565 [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
1566 } samr_ValidatePasswordInfo;
1568 typedef struct {
1569 samr_ValidatePasswordInfo info;
1570 samr_ValidationStatus status;
1571 } samr_ValidatePasswordRepCtr;
1573 typedef [switch_type(uint16)] union {
1574 [case(1)] samr_ValidatePasswordRepCtr ctr1;
1575 [case(2)] samr_ValidatePasswordRepCtr ctr2;
1576 [case(3)] samr_ValidatePasswordRepCtr ctr3;
1577 } samr_ValidatePasswordRep;
1579 typedef struct {
1580 samr_ValidatePasswordInfo info;
1581 lsa_StringLarge password;
1582 lsa_StringLarge account;
1583 samr_ValidationBlob hash;
1584 boolean8 pwd_must_change_at_next_logon;
1585 boolean8 clear_lockout;
1586 } samr_ValidatePasswordReq3;
1588 typedef struct {
1589 samr_ValidatePasswordInfo info;
1590 lsa_StringLarge password;
1591 lsa_StringLarge account;
1592 samr_ValidationBlob hash;
1593 boolean8 password_matched;
1594 } samr_ValidatePasswordReq2;
1596 typedef struct {
1597 samr_ValidatePasswordInfo info;
1598 boolean8 password_matched;
1599 } samr_ValidatePasswordReq1;
1601 typedef [switch_type(uint16)] union {
1602 [case(1)] samr_ValidatePasswordReq1 req1;
1603 [case(2)] samr_ValidatePasswordReq2 req2;
1604 [case(3)] samr_ValidatePasswordReq3 req3;
1605 } samr_ValidatePasswordReq;
1607 NTSTATUS samr_ValidatePassword(
1608 [in] samr_ValidatePasswordLevel level,
1609 [in,switch_is(level)] samr_ValidatePasswordReq *req,
1610 [out,ref,switch_is(level)] samr_ValidatePasswordRep **rep