diff options
author | Günther Deschner <gd@samba.org> | 2008-07-17 20:16:10 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-07-18 16:52:34 +0200 |
commit | bbdf38d1d73e0424c3b4a6ee27c11b6751af2582 (patch) | |
tree | ddee2806a2c7ea1cc73fb637686f7d85d61dfe15 | |
parent | 6fa58fdc07743e5db71d9f27b67d14d8103aa2e9 (diff) | |
download | samba-bbdf38d1d73e0424c3b4a6ee27c11b6751af2582.tar.gz samba-bbdf38d1d73e0424c3b4a6ee27c11b6751af2582.tar.bz2 samba-bbdf38d1d73e0424c3b4a6ee27c11b6751af2582.zip |
netapi: use private samr structure in libnetapi_samr_open_builtin().
Guenther
(This used to be commit 538ac493b71b4c880bb6fb0fc5fc2f15e1a19f95)
-rw-r--r-- | source3/lib/netapi/netapi_private.h | 2 | ||||
-rw-r--r-- | source3/lib/netapi/samr.c | 39 |
2 files changed, 39 insertions, 2 deletions
diff --git a/source3/lib/netapi/netapi_private.h b/source3/lib/netapi/netapi_private.h index 246672a349..37c837d897 100644 --- a/source3/lib/netapi/netapi_private.h +++ b/source3/lib/netapi/netapi_private.h @@ -58,7 +58,7 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_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, +WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx, struct rpc_pipe_client *pipe_cli, uint32_t connect_mask, uint32_t builtin_mask, diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c index e83b8eba9c..19cf6cb338 100644 --- a/source3/lib/netapi/samr.c +++ b/source3/lib/netapi/samr.c @@ -154,7 +154,7 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, /**************************************************************** ****************************************************************/ -WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx, +WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx, struct rpc_pipe_client *pipe_cli, uint32_t connect_mask, uint32_t builtin_mask, @@ -163,6 +163,35 @@ WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx, { NTSTATUS status; WERROR werr; + struct libnetapi_private_ctx *priv; + + priv = talloc_get_type_abort(mem_ctx->private_data, + struct libnetapi_private_ctx); + + if (is_valid_policy_hnd(&priv->samr.connect_handle)) { + if ((priv->samr.connect_mask & connect_mask) == connect_mask) { + *connect_handle = priv->samr.connect_handle; + } else { + libnetapi_samr_close_connect_handle(mem_ctx, + &priv->samr.connect_handle); + } + } + + if (is_valid_policy_hnd(&priv->samr.builtin_handle)) { + if ((priv->samr.builtin_mask & builtin_mask) == builtin_mask) { + *builtin_handle = priv->samr.builtin_handle; + } else { + libnetapi_samr_close_builtin_handle(mem_ctx, + &priv->samr.builtin_handle); + } + } + + if (is_valid_policy_hnd(&priv->samr.connect_handle) && + ((priv->samr.connect_mask & connect_mask) == connect_mask) && + is_valid_policy_hnd(&priv->samr.builtin_handle) && + (priv->samr.builtin_mask & builtin_mask) == builtin_mask) { + return WERR_OK; + } if (!is_valid_policy_hnd(connect_handle)) { status = rpccli_try_samr_connects(pipe_cli, mem_ctx, @@ -184,6 +213,14 @@ WERROR libnetapi_samr_open_builtin_domain(TALLOC_CTX *mem_ctx, goto done; } + priv->samr.cli = pipe_cli; + + priv->samr.connect_mask = connect_mask; + priv->samr.connect_handle = *connect_handle; + + priv->samr.builtin_mask = builtin_mask; + priv->samr.builtin_handle = *builtin_handle; + werr = WERR_OK; done: |