svn commit: samba r19353 - in branches/SAMBA_3_0/source/rpcclient: .

gd at samba.org gd at samba.org
Mon Oct 16 23:27:39 GMT 2006


Author: gd
Date: 2006-10-16 23:27:38 +0000 (Mon, 16 Oct 2006)
New Revision: 19353

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19353

Log:
Add "timeout" command for rpcclient.

Guenther

Modified:
   branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c
   branches/SAMBA_3_0/source/rpcclient/cmd_samr.c
   branches/SAMBA_3_0/source/rpcclient/rpcclient.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c	2006-10-16 23:25:19 UTC (rev 19352)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_netlogon.c	2006-10-16 23:27:38 UTC (rev 19353)
@@ -59,7 +59,7 @@
 	}
 
 	/* 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 @@
 	}
 
 	/* 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);
 

Modified: branches/SAMBA_3_0/source/rpcclient/cmd_samr.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/cmd_samr.c	2006-10-16 23:25:19 UTC (rev 19352)
+++ branches/SAMBA_3_0/source/rpcclient/cmd_samr.c	2006-10-16 23:27:38 UTC (rev 19353)
@@ -787,7 +787,7 @@
 		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,

Modified: branches/SAMBA_3_0/source/rpcclient/rpcclient.c
===================================================================
--- branches/SAMBA_3_0/source/rpcclient/rpcclient.c	2006-10-16 23:25:19 UTC (rev 19352)
+++ branches/SAMBA_3_0/source/rpcclient/rpcclient.c	2006-10-16 23:27:38 UTC (rev 19353)
@@ -27,6 +27,7 @@
 
 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 @@
 	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 @@
 	{ "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 @@
 
 	/* Load command lists */
 
+	timeout = cli_set_timeout(cli, 10000);
+
 	cmd_set = rpcclient_command_list;
 
 	while(*cmd_set) {



More information about the samba-cvs mailing list