diff options
author | Günther Deschner <gd@samba.org> | 2011-01-12 11:17:48 +0100 |
---|---|---|
committer | Andreas Schneider <asn@samba.org> | 2011-01-13 12:21:08 +0100 |
commit | 425753ebe3e85e1e7ea939937269c10bc5f7fd73 (patch) | |
tree | ee8eb905c2ff2b47214a54ffefb7f7e0b08a26dd | |
parent | f9ca6904a474e8c33532708977878940ad5696e0 (diff) | |
download | samba-425753ebe3e85e1e7ea939937269c10bc5f7fd73.tar.gz samba-425753ebe3e85e1e7ea939937269c10bc5f7fd73.tar.bz2 samba-425753ebe3e85e1e7ea939937269c10bc5f7fd73.zip |
s3-libnetapi: prefer dcerpc_netr_X functions.
Guenther
Signed-off-by: Andreas Schneider <asn@samba.org>
-rw-r--r-- | source3/lib/netapi/getdc.c | 22 | ||||
-rw-r--r-- | source3/lib/netapi/netlogon.c | 23 |
2 files changed, 32 insertions, 13 deletions
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c index faf2672a14..fd5cdc220d 100644 --- a/source3/lib/netapi/getdc.c +++ b/source3/lib/netapi/getdc.c @@ -19,7 +19,7 @@ #include "includes.h" -#include "../librpc/gen_ndr/cli_netlogon.h" +#include "../librpc/gen_ndr/ndr_netlogon_c.h" #include "librpc/gen_ndr/libnetapi.h" #include "lib/netapi/netapi.h" #include "lib/netapi/netapi_private.h" @@ -43,6 +43,7 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx, struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; + struct dcerpc_binding_handle *b; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_netlogon.syntax_id, @@ -51,7 +52,9 @@ WERROR NetGetDCName_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_GetDcName(pipe_cli, talloc_tos(), + b = pipe_cli->binding_handle; + + status = dcerpc_netr_GetDcName(b, talloc_tos(), r->in.server_name, r->in.domain_name, (const char **)r->out.buffer, @@ -83,6 +86,7 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx, struct rpc_pipe_client *pipe_cli = NULL; NTSTATUS status; WERROR werr; + struct dcerpc_binding_handle *b; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_netlogon.syntax_id, @@ -91,12 +95,15 @@ WERROR NetGetAnyDCName_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_GetAnyDCName(pipe_cli, talloc_tos(), + b = pipe_cli->binding_handle; + + status = dcerpc_netr_GetAnyDCName(b, talloc_tos(), r->in.server_name, r->in.domain_name, (const char **)r->out.buffer, &werr); if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); goto done; } done: @@ -142,6 +149,7 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx, WERROR werr; NTSTATUS status = NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND; struct rpc_pipe_client *pipe_cli = NULL; + struct dcerpc_binding_handle *b; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_netlogon.syntax_id, @@ -150,7 +158,9 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_DsRGetDCNameEx(pipe_cli, + b = pipe_cli->binding_handle; + + status = dcerpc_netr_DsRGetDCNameEx(b, ctx, r->in.server_name, r->in.domain_name, @@ -159,11 +169,11 @@ WERROR DsGetDcName_r(struct libnetapi_ctx *ctx, r->in.flags, (struct netr_DsRGetDCNameInfo **)r->out.dc_info, &werr); - if (NT_STATUS_IS_OK(status)) { + if (NT_STATUS_IS_OK(status) && W_ERROR_IS_OK(werr)) { goto done; } - status = rpccli_netr_DsRGetDCName(pipe_cli, + status = dcerpc_netr_DsRGetDCName(b, ctx, r->in.server_name, r->in.domain_name, diff --git a/source3/lib/netapi/netlogon.c b/source3/lib/netapi/netlogon.c index 8c30d6caab..0a15063ba4 100644 --- a/source3/lib/netapi/netlogon.c +++ b/source3/lib/netapi/netlogon.c @@ -19,7 +19,7 @@ #include "includes.h" -#include "../librpc/gen_ndr/cli_netlogon.h" +#include "../librpc/gen_ndr/ndr_netlogon_c.h" #include "librpc/gen_ndr/libnetapi.h" #include "lib/netapi/netapi.h" #include "lib/netapi/netapi_private.h" @@ -131,6 +131,7 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx, NTSTATUS status; struct rpc_pipe_client *pipe_cli = NULL; union netr_CONTROL_QUERY_INFORMATION query; + struct dcerpc_binding_handle *b; werr = libnetapi_open_pipe(ctx, r->in.server_name, &ndr_table_netlogon.syntax_id, @@ -139,7 +140,9 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx, goto done; } - status = rpccli_netr_LogonControl(pipe_cli, talloc_tos(), + b = pipe_cli->binding_handle; + + status = dcerpc_netr_LogonControl(b, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, @@ -149,6 +152,9 @@ WERROR I_NetLogonControl_r(struct libnetapi_ctx *ctx, werr = ntstatus_to_werror(status); goto done; } + if (!W_ERROR_IS_OK(werr)) { + goto done; + } werr = construct_buffer(ctx, r->in.query_level, &query, r->out.buffer); @@ -180,6 +186,7 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, struct rpc_pipe_client *pipe_cli = NULL; union netr_CONTROL_DATA_INFORMATION data; union netr_CONTROL_QUERY_INFORMATION query; + struct dcerpc_binding_handle *b; werr = construct_data(r->in.function_code, r->in.data, &data); if (!W_ERROR_IS_OK(werr)) { @@ -193,11 +200,13 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, goto done; } + b = pipe_cli->binding_handle; + switch (r->in.function_code) { case NETLOGON_CONTROL_TC_VERIFY: case NETLOGON_CONTROL_SET_DBFLAG: case NETLOGON_CONTROL_FORCE_DNS_REG: - status = rpccli_netr_LogonControl2Ex(pipe_cli, talloc_tos(), + status = dcerpc_netr_LogonControl2Ex(b, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, @@ -206,7 +215,7 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, &werr); break; default: - status = rpccli_netr_LogonControl2(pipe_cli, talloc_tos(), + status = dcerpc_netr_LogonControl2(b, talloc_tos(), r->in.server_name, r->in.function_code, r->in.query_level, @@ -216,12 +225,12 @@ WERROR I_NetLogonControl2_r(struct libnetapi_ctx *ctx, break; } - if (!W_ERROR_IS_OK(werr)) { + if (!NT_STATUS_IS_OK(status)) { + werr = ntstatus_to_werror(status); goto done; } - if (!NT_STATUS_IS_OK(status)) { - werr = ntstatus_to_werror(status); + if (!W_ERROR_IS_OK(werr)) { goto done; } |