From: Günther Deschner Date: Mon, 2 Jun 2008 22:41:36 +0000 (+0200) Subject: netapi: add libnetapi_samr_lookup_and_open_alias(). X-Git-Tag: samba-4.0.0alpha6~801^2~1188 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4fd700ca0776862313917103dcb8bbb14dcdd589;p=thirdparty%2Fsamba.git netapi: add libnetapi_samr_lookup_and_open_alias(). Guenther (This used to be commit 890d63f31c0ff3931b8efb627c3a375850a59a9a) --- diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c index a505abdf5b5..07adf7c6a6f 100644 --- a/source3/lib/netapi/localgroup.c +++ b/source3/lib/netapi/localgroup.c @@ -24,6 +24,52 @@ #include "lib/netapi/netapi_private.h" #include "lib/netapi/libnetapi.h" +static WERROR libnetapi_samr_lookup_and_open_alias(TALLOC_CTX *mem_ctx, + struct rpc_pipe_client *pipe_cli, + struct policy_handle *domain_handle, + struct lsa_String *lsa_account_name, + uint32_t access_rights, + struct policy_handle *alias_handle) +{ + NTSTATUS status; + WERROR werr; + struct samr_Ids user_rids, name_types; + + status = rpccli_samr_LookupNames(pipe_cli, mem_ctx, + domain_handle, + 1, + lsa_account_name, + &user_rids, + &name_types); + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + switch (name_types.ids[0]) { + case SID_NAME_ALIAS: + case SID_NAME_WKN_GRP: + break; + default: + return WERR_INVALID_DATATYPE; + } + + status = rpccli_samr_OpenAlias(pipe_cli, mem_ctx, + domain_handle, + access_rights, + user_rids.ids[0], + alias_handle); + if (NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); + goto done; + } + + werr = WERR_OK; + + done: + return werr; +} + /**************************************************************** ****************************************************************/