[SCM] Samba Shared Repository - branch v3-4-test updated - release-4-0-0alpha7-788-g1d1e859

Stefan Metzmacher metze at samba.org
Sun Apr 19 09:06:18 GMT 2009


The branch, v3-4-test has been updated
       via  1d1e859c4e08fed1775a170ccff459f3a18e13ba (commit)
       via  e20b8706401d1a4eee0fe494825deef6ab23ab23 (commit)
       via  d87563604ca7b1c18c5a84d76726c2a99dc454f8 (commit)
      from  9deb558c5a3c380c7e4964e6fd2fc1b948115078 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-4-test


- Log -----------------------------------------------------------------
commit 1d1e859c4e08fed1775a170ccff459f3a18e13ba
Author: Stefan Metzmacher <metze at samba.org>
Date:   Fri Apr 3 12:21:17 2009 +0200

    s3:docs: document the --request-timeout option of net
    
    metze
    (cherry picked from commit cdbbc81bad5d53397bf80898cf68d8867cf64cba)

commit e20b8706401d1a4eee0fe494825deef6ab23ab23
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 26 20:32:55 2009 +0100

    s3:net: add --request-timeout option
    
    metze
    (cherry picked from commit 257809558bfab3e45703cf8be76357596392a3ea)

commit d87563604ca7b1c18c5a84d76726c2a99dc454f8
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Mar 26 20:29:24 2009 +0100

    s3:net_rpc: don't shutdown a cli_state passed from the caller
    
    This fixes a crash bug if we timeout in net rpc trustdom list.
    
    metze
    (cherry picked from commit c0dfe0cf80ee50f395912b7d6aec0d87febd34c0)

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/manpages-3/net.8.xml |    9 +++++++++
 source3/utils/net.c           |    1 +
 source3/utils/net.h           |    1 +
 source3/utils/net_rpc.c       |   17 ++++++++---------
 source3/utils/net_util.c      |    2 ++
 5 files changed, 21 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/docs-xml/manpages-3/net.8.xml b/docs-xml/manpages-3/net.8.xml
index 3eb0c90..826b916 100644
--- a/docs-xml/manpages-3/net.8.xml
+++ b/docs-xml/manpages-3/net.8.xml
@@ -35,6 +35,7 @@
 		<arg choice="opt">-P</arg>
 		<arg choice="opt">-d debuglevel</arg>
 		<arg choice="opt">-V</arg>
+		<arg choice="opt">--request-timeout seconds</arg>
 	</cmdsynopsis>
 </refsynopsisdiv>
 
@@ -125,6 +126,14 @@
 		</para></listitem>
 		</varlistentry>
 
+		<varlistentry>
+		<term>--request-timeout 30</term>
+		<listitem><para>
+		Let client requests timeout after 30 seconds the default is 10
+		seconds.
+		</para></listitem>
+		</varlistentry>
+
 		&stdarg.server.debug;
 	</variablelist>
 </refsect1>
diff --git a/source3/utils/net.c b/source3/utils/net.c
index 4234852..77662ef 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -644,6 +644,7 @@ static struct functable net_func[] = {
 		{"force",	'f', POPT_ARG_NONE,   &c->opt_force},
 		{"stdin",	'i', POPT_ARG_NONE,   &c->opt_stdin},
 		{"timeout",	't', POPT_ARG_INT,    &c->opt_timeout},
+		{"request-timeout",0,POPT_ARG_INT,    &c->opt_request_timeout},
 		{"machine-pass",'P', POPT_ARG_NONE,   &c->opt_machine_pass},
 		{"kerberos",    'k', POPT_ARG_NONE,   &c->opt_kerberos},
 		{"myworkgroup", 'W', POPT_ARG_STRING, &c->opt_workgroup},
diff --git a/source3/utils/net.h b/source3/utils/net.h
index 2d72756..d88f962 100644
--- a/source3/utils/net.h
+++ b/source3/utils/net.h
@@ -43,6 +43,7 @@ struct net_context {
 	const char *opt_container;
 	int opt_flags;
 	int opt_timeout;
+	int opt_request_timeout;
 	const char *opt_target_workgroup;
 	int opt_machine_pass;
 	int opt_localgroup;
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index ed7b2f0..0b66281 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -120,6 +120,7 @@ int run_rpc_command(struct net_context *c,
 	NTSTATUS nt_status;
 	DOM_SID *domain_sid;
 	const char *domain_name;
+	int ret = -1;
 
 	/* make use of cli_state handed over as an argument, if possible */
 	if (!cli_arg) {
@@ -141,15 +142,13 @@ int run_rpc_command(struct net_context *c,
 
 	if (!(mem_ctx = talloc_init("run_rpc_command"))) {
 		DEBUG(0, ("talloc_init() failed\n"));
-		cli_shutdown(cli);
-		return -1;
+		goto fail;
 	}
 
 	nt_status = net_get_remote_domain_sid(cli, mem_ctx, &domain_sid,
 					      &domain_name);
 	if (!NT_STATUS_IS_OK(nt_status)) {
-		cli_shutdown(cli);
-		return -1;
+		goto fail;
 	}
 
 	if (!(conn_flags & NET_FLAGS_NO_PIPE)) {
@@ -164,8 +163,7 @@ int run_rpc_command(struct net_context *c,
 			if (!NT_STATUS_IS_OK(nt_status)) {
 				DEBUG(0, ("Could not initialise schannel netlogon pipe. Error was %s\n",
 					nt_errstr(nt_status) ));
-				cli_shutdown(cli);
-				return -1;
+				goto fail;
 			}
 		} else {
 			if (conn_flags & NET_FLAGS_SEAL) {
@@ -183,8 +181,7 @@ int run_rpc_command(struct net_context *c,
 				DEBUG(0, ("Could not initialise pipe %s. Error was %s\n",
 					get_pipe_name_from_iface(interface),
 					nt_errstr(nt_status) ));
-				cli_shutdown(cli);
-				return -1;
+				goto fail;
 			}
 		}
 	}
@@ -194,6 +191,7 @@ int run_rpc_command(struct net_context *c,
 	if (!NT_STATUS_IS_OK(nt_status)) {
 		DEBUG(1, ("rpc command function failed! (%s)\n", nt_errstr(nt_status)));
 	} else {
+		ret = 0;
 		DEBUG(5, ("rpc command function succedded\n"));
 	}
 
@@ -203,13 +201,14 @@ int run_rpc_command(struct net_context *c,
 		}
 	}
 
+fail:
 	/* close the connection only if it was opened here */
 	if (!cli_arg) {
 		cli_shutdown(cli);
 	}
 
 	talloc_destroy(mem_ctx);
-	return (!NT_STATUS_IS_OK(nt_status));
+	return ret;
 }
 
 /**
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index c6b6ee9..2915ffb 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -521,6 +521,8 @@ NTSTATUS net_make_ipc_connection_ex(struct net_context *c ,const char *domain,
 		d_fprintf(stderr, "Connection failed: %s\n",
 			  nt_errstr(nt_status));
 		cli = NULL;
+	} else if (c->opt_request_timeout) {
+		cli_set_timeout(cli, c->opt_request_timeout * 1000);
 	}
 
 done:


-- 
Samba Shared Repository


More information about the samba-cvs mailing list