From 7b7f349de6fd0ae3a558bc41b54ee2c873130071 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 7 Apr 2015 16:12:18 +0200 Subject: [PATCH] rpcclient: Fix the timeout command https://bugzilla.samba.org/show_bug.cgi?id=11199 Signed-off-by: Andreas Schneider Reviewed-by: Stefan Metzmacher (cherry picked from commit 2bca4cdc6f83dce48c73a33288c4fd3ae80f883b) --- source3/rpcclient/rpcclient.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c index d204d7f..25e93e4 100644 --- a/source3/rpcclient/rpcclient.c +++ b/source3/rpcclient/rpcclient.c @@ -483,8 +483,6 @@ static NTSTATUS cmd_seal(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, static NTSTATUS cmd_timeout(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, int argc, const char **argv) { - struct cmd_list *tmp; - if (argc > 2) { printf("Usage: %s timeout\n", argv[0]); return NT_STATUS_OK; @@ -492,19 +490,6 @@ static NTSTATUS cmd_timeout(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, if (argc == 2) { timeout = atoi(argv[1]); - - for (tmp = cmd_list; tmp; tmp = tmp->next) { - - struct cmd_set *tmp_set; - - for (tmp_set = tmp->cmd_set; tmp_set->name; tmp_set++) { - if (tmp_set->rpc_pipe == NULL) { - continue; - } - - rpccli_set_timeout(tmp_set->rpc_pipe, timeout); - } - } } printf("timeout is %d\n", timeout); @@ -785,6 +770,11 @@ static NTSTATUS do_cmd(struct cli_state *cli, } } + /* Set timeout for new connections */ + if (cmd_entry->rpc_pipe) { + rpccli_set_timeout(cmd_entry->rpc_pipe, timeout); + } + /* Run command */ if ( cmd_entry->returntype == RPC_RTYPE_NTSTATUS ) { @@ -1108,7 +1098,8 @@ out_free: /* Load command lists */ - timeout = cli_set_timeout(cli, 10000); + timeout = 10000; + cli_set_timeout(cli, timeout); cmd_set = rpcclient_command_list; -- 2.3.5