summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-06-03 00:13:39 +0200
committerGünther Deschner <gd@samba.org>2008-06-03 01:27:50 +0200
commit56bdfad87f69963d65ceb8f7c780a1bd887c1fea (patch)
treef21be849401f68445005560d3d874f958a29adfa /source3/lib
parentb652e5b4753afd8916d347d5c8ef6f54ca140097 (diff)
downloadsamba-56bdfad87f69963d65ceb8f7c780a1bd887c1fea.tar.gz
samba-56bdfad87f69963d65ceb8f7c780a1bd887c1fea.tar.bz2
samba-56bdfad87f69963d65ceb8f7c780a1bd887c1fea.zip
netapi: add libnetapi_samr_open_builtin_domain().
Guenther (This used to be commit f15a7f9ab1da88369185beda267f3e67a3b36191)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/netapi/netapi_private.h7
-rw-r--r--source3/lib/netapi/samr.c39
2 files changed, 46 insertions, 0 deletions
diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h
index 69e68ab733..3ce078c2b6 100644
--- a/source3/lib/netapi/netapi_private.h
+++ b/source3/lib/netapi/netapi_private.h
@@ -40,4 +40,11 @@ WERROR libnetapi_samr_open_domain(TALLOC_CTX *mem_ctx,
struct policy_handle *connect_handle,
struct policy_handle *domain_handle,
struct dom_sid2 **domain_sid);
+WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_cli,
+ uint32_t connect_mask,
+ uint32_t builtin_mask,
+ struct policy_handle *connect_handle,
+ struct policy_handle *builtin_handle);
+
#endif
diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c
index a41de91de3..8289890237 100644
--- a/source3/lib/netapi/samr.c
+++ b/source3/lib/netapi/samr.c
@@ -109,3 +109,42 @@ WERROR libnetapi_samr_open_domain(TALLOC_CTX *mem_ctx,
done:
return werr;
}
+
+/****************************************************************
+****************************************************************/
+
+WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx,
+ struct rpc_pipe_client *pipe_cli,
+ uint32_t connect_mask,
+ uint32_t builtin_mask,
+ struct policy_handle *connect_handle,
+ struct policy_handle *builtin_handle)
+{
+ NTSTATUS status;
+ WERROR werr;
+
+ if (!is_valid_policy_hnd(connect_handle)) {
+ status = rpccli_try_samr_connects(pipe_cli, mem_ctx,
+ connect_mask,
+ connect_handle);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+ }
+
+ status = rpccli_samr_OpenDomain(pipe_cli, mem_ctx,
+ connect_handle,
+ builtin_mask,
+ CONST_DISCARD(DOM_SID *, &global_sid_Builtin),
+ builtin_handle);
+ if (!NT_STATUS_IS_OK(status)) {
+ werr = ntstatus_to_werror(status);
+ goto done;
+ }
+
+ werr = WERR_OK;
+
+ done:
+ return werr;
+}