The branch, master has been updated
       via  cdbbc81bad5d53397bf80898cf68d8867cf64cba (commit)
       via  257809558bfab3e45703cf8be76357596392a3ea (commit)
       via  c0dfe0cf80ee50f395912b7d6aec0d87febd34c0 (commit)
      from  6f90cdaf63b5b584c96b9ffc388c9e8df172db67 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit cdbbc81bad5d53397bf80898cf68d8867cf64cba
Author: Stefan Metzmacher <me...@samba.org>
Date:   Fri Apr 3 12:21:17 2009 +0200

    s3:docs: document the --request-timeout option of net
    
    metze

commit 257809558bfab3e45703cf8be76357596392a3ea
Author: Stefan Metzmacher <me...@samba.org>
Date:   Thu Mar 26 20:32:55 2009 +0100

    s3:net: add --request-timeout option
    
    metze

commit c0dfe0cf80ee50f395912b7d6aec0d87febd34c0
Author: Stefan Metzmacher <me...@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

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

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 77d7bfb..3907f2e 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 7823a98..bd5107a 100644
--- a/source3/utils/net.c
+++ b/source3/utils/net.c
@@ -651,6 +651,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

Reply via email to