[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-5229-g8775968

Stefan Metzmacher metze at samba.org
Mon Apr 20 14:30:58 GMT 2009


The branch, v3-3-test has been updated
       via  8775968526046f040a2e6ba8697d719b5e3bced8 (commit)
       via  d80e02de5714aaa650bef91767ce0775bd2392f5 (commit)
       via  cba4214b963983730bedc792e391b5435889597a (commit)
      from  5a5dcd125fe236ddd93a6e56ae361fc84e306185 (commit)

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


- Log -----------------------------------------------------------------
commit 8775968526046f040a2e6ba8697d719b5e3bced8
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)
    (cherry picked from commit 1d1e859c4e08fed1775a170ccff459f3a18e13ba)

commit d80e02de5714aaa650bef91767ce0775bd2392f5
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)
    (cherry picked from commit e20b8706401d1a4eee0fe494825deef6ab23ab23)

commit cba4214b963983730bedc792e391b5435889597a
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)
    (cherry picked from commit d87563604ca7b1c18c5a84d76726c2a99dc454f8)

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

Summary of changes:
 docs-xml/manpages-3/net.8.xml |    9 +++++++++
 source/utils/net.c            |    1 +
 source/utils/net.h            |    1 +
 source/utils/net_rpc.c        |   17 ++++++++---------
 source/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 1fb720a..78f798c 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/source/utils/net.c b/source/utils/net.c
index f1a5be1..a8203b6 100644
--- a/source/utils/net.c
+++ b/source/utils/net.c
@@ -635,6 +635,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/source/utils/net.h b/source/utils/net.h
index 2d72756..d88f962 100644
--- a/source/utils/net.h
+++ b/source/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/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 98605d1..8377e1c 100644
--- a/source/utils/net_rpc.c
+++ b/source/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) {
@@ -184,8 +182,7 @@ int run_rpc_command(struct net_context *c,
 					cli_get_pipe_name_from_iface(
 						debug_ctx(), cli, interface),
 					nt_errstr(nt_status) ));
-				cli_shutdown(cli);
-				return -1;
+				goto fail;
 			}
 		}
 	}
@@ -195,6 +192,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"));
 	}
 
@@ -204,13 +202,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/source/utils/net_util.c b/source/utils/net_util.c
index ee02942..98dac4d 100644
--- a/source/utils/net_util.c
+++ b/source/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