summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_netlogon.c
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-02-07 10:24:18 +0100
committerGünther Deschner <gd@samba.org>2008-02-07 10:29:26 +0100
commitbca0ef0ed769bfbee6e7041aae8256be872813c7 (patch)
treea77de5cf619b05e9d1cb0d0eceb040269dea9951 /source3/rpcclient/cmd_netlogon.c
parent3e731a49366df8a1fda6cc6b7fb14fc68dbb5d36 (diff)
downloadsamba-bca0ef0ed769bfbee6e7041aae8256be872813c7.tar.gz
samba-bca0ef0ed769bfbee6e7041aae8256be872813c7.tar.bz2
samba-bca0ef0ed769bfbee6e7041aae8256be872813c7.zip
Use rpccli_netr_GetAnyDCName and rpccli_netr_GetDCName everywhere.
Guenther (This used to be commit 8abeea9922ac09e7307730ee7695453718356873)
Diffstat (limited to 'source3/rpcclient/cmd_netlogon.c')
-rw-r--r--source3/rpcclient/cmd_netlogon.c52
1 files changed, 34 insertions, 18 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index aad538a0ee..e1d13d3b1d 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -48,8 +48,9 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- char *dcname = NULL;
- WERROR result = WERR_GENERAL_FAILURE;
+ const char *dcname = NULL;
+ WERROR werr;
+ NTSTATUS status;
int old_timeout;
if (argc != 2) {
@@ -60,27 +61,35 @@ static WERROR cmd_netlogon_getanydcname(struct rpc_pipe_client *cli,
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getanydcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
-
+ status = rpccli_netr_GetAnyDCName(cli, mem_ctx,
+ cli->cli->desthost,
+ argv[1],
+ &dcname,
+ &werr);
cli_set_timeout(cli->cli, old_timeout);
- if (!W_ERROR_IS_OK(result))
- goto done;
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
/* Display results */
printf("%s\n", dcname);
- done:
- return result;
+ return werr;
}
-static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
- TALLOC_CTX *mem_ctx, int argc,
+static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
+ TALLOC_CTX *mem_ctx, int argc,
const char **argv)
{
- char *dcname = NULL;
- WERROR result = WERR_GENERAL_FAILURE;
+ const char *dcname = NULL;
+ NTSTATUS status;
+ WERROR werr;
int old_timeout;
if (argc != 2) {
@@ -91,19 +100,26 @@ static WERROR cmd_netlogon_getdcname(struct rpc_pipe_client *cli,
/* Make sure to wait for our DC's reply */
old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
- result = rpccli_netlogon_getdcname(cli, mem_ctx, cli->cli->desthost, argv[1], &dcname);
-
+ status = rpccli_netr_GetDcName(cli, mem_ctx,
+ cli->cli->desthost,
+ argv[1],
+ &dcname,
+ &werr);
cli_set_timeout(cli->cli, old_timeout);
- if (!W_ERROR_IS_OK(result))
- goto done;
+ if (!NT_STATUS_IS_OK(status)) {
+ return ntstatus_to_werror(status);
+ }
+
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
+ }
/* Display results */
printf("%s\n", dcname);
- done:
- return result;
+ return werr;
}
static WERROR cmd_netlogon_dsr_getdcname(struct rpc_pipe_client *cli,