diff options
author | Günther Deschner <gd@samba.org> | 2011-01-14 16:16:31 +0100 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2011-02-01 12:49:58 +0100 |
commit | 32fb4f5206bf754cecc761e5c2634f84a073e1eb (patch) | |
tree | 6a957d5aadc0db763f9c32be24ecb43b9c90cc0b /source3/lib/netapi | |
parent | b76657f8d9fea54430b048e61ed7c8c78eb582e5 (diff) | |
download | samba-32fb4f5206bf754cecc761e5c2634f84a073e1eb.tar.gz samba-32fb4f5206bf754cecc761e5c2634f84a073e1eb.tar.bz2 samba-32fb4f5206bf754cecc761e5c2634f84a073e1eb.zip |
s3-libnetapi: prefer dcerpc_samr_X functions in lib/netapi/samr.c.
Guenther
Diffstat (limited to 'source3/lib/netapi')
-rw-r--r-- | source3/lib/netapi/samr.c | 62 |
1 files changed, 48 insertions, 14 deletions
diff --git a/source3/lib/netapi/samr.c b/source3/lib/netapi/samr.c index 1e2620f974..470e5e613c 100644 --- a/source3/lib/netapi/samr.c +++ b/source3/lib/netapi/samr.c @@ -20,7 +20,7 @@ #include "includes.h" #include "lib/netapi/netapi.h" #include "lib/netapi/netapi_private.h" -#include "../librpc/gen_ndr/cli_samr.h" +#include "../librpc/gen_ndr/ndr_samr_c.h" #include "rpc_client/cli_samr.h" #include "rpc_client/init_lsa.h" #include "../libcli/security/security.h" @@ -36,7 +36,7 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, struct policy_handle *domain_handle, struct dom_sid2 **domain_sid) { - NTSTATUS status; + NTSTATUS status, result; WERROR werr; struct libnetapi_private_ctx *priv; uint32_t resume_handle = 0; @@ -46,6 +46,7 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, struct lsa_String lsa_domain_name; bool domain_found = true; int i; + struct dcerpc_binding_handle *b = pipe_cli->binding_handle; priv = talloc_get_type_abort(mem_ctx->private_data, struct libnetapi_private_ctx); @@ -89,16 +90,21 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, } } - status = rpccli_samr_EnumDomains(pipe_cli, mem_ctx, + status = dcerpc_samr_EnumDomains(b, mem_ctx, connect_handle, &resume_handle, &sam, 0xffffffff, - &num_entries); + &num_entries, + &result); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); goto done; } + if (!NT_STATUS_IS_OK(result)) { + werr = ntstatus_to_werror(result); + goto done; + } for (i=0; i<num_entries; i++) { @@ -119,24 +125,34 @@ WERROR libnetapi_samr_open_domain(struct libnetapi_ctx *mem_ctx, init_lsa_String(&lsa_domain_name, domain_name); - status = rpccli_samr_LookupDomain(pipe_cli, mem_ctx, + status = dcerpc_samr_LookupDomain(b, mem_ctx, connect_handle, &lsa_domain_name, - domain_sid); + domain_sid, + &result); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); goto done; } + if (!NT_STATUS_IS_OK(result)) { + werr = ntstatus_to_werror(result); + goto done; + } - status = rpccli_samr_OpenDomain(pipe_cli, mem_ctx, + status = dcerpc_samr_OpenDomain(b, mem_ctx, connect_handle, domain_mask, *domain_sid, - domain_handle); + domain_handle, + &result); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); goto done; } + if (!NT_STATUS_IS_OK(result)) { + werr = ntstatus_to_werror(result); + goto done; + } priv->samr.cli = pipe_cli; @@ -165,9 +181,10 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx, struct policy_handle *connect_handle, struct policy_handle *builtin_handle) { - NTSTATUS status; + NTSTATUS status, result; WERROR werr; struct libnetapi_private_ctx *priv; + struct dcerpc_binding_handle *b = pipe_cli->binding_handle; priv = talloc_get_type_abort(mem_ctx->private_data, struct libnetapi_private_ctx); @@ -207,15 +224,20 @@ WERROR libnetapi_samr_open_builtin_domain(struct libnetapi_ctx *mem_ctx, } } - status = rpccli_samr_OpenDomain(pipe_cli, mem_ctx, + status = dcerpc_samr_OpenDomain(b, mem_ctx, connect_handle, builtin_mask, CONST_DISCARD(struct dom_sid *, &global_sid_Builtin), - builtin_handle); + builtin_handle, + &result); if (!NT_STATUS_IS_OK(status)) { werr = ntstatus_to_werror(status); goto done; } + if (!NT_STATUS_IS_OK(result)) { + werr = ntstatus_to_werror(result); + goto done; + } priv->samr.cli = pipe_cli; @@ -238,6 +260,8 @@ void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx, struct policy_handle *handle) { struct libnetapi_private_ctx *priv; + struct dcerpc_binding_handle *b; + NTSTATUS result; if (!is_valid_policy_hnd(handle)) { return; @@ -250,7 +274,9 @@ void libnetapi_samr_close_domain_handle(struct libnetapi_ctx *ctx, return; } - rpccli_samr_Close(priv->samr.cli, ctx, handle); + b = priv->samr.cli->binding_handle; + + dcerpc_samr_Close(b, ctx, handle, &result); ZERO_STRUCT(priv->samr.domain_handle); } @@ -262,6 +288,8 @@ void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx *ctx, struct policy_handle *handle) { struct libnetapi_private_ctx *priv; + struct dcerpc_binding_handle *b; + NTSTATUS result; if (!is_valid_policy_hnd(handle)) { return; @@ -274,7 +302,9 @@ void libnetapi_samr_close_builtin_handle(struct libnetapi_ctx *ctx, return; } - rpccli_samr_Close(priv->samr.cli, ctx, handle); + b = priv->samr.cli->binding_handle; + + dcerpc_samr_Close(b, ctx, handle, &result); ZERO_STRUCT(priv->samr.builtin_handle); } @@ -286,6 +316,8 @@ void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx, struct policy_handle *handle) { struct libnetapi_private_ctx *priv; + struct dcerpc_binding_handle *b; + NTSTATUS result; if (!is_valid_policy_hnd(handle)) { return; @@ -298,7 +330,9 @@ void libnetapi_samr_close_connect_handle(struct libnetapi_ctx *ctx, return; } - rpccli_samr_Close(priv->samr.cli, ctx, handle); + b = priv->samr.cli->binding_handle; + + dcerpc_samr_Close(b, ctx, handle, &result); ZERO_STRUCT(priv->samr.connect_handle); } |