summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-03 00:41:36 +0200
committerGünther Deschner <gd@samba.org>2008-06-03 01:27:50 +0200
commit4fd700ca0776862313917103dcb8bbb14dcdd589 (patch)
treec4907f304b1d27b8bab65b061f19a188b61d0cfa /source3/lib
parentbd9d129e6a3857a0faa3ed4ab5a4a71f1272f94a (diff)
downloadsamba-4fd700ca0776862313917103dcb8bbb14dcdd589.tar.gz
samba-4fd700ca0776862313917103dcb8bbb14dcdd589.tar.bz2
samba-4fd700ca0776862313917103dcb8bbb14dcdd589.zip
netapi: add libnetapi_samr_lookup_and_open_alias().
Guenther (This used to be commit 890d63f31c0ff3931b8efb627c3a375850a59a9a)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/netapi/localgroup.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source3/lib/netapi/localgroup.c b/source3/lib/netapi/localgroup.c
index a505abdf5b..07adf7c6a6 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;
+}
+
/****************************************************************
****************************************************************/