/*
samr interface definition
*/
+import "misc.idl", "lsa.idl", "security.idl";
/*
Thanks to Todd Sabin for some information from his samr.idl in acltools
[ uuid("12345778-1234-abcd-ef00-0123456789ac"),
version(1.0),
endpoint("ncacn_np:[\\pipe\\samr]","ncacn_ip_tcp:", "ncalrpc:"),
- pointer_default(unique),
- depends(lsa,security)
+ pointer_default(unique)
] interface samr
{
- /* account control (acct_flags) bits */
- const int ACB_DISABLED = 0x0001; /* 1 = User account disabled */
- const int ACB_HOMDIRREQ = 0x0002; /* 1 = Home directory required */
- const int ACB_PWNOTREQ = 0x0004; /* 1 = User password not required */
- const int ACB_TEMPDUP = 0x0008; /* 1 = Temporary duplicate account */
- const int ACB_NORMAL = 0x0010; /* 1 = Normal user account */
- const int ACB_MNS = 0x0020; /* 1 = MNS logon user account */
- const int ACB_DOMTRUST = 0x0040; /* 1 = Interdomain trust account */
- const int ACB_WSTRUST = 0x0080; /* 1 = Workstation trust account */
- const int ACB_SVRTRUST = 0x0100; /* 1 = Server trust account */
- const int ACB_PWNOEXP = 0x0200; /* 1 = User password does not expire */
- const int ACB_AUTOLOCK = 0x0400; /* 1 = Account auto locked */
+ typedef bitmap security_secinfo security_secinfo;
+ /* account control (acct_flags) bits */
+ typedef [public,bitmap32bit] bitmap {
+ ACB_DISABLED = 0x00000001, /* 1 = User account disabled */
+ ACB_HOMDIRREQ = 0x00000002, /* 1 = Home directory required */
+ ACB_PWNOTREQ = 0x00000004, /* 1 = User password not required */
+ ACB_TEMPDUP = 0x00000008, /* 1 = Temporary duplicate account */
+ ACB_NORMAL = 0x00000010, /* 1 = Normal user account */
+ ACB_MNS = 0x00000020, /* 1 = MNS logon user account */
+ ACB_DOMTRUST = 0x00000040, /* 1 = Interdomain trust account */
+ ACB_WSTRUST = 0x00000080, /* 1 = Workstation trust account */
+ ACB_SVRTRUST = 0x00000100, /* 1 = Server trust account */
+ ACB_PWNOEXP = 0x00000200, /* 1 = User password does not expire */
+ ACB_AUTOLOCK = 0x00000400, /* 1 = Account auto locked */
+ ACB_ENC_TXT_PWD_ALLOWED = 0x00000800, /* 1 = Encryped text password is allowed */
+ ACB_SMARTCARD_REQUIRED = 0x00001000, /* 1 = Smart Card required */
+ ACB_TRUSTED_FOR_DELEGATION = 0x00002000, /* 1 = Trusted for Delegation */
+ ACB_NOT_DELEGATED = 0x00004000, /* 1 = Not delegated */
+ ACB_USE_DES_KEY_ONLY = 0x00008000, /* 1 = Use DES key only */
+ ACB_DONT_REQUIRE_PREAUTH = 0x00010000, /* 1 = Preauth not required */
+ ACB_PW_EXPIRED = 0x00020000, /* 1 = Password Expired */
+ ACB_NO_AUTH_DATA_REQD = 0x00080000 /* 1 = No authorization data required */
+ } samr_AcctFlags;
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_ACCESS_CONNECT_TO_SERVER = 0x00000001,
+ SAMR_ACCESS_SHUTDOWN_SERVER = 0x00000002,
+ SAMR_ACCESS_INITIALIZE_SERVER = 0x00000004,
+ SAMR_ACCESS_CREATE_DOMAIN = 0x00000008,
+ SAMR_ACCESS_ENUM_DOMAINS = 0x00000010,
+ SAMR_ACCESS_OPEN_DOMAIN = 0x00000020
+ } samr_ConnectAccessMask;
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_USER_ACCESS_GET_NAME_ETC = 0x00000001,
+ SAMR_USER_ACCESS_GET_LOCALE = 0x00000002,
+ SAMR_USER_ACCESS_SET_LOC_COM = 0x00000004,
+ SAMR_USER_ACCESS_GET_LOGONINFO = 0x00000008,
+ SAMR_USER_ACCESS_GET_ATTRIBUTES = 0x00000010,
+ SAMR_USER_ACCESS_SET_ATTRIBUTES = 0x00000020,
+ SAMR_USER_ACCESS_CHANGE_PASSWORD = 0x00000040,
+ SAMR_USER_ACCESS_SET_PASSWORD = 0x00000080,
+ SAMR_USER_ACCESS_GET_GROUPS = 0x00000100,
+ SAMR_USER_ACCESS_GET_GROUP_MEMBERSHIP = 0x00000200,
+ SAMR_USER_ACCESS_CHANGE_GROUP_MEMBERSHIP = 0x00000400
+ } samr_UserAccessMask;
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_1 = 0x00000001,
+ SAMR_DOMAIN_ACCESS_SET_INFO_1 = 0x00000002,
+ SAMR_DOMAIN_ACCESS_LOOKUP_INFO_2 = 0x00000004,
+ SAMR_DOMAIN_ACCESS_SET_INFO_2 = 0x00000008,
+ SAMR_DOMAIN_ACCESS_CREATE_USER = 0x00000010,
+ SAMR_DOMAIN_ACCESS_CREATE_GROUP = 0x00000020,
+ SAMR_DOMAIN_ACCESS_CREATE_ALIAS = 0x00000040,
+ SAMR_DOMAIN_ACCESS_LOOKUP_ALIAS = 0x00000080,
+ SAMR_DOMAIN_ACCESS_ENUM_ACCOUNTS = 0x00000100,
+ SAMR_DOMAIN_ACCESS_OPEN_ACCOUNT = 0x00000200,
+ SAMR_DOMAIN_ACCESS_SET_INFO_3 = 0x00000400
+ } samr_DomainAccessMask;
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_GROUP_ACCESS_LOOKUP_INFO = 0x00000001,
+ SAMR_GROUP_ACCESS_SET_INFO = 0x00000002,
+ SAMR_GROUP_ACCESS_ADD_MEMBER = 0x00000004,
+ SAMR_GROUP_ACCESS_REMOVE_MEMBER = 0x00000008,
+ SAMR_GROUP_ACCESS_GET_MEMBERS = 0x00000010
+ } samr_GroupAccessMask;
+
+ typedef [bitmap32bit] bitmap {
+ SAMR_ALIAS_ACCESS_ADD_MEMBER = 0x00000001,
+ SAMR_ALIAS_ACCESS_REMOVE_MEMBER = 0x00000002,
+ SAMR_ALIAS_ACCESS_GET_MEMBERS = 0x00000004,
+ SAMR_ALIAS_ACCESS_LOOKUP_INFO = 0x00000008,
+ SAMR_ALIAS_ACCESS_SET_INFO = 0x00000010
+ } samr_AliasAccessMask;
/******************/
/* Function: 0x00 */
NTSTATUS samr_Connect (
/* notice the lack of [string] */
- [in] uint16 *system_name,
- [in] uint32 access_mask,
+ [in,unique] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
[out,ref] policy_handle *connect_handle
);
/******************/
/* Function: 0x01 */
- NTSTATUS samr_Close (
+ [public] NTSTATUS samr_Close (
[in,out,ref] policy_handle *handle
);
NTSTATUS samr_SetSecurity (
[in,ref] policy_handle *handle,
- [in] uint32 sec_info,
+ [in] security_secinfo sec_info,
[in,ref] sec_desc_buf *sdbuf
);
NTSTATUS samr_QuerySecurity (
[in,ref] policy_handle *handle,
- [in] uint32 sec_info,
- [out] sec_desc_buf *sdbuf
+ [in] security_secinfo sec_info,
+ [out,unique] sec_desc_buf *sdbuf
);
/******************/
/******************/
/* Function: 0x05 */
- typedef struct {
- [value(2*strlen_m(r->string))] uint16 length;
- [value(r->length)] uint16 size;
- unistr_noterm *string;
- } samr_String;
-
NTSTATUS samr_LookupDomain (
[in,ref] policy_handle *connect_handle,
- [in,ref] samr_String *domain,
- [out] dom_sid2 *sid
+ [in,ref] lsa_String *domain_name,
+ [out,unique] dom_sid2 *sid
);
typedef struct {
uint32 idx;
- samr_String name;
+ lsa_String name;
} samr_SamEntry;
typedef struct {
[in,ref] policy_handle *connect_handle,
[in,out,ref] uint32 *resume_handle,
[in] uint32 buf_size,
- [out] samr_SamArray *sam,
+ [out,unique] samr_SamArray *sam,
[out] uint32 num_entries
);
/************************/
/* Function 0x07 */
- NTSTATUS samr_OpenDomain(
+ [public] NTSTATUS samr_OpenDomain(
[in,ref] policy_handle *connect_handle,
- [in] uint32 access_mask,
+ [in] samr_DomainAccessMask access_mask,
[in,ref] dom_sid2 *sid,
[out,ref] policy_handle *domain_handle
);
/************************/
/* Function 0x08 */
+ /* server roles */
+ typedef [v1_enum] enum {
+ SAMR_ROLE_STANDALONE = 0,
+ SAMR_ROLE_DOMAIN_MEMBER = 1,
+ SAMR_ROLE_DOMAIN_BDC = 2,
+ SAMR_ROLE_DOMAIN_PDC = 3
+ } samr_Role;
+
+ /* password properties flags */
+ typedef [public,bitmap32bit] bitmap {
+ DOMAIN_PASSWORD_COMPLEX = 0x00000001,
+ DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002,
+ DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004,
+ DOMAIN_PASSWORD_LOCKOUT_ADMINS = 0x00000008,
+ DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010,
+ DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020
+ } samr_PasswordProperties;
typedef struct {
uint16 min_password_length;
uint16 password_history_length;
- uint32 password_properties;
+ samr_PasswordProperties password_properties;
/* yes, these are signed. They are in negative 100ns */
- int64 max_password_age;
- int64 min_password_age;
+ dlong max_password_age;
+ dlong min_password_age;
} samr_DomInfo1;
typedef struct {
NTTIME force_logoff_time;
- samr_String comment;
- samr_String domain; /* domain name */
- samr_String primary; /* PDC name if this is a BDC */
- uint64 sequence_num;
+ lsa_String oem_information; /* comment */
+ lsa_String domain_name;
+ lsa_String primary; /* PDC name if this is a BDC */
+ udlong sequence_num;
uint32 unknown2;
- uint32 role;
+ samr_Role role;
uint32 unknown3;
uint32 num_users;
uint32 num_groups;
uint32 num_aliases;
- } samr_DomInfo2;
+ } samr_DomGeneralInformation;
typedef struct {
NTTIME force_logoff_time;
} samr_DomInfo3;
typedef struct {
- samr_String comment;
- } samr_DomInfo4;
+ lsa_String oem_information; /* comment */
+ } samr_DomOEMInformation;
typedef struct {
- samr_String domain_name;
+ lsa_String domain_name;
} samr_DomInfo5;
typedef struct {
- samr_String primary;
+ lsa_String primary;
} samr_DomInfo6;
typedef struct {
- uint32 role;
+ samr_Role role;
} samr_DomInfo7;
typedef struct {
- HYPER_T sequence_num;
+ hyper sequence_num;
NTTIME domain_create_time;
} samr_DomInfo8;
} samr_DomInfo9;
typedef struct {
- samr_DomInfo2 info2;
- HYPER_T lockout_duration;
- HYPER_T lockout_window;
+ samr_DomGeneralInformation general;
+ hyper lockout_duration;
+ hyper lockout_window;
uint16 lockout_threshold;
- } samr_DomInfo11;
+ } samr_DomGeneralInformation2;
typedef struct {
- HYPER_T lockout_duration;
- HYPER_T lockout_window;
+ hyper lockout_duration;
+ hyper lockout_window;
uint16 lockout_threshold;
} samr_DomInfo12;
typedef struct {
- HYPER_T sequence_num;
+ hyper sequence_num;
NTTIME domain_create_time;
uint32 unknown1;
uint32 unknown2;
} samr_DomInfo13;
- typedef union {
+ typedef [switch_type(uint16)] union {
[case(1)] samr_DomInfo1 info1;
- [case(2)] samr_DomInfo2 info2;
+ [case(2)] samr_DomGeneralInformation general;
[case(3)] samr_DomInfo3 info3;
- [case(4)] samr_DomInfo4 info4;
+ [case(4)] samr_DomOEMInformation oem;
[case(5)] samr_DomInfo5 info5;
[case(6)] samr_DomInfo6 info6;
[case(7)] samr_DomInfo7 info7;
[case(8)] samr_DomInfo8 info8;
[case(9)] samr_DomInfo9 info9;
- [case(11)] samr_DomInfo11 info11;
+ [case(11)] samr_DomGeneralInformation2 general2;
[case(12)] samr_DomInfo12 info12;
[case(13)] samr_DomInfo13 info13;
} samr_DomainInfo;
NTSTATUS samr_QueryDomainInfo(
[in,ref] policy_handle *domain_handle,
[in] uint16 level,
- [out,switch_is(level)] samr_DomainInfo *info
+ [out,switch_is(level),unique] samr_DomainInfo *info
);
/************************/
/* Function 0x0a */
NTSTATUS samr_CreateDomainGroup(
[in,ref] policy_handle *domain_handle,
- [in,ref] samr_String *name,
- [in] uint32 access_mask,
+ [in,ref] lsa_String *name,
+ [in] samr_GroupAccessMask access_mask,
[out,ref] policy_handle *group_handle,
[out,ref] uint32 *rid
);
[in,ref] policy_handle *domain_handle,
[in,out,ref] uint32 *resume_handle,
[in] uint32 max_size,
- [out] samr_SamArray *sam,
+ [out,unique] samr_SamArray *sam,
[out] uint32 num_entries
);
/* Function 0x0c */
NTSTATUS samr_CreateUser(
[in,ref] policy_handle *domain_handle,
- [in,ref] samr_String *account_name,
- [in] uint32 access_mask,
+ [in,ref] lsa_String *account_name,
+ [in] samr_UserAccessMask access_mask,
[out,ref] policy_handle *user_handle,
[out,ref] uint32 *rid
);
NTSTATUS samr_EnumDomainUsers(
[in,ref] policy_handle *domain_handle,
[in,out,ref] uint32 *resume_handle,
- [in] uint32 acct_flags,
+ [in] samr_AcctFlags acct_flags,
[in] uint32 max_size,
- [out] samr_SamArray *sam,
+ [out,unique] samr_SamArray *sam,
[out] uint32 num_entries
);
/* Function 0x0e */
NTSTATUS samr_CreateDomAlias(
[in,ref] policy_handle *domain_handle,
- [in,ref] samr_String *aliasname,
- [in] uint32 access_mask,
+ [in,ref] lsa_String *alias_name,
+ [in] samr_AliasAccessMask access_mask,
[out,ref] policy_handle *alias_handle,
[out,ref] uint32 *rid
);
NTSTATUS samr_EnumDomainAliases(
[in,ref] policy_handle *domain_handle,
[in,out,ref] uint32 *resume_handle,
- [in] uint32 acct_flags,
- [out] samr_SamArray *sam,
+ [in] samr_AcctFlags acct_flags,
+ [out,unique] samr_SamArray *sam,
[out] uint32 num_entries
);
/************************/
/* Function 0x10 */
- typedef enum {
- SID_NAME_USE_NONE = 0,/* NOTUSED */
- SID_NAME_USER = 1, /* user */
- SID_NAME_DOM_GRP = 2, /* domain group */
- SID_NAME_DOMAIN = 3, /* domain: don't know what this is */
- SID_NAME_ALIAS = 4, /* local group */
- SID_NAME_WKN_GRP = 5, /* well-known group */
- SID_NAME_DELETED = 6, /* deleted account: needed for c2 rating */
- SID_NAME_INVALID = 7, /* invalid account */
- SID_NAME_UNKNOWN = 8 /* oops. */
- } samr_SidType;
-
typedef struct {
[range(0,1024)] uint32 count;
[size_is(count)] uint32 *ids;
} samr_Ids;
NTSTATUS samr_GetAliasMembership(
- [in,ref] policy_handle *alias_handle,
+ [in,ref] policy_handle *domain_handle,
[in,ref] lsa_SidArray *sids,
- [out] samr_Ids *rids
+ [out,ref] samr_Ids *rids
);
/************************/
/* Function 0x11 */
- NTSTATUS samr_LookupNames(
+ [public] NTSTATUS samr_LookupNames(
[in,ref] policy_handle *domain_handle,
[in,range(0,1000)] uint32 num_names,
- [in,ref,size_is(1000),length_is(num_names)] samr_String *names,
+ [in,size_is(1000),length_is(num_names)] lsa_String names[],
[out] samr_Ids rids,
[out] samr_Ids types
);
/************************/
/* Function 0x12 */
-
- typedef struct {
- uint32 count;
- [size_is(count)] samr_String *names;
- } samr_Strings;
-
NTSTATUS samr_LookupRids(
[in,ref] policy_handle *domain_handle,
[in,range(0,1000)] uint32 num_rids,
- [in,ref,size_is(1000),length_is(num_rids)] uint32 *rids,
- [out] samr_Strings names,
+ [in,size_is(1000),length_is(num_rids)] uint32 rids[],
+ [out] lsa_Strings names,
[out] samr_Ids types
);
/* Function 0x13 */
NTSTATUS samr_OpenGroup(
[in,ref] policy_handle *domain_handle,
- [in] uint32 access_mask,
+ [in] samr_GroupAccessMask access_mask,
[in] uint32 rid,
[out,ref] policy_handle *group_handle
);
+ /* Group attributes */
+ typedef [public,bitmap32bit] bitmap {
+ SE_GROUP_MANDATORY = 0x00000001,
+ SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002,
+ SE_GROUP_ENABLED = 0x00000004,
+ SE_GROUP_OWNER = 0x00000008,
+ SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010,
+ SE_GROUP_RESOURCE = 0x20000000,
+ SE_GROUP_LOGON_ID = 0xC0000000
+ } samr_GroupAttrs;
/************************/
/* Function 0x14 */
typedef struct {
- samr_String name;
- uint32 attributes;
+ lsa_String name;
+ samr_GroupAttrs attributes;
uint32 num_members;
- samr_String description;
+ lsa_String description;
} samr_GroupInfoAll;
typedef struct {
- uint32 unknown;
- } samr_GroupInfoX;
+ samr_GroupAttrs attributes;
+ } samr_GroupInfoAttributes;
typedef struct {
- samr_String description;
- } samr_GroupInfoDesciption;
+ lsa_String description;
+ } samr_GroupInfoDescription;
typedef enum {
- GroupInfoAll = 1,
- GroupInfoName = 2,
- GroupInfoX = 3,
- GroupInfoDescription = 4,
- GroupInfoAll2 = 5
- } GroupInfo;
-
- typedef union {
- [case(GroupInfoAll)] samr_GroupInfoAll all;
- [case(GroupInfoName)] samr_String name;
- [case(GroupInfoX)] samr_GroupInfoX unknown;
- [case(GroupInfoDescription)] samr_String description;
- [case(GroupInfoAll2)] samr_GroupInfoAll all2;
+ GROUPINFOALL = 1,
+ GROUPINFONAME = 2,
+ GROUPINFOATTRIBUTES = 3,
+ GROUPINFODESCRIPTION = 4,
+ GROUPINFOALL2 = 5
+ } samr_GroupInfoEnum;
+
+ typedef [switch_type(samr_GroupInfoEnum)] union {
+ [case(GROUPINFOALL)] samr_GroupInfoAll all;
+ [case(GROUPINFONAME)] lsa_String name;
+ [case(GROUPINFOATTRIBUTES)] samr_GroupInfoAttributes attributes;
+ [case(GROUPINFODESCRIPTION)] lsa_String description;
+ [case(GROUPINFOALL2)] samr_GroupInfoAll all2;
} samr_GroupInfo;
NTSTATUS samr_QueryGroupInfo(
[in,ref] policy_handle *group_handle,
- [in] uint16 level,
- [out,switch_is(level)] samr_GroupInfo *info
+ [in] samr_GroupInfoEnum level,
+ [out,switch_is(level),unique] samr_GroupInfo *info
);
/************************/
/* Function 0x15 */
NTSTATUS samr_SetGroupInfo(
[in,ref] policy_handle *group_handle,
- [in] uint16 level,
+ [in] samr_GroupInfoEnum level,
[in,switch_is(level),ref] samr_GroupInfo *info
);
typedef struct {
uint32 count;
[size_is(count)] uint32 *rids;
- [size_is(count)] uint32 *unknown;
- } samr_ridArray;
+ [size_is(count)] uint32 *types;
+ } samr_RidTypeArray;
NTSTATUS samr_QueryGroupMember(
[in,ref] policy_handle *group_handle,
- [out] samr_ridArray *rids
+ [out,unique] samr_RidTypeArray *rids
);
/* Function 0x1b */
NTSTATUS samr_OpenAlias (
[in,ref] policy_handle *domain_handle,
- [in] uint32 access_mask,
+ [in] samr_AliasAccessMask access_mask,
[in] uint32 rid,
[out,ref] policy_handle *alias_handle
);
/* Function 0x1c */
typedef struct {
- samr_String name;
+ lsa_String name;
uint32 num_members;
- samr_String description;
+ lsa_String description;
} samr_AliasInfoAll;
typedef enum {
- AliasInfoAll = 1,
- AliasInfoName = 2,
- AliasInfoDescription = 3
- } AliasInfo;
-
- typedef union {
- [case(AliasInfoAll)] samr_AliasInfoAll all;
- [case(AliasInfoName)] samr_String name;
- [case(AliasInfoDescription)] samr_String description;
+ ALIASINFOALL = 1,
+ ALIASINFONAME = 2,
+ ALIASINFODESCRIPTION = 3
+ } samr_AliasInfoEnum;
+
+ typedef [switch_type(samr_AliasInfoEnum)] union {
+ [case(ALIASINFOALL)] samr_AliasInfoAll all;
+ [case(ALIASINFONAME)] lsa_String name;
+ [case(ALIASINFODESCRIPTION)] lsa_String description;
} samr_AliasInfo;
NTSTATUS samr_QueryAliasInfo(
- [in,ref] policy_handle *alias_handle,
- [in] uint16 level,
- [out,switch_is(level)] samr_AliasInfo *info
+ [in,ref] policy_handle *alias_handle,
+ [in] samr_AliasInfoEnum level,
+ [out,switch_is(level),unique] samr_AliasInfo *info
);
/************************/
/* Function 0x1d */
NTSTATUS samr_SetAliasInfo(
[in,ref] policy_handle *alias_handle,
- [in] uint16 level,
- [in,switch_is(level),ref] samr_AliasInfo *info
+ [in] samr_AliasInfoEnum level,
+ [in,switch_is(level),ref] samr_AliasInfo *info
);
/************************/
/************************/
/* Function 0x22 */
- NTSTATUS samr_OpenUser(
+ [public] NTSTATUS samr_OpenUser(
[in,ref] policy_handle *domain_handle,
- [in] uint32 access_mask,
+ [in] samr_UserAccessMask access_mask,
[in] uint32 rid,
[out,ref] policy_handle *user_handle
);
/************************/
/* Function 0x24 */
typedef struct {
- samr_String account_name;
- samr_String full_name;
+ lsa_String account_name;
+ lsa_String full_name;
uint32 primary_gid;
- samr_String description;
- samr_String comment;
+ lsa_String description;
+ lsa_String comment;
} samr_UserInfo1;
typedef struct {
- samr_String comment;
- samr_String unknown; /* settable, but doesn't stick. probably obsolete */
+ lsa_String comment;
+ lsa_String unknown; /* settable, but doesn't stick. probably obsolete */
uint16 country_code;
uint16 code_page;
} samr_UserInfo2;
/* this is also used in samr and netlogon */
typedef [public, flag(NDR_PAHEX)] struct {
uint16 units_per_week;
- [size_is(1260), length_is(units_per_week/8)] uint8 *bitmap;
+ [size_is(1260), length_is(units_per_week/8)] uint8 *bits;
} samr_LogonHours;
typedef struct {
- samr_String account_name;
- samr_String full_name;
+ lsa_String account_name;
+ lsa_String full_name;
uint32 rid;
uint32 primary_gid;
- samr_String home_directory;
- samr_String home_drive;
- samr_String logon_script;
- samr_String profile_path;
- samr_String workstations;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String workstations;
NTTIME last_logon;
NTTIME last_logoff;
NTTIME last_password_change;
samr_LogonHours logon_hours;
uint16 bad_password_count;
uint16 logon_count;
- uint32 acct_flags;
+ samr_AcctFlags acct_flags;
} samr_UserInfo3;
typedef struct {
} samr_UserInfo4;
typedef struct {
- samr_String account_name;
- samr_String full_name;
+ lsa_String account_name;
+ lsa_String full_name;
uint32 rid;
uint32 primary_gid;
- samr_String home_directory;
- samr_String home_drive;
- samr_String logon_script;
- samr_String profile_path;
- samr_String description;
- samr_String workstations;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String description;
+ lsa_String workstations;
NTTIME last_logon;
NTTIME last_logoff;
samr_LogonHours logon_hours;
uint16 logon_count;
NTTIME last_password_change;
NTTIME acct_expiry;
- uint32 acct_flags;
+ samr_AcctFlags acct_flags;
} samr_UserInfo5;
typedef struct {
- samr_String account_name;
- samr_String full_name;
+ lsa_String account_name;
+ lsa_String full_name;
} samr_UserInfo6;
typedef struct {
- samr_String account_name;
+ lsa_String account_name;
} samr_UserInfo7;
typedef struct {
- samr_String full_name;
+ lsa_String full_name;
} samr_UserInfo8;
typedef struct {
} samr_UserInfo9;
typedef struct {
- samr_String home_directory;
- samr_String home_drive;
+ lsa_String home_directory;
+ lsa_String home_drive;
} samr_UserInfo10;
typedef struct {
- samr_String logon_script;
+ lsa_String logon_script;
} samr_UserInfo11;
typedef struct {
- samr_String profile_path;
+ lsa_String profile_path;
} samr_UserInfo12;
typedef struct {
- samr_String description;
+ lsa_String description;
} samr_UserInfo13;
typedef struct {
- samr_String workstations;
+ lsa_String workstations;
} samr_UserInfo14;
typedef struct {
- uint32 acct_flags;
+ samr_AcctFlags acct_flags;
} samr_UserInfo16;
typedef struct {
} samr_UserInfo17;
typedef struct {
- samr_String parameters;
+ lsa_String parameters;
} samr_UserInfo20;
/* this defines the bits used for fields_present in info21 */
- const int SAMR_FIELD_NAME = 0x00000002;
- const int SAMR_FIELD_DESCRIPTION = 0x00000010;
- const int SAMR_FIELD_COMMENT = 0x00000020;
- const int SAMR_FIELD_LOGON_SCRIPT = 0x00000100;
- const int SAMR_FIELD_PROFILE_PATH = 0x00000200;
- const int SAMR_FIELD_WORKSTATION = 0x00000400;
- const int SAMR_FIELD_LOGON_HOURS = 0x00002000;
- const int SAMR_FIELD_ACCT_FLAGS = 0x00100000;
- const int SAMR_FIELD_PARAMETERS = 0x00200000;
- const int SAMR_FIELD_COUNTRY_CODE = 0x00400000;
- const int SAMR_FIELD_CODE_PAGE = 0x00800000;
- const int SAMR_FIELD_PASSWORD = 0x01000000; /* either of these */
- const int SAMR_FIELD_PASSWORD2 = 0x02000000; /* two bits seems to work */
+ typedef [bitmap32bit] bitmap {
+ SAMR_FIELD_ACCOUNT_NAME = 0x00000001,
+ SAMR_FIELD_FULL_NAME = 0x00000002,
+ SAMR_FIELD_RID = 0x00000004,
+ SAMR_FIELD_PRIMARY_GID = 0x00000008,
+ SAMR_FIELD_DESCRIPTION = 0x00000010,
+ SAMR_FIELD_COMMENT = 0x00000020,
+ SAMR_FIELD_HOME_DIRECTORY = 0x00000040,
+ SAMR_FIELD_HOME_DRIVE = 0x00000080,
+ SAMR_FIELD_LOGON_SCRIPT = 0x00000100,
+ SAMR_FIELD_PROFILE_PATH = 0x00000200,
+ SAMR_FIELD_WORKSTATIONS = 0x00000400,
+ SAMR_FIELD_LAST_LOGON = 0x00000800,
+ SAMR_FIELD_LAST_LOGOFF = 0x00001000,
+ SAMR_FIELD_LOGON_HOURS = 0x00002000,
+ SAMR_FIELD_BAD_PWD_COUNT = 0x00004000,
+ SAMR_FIELD_NUM_LOGONS = 0x00008000,
+ SAMR_FIELD_ALLOW_PWD_CHANGE = 0x00010000,
+ SAMR_FIELD_FORCE_PWD_CHANGE = 0x00020000,
+ SAMR_FIELD_LAST_PWD_CHANGE = 0x00040000,
+ SAMR_FIELD_ACCT_EXPIRY = 0x00080000,
+ SAMR_FIELD_ACCT_FLAGS = 0x00100000,
+ SAMR_FIELD_PARAMETERS = 0x00200000,
+ SAMR_FIELD_COUNTRY_CODE = 0x00400000,
+ SAMR_FIELD_CODE_PAGE = 0x00800000,
+ SAMR_FIELD_PASSWORD = 0x01000000, /* either of these */
+ SAMR_FIELD_PASSWORD2 = 0x02000000, /* two bits seems to work */
+ SAMR_FIELD_PRIVATE_DATA = 0x04000000,
+ SAMR_FIELD_EXPIRED_FLAG = 0x08000000,
+ SAMR_FIELD_SEC_DESC = 0x10000000,
+ SAMR_FIELD_OWF_PWD = 0x20000000
+ } samr_FieldsPresent;
typedef struct {
NTTIME last_logon;
NTTIME acct_expiry;
NTTIME allow_password_change;
NTTIME force_password_change;
- samr_String account_name;
- samr_String full_name;
- samr_String home_directory;
- samr_String home_drive;
- samr_String logon_script;
- samr_String profile_path;
- samr_String description;
- samr_String workstations;
- samr_String comment;
- samr_String parameters;
- samr_String unknown1;
- samr_String unknown2;
- samr_String unknown3;
+ lsa_String account_name;
+ lsa_String full_name;
+ lsa_String home_directory;
+ lsa_String home_drive;
+ lsa_String logon_script;
+ lsa_String profile_path;
+ lsa_String description;
+ lsa_String workstations;
+ lsa_String comment;
+ lsa_String parameters;
+ lsa_String unknown1;
+ lsa_String unknown2;
+ lsa_String unknown3;
uint32 buf_count;
[size_is(buf_count)] uint8 *buffer;
uint32 rid;
uint32 primary_gid;
- uint32 acct_flags;
- uint32 fields_present;
+ samr_AcctFlags acct_flags;
+ samr_FieldsPresent fields_present;
samr_LogonHours logon_hours;
uint16 bad_password_count;
uint16 logon_count;
uint8 unknown4;
} samr_UserInfo21;
- typedef [flag(NDR_PAHEX)] struct {
+ typedef [public, flag(NDR_PAHEX)] struct {
uint8 data[516];
} samr_CryptPassword;
typedef struct {
samr_CryptPassword password;
- uint16 pw_len;
+ uint8 pw_len;
} samr_UserInfo24;
typedef [flag(NDR_PAHEX)] struct {
uint8 pw_len;
} samr_UserInfo26;
- typedef union {
+ typedef [switch_type(uint16)] union {
[case(1)] samr_UserInfo1 info1;
[case(2)] samr_UserInfo2 info2;
[case(3)] samr_UserInfo3 info3;
[case(26)] samr_UserInfo26 info26;
} samr_UserInfo;
- NTSTATUS samr_QueryUserInfo(
+ [public] NTSTATUS samr_QueryUserInfo(
[in,ref] policy_handle *user_handle,
[in] uint16 level,
- [out,switch_is(level)] samr_UserInfo *info
+ [out,unique,switch_is(level)] samr_UserInfo *info
);
/************************/
/* Function 0x25 */
- NTSTATUS samr_SetUserInfo(
+ [public] NTSTATUS samr_SetUserInfo(
[in,ref] policy_handle *user_handle,
[in] uint16 level,
[in,ref,switch_is(level)] samr_UserInfo *info
/************************/
/* Function 0x26 */
-
+ typedef [public, flag(NDR_PAHEX)] struct {
+ uint8 hash[16];
+ } samr_Password;
+
/*
this is a password change interface that doesn't give
the server the plaintext password. Depricated.
*/
NTSTATUS samr_ChangePasswordUser(
[in,ref] policy_handle *user_handle,
- [in] bool8 lm_present,
- [in] samr_Password *old_lm_crypted,
- [in] samr_Password *new_lm_crypted,
- [in] bool8 nt_present,
- [in] samr_Password *old_nt_crypted,
- [in] samr_Password *new_nt_crypted,
- [in] bool8 cross1_present,
- [in] samr_Password *nt_cross,
- [in] bool8 cross2_present,
- [in] samr_Password *lm_cross
+ [in] boolean8 lm_present,
+ [in,unique] samr_Password *old_lm_crypted,
+ [in,unique] samr_Password *new_lm_crypted,
+ [in] boolean8 nt_present,
+ [in,unique] samr_Password *old_nt_crypted,
+ [in,unique] samr_Password *new_nt_crypted,
+ [in] boolean8 cross1_present,
+ [in,unique] samr_Password *nt_cross,
+ [in] boolean8 cross2_present,
+ [in,unique] samr_Password *lm_cross
);
/************************/
/* Function 0x27 */
- typedef struct {
+ typedef [public] struct {
uint32 rid;
- uint32 type;
- } samr_RidType;
+ samr_GroupAttrs attributes;
+ } samr_RidWithAttribute;
- typedef struct {
+ typedef [public] struct {
uint32 count;
- [size_is(count)] samr_RidType *rid;
- } samr_RidArray;
+ [size_is(count)] samr_RidWithAttribute *rids;
+ } samr_RidWithAttributeArray;
NTSTATUS samr_GetGroupsForUser(
[in,ref] policy_handle *user_handle,
- [out] samr_RidArray *rids
+ [out,unique] samr_RidWithAttributeArray *rids
);
/************************/
typedef struct {
uint32 idx;
uint32 rid;
- uint32 acct_flags;
- samr_String account_name;
- samr_String full_name;
- samr_String description;
+ samr_AcctFlags acct_flags;
+ lsa_String account_name;
+ lsa_String description;
+ lsa_String full_name;
} samr_DispEntryGeneral;
typedef struct {
typedef struct {
uint32 idx;
uint32 rid;
- uint32 acct_flags;
- samr_String account_name;
- samr_String description;
+ samr_AcctFlags acct_flags;
+ lsa_String account_name;
+ lsa_String description;
} samr_DispEntryFull;
typedef struct {
} samr_DispInfoFull;
typedef struct {
- [value(strlen_m(r->string))] uint16 length;
- [value(strlen_m(r->string))] uint16 size;
- ascstr_noterm *string;
- } samr_AsciiName;
+ uint32 idx;
+ uint32 rid;
+ samr_GroupAttrs acct_flags;
+ lsa_String account_name;
+ lsa_String description;
+ } samr_DispEntryFullGroup;
+
+ typedef struct {
+ uint32 count;
+ [size_is(count)] samr_DispEntryFullGroup *entries;
+ } samr_DispInfoFullGroups;
typedef struct {
uint32 idx;
- samr_AsciiName account_name;
+ lsa_AsciiStringLarge account_name;
} samr_DispEntryAscii;
typedef struct {
[size_is(count)] samr_DispEntryAscii *entries;
} samr_DispInfoAscii;
- typedef union {
+ typedef [switch_type(uint16)] union {
[case(1)] samr_DispInfoGeneral info1;/* users */
[case(2)] samr_DispInfoFull info2; /* trust accounts? */
- [case(3)] samr_DispInfoFull info3; /* groups */
+ [case(3)] samr_DispInfoFullGroups info3; /* groups */
[case(4)] samr_DispInfoAscii info4; /* users */
[case(5)] samr_DispInfoAscii info5; /* groups */
} samr_DispInfo;
NTSTATUS samr_GetDisplayEnumerationIndex(
[in,ref] policy_handle *domain_handle,
[in] uint16 level,
- [in] samr_String name,
+ [in] lsa_String name,
[out] uint32 idx
);
/************************/
/* Function 0x2c */
- /* password properties flags */
- const uint32 DOMAIN_PASSWORD_COMPLEX = 0x00000001;
- const uint32 DOMAIN_PASSWORD_NO_ANON_CHANGE = 0x00000002;
- const uint32 DOMAIN_PASSWORD_NO_CLEAR_CHANGE = 0x00000004;
- const uint32 DOMAIN_PASSWORD_STORE_CLEARTEXT = 0x00000010;
- const uint32 DOMAIN_REFUSE_PASSWORD_CHANGE = 0x00000020;
-
typedef struct {
uint16 min_password_length;
- uint32 password_properties;
+ samr_PasswordProperties password_properties;
} samr_PwInfo;
- NTSTATUS samr_GetUserPwInfo(
+ [public] NTSTATUS samr_GetUserPwInfo(
[in,ref] policy_handle *user_handle,
[out] samr_PwInfo info
);
NTSTATUS samr_QueryDomainInfo2(
[in,ref] policy_handle *domain_handle,
[in] uint16 level,
- [out,switch_is(level)] samr_DomainInfo *info
+ [out,unique,switch_is(level)] samr_DomainInfo *info
);
/************************/
NTSTATUS samr_QueryUserInfo2(
[in,ref] policy_handle *user_handle,
[in] uint16 level,
- [out,switch_is(level)] samr_UserInfo *info
+ [out,unique,switch_is(level)] samr_UserInfo *info
);
/************************/
NTSTATUS samr_GetDisplayEnumerationIndex2(
[in,ref] policy_handle *domain_handle,
[in] uint16 level,
- [in] samr_String name,
+ [in] lsa_String name,
[out] uint32 idx
);
/* Function 0x32 */
NTSTATUS samr_CreateUser2(
[in,ref] policy_handle *domain_handle,
- [in,ref] samr_String *account_name,
- [in] uint32 acct_flags,
- [in] uint32 access_mask,
+ [in,ref] lsa_String *account_name,
+ [in] samr_AcctFlags acct_flags,
+ [in] samr_UserAccessMask access_mask,
[out,ref] policy_handle *user_handle,
[out,ref] uint32 *access_granted,
[out,ref] uint32 *rid
/* Function 0x36 */
NTSTATUS samr_OemChangePasswordUser2(
- [in] samr_AsciiName *server,
- [in,ref] samr_AsciiName *account,
- [in] samr_CryptPassword *password,
- [in] samr_Password *hash
+ [in,unique] lsa_AsciiString *server,
+ [in,ref] lsa_AsciiString *account,
+ [in,unique] samr_CryptPassword *password,
+ [in,unique] samr_Password *hash
);
/************************/
/* Function 0x37 */
NTSTATUS samr_ChangePasswordUser2(
- [in] samr_String *server,
- [in,ref] samr_String *account,
- [in] samr_CryptPassword *nt_password,
- [in] samr_Password *nt_verifier,
- [in] bool8 lm_change,
- [in] samr_CryptPassword *lm_password,
- [in] samr_Password *lm_verifier
+ [in,unique] lsa_String *server,
+ [in,ref] lsa_String *account,
+ [in,unique] samr_CryptPassword *nt_password,
+ [in,unique] samr_Password *nt_verifier,
+ [in] boolean8 lm_change,
+ [in,unique] samr_CryptPassword *lm_password,
+ [in,unique] samr_Password *lm_verifier
);
/************************/
/* Function 0x38 */
NTSTATUS samr_GetDomPwInfo(
- [in] samr_String *name,
+ [in,unique] lsa_String *domain_name,
[out] samr_PwInfo info
);
/************************/
/* Function 0x39 */
NTSTATUS samr_Connect2(
- [in] unistr *system_name,
- [in] uint32 access_mask,
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
[out,ref] policy_handle *connect_handle
);
/*
seems to be an exact alias for samr_SetUserInfo()
*/
- NTSTATUS samr_SetUserInfo2(
+ [public] NTSTATUS samr_SetUserInfo2(
[in,ref] policy_handle *user_handle,
[in] uint16 level,
[in,ref,switch_is(level)] samr_UserInfo *info
/************************/
/* Function 0x3d */
NTSTATUS samr_Connect3(
- [in] unistr *system_name,
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
/* this unknown value seems to be completely ignored by w2k3 */
[in] uint32 unknown,
- [in] uint32 access_mask,
+ [in] samr_ConnectAccessMask access_mask,
[out,ref] policy_handle *connect_handle
);
/************************/
/* Function 0x3e */
NTSTATUS samr_Connect4(
- [in] unistr *system_name,
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
[in] uint32 unknown,
- [in] uint32 access_mask,
+ [in] samr_ConnectAccessMask access_mask,
[out,ref] policy_handle *connect_handle
);
/************************/
/* Function 0x3f */
- const int SAMR_REJECT_OTHER = 0;
- const int SAMR_REJECT_TOO_SHORT = 1;
- const int SAMR_REJECT_COMPLEXITY = 2;
+ typedef enum samr_RejectReason samr_RejectReason;
typedef struct {
- uint32 reason;
+ samr_RejectReason reason;
uint32 unknown1;
uint32 unknown2;
} samr_ChangeReject;
NTSTATUS samr_ChangePasswordUser3(
- [in] samr_String *server,
- [in,ref] samr_String *account,
- [in] samr_CryptPassword *nt_password,
- [in] samr_Password *nt_verifier,
- [in] bool8 lm_change,
- [in] samr_CryptPassword *lm_password,
- [in] samr_Password *lm_verifier,
- [in] samr_CryptPassword *password3,
- [out] samr_DomInfo1 *dominfo,
- [out] samr_ChangeReject *reject
+ [in,unique] lsa_String *server,
+ [in,ref] lsa_String *account,
+ [in,unique] samr_CryptPassword *nt_password,
+ [in,unique] samr_Password *nt_verifier,
+ [in] boolean8 lm_change,
+ [in,unique] samr_CryptPassword *lm_password,
+ [in,unique] samr_Password *lm_verifier,
+ [in,unique] samr_CryptPassword *password3,
+ [out,unique] samr_DomInfo1 *dominfo,
+ [out,unique] samr_ChangeReject *reject
);
/************************/
[case(1)] samr_ConnectInfo1 info1;
} samr_ConnectInfo;
- NTSTATUS samr_Connect5(
- [in] unistr *system_name,
- [in] uint32 access_mask,
+ [public] NTSTATUS samr_Connect5(
+ [in,unique,string,charset(UTF16)] uint16 *system_name,
+ [in] samr_ConnectAccessMask access_mask,
[in,out] uint32 level,
[in,out,switch_is(level),ref] samr_ConnectInfo *info,
[out,ref] policy_handle *connect_handle
NTSTATUS samr_RidToSid(
[in,ref] policy_handle *domain_handle,
[in] uint32 rid,
- [out] dom_sid2 *sid
+ [out,unique] dom_sid2 *sid
);
*/
NTSTATUS samr_SetDsrmPassword(
- [in] samr_String *name,
+ [in,unique] lsa_String *name,
[in] uint32 unknown,
- [in] samr_Password *hash
+ [in,unique] samr_Password *hash
);
/************************/
/* Function 0x43 */
- /*
- I haven't been able to work out the format of this one yet.
- Seems to start with a switch level for a union?
- */
- NTSTATUS samr_ValidatePassword();
+ /************************/
+ typedef [bitmap32bit] bitmap {
+ SAMR_VALIDATE_FIELD_PASSWORD_LAST_SET = 0x00000001,
+ SAMR_VALIDATE_FIELD_BAD_PASSWORD_TIME = 0x00000002,
+ SAMR_VALIDATE_FIELD_LOCKOUT_TIME = 0x00000004,
+ SAMR_VALIDATE_FIELD_BAD_PASSWORD_COUNT = 0x00000008,
+ SAMR_VALIDATE_FIELD_PASSWORD_HISTORY_LENGTH = 0x00000010,
+ SAMR_VALIDATE_FIELD_PASSWORD_HISTORY = 0x00000020
+ } samr_ValidateFieldsPresent;
+
+ typedef enum {
+ NetValidateAuthentication = 1,
+ NetValidatePasswordChange= 2,
+ NetValidatePasswordReset = 3
+ } samr_ValidatePasswordLevel;
+
+ /* NetApi maps samr_ValidationStatus errors to WERRORs. Haven't
+ * identified the mapping of
+ * - NERR_PasswordFilterError
+ * - NERR_PasswordExpired and
+ * - NERR_PasswordCantChange
+ * yet - Guenther
+ */
+
+ typedef enum {
+ SAMR_VALIDATION_STATUS_SUCCESS = 0,
+ SAMR_VALIDATION_STATUS_PASSWORD_MUST_CHANGE = 1,
+ SAMR_VALIDATION_STATUS_ACCOUNT_LOCKED_OUT = 2,
+ SAMR_VALIDATION_STATUS_BAD_PASSWORD = 4,
+ SAMR_VALIDATION_STATUS_PWD_HISTORY_CONFLICT = 5,
+ SAMR_VALIDATION_STATUS_PWD_TOO_SHORT = 6,
+ SAMR_VALIDATION_STATUS_PWD_TOO_LONG = 7,
+ SAMR_VALIDATION_STATUS_NOT_COMPLEX_ENOUGH = 8,
+ SAMR_VALIDATION_STATUS_PASSWORD_TOO_RECENT = 9
+ } samr_ValidationStatus;
+
+ typedef struct {
+ uint32 length;
+ [size_is(length)] uint8 *data;
+ } samr_ValidationBlob;
+
+ typedef struct {
+ samr_ValidateFieldsPresent fields_present;
+ NTTIME_hyper last_password_change;
+ NTTIME_hyper bad_password_time;
+ NTTIME_hyper lockout_time;
+ uint32 bad_pwd_count;
+ uint32 pwd_history_len;
+ [size_is(pwd_history_len)] samr_ValidationBlob *pwd_history;
+ } samr_ValidatePasswordInfo;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ samr_ValidationStatus status;
+ } samr_ValidatePasswordRepCtr;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_ValidatePasswordRepCtr ctr1;
+ [case(2)] samr_ValidatePasswordRepCtr ctr2;
+ [case(3)] samr_ValidatePasswordRepCtr ctr3;
+ } samr_ValidatePasswordRep;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ lsa_StringLarge password;
+ lsa_StringLarge account;
+ samr_ValidationBlob hash;
+ boolean8 pwd_must_change_at_next_logon;
+ boolean8 clear_lockout;
+ } samr_ValidatePasswordReq3;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ lsa_StringLarge password;
+ lsa_StringLarge account;
+ samr_ValidationBlob hash;
+ boolean8 password_matched;
+ } samr_ValidatePasswordReq2;
+
+ typedef struct {
+ samr_ValidatePasswordInfo info;
+ boolean8 password_matched;
+ } samr_ValidatePasswordReq1;
+
+ typedef [switch_type(uint16)] union {
+ [case(1)] samr_ValidatePasswordReq1 req1;
+ [case(2)] samr_ValidatePasswordReq2 req2;
+ [case(3)] samr_ValidatePasswordReq3 req3;
+ } samr_ValidatePasswordReq;
+
+ NTSTATUS samr_ValidatePassword(
+ [in] samr_ValidatePasswordLevel level,
+ [in,switch_is(level)] samr_ValidatePasswordReq req,
+ [out,unique,switch_is(level)] samr_ValidatePasswordRep *rep
+ );
}