Remove another global from clidfs that is only used in client.c.
authorJeremy Allison <jra@samba.org>
Wed, 14 Jan 2009 22:26:56 +0000 (14:26 -0800)
committerJeremy Allison <jra@samba.org>
Wed, 14 Jan 2009 22:26:56 +0000 (14:26 -0800)
Jeremy.

source3/client/client.c
source3/include/proto.h
source3/libsmb/clidfs.c

index adcbffe6fac30f9fbff4aaaac5778b704da4a8e1..cfe33c46c2fb131f29c7f91d4d9e44a03417535a 100644 (file)
@@ -45,7 +45,7 @@ const char *cmd_ptr = NULL;
 static int io_bufsize = 524288;
 
 static int name_type = 0x20;
-extern int max_protocol;
+static int max_protocol = PROTOCOL_NT1;
 
 static int process_tok(char *tok);
 static int cmd_help(void);
@@ -4051,7 +4051,8 @@ static int process_command_string(const char *cmd_in)
        if (!cli) {
                cli = cli_cm_open(talloc_tos(), NULL,
                                have_ip ? dest_ss_str : desthost,
-                               service, true, smb_encrypt);
+                               service, true, smb_encrypt,
+                               max_protocol);
                if (!cli) {
                        return 1;
                }
@@ -4516,7 +4517,8 @@ static int process(const char *base_directory)
 
        cli = cli_cm_open(talloc_tos(), NULL,
                        have_ip ? dest_ss_str : desthost,
-                       service, true, smb_encrypt);
+                       service, true, smb_encrypt,
+                       max_protocol);
        if (!cli) {
                return 1;
        }
@@ -4548,7 +4550,8 @@ static int do_host_query(const char *query_host)
        struct sockaddr_storage ss;
 
        cli = cli_cm_open(talloc_tos(), NULL,
-                       query_host, "IPC$", true, smb_encrypt);
+                       query_host, "IPC$", true, smb_encrypt,
+                       max_protocol);
        if (!cli)
                return 1;
 
@@ -4568,7 +4571,8 @@ static int do_host_query(const char *query_host)
                cli_cm_shutdown();
                cli_cm_set_port( 139 );
                cli = cli_cm_open(talloc_tos(), NULL,
-                               query_host, "IPC$", true, smb_encrypt);
+                               query_host, "IPC$", true, smb_encrypt,
+                               max_protocol);
        }
 
        if (cli == NULL) {
@@ -4595,7 +4599,8 @@ static int do_tar_op(const char *base_directory)
        if (!cli) {
                cli = cli_cm_open(talloc_tos(), NULL,
                        have_ip ? dest_ss_str : desthost,
-                       service, true, smb_encrypt);
+                       service, true, smb_encrypt,
+                       max_protocol);
                if (!cli)
                        return 1;
        }
index 9d990207a060ce8bc1324cdfc19c96d86d9ef28a..5d70c1c2fc8f356f98dc98c85faf86f4b45a3871 100644 (file)
@@ -2383,7 +2383,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                const char *server,
                                const char *share,
                                bool show_hdr,
-                               bool force_encrypt);
+                               bool force_encrypt,
+                               int max_protocol);
 void cli_cm_shutdown(void);
 void cli_cm_display(void);
 void cli_cm_set_credentials(struct user_auth_info *auth_info);
index 211aca2bd8f9980765f48efb40590dce848b56e5..7ed66611bd1c299e40750b8426464247f0da6656 100644 (file)
@@ -38,9 +38,6 @@ struct client_connection {
        char *mount;
 };
 
-/* global state....globals reek! */
-int max_protocol = PROTOCOL_NT1;
-
 static struct cm_cred_struct {
        char *username;
        char *password;
@@ -111,7 +108,8 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                                        const char *server,
                                        const char *share,
                                        bool show_sessetup,
-                                       bool force_encrypt)
+                                       bool force_encrypt,
+                                       int max_protocol)
 {
        struct cli_state *c = NULL;
        struct nmb_name called, calling;
@@ -264,7 +262,8 @@ static struct cli_state *do_connect(TALLOC_CTX *ctx,
                                lp_workgroup())) {
                cli_shutdown(c);
                return do_connect(ctx, newserver,
-                               newshare, false, force_encrypt);
+                               newshare, false,
+                               force_encrypt, max_protocol);
        }
 
        /* must be a normal share */
@@ -348,7 +347,8 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx,
                                        const char *server,
                                        const char *share,
                                        bool show_hdr,
-                                       bool force_encrypt)
+                                       bool force_encrypt,
+                                       int max_protocol)
 {
        struct client_connection *node;
 
@@ -358,7 +358,8 @@ static struct cli_state *cli_cm_connect(TALLOC_CTX *ctx,
                return NULL;
        }
 
-       node->cli = do_connect(ctx, server, share, show_hdr, force_encrypt);
+       node->cli = do_connect(ctx, server, share,
+                               show_hdr, force_encrypt, max_protocol);
 
        if ( !node->cli ) {
                TALLOC_FREE( node );
@@ -411,7 +412,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
                                const char *server,
                                const char *share,
                                bool show_hdr,
-                               bool force_encrypt)
+                               bool force_encrypt,
+                               int max_protocol)
 {
        struct cli_state *c;
 
@@ -420,7 +422,8 @@ struct cli_state *cli_cm_open(TALLOC_CTX *ctx,
        c = cli_cm_find(server, share);
        if (!c) {
                c = cli_cm_connect(ctx, referring_cli,
-                               server, share, show_hdr, force_encrypt);
+                               server, share, show_hdr, force_encrypt,
+                               max_protocol);
        }
 
        return c;
@@ -900,7 +903,8 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
        if (!(cli_ipc = cli_cm_open(ctx, rootcli,
                                        rootcli->desthost,
                                        "IPC$", false,
-                                       (rootcli->trans_enc_state != NULL)))) {
+                                       (rootcli->trans_enc_state != NULL),
+                                       rootcli->protocol))) {
                return false;
        }
 
@@ -945,7 +949,8 @@ bool cli_resolve_path(TALLOC_CTX *ctx,
                                        server,
                                        share,
                                        false,
-                                       (rootcli->trans_enc_state != NULL))) == NULL) {
+                                       (rootcli->trans_enc_state != NULL),
+                                       rootcli->protocol)) == NULL) {
                d_printf("Unable to follow dfs referral [\\%s\\%s]\n",
                        server, share );
                return false;