From b12b8cec374c74b0700b0f11c5839cc03ffbdf3a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Wed, 1 Oct 2008 00:14:17 +0000 Subject: [PATCH] add initial idl file and conformance file for LSA svn path=/trunk/; revision=26316 --- epan/dissectors/pidl/lsa.cnf | 327 ++++++++++ epan/dissectors/pidl/lsa.idl | 1115 ++++++++++++++++++++++++++++++++++ 2 files changed, 1442 insertions(+) create mode 100644 epan/dissectors/pidl/lsa.cnf create mode 100644 epan/dissectors/pidl/lsa.idl diff --git a/epan/dissectors/pidl/lsa.cnf b/epan/dissectors/pidl/lsa.cnf new file mode 100644 index 0000000000..24221821d1 --- /dev/null +++ b/epan/dissectors/pidl/lsa.cnf @@ -0,0 +1,327 @@ +# +# policyhandle tracking +# This block is to specify where a policyhandle is opened and where it is +# closed so that policyhandles when dissected contain nice info such as +# [opened in xxx] [closed in yyy] +# +# Policyhandles are opened in these functions +PARAM_VALUE lsarpc_dissect_element_lsa_OpenPolicy_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_POLICY +PARAM_VALUE lsarpc_dissect_element_lsa_OpenPolicy2_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_POLICY +PARAM_VALUE lsarpc_dissect_element_lsa_CreateAccount_acct_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_ACCOUNT +PARAM_VALUE lsarpc_dissect_element_lsa_OpenAccount_acct_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_ACCOUNT +PARAM_VALUE lsarpc_dissect_element_lsa_CreateTrustedDomain_trustdom_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_DOMAIN +PARAM_VALUE lsarpc_dissect_element_lsa_OpenTrustedDomain_trustdom_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_DOMAIN +PARAM_VALUE lsarpc_dissect_element_lsa_OpenTrustedDomainByName_trustdom_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_DOMAIN +PARAM_VALUE lsarpc_dissect_element_lsa_CreateSecret_sec_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_SECRET +PARAM_VALUE lsarpc_dissect_element_lsa_OpenSecret_sec_handle_ PIDL_POLHND_OPEN|PIDL_POLHND_TYPE_LSA_SECRET +# Policyhandles are closed in these functions +PARAM_VALUE lsarpc_dissect_element_lsa_Close_handle_ PIDL_POLHND_CLOSE +PARAM_VALUE lsarpc_dissect_element_lsa_Delete_handle_ PIDL_POLHND_CLOSE +PARAM_VALUE lsarpc_dissect_element_lsa_CloseTrustedDomainEx_handle_ PIDL_POLHND_CLOSE + + + +TYPE hyper "offset=cnf_dissect_hyper(tvb, offset, pinfo, tree, drep, @PARAM@, @HF@);" FT_UINT64 BASE_DEC 0 NULL 8 + +TYPE sec_desc_buf "offset=cnf_dissect_sec_desc_buf(tvb, offset, pinfo, tree, drep);" FT_NONE BASE_NONE 0 NULL 4 +HF_FIELD hf_lsarpc_sec_desc_buf_len "Sec Desc Buf Len" "lsarpc.sec_desc_buf_len" FT_UINT32 BASE_DEC NULL 0 "" "" "" + + +MANUAL lsarpc_dissect_bitmap_lsa_PolicyAccessMask +MANUAL lsarpc_dissect_bitmap_lsa_AccountAccessMask +MANUAL lsarpc_dissect_bitmap_lsa_SecretAccessMask +MANUAL lsarpc_dissect_bitmap_lsa_DomainAccessMask +HF_FIELD hf_lsarpc_policy_access_mask "Access Mask" "lsarpc.policy.access_mask" FT_UINT32 BASE_HEX NULL 0 "" "" "" +HF_FIELD hf_lsarpc_account_access_mask "Access Mask" "lsarpc.policy.access_mask" FT_UINT32 BASE_HEX NULL 0 "" "" "" +HF_FIELD hf_lsarpc_secret_access_mask "Access Mask" "lsarpc.policy.access_mask" FT_UINT32 BASE_HEX NULL 0 "" "" "" +HF_FIELD hf_lsarpc_domain_access_mask "Access Mask" "lsarpc.policy.access_mask" FT_UINT32 BASE_HEX NULL 0 "" "" "" + +HF_FIELD hf_lsarpc_String_name "String" "lsarpc.lsa.string" FT_STRING BASE_NONE NULL 0 "" "" "" + +MANUAL lsarpc_dissect_element_lsa_LookupNames3_names +MANUAL lsarpc_dissect_element_lsa_String_string_ +MANUAL lsarpc_dissect_element_lsa_String_string__ +MANUAL lsarpc_dissect_element_lsa_StringLarge_string_ +MANUAL lsarpc_dissect_element_lsa_StringLarge_string__ + +ETT_FIELD ett_lsarpc_names +HF_FIELD hf_lsarpc_names "Names" "lsarpc.lookup.names" FT_NONE BASE_NONE NULL 0 "" "" "" + +CODE START + + +static void +lsarpc_policy_specific_rights(tvbuff_t *tvb _U_, gint offset _U_, proto_tree *tree _U_, guint32 access _U_) +{ + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_NOTIFICATION, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_LOOKUP_NAMES, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_SERVER_ADMIN, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_AUDIT_LOG_ADMIN, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_SET_AUDIT_REQUIREMENTS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_CREATE_PRIVILEGE, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_CREATE_SECRET, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_CREATE_ACCOUNT, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_TRUST_ADMIN, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_GET_PRIVATE_INFORMATION, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_VIEW_AUDIT_INFORMATION, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_PolicyAccessMask_LSA_POLICY_VIEW_LOCAL_INFORMATION, tvb, offset, 4, access); +} + +static void +lsarpc_account_specific_rights(tvbuff_t *tvb _U_, gint offset _U_, proto_tree *tree _U_, guint32 access _U_) +{ + proto_tree_add_boolean(tree, hf_lsarpc_lsa_AccountAccessMask_LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_AccountAccessMask_LSA_ACCOUNT_ADJUST_QUOTAS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_AccountAccessMask_LSA_ACCOUNT_ADJUST_PRIVILEGES, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_AccountAccessMask_LSA_ACCOUNT_VIEW, tvb, offset, 4, access); +} + +static void +lsarpc_secret_specific_rights(tvbuff_t *tvb _U_, gint offset _U_, proto_tree *tree _U_, guint32 access _U_) +{ + proto_tree_add_boolean(tree, hf_lsarpc_lsa_SecretAccessMask_LSA_SECRET_QUERY_VALUE, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_SecretAccessMask_LSA_SECRET_SET_VALUE, tvb, offset, 4, access); +} + +static void +lsarpc_domain_specific_rights(tvbuff_t *tvb _U_, gint offset _U_, proto_tree *tree _U_, guint32 access _U_) +{ + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_QUERY_AUTH, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_SET_AUTH, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_SET_POSIX, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_QUERY_POSIX, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_SET_CONTROLLERS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_QUERY_CONTROLLERS, tvb, offset, 4, access); + proto_tree_add_boolean(tree, hf_lsarpc_lsa_DomainAccessMask_LSA_DOMAIN_QUERY_DOMAIN_NAME, tvb, offset, 4, access); +} + + +struct access_mask_info lsarpc_policy_access_mask_info = { + "LSA Policy", /* Name of specific rights */ + lsarpc_policy_specific_rights, /* Dissection function */ + NULL, /* Generic mapping table */ + NULL /* Standard mapping table */ +}; + +struct access_mask_info lsarpc_account_access_mask_info = { + "LSA Account", /* Name of specific rights */ + lsarpc_account_specific_rights, /* Dissection function */ + NULL, /* Generic mapping table */ + NULL /* Standard mapping table */ +}; + +struct access_mask_info lsarpc_secret_access_mask_info = { + "LSA Secret", /* Name of specific rights */ + lsarpc_secret_specific_rights, /* Dissection function */ + NULL, /* Generic mapping table */ + NULL /* Standard mapping table */ +}; + +struct access_mask_info lsarpc_domain_access_mask_info = { + "LSA Domain", /* Name of specific rights */ + lsarpc_domain_specific_rights, /* Dissection function */ + NULL, /* Generic mapping table */ + NULL /* Standard mapping table */ +}; + +int +lsarpc_dissect_bitmap_lsa_PolicyAccessMask(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index _U_, guint32 param _U_) +{ + offset = dissect_nt_access_mask( + tvb, offset, pinfo, tree, drep, hf_lsarpc_policy_access_mask, + &lsarpc_policy_access_mask_info, NULL); + return offset; +} + +int +lsarpc_dissect_bitmap_lsa_AccountAccessMask(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index _U_, guint32 param _U_) +{ + offset = dissect_nt_access_mask( + tvb, offset, pinfo, tree, drep, hf_lsarpc_account_access_mask, + &lsarpc_account_access_mask_info, NULL); + return offset; +} + +int +lsarpc_dissect_bitmap_lsa_SecretAccessMask(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index _U_, guint32 param _U_) +{ + offset = dissect_nt_access_mask( + tvb, offset, pinfo, tree, drep, hf_lsarpc_secret_access_mask, + &lsarpc_secret_access_mask_info, NULL); + return offset; +} + +int +lsarpc_dissect_bitmap_lsa_DomainAccessMask(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index _U_, guint32 param _U_) +{ + offset = dissect_nt_access_mask( + tvb, offset, pinfo, tree, drep, hf_lsarpc_domain_access_mask, + &lsarpc_domain_access_mask_info, NULL); + return offset; +} + +static int +cnf_dissect_sec_desc_buf_(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) +{ + guint32 len; + dcerpc_info *di = NULL; + e_ctx_hnd *polhnd = NULL; + dcerpc_call_value *dcv = NULL; + guint32 type=0; + struct access_mask_info *ami=NULL; + + di=pinfo->private_data; + if(di->conformant_run){ + /*just a run to handle conformant arrays, nothing to dissect */ + return offset; + } + + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, + hf_lsarpc_sec_desc_buf_len, &len); + + dcv = (dcerpc_call_value *)di->call_data; + if(dcv){ + polhnd = dcv->pol; + } + if(polhnd){ + dcerpc_fetch_polhnd_data(polhnd, NULL, &type, NULL, NULL, + pinfo->fd->num); + } + switch(type){ + case PIDL_POLHND_TYPE_LSA_POLICY: + ami=&lsarpc_policy_access_mask_info; + break; + case PIDL_POLHND_TYPE_LSA_ACCOUNT: + ami=&lsarpc_account_access_mask_info; + break; + case PIDL_POLHND_TYPE_LSA_SECRET: + ami=&lsarpc_secret_access_mask_info; + break; + case PIDL_POLHND_TYPE_LSA_DOMAIN: + ami=&lsarpc_domain_access_mask_info; + break; + } + + dissect_nt_sec_desc(tvb, offset, pinfo, tree, drep, TRUE, len, ami); + + offset += len; + + return offset; +} + +static int +cnf_dissect_sec_desc_buf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep) +{ + guint32 len; + dcerpc_info *di; + + di=pinfo->private_data; + if(di->conformant_run){ + /*just a run to handle conformant arrays, nothing to dissect */ + return offset; + } + + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep, + hf_lsarpc_sec_desc_buf_len, &len); + + offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep, + cnf_dissect_sec_desc_buf_, NDR_POINTER_UNIQUE, + "LSA SECURITY DESCRIPTOR data:", -1); + + return offset; +} + + +int +lsarpc_dissect_sec_desc_buf(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep){ + return cnf_dissect_sec_desc_buf(tvb, offset, pinfo, tree, drep); +} + +int +lsarpc_dissect_struct_security_descriptor(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int unused1 _U_, int unused2 _U_){ + return cnf_dissect_sec_desc_buf(tvb, offset, pinfo, tree, drep); +} + + +int +lsarpc_dissect_struct_dom_sid2(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int unused1 _U_, int unused2 _U_) { + /* sid */ + return dissect_ndr_nt_SID(tvb, offset, pinfo, tree, drep); + +} + +static int +cnf_dissect_hyper(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint32 param _U_, int hfindex) +{ + offset = dissect_ndr_uint64(tvb, offset, pinfo, tree, drep, hfindex, NULL); + + return offset; +} + +static int +lsarpc_dissect_element_lsa_LookupNames3_names_X(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_) +{ + proto_item *item = NULL; + proto_tree *tree = NULL; + dcerpc_info *di = NULL; + int old_offset = offset; + + if (parent_tree) { + item = proto_tree_add_item(parent_tree, hf_lsarpc_names, tvb, offset, -1, TRUE); + tree = proto_item_add_subtree(item, ett_lsarpc_names); + } + + di=pinfo->private_data; + + offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep, lsarpc_dissect_element_lsa_LookupNames3_names_); + + proto_item_set_len(item, offset-old_offset); + return offset; +} + +static int +lsarpc_dissect_element_lsa_LookupNames3_names(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_) +{ + offset = dissect_ndr_toplevel_pointer(tvb, offset, pinfo, tree, drep, lsarpc_dissect_element_lsa_LookupNames3_names_X, NDR_POINTER_REF, "Pointer to Names", hf_lsarpc_names); + + return offset; +} + + +static int +lsarpc_dissect_element_lsa_String_string__(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_) +{ + return offset; +} + +static int +lsarpc_dissect_element_lsa_String_string_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_) +{ + char *data; + + offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint16), hf_lsarpc_String_name, FALSE, &data); + proto_item_append_text(tree, ": %s", data); + + return offset; +} + +static int +lsarpc_dissect_element_lsa_StringLarge_string__(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_) +{ + return offset; +} + +static int +lsarpc_dissect_element_lsa_StringLarge_string_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_) +{ + char *data; + + offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, sizeof(guint16), hf_lsarpc_String_name, FALSE, &data); + proto_item_append_text(tree, ": %s", data); + + return offset; +} + + +CODE END diff --git a/epan/dissectors/pidl/lsa.idl b/epan/dissectors/pidl/lsa.idl new file mode 100644 index 0000000000..d923e19609 --- /dev/null +++ b/epan/dissectors/pidl/lsa.idl @@ -0,0 +1,1115 @@ +#include "idl_types.h" + +/* + lsa interface definition +*/ + +/*import "misc.idl", "security.idl";*/ + +[ uuid("12345778-1234-abcd-ef00-0123456789ab"), + version(0.0), + endpoint("ncacn_np:[\\pipe\\lsarpc]","ncacn_np:[\\pipe\\netlogon]","ncacn_np:[\\pipe\\lsass]", "ncacn_ip_tcp:", "ncalrpc:"), + pointer_default(unique), + helpstring("Local Security Authority") +] interface lsarpc +{ + typedef [bitmap32bit] bitmap { + LSA_POLICY_NOTIFICATION = 0x00001000, + LSA_POLICY_LOOKUP_NAMES = 0x00000800, + LSA_POLICY_SERVER_ADMIN = 0x00000400, + LSA_POLICY_AUDIT_LOG_ADMIN = 0x00000200, + LSA_POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100, + LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080, + LSA_POLICY_CREATE_PRIVILEGE = 0x00000040, + LSA_POLICY_CREATE_SECRET = 0x00000020, + LSA_POLICY_CREATE_ACCOUNT = 0x00000010, + LSA_POLICY_TRUST_ADMIN = 0x00000008, + LSA_POLICY_GET_PRIVATE_INFORMATION = 0x00000004, + LSA_POLICY_VIEW_AUDIT_INFORMATION = 0x00000002, + LSA_POLICY_VIEW_LOCAL_INFORMATION = 0x00000001 + } lsa_PolicyAccessMask; + + typedef [bitmap32bit] bitmap { + LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS = 0x00000008, + LSA_ACCOUNT_ADJUST_QUOTAS = 0x00000004, + LSA_ACCOUNT_ADJUST_PRIVILEGES = 0x00000002, + LSA_ACCOUNT_VIEW = 0x00000001 + } lsa_AccountAccessMask; + + typedef [bitmap32bit] bitmap { + LSA_DOMAIN_QUERY_AUTH = 0x00000040, + LSA_DOMAIN_SET_AUTH = 0x00000020, + LSA_DOMAIN_SET_POSIX = 0x00000010, + LSA_DOMAIN_QUERY_POSIX = 0x00000008, + LSA_DOMAIN_SET_CONTROLLERS = 0x00000004, + LSA_DOMAIN_QUERY_CONTROLLERS = 0x00000002, + LSA_DOMAIN_QUERY_DOMAIN_NAME = 0x00000001 + } lsa_DomainAccessMask; + + typedef [bitmap32bit] bitmap { + LSA_SECRET_QUERY_VALUE = 0x00000002, + LSA_SECRET_SET_VALUE = 0x00000001 + } lsa_SecretAccessMask; + + typedef bitmap security_secinfo security_secinfo; + + typedef [public,noejs] struct { + [value(2*strlen_m(string))] uint16 length; + [value(2*strlen_m(string))] uint16 size; + [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string; + } lsa_String; + + typedef [public] struct { + [value(2*strlen_m(string))] uint16 length; + [value(2*strlen_m_term(string))] uint16 size; + [charset(UTF16),size_is(size/2),length_is(length/2)] uint16 *string; + } lsa_StringLarge; + + typedef [public] struct { + uint32 count; + [size_is(count)] lsa_String *names; + } lsa_Strings; + + typedef [public] struct { + [value(strlen_m(string))] uint16 length; + [value(strlen_m(string))] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; + } lsa_AsciiString; + + typedef [public] struct { + [value(strlen_m(string))] uint16 length; + [value(strlen_m_term(string))] uint16 size; + [charset(DOS),size_is(size),length_is(length)] uint8 *string; + } lsa_AsciiStringLarge; + + /******************/ + /* Function: 0x00 */ + NTSTATUS lsa_Close ( + [in,out] policy_handle *handle + ); + + + /******************/ + /* Function: 0x01 */ + [public] NTSTATUS lsa_Delete ( + [in] policy_handle *handle + ); + + + /******************/ + /* Function: 0x02 */ + typedef struct { + uint32 low; + uint32 high; + } lsa_LUID; + + typedef struct { + lsa_StringLarge name; + lsa_LUID luid; + } lsa_PrivEntry; + + typedef struct { + uint32 count; + [size_is(count)] lsa_PrivEntry *privs; + } lsa_PrivArray; + + [public] NTSTATUS lsa_EnumPrivs ( + [in] policy_handle *handle, + [in,out] uint32 *resume_handle, + [in] uint32 max_count, + [out] lsa_PrivArray *privs + ); + + /******************/ + /* Function: 0x03 */ + + NTSTATUS lsa_QuerySecurity ( + [in] policy_handle *handle, + [in] security_secinfo sec_info, + [out,unique] sec_desc_buf *sdbuf + ); + + + /******************/ + /* Function: 0x04 */ + [todo] NTSTATUS lsa_SetSecObj (); + + + /******************/ + /* Function: 0x05 */ + [todo] NTSTATUS lsa_ChangePassword (); + + + /******************/ + /* Function: 0x06 */ + + typedef enum { + LSA_SECURITY_ANONYMOUS = 0, + LSA_SECURITY_IDENTIFICATION = 1, + LSA_SECURITY_IMPERSONATION = 2, + LSA_SECURITY_DELEGATION = 3 + } lsa_SecurityImpersonationLevel; + + typedef struct { + uint32 len; /* ignored */ + lsa_SecurityImpersonationLevel impersonation_level; + uint8 context_mode; + uint8 effective_only; + } lsa_QosInfo; + + typedef struct { + uint32 len; /* ignored */ + uint8 *root_dir; + [string,charset(UTF16)] uint16 *object_name; + uint32 attributes; + security_descriptor *sec_desc; + lsa_QosInfo *sec_qos; + } lsa_ObjectAttribute; + + /* notice the screwup with the system_name - thats why MS created + OpenPolicy2 */ + [public] NTSTATUS lsa_OpenPolicy ( + [in,unique] uint16 *system_name, + [in] lsa_ObjectAttribute *attr, + [in] lsa_PolicyAccessMask access_mask, + [out] policy_handle *handle + ); + + + + /******************/ + /* Function: 0x07 */ + + typedef struct { + uint32 percent_full; + uint32 log_size; + NTTIME retention_time; + uint8 shutdown_in_progress; + NTTIME time_to_shutdown; + uint32 next_audit_record; + uint32 unknown; + } lsa_AuditLogInfo; + + typedef [v1_enum] enum { + LSA_AUDIT_POLICY_NONE=0, + LSA_AUDIT_POLICY_SUCCESS=1, + LSA_AUDIT_POLICY_FAILURE=2, + LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE), + LSA_AUDIT_POLICY_CLEAR=4 + } lsa_PolicyAuditPolicy; + + typedef enum { + LSA_AUDIT_CATEGORY_SYSTEM = 0, + LSA_AUDIT_CATEGORY_LOGON = 1, + LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2, + LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3, + LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4, + LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5, + LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6, + LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */ + LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */ + } lsa_PolicyAuditEventType; + + typedef struct { + uint32 auditing_mode; + [size_is(count)] lsa_PolicyAuditPolicy *settings; + uint32 count; + } lsa_AuditEventsInfo; + + typedef struct { + lsa_StringLarge name; + dom_sid2 *sid; + } lsa_DomainInfo; + + typedef struct { + lsa_String name; + } lsa_PDAccountInfo; + + typedef struct { + uint16 unknown; /* an midl padding bug? */ + uint16 role; + } lsa_ServerRole; + + typedef struct { + lsa_String source; + lsa_String account; + } lsa_ReplicaSourceInfo; + + typedef struct { + uint32 paged_pool; + uint32 non_paged_pool; + uint32 min_wss; + uint32 max_wss; + uint32 pagefile; + hyper unknown; + } lsa_DefaultQuotaInfo; + + typedef struct { + hyper modified_id; + NTTIME db_create_time; + } lsa_ModificationInfo; + + typedef struct { + uint8 shutdown_on_full; + } lsa_AuditFullSetInfo; + + typedef struct { + uint16 unknown; /* an midl padding bug? */ + uint8 shutdown_on_full; + uint8 log_is_full; + } lsa_AuditFullQueryInfo; + + typedef struct { + /* it's important that we use the lsa_StringLarge here, + * because otherwise windows clients result with such dns hostnames + * e.g. w2k3-client.samba4.samba.orgsamba4.samba.org + * where it should be + * w2k3-client.samba4.samba.org + */ + lsa_StringLarge name; + lsa_StringLarge dns_domain; + lsa_StringLarge dns_forest; + GUID domain_guid; + dom_sid2 *sid; + } lsa_DnsDomainInfo; + + typedef enum { + LSA_POLICY_INFO_AUDIT_LOG=1, + LSA_POLICY_INFO_AUDIT_EVENTS=2, + LSA_POLICY_INFO_DOMAIN=3, + LSA_POLICY_INFO_PD=4, + LSA_POLICY_INFO_ACCOUNT_DOMAIN=5, + LSA_POLICY_INFO_ROLE=6, + LSA_POLICY_INFO_REPLICA=7, + LSA_POLICY_INFO_QUOTA=8, + LSA_POLICY_INFO_DB=9, + LSA_POLICY_INFO_AUDIT_FULL_SET=10, + LSA_POLICY_INFO_AUDIT_FULL_QUERY=11, + LSA_POLICY_INFO_DNS=12 + } lsa_PolicyInfo; + + typedef [switch_type(uint16)] union { + [case(LSA_POLICY_INFO_AUDIT_LOG)] lsa_AuditLogInfo audit_log; + [case(LSA_POLICY_INFO_AUDIT_EVENTS)] lsa_AuditEventsInfo audit_events; + [case(LSA_POLICY_INFO_DOMAIN)] lsa_DomainInfo domain; + [case(LSA_POLICY_INFO_PD)] lsa_PDAccountInfo pd; + [case(LSA_POLICY_INFO_ACCOUNT_DOMAIN)] lsa_DomainInfo account_domain; + [case(LSA_POLICY_INFO_ROLE)] lsa_ServerRole role; + [case(LSA_POLICY_INFO_REPLICA)] lsa_ReplicaSourceInfo replica; + [case(LSA_POLICY_INFO_QUOTA)] lsa_DefaultQuotaInfo quota; + [case(LSA_POLICY_INFO_DB)] lsa_ModificationInfo db; + [case(LSA_POLICY_INFO_AUDIT_FULL_SET)] lsa_AuditFullSetInfo auditfullset; + [case(LSA_POLICY_INFO_AUDIT_FULL_QUERY)] lsa_AuditFullQueryInfo auditfullquery; + [case(LSA_POLICY_INFO_DNS)] lsa_DnsDomainInfo dns; + } lsa_PolicyInformation; + + NTSTATUS lsa_QueryInfoPolicy ( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [out,unique,switch_is(level)] lsa_PolicyInformation *info + ); + + /******************/ + /* Function: 0x08 */ + NTSTATUS lsa_SetInfoPolicy ( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); + + /******************/ + /* Function: 0x09 */ + [todo] NTSTATUS lsa_ClearAuditLog (); + + /******************/ + /* Function: 0x0a */ + [public] NTSTATUS lsa_CreateAccount ( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] lsa_AccountAccessMask access_mask, + [out] policy_handle *acct_handle + ); + + /******************/ + /* NOTE: This only returns accounts that have at least + one privilege set + */ + /* Function: 0x0b */ + typedef struct { + dom_sid2 *sid; + } lsa_SidPtr; + + typedef [public] struct { + [range(0,1000)] uint32 num_sids; + [size_is(num_sids)] lsa_SidPtr *sids; + } lsa_SidArray; + + [public] NTSTATUS lsa_EnumAccounts ( + [in] policy_handle *handle, + [in,out] uint32 *resume_handle, + [in,range(0,8192)] uint32 num_entries, + [out] lsa_SidArray *sids + ); + + + /*************************************************/ + /* Function: 0x0c */ + + [public] NTSTATUS lsa_CreateTrustedDomain( + [in] policy_handle *handle, + [in] lsa_DomainInfo *info, + [in] lsa_DomainAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + + /******************/ + /* Function: 0x0d */ + + /* w2k3 treats max_size as max_domains*60 */ + const int LSA_ENUM_TRUST_DOMAIN_MULTIPLIER = 60; + + typedef struct { + uint32 count; + [size_is(count)] lsa_DomainInfo *domains; + } lsa_DomainList; + + NTSTATUS lsa_EnumTrustDom ( + [in] policy_handle *handle, + [in,out] uint32 *resume_handle, + [in] uint32 max_size, + [out] lsa_DomainList *domains + ); + + + /******************/ + /* Function: 0x0e */ + typedef [public] 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. */ + SID_NAME_COMPUTER = 9 /* machine */ + } lsa_SidType; + + typedef struct { + lsa_SidType sid_type; + uint32 rid; + uint32 sid_index; + } lsa_TranslatedSid; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid *sids; + } lsa_TransSidArray; + + const int LSA_REF_DOMAIN_LIST_MULTIPLIER = 32; + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_DomainInfo *domains; + uint32 max_size; + } lsa_RefDomainList; + + /* Level 1: Ask everywhere + * Level 2: Ask domain and trusted domains, no builtin and wkn + * Level 3: Only ask domain + * Level 4: W2k3ad: Only ask AD trusts + * Level 5: Only ask transitive forest trusts + * Level 6: Like 4 + */ + + typedef enum { + LSA_LOOKUP_NAMES_ALL = 1, + LSA_LOOKUP_NAMES_DOMAINS_ONLY = 2, + LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY = 3, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY = 4, + LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY = 5, + LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2 = 6 + } lsa_LookupNamesLevel; + + [public] NTSTATUS lsa_LookupNames ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransSidArray *sids, + [in] lsa_LookupNamesLevel level, + [in,out] uint32 *count + ); + + + /******************/ + /* Function: 0x0f */ + + typedef struct { + lsa_SidType sid_type; + lsa_String name; + uint32 sid_index; + } lsa_TranslatedName; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedName *names; + } lsa_TransNameArray; + + [public] NTSTATUS lsa_LookupSids ( + [in] policy_handle *handle, + [in] lsa_SidArray *sids, + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransNameArray *names, + [in] uint16 level, + [in,out] uint32 *count + ); + + + /* Function: 0x10 */ + [public] NTSTATUS lsa_CreateSecret( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_SecretAccessMask access_mask, + [out] policy_handle *sec_handle + ); + + + /*****************************************/ + /* Function: 0x11 */ + NTSTATUS lsa_OpenAccount ( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] lsa_AccountAccessMask access_mask, + [out] policy_handle *acct_handle + ); + + + /****************************************/ + /* Function: 0x12 */ + + typedef struct { + lsa_LUID luid; + uint32 attribute; + } lsa_LUIDAttribute; + + typedef struct { + [range(0,1000)] uint32 count; + uint32 unknown; + [size_is(count)] lsa_LUIDAttribute set[*]; + } lsa_PrivilegeSet; + + NTSTATUS lsa_EnumPrivsAccount ( + [in] policy_handle *handle, + [out,unique] lsa_PrivilegeSet *privs + ); + + + /****************************************/ + /* Function: 0x13 */ + NTSTATUS lsa_AddPrivilegesToAccount( + [in] policy_handle *handle, + [in] lsa_PrivilegeSet *privs + ); + + + /****************************************/ + /* Function: 0x14 */ + NTSTATUS lsa_RemovePrivilegesFromAccount( + [in] policy_handle *handle, + [in] uint8 remove_all, + [in,unique] lsa_PrivilegeSet *privs + ); + + /* Function: 0x15 */ + [todo] NTSTATUS lsa_GetQuotasForAccount(); + + /* Function: 0x16 */ + [todo] NTSTATUS lsa_SetQuotasForAccount(); + + /* Function: 0x17 */ + [todo] NTSTATUS lsa_GetSystemAccessAccount(); + /* Function: 0x18 */ + [todo] NTSTATUS lsa_SetSystemAccessAccount(); + + /* Function: 0x19 */ + NTSTATUS lsa_OpenTrustedDomain( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] lsa_DomainAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + typedef [flag(NDR_PAHEX)] struct { + uint32 length; + uint32 size; + [size_is(size),length_is(length)] uint8 *data; + } lsa_DATA_BUF; + + typedef [flag(NDR_PAHEX)] struct { + [range(0,65536)] uint32 size; + [size_is(size)] uint8 *data; + } lsa_DATA_BUF2; + + typedef enum { + LSA_TRUSTED_DOMAIN_INFO_NAME = 1, + LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS_INFO = 2, + LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET = 3, + LSA_TRUSTED_DOMAIN_INFO_PASSWORD = 4, + LSA_TRUSTED_DOMAIN_INFO_BASIC = 5, + LSA_TRUSTED_DOMAIN_INFO_INFO_EX = 6, + LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO = 7, + LSA_TRUSTED_DOMAIN_INFO_FULL_INFO = 8, + LSA_TRUSTED_DOMAIN_INFO_11 = 11, + LSA_TRUSTED_DOMAIN_INFO_INFO_ALL = 12 + } lsa_TrustDomInfoEnum; + + typedef struct { + lsa_StringLarge netbios_name; + } lsa_TrustDomainInfoName; + + typedef struct { + uint32 posix_offset; + } lsa_TrustDomainInfoPosixOffset; + + typedef struct { + lsa_DATA_BUF *password; + lsa_DATA_BUF *old_password; + } lsa_TrustDomainInfoPassword; + + typedef struct { + lsa_String netbios_name; + dom_sid2 *sid; + } lsa_TrustDomainInfoBasic; + + typedef struct { + lsa_StringLarge domain_name; + lsa_StringLarge netbios_name; + dom_sid2 *sid; + uint32 trust_direction; + uint32 trust_type; + uint32 trust_attributes; + } lsa_TrustDomainInfoInfoEx; + + typedef struct { + NTTIME_hyper last_update_time; + uint32 secret_type; + lsa_DATA_BUF2 data; + } lsa_TrustDomainInfoBuffer; + + typedef struct { + uint32 incoming_count; + lsa_TrustDomainInfoBuffer *incoming_current_auth_info; + lsa_TrustDomainInfoBuffer *incoming_previous_auth_info; + uint32 outgoing_count; + lsa_TrustDomainInfoBuffer *outgoing_current_auth_info; + lsa_TrustDomainInfoBuffer *outgoing_previous_auth_info; + } lsa_TrustDomainInfoAuthInfo; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfo auth_info; + } lsa_TrustDomainInfoFullInfo; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_DATA_BUF2 data1; + } lsa_TrustDomainInfo11; + + typedef struct { + lsa_TrustDomainInfoInfoEx info_ex; + lsa_DATA_BUF2 data1; + lsa_TrustDomainInfoPosixOffset posix_offset; + lsa_TrustDomainInfoAuthInfo auth_info; + } lsa_TrustDomainInfoInfoAll; + + typedef [switch_type(lsa_TrustDomInfoEnum)] union { + [case(LSA_TRUSTED_DOMAIN_INFO_NAME)] lsa_TrustDomainInfoName name; + [case(LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET)] lsa_TrustDomainInfoPosixOffset posix_offset; + [case(LSA_TRUSTED_DOMAIN_INFO_PASSWORD)] lsa_TrustDomainInfoPassword password; + [case(LSA_TRUSTED_DOMAIN_INFO_BASIC)] lsa_TrustDomainInfoBasic info_basic; + [case(LSA_TRUSTED_DOMAIN_INFO_INFO_EX)] lsa_TrustDomainInfoInfoEx info_ex; + [case(LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO)] lsa_TrustDomainInfoAuthInfo auth_info; + [case(LSA_TRUSTED_DOMAIN_INFO_FULL_INFO)] lsa_TrustDomainInfoFullInfo full_info; + [case(LSA_TRUSTED_DOMAIN_INFO_11)] lsa_TrustDomainInfo11 info11; + [case(LSA_TRUSTED_DOMAIN_INFO_INFO_ALL)] lsa_TrustDomainInfoInfoAll info_all; + } lsa_TrustedDomainInfo; + + /* Function: 0x1a */ + NTSTATUS lsa_QueryTrustedDomainInfo( + [in] policy_handle *trustdom_handle, + [in] lsa_TrustDomInfoEnum level, + [out,switch_is(level),unique] lsa_TrustedDomainInfo *info + ); + + /* Function: 0x1b */ + [todo] NTSTATUS lsa_SetInformationTrustedDomain(); + + /* Function: 0x1c */ + [public] NTSTATUS lsa_OpenSecret( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_SecretAccessMask access_mask, + [out] policy_handle *sec_handle + ); + + /* Function: 0x1d */ + + [public] NTSTATUS lsa_SetSecret( + [in] policy_handle *sec_handle, + [in,unique] lsa_DATA_BUF *new_val, + [in,unique] lsa_DATA_BUF *old_val + ); + + typedef struct { + lsa_DATA_BUF *buf; + } lsa_DATA_BUF_PTR; + + /* Function: 0x1e */ + [public] NTSTATUS lsa_QuerySecret ( + [in] policy_handle *sec_handle, + [in,out,unique] lsa_DATA_BUF_PTR *new_val, + [in,out,unique] NTTIME_hyper *new_mtime, + [in,out,unique] lsa_DATA_BUF_PTR *old_val, + [in,out,unique] NTTIME_hyper *old_mtime + ); + + /* Function: 0x1f */ + NTSTATUS lsa_LookupPrivValue( + [in] policy_handle *handle, + [in] lsa_String *name, + [out] lsa_LUID *luid + ); + + + /* Function: 0x20 */ + NTSTATUS lsa_LookupPrivName ( + [in] policy_handle *handle, + [in] lsa_LUID *luid, + [out,unique] lsa_StringLarge *name + ); + + + /*******************/ + /* Function: 0x21 */ + NTSTATUS lsa_LookupPrivDisplayName ( + [in] policy_handle *handle, + [in] lsa_String *name, + [out,unique] lsa_StringLarge *disp_name, + /* see http://www.microsoft.com/globaldev/nlsweb/ for + language definitions */ + [in,out] uint16 *language_id, + [in] uint16 unknown + ); + + /* Function: 0x22 */ + [todo] NTSTATUS lsa_DeleteObject(); + + + /*******************/ + /* Function: 0x23 */ + NTSTATUS lsa_EnumAccountsWithUserRight ( + [in] policy_handle *handle, + [in,unique] lsa_String *name, + [out] lsa_SidArray *sids + ); + + /* Function: 0x24 */ + typedef struct { + [string,charset(UTF16)] uint16 *name; + } lsa_RightAttribute; + + typedef struct { + uint32 count; + [size_is(count)] lsa_StringLarge *names; + } lsa_RightSet; + + NTSTATUS lsa_EnumAccountRights ( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [out] lsa_RightSet *rights + ); + + + /**********************/ + /* Function: 0x25 */ + NTSTATUS lsa_AddAccountRights ( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] lsa_RightSet *rights + ); + + /**********************/ + /* Function: 0x26 */ + NTSTATUS lsa_RemoveAccountRights ( + [in] policy_handle *handle, + [in] dom_sid2 *sid, + [in] uint32 unknown, + [in] lsa_RightSet *rights + ); + + /* Function: 0x27 */ + NTSTATUS lsa_QueryTrustedDomainInfoBySid( + [in] policy_handle *handle, + [in] dom_sid2 *dom_sid, + [in] lsa_TrustDomInfoEnum level, + [out,switch_is(level),unique] lsa_TrustedDomainInfo *info + ); + + /* Function: 0x28 */ + [todo] NTSTATUS lsa_SetTrustedDomainInfo(); + /* Function: 0x29 */ + NTSTATUS lsa_DeleteTrustedDomain( + [in] policy_handle *handle, + [in] dom_sid2 *dom_sid + ); + + /* Function: 0x2a */ + [todo] NTSTATUS lsa_StorePrivateData(); + /* Function: 0x2b */ + [todo] NTSTATUS lsa_RetrievePrivateData(); + + + /**********************/ + /* Function: 0x2c */ + [public] NTSTATUS lsa_OpenPolicy2 ( + [in,unique] [string,charset(UTF16)] uint16 *system_name, + [in] lsa_ObjectAttribute *attr, + [in] lsa_PolicyAccessMask access_mask, + [out] policy_handle *handle + ); + + /**********************/ + /* Function: 0x2d */ + typedef struct { + lsa_String *string; + } lsa_StringPointer; + + NTSTATUS lsa_GetUserName( + [in,unique] [string,charset(UTF16)] uint16 *system_name, + [in,out,unique] lsa_String *account_name, + [in,out,unique] lsa_StringPointer *authority_name + ); + + /**********************/ + /* Function: 0x2e */ + + NTSTATUS lsa_QueryInfoPolicy2( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [out,unique,switch_is(level)] lsa_PolicyInformation *info + ); + + /* Function 0x2f */ + NTSTATUS lsa_SetInfoPolicy2( + [in] policy_handle *handle, + [in] lsa_PolicyInfo level, + [in,switch_is(level)] lsa_PolicyInformation *info + ); + + /**********************/ + /* Function 0x30 */ + NTSTATUS lsa_QueryTrustedDomainInfoByName( + [in] policy_handle *handle, + [in] lsa_String trusted_domain, + [in] lsa_TrustDomInfoEnum level, + [out,unique,switch_is(level)] lsa_TrustedDomainInfo *info + ); + + /**********************/ + /* Function 0x31 */ + NTSTATUS lsa_SetTrustedDomainInfoByName( + [in] policy_handle *handle, + [in] lsa_String trusted_domain, + [in] lsa_TrustDomInfoEnum level, + [in,unique,switch_is(level)] lsa_TrustedDomainInfo *info + ); + + /* Function 0x32 */ + + /* w2k3 treats max_size as max_domains*82 */ + const int LSA_ENUM_TRUST_DOMAIN_EX_MULTIPLIER = 82; + + typedef struct { + uint32 count; + [size_is(count)] lsa_TrustDomainInfoInfoEx *domains; + } lsa_DomainListEx; + + NTSTATUS lsa_EnumTrustedDomainsEx ( + [in] policy_handle *handle, + [in,out] uint32 *resume_handle, + [out] lsa_DomainListEx *domains, + [in] uint32 max_size + ); + + + /* Function 0x33 */ + [todo] NTSTATUS lsa_CreateTrustedDomainEx(); + + /* Function 0x34 */ + NTSTATUS lsa_CloseTrustedDomainEx( + [in,out] policy_handle *handle + ); + + /* Function 0x35 */ + + /* w2k3 returns either 0x000bbbd000000000 or 0x000a48e800000000 + for unknown6 - gd */ + typedef struct { + uint32 enforce_restrictions; + hyper service_tkt_lifetime; + hyper user_tkt_lifetime; + hyper user_tkt_renewaltime; + hyper clock_skew; + hyper unknown6; + } lsa_DomainInfoKerberos; + + typedef struct { + uint32 blob_size; + [size_is(blob_size)] uint8 *efs_blob; + } lsa_DomainInfoEfs; + + typedef enum { + LSA_DOMAIN_INFO_POLICY_EFS=2, + LSA_DOMAIN_INFO_POLICY_KERBEROS=3 + } lsa_DomainInfoEnum; + + typedef [switch_type(uint16)] union { + [case(LSA_DOMAIN_INFO_POLICY_EFS)] lsa_DomainInfoEfs efs_info; + [case(LSA_DOMAIN_INFO_POLICY_KERBEROS)] lsa_DomainInfoKerberos kerberos_info; + } lsa_DomainInformationPolicy; + + NTSTATUS lsa_QueryDomainInformationPolicy( + [in] policy_handle *handle, + [in] uint16 level, + [out,unique,switch_is(level)] lsa_DomainInformationPolicy *info + ); + + /* Function 0x36 */ + NTSTATUS lsa_SetDomainInformationPolicy( + [in] policy_handle *handle, + [in] uint16 level, + [in,unique,switch_is(level)] lsa_DomainInformationPolicy *info + ); + + /**********************/ + /* Function 0x37 */ + NTSTATUS lsa_OpenTrustedDomainByName( + [in] policy_handle *handle, + [in] lsa_String name, + [in] lsa_DomainAccessMask access_mask, + [out] policy_handle *trustdom_handle + ); + + /* Function 0x38 */ + [todo] NTSTATUS lsa_TestCall(); + + /**********************/ + /* Function 0x39 */ + + typedef struct { + lsa_SidType sid_type; + lsa_String name; + uint32 sid_index; + uint32 unknown; + } lsa_TranslatedName2; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedName2 *names; + } lsa_TransNameArray2; + + [public] NTSTATUS lsa_LookupSids2( + [in] policy_handle *handle, + [in] lsa_SidArray *sids, + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransNameArray2 *names, + [in] uint16 level, + [in,out] uint32 *count, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + /**********************/ + /* Function 0x3a */ + + typedef struct { + lsa_SidType sid_type; + uint32 rid; + uint32 sid_index; + uint32 unknown; + } lsa_TranslatedSid2; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid2 *sids; + } lsa_TransSidArray2; + + [public] NTSTATUS lsa_LookupNames2 ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransSidArray2 *sids, + [in] lsa_LookupNamesLevel level, + [in,out] uint32 *count, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + /* Function 0x3b */ + [todo] NTSTATUS lsa_CreateTrustedDomainEx2(); + + /* Function 0x3c */ + [todo] NTSTATUS lsa_CREDRWRITE(); + + /* Function 0x3d */ + [todo] NTSTATUS lsa_CREDRREAD(); + + /* Function 0x3e */ + [todo] NTSTATUS lsa_CREDRENUMERATE(); + + /* Function 0x3f */ + [todo] NTSTATUS lsa_CREDRWRITEDOMAINCREDENTIALS(); + + /* Function 0x40 */ + [todo] NTSTATUS lsa_CREDRREADDOMAINCREDENTIALS(); + + /* Function 0x41 */ + [todo] NTSTATUS lsa_CREDRDELETE(); + + /* Function 0x42 */ + [todo] NTSTATUS lsa_CREDRGETTARGETINFO(); + + /* Function 0x43 */ + [todo] NTSTATUS lsa_CREDRPROFILELOADED(); + + /**********************/ + /* Function 0x44 */ + typedef struct { + lsa_SidType sid_type; + dom_sid2 *sid; + uint32 sid_index; + uint32 unknown; + } lsa_TranslatedSid3; + + typedef struct { + [range(0,1000)] uint32 count; + [size_is(count)] lsa_TranslatedSid3 *sids; + } lsa_TransSidArray3; + + [public] NTSTATUS lsa_LookupNames3 ( + [in] policy_handle *handle, + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransSidArray3 *sids, + [in] lsa_LookupNamesLevel level, + [in,out] uint32 *count, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + /* Function 0x45 */ + [todo] NTSTATUS lsa_CREDRGETSESSIONTYPES(); + + /* Function 0x46 */ + [todo] NTSTATUS lsa_LSARREGISTERAUDITEVENT(); + + /* Function 0x47 */ + [todo] NTSTATUS lsa_LSARGENAUDITEVENT(); + + /* Function 0x48 */ + [todo] NTSTATUS lsa_LSARUNREGISTERAUDITEVENT(); + + /* Function 0x49 */ + typedef struct { + [range(0,131072)] uint32 length; + [size_is(length)] uint8 *data; + } lsa_ForestTrustBinaryData; + + typedef struct { + dom_sid2 *domain_sid; + lsa_StringLarge dns_domain_name; + lsa_StringLarge netbios_domain_name; + } lsa_ForestTrustDomainInfo; + + typedef [switch_type(uint32)] union { + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME)] lsa_String top_level_name; + [case(LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX)] lsa_StringLarge top_level_name_ex; + [case(LSA_FOREST_TRUST_DOMAIN_INFO)] lsa_ForestTrustDomainInfo domain_info; + [default] lsa_ForestTrustBinaryData data; + } lsa_ForestTrustData; + + typedef [v1_enum] enum { + LSA_FOREST_TRUST_TOP_LEVEL_NAME = 0, + LSA_FOREST_TRUST_TOP_LEVEL_NAME_EX = 1, + LSA_FOREST_TRUST_DOMAIN_INFO = 2, + LSA_FOREST_TRUST_RECORD_TYPE_LAST = 3 + } lsa_ForestTrustRecordType; + + typedef struct { + uint32 flags; + lsa_ForestTrustRecordType level; + hyper unknown; + [switch_is(level)] lsa_ForestTrustData forest_trust_data; + } lsa_ForestTrustRecord; + + typedef [public] struct { + [range(0,4000)] uint32 count; + [size_is(count)] lsa_ForestTrustRecord **entries; + } lsa_ForestTrustInformation; + + NTSTATUS lsa_lsaRQueryForestTrustInformation( + [in] policy_handle *handle, + [in,ref] lsa_String *trusted_domain_name, + [in] uint16 unknown, /* level ? */ + [out,ref] lsa_ForestTrustInformation **forest_trust_info + ); + + /* Function 0x4a */ + [todo] NTSTATUS lsa_LSARSETFORESTTRUSTINFORMATION(); + + /* Function 0x4b */ + [todo] NTSTATUS lsa_CREDRRENAME(); + + /*****************/ + /* Function 0x4c */ + + [public] NTSTATUS lsa_LookupSids3( + [in] lsa_SidArray *sids, + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransNameArray2 *names, + [in] uint16 level, + [in,out] uint32 *count, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + /* Function 0x4d */ + NTSTATUS lsa_LookupNames4( + [in,range(0,1000)] uint32 num_names, + [in,size_is(num_names)] lsa_String names[], + [out,unique] lsa_RefDomainList *domains, + [in,out] lsa_TransSidArray3 *sids, + [in] lsa_LookupNamesLevel level, + [in,out] uint32 *count, + [in] uint32 unknown1, + [in] uint32 unknown2 + ); + + /* Function 0x4e */ + [todo] NTSTATUS lsa_LSAROPENPOLICYSCE(); + + /* Function 0x4f */ + [todo] NTSTATUS lsa_LSARADTREGISTERSECURITYEVENTSOURCE(); + + /* Function 0x50 */ + [todo] NTSTATUS lsa_LSARADTUNREGISTERSECURITYEVENTSOURCE(); + + /* Function 0x51 */ + [todo] NTSTATUS lsa_LSARADTREPORTSECURITYEVENT(); + +}