s3:net: add --request-timeout option
authorStefan Metzmacher <metze@samba.org>
Thu, 26 Mar 2009 19:32:55 +0000 (20:32 +0100)
committerKarolin Seeger <kseeger@samba.org>
Tue, 2 Jun 2009 10:41:52 +0000 (12:41 +0200)
metze
(cherry picked from commit 257809558bfab3e45703cf8be76357596392a3ea)
(cherry picked from commit e20b8706401d1a4eee0fe494825deef6ab23ab23)
(cherry picked from commit d80e02de5714aaa650bef91767ce0775bd2392f5)
(cherry picked from commit 340c23e150061a20af72e9b9a1762d288660861c)

source/utils/net.c
source/utils/net.h
source/utils/net_help.c

index 7c616125402da2b2518b38f6db5eabdcb8d7a2b5..570051123ad42e00a52aa8993e979c35cfd27a6d 100644 (file)
@@ -72,6 +72,7 @@ const char *opt_comment = "";
 const char *opt_container = NULL;
 int opt_flags = -1;
 int opt_timeout = 0;
+int opt_request_timeout = 0;
 const char *opt_target_workgroup = NULL;
 int opt_machine_pass = 0;
 int opt_localgroup = False;
@@ -571,6 +572,8 @@ NTSTATUS net_make_ipc_connection_ex(const char *domain, const char *server,
                d_fprintf(stderr, "Connection failed: %s\n",
                          nt_errstr(nt_status));
                cli = NULL;
+       } else if (opt_request_timeout) {
+               cli_set_timeout(cli, opt_request_timeout * 1000);
        }
 
 done:
@@ -1042,6 +1045,7 @@ static struct functable net_func[] = {
                {"force",       'f', POPT_ARG_NONE,   &opt_force},
                {"stdin",       'i', POPT_ARG_NONE,   &opt_stdin},
                {"timeout",     't', POPT_ARG_INT,    &opt_timeout},
+               {"request-timeout",0,POPT_ARG_INT,    &opt_request_timeout},
                {"machine-pass",'P', POPT_ARG_NONE,   &opt_machine_pass},
                {"myworkgroup", 'W', POPT_ARG_STRING, &opt_workgroup},
                {"verbose",     'v', POPT_ARG_NONE,   &opt_verbose},
index f0436688ab33b4e024158fe11ce464981344942c..7786b26ed9f4bf4cd4bbdf9c1e652143245b1253 100644 (file)
@@ -100,6 +100,7 @@ extern int opt_reboot;
 extern int opt_force;
 extern int opt_machine_pass;
 extern int opt_timeout;
+extern int opt_request_timeout;
 extern const char *opt_host;
 extern const char *opt_user_name;
 extern const char *opt_password;
index c4accf01162972149824b99c8a35b28b8421abd5..6554364a4161b743f3cd44a0e087018ea24cb5a9 100644 (file)
@@ -48,7 +48,8 @@ int net_common_flags_usage(int argc, const char **argv)
        d_printf("\t-l or --long\t\t\tDisplay full information\n");
        d_printf("\t-V or --version\t\t\tPrint samba version information\n");
        d_printf("\t-P or --machine-pass\t\tAuthenticate as machine account\n");
-       d_printf("\t-e or --encrypt\t\tEncrypt SMB transport (UNIX extended servers only)\n");
+       d_printf("\t-e or --encrypt\t\t\tEncrypt SMB transport (UNIX extended servers only)\n");
+       d_printf("\t--request-timeout\t\tThe timeout for smb and rpc requests in seconds\n");
        return -1;
 }