summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2006-10-16 23:27:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:15:30 -0500
commitfb183ebd9207cac7b98aff9f672c06b0b50609ce (patch)
tree4e907f72bc55b4f340deb49cba39be60606fad76
parentb26b8f95e95030506189d714ac62380788a5fe3e (diff)
downloadsamba-fb183ebd9207cac7b98aff9f672c06b0b50609ce.tar.gz
samba-fb183ebd9207cac7b98aff9f672c06b0b50609ce.tar.bz2
samba-fb183ebd9207cac7b98aff9f672c06b0b50609ce.zip
r19353: Add "timeout" command for rpcclient.
Guenther (This used to be commit 4106a56d3f4edb2e07e876204743a1cb028c950a)
-rw-r--r--source3/rpcclient/cmd_netlogon.c4
-rw-r--r--source3/rpcclient/cmd_samr.c2
-rw-r--r--source3/rpcclient/rpcclient.c37
3 files changed, 40 insertions, 3 deletions
diff --git a/source3/rpcclient/cmd_netlogon.c b/source3/rpcclient/cmd_netlogon.c
index 5ae449a68c..a1093d693f 100644
--- a/source3/rpcclient/cmd_netlogon.c
+++ b/source3/rpcclient/cmd_netlogon.c
@@ -59,7 +59,7 @@ 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, 30000); /* 30 seconds. */
+ 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);
@@ -90,7 +90,7 @@ 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, 30000); /* 30 seconds. */
+ 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);
diff --git a/source3/rpcclient/cmd_samr.c b/source3/rpcclient/cmd_samr.c
index 4ce613bde1..a899efb64b 100644
--- a/source3/rpcclient/cmd_samr.c
+++ b/source3/rpcclient/cmd_samr.c
@@ -787,7 +787,7 @@ static NTSTATUS cmd_samr_query_groupmem(struct rpc_pipe_client *cli,
goto done;
/* Make sure to wait for our DC's reply */
- old_timeout = cli_set_timeout(cli->cli, 30000); /* 30 seconds. */
+ old_timeout = cli_set_timeout(cli->cli, MAX(cli->cli->timeout,30000)); /* 30 seconds. */
result = rpccli_samr_query_groupmem(cli, mem_ctx, &group_pol,
&num_members, &group_rids,
diff --git a/source3/rpcclient/rpcclient.c b/source3/rpcclient/rpcclient.c
index 6e9bc81884..ae04f197ed 100644
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -27,6 +27,7 @@ DOM_SID domain_sid;
static enum pipe_auth_type pipe_default_auth_type = PIPE_AUTH_TYPE_NONE;
static enum pipe_auth_level pipe_default_auth_level = PIPE_AUTH_LEVEL_NONE;
+static unsigned int timeout = 0;
/* List to hold groups of commands.
*
@@ -398,6 +399,39 @@ static NTSTATUS cmd_seal(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
return cmd_set_ss_level();
}
+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;
+ }
+
+ 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;
+ }
+
+ cli_set_timeout(tmp_set->rpc_pipe->cli, timeout);
+ }
+ }
+ }
+
+ printf("timeout is %d\n", timeout);
+
+ return NT_STATUS_OK;
+}
+
+
static NTSTATUS cmd_none(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx,
int argc, const char **argv)
{
@@ -445,6 +479,7 @@ static struct cmd_set rpcclient_commands[] = {
{ "seal", RPC_RTYPE_NTSTATUS, cmd_seal, NULL, -1, NULL, "Force RPC pipe connections to be sealed", "" },
{ "schannel", RPC_RTYPE_NTSTATUS, cmd_schannel, NULL, -1, NULL, "Force RPC pipe connections to be sealed with 'schannel'. Assumes valid machine account to this domain controller.", "" },
{ "schannelsign", RPC_RTYPE_NTSTATUS, cmd_schannel_sign, NULL, -1, NULL, "Force RPC pipe connections to be signed (not sealed) with 'schannel'. Assumes valid machine account to this domain controller.", "" },
+ { "timeout", RPC_RTYPE_NTSTATUS, cmd_timeout, NULL, -1, NULL, "Set timeout for RPC operations", "" },
{ "none", RPC_RTYPE_NTSTATUS, cmd_none, NULL, -1, NULL, "Force RPC pipe connections to have no special properties", "" },
{ NULL }
@@ -813,6 +848,8 @@ out_free:
/* Load command lists */
+ timeout = cli_set_timeout(cli, 10000);
+
cmd_set = rpcclient_command_list;
while(*cmd_set) {