From adc299bd0863a42f699874f1933dbace3abea316 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Fri, 6 Oct 2006 16:13:10 +0000 Subject: r19143: getdcname on the NETLOGON pipe returns WERROR, not NTSTATUS. Guenther (This used to be commit 44e228ac796fca2db8509915067511ed705032bf) --- source3/include/rpc_netlogon.h | 2 +- source3/nsswitch/winbindd_cm.c | 7 ++++--- source3/nsswitch/winbindd_misc.c | 7 ++++--- source3/rpc_client/cli_netlogon.c | 14 +++++++------- source3/rpc_parse/parse_net.c | 2 +- source3/rpcclient/cmd_netlogon.c | 14 +++++++------- 6 files changed, 24 insertions(+), 22 deletions(-) (limited to 'source3') diff --git a/source3/include/rpc_netlogon.h b/source3/include/rpc_netlogon.h index 0a515b74f3..c72a35749f 100644 --- a/source3/include/rpc_netlogon.h +++ b/source3/include/rpc_netlogon.h @@ -421,7 +421,7 @@ typedef struct net_q_getdcname { typedef struct net_r_getdcname { uint32 ptr_dcname; UNISTR2 uni_dcname; - NTSTATUS status; + WERROR status; } NET_R_GETDCNAME; /* NET_Q_TRUST_DOM_LIST - LSA Query Trusted Domains */ diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c index 17663a7cfc..8f82f97d88 100644 --- a/source3/nsswitch/winbindd_cm.c +++ b/source3/nsswitch/winbindd_cm.c @@ -289,6 +289,7 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain, struct winbindd_domain *our_domain = NULL; struct rpc_pipe_client *netlogon_pipe = NULL; NTSTATUS result; + WERROR werr; TALLOC_CTX *mem_ctx; fstring tmp; @@ -316,14 +317,14 @@ static BOOL get_dc_name_via_netlogon(const struct winbindd_domain *domain, return False; } - result = rpccli_netlogon_getdcname(netlogon_pipe, mem_ctx, our_domain->dcname, + werr = rpccli_netlogon_getdcname(netlogon_pipe, mem_ctx, our_domain->dcname, domain->name, tmp); talloc_destroy(mem_ctx); - if (!NT_STATUS_IS_OK(result)) { + if (!W_ERROR_IS_OK(werr)) { DEBUG(10, ("rpccli_netlogon_getdcname failed: %s\n", - nt_errstr(result))); + dos_errstr(werr))); return False; } diff --git a/source3/nsswitch/winbindd_misc.c b/source3/nsswitch/winbindd_misc.c index 9fb05d9df6..34ce468516 100644 --- a/source3/nsswitch/winbindd_misc.c +++ b/source3/nsswitch/winbindd_misc.c @@ -195,6 +195,7 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain, char *p; struct rpc_pipe_client *netlogon_pipe; NTSTATUS result; + WERROR werr; state->request.domain_name [sizeof(state->request.domain_name)-1] = '\0'; @@ -209,12 +210,12 @@ enum winbindd_result winbindd_dual_getdcname(struct winbindd_domain *domain, return WINBINDD_ERROR; } - result = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx, domain->dcname, + werr = rpccli_netlogon_getdcname(netlogon_pipe, state->mem_ctx, domain->dcname, state->request.domain_name, dcname_slash); - if (!NT_STATUS_IS_OK(result)) { - DEBUG(5, ("Error requesting DCname: %s\n", nt_errstr(result))); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(5, ("Error requesting DCname: %s\n", dos_errstr(werr))); return WINBINDD_ERROR; } diff --git a/source3/rpc_client/cli_netlogon.c b/source3/rpc_client/cli_netlogon.c index faecf9f3fe..5396de9bf0 100644 --- a/source3/rpc_client/cli_netlogon.c +++ b/source3/rpc_client/cli_netlogon.c @@ -382,14 +382,14 @@ NTSTATUS rpccli_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, TALLOC_CTX *me /* GetDCName */ -NTSTATUS rpccli_netlogon_getdcname(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, const char *mydcname, - const char *domainname, fstring newdcname) +WERROR rpccli_netlogon_getdcname(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, const char *mydcname, + const char *domainname, fstring newdcname) { prs_struct qbuf, rbuf; NET_Q_GETDCNAME q; NET_R_GETDCNAME r; - NTSTATUS result; + WERROR result; fstring mydcname_slash; ZERO_STRUCT(q); @@ -402,16 +402,16 @@ NTSTATUS rpccli_netlogon_getdcname(struct rpc_pipe_client *cli, /* Marshall data and send request */ - CLI_DO_RPC(cli, mem_ctx, PI_NETLOGON, NET_GETDCNAME, + CLI_DO_RPC_WERR(cli, mem_ctx, PI_NETLOGON, NET_GETDCNAME, q, r, qbuf, rbuf, net_io_q_getdcname, net_io_r_getdcname, - NT_STATUS_UNSUCCESSFUL); + WERR_GENERAL_FAILURE); result = r.status; - if (NT_STATUS_IS_OK(result)) { + if (W_ERROR_IS_OK(result)) { rpcstr_pull_unistr2_fstring(newdcname, &r.uni_dcname); } diff --git a/source3/rpc_parse/parse_net.c b/source3/rpc_parse/parse_net.c index ac8921987a..6f7c453edf 100644 --- a/source3/rpc_parse/parse_net.c +++ b/source3/rpc_parse/parse_net.c @@ -560,7 +560,7 @@ BOOL net_io_r_getdcname(const char *desc, NET_R_GETDCNAME *r_t, prs_struct *ps, if (!prs_align(ps)) return False; - if (!prs_ntstatus("status", ps, depth, &r_t->status)) + if (!prs_werror("status", ps, depth, &r_t->status)) return False; return True; diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c index ee0fc2e14c..1a145711cc 100644 --- a/source3/rpcclient/cmd_netlogon.c +++ b/source3/rpcclient/cmd_netlogon.c @@ -45,21 +45,21 @@ static NTSTATUS cmd_netlogon_logon_ctrl2(struct rpc_pipe_client *cli, return result; } -static NTSTATUS cmd_netlogon_getdcname(struct rpc_pipe_client *cli, - TALLOC_CTX *mem_ctx, int argc, - const char **argv) +static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli, + TALLOC_CTX *mem_ctx, int argc, + const char **argv) { fstring dcname; - NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + WERROR result = WERR_GENERAL_FAILURE; if (argc != 2) { fprintf(stderr, "Usage: %s domainname\n", argv[0]); - return NT_STATUS_OK; + return WERR_OK; } result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], dcname); - if (!NT_STATUS_IS_OK(result)) + if (!W_ERROR_IS_OK(result)) goto done; /* Display results */ @@ -368,7 +368,7 @@ struct cmd_set netlogon_commands[] = { { "NETLOGON" }, { "logonctrl2", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl2, NULL, PI_NETLOGON, NULL, "Logon Control 2", "" }, - { "getdcname", RPC_RTYPE_NTSTATUS, cmd_netlogon_getdcname, NULL, PI_NETLOGON, NULL, "Get trusted DC name", "" }, + { "getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_getdcname, PI_NETLOGON, NULL, "Get trusted DC name", "" }, { "dsr_getdcname", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getdcname, PI_NETLOGON, NULL, "Get trusted DC name", "" }, { "dsr_getsitename", RPC_RTYPE_WERROR, NULL, cmd_netlogon_dsr_getsitename, PI_NETLOGON, NULL, "Get sitename", "" }, { "logonctrl", RPC_RTYPE_NTSTATUS, cmd_netlogon_logon_ctrl, NULL, PI_NETLOGON, NULL, "Logon Control", "" }, -- cgit