From 2c0a802cf823df9bac879b1e7d591f50ee7d51fa Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 14 Jan 2009 14:26:56 -0800 Subject: Remove another global from clidfs that is only used in client.c. Jeremy. --- source3/client/client.c | 17 +++++++++++------ source3/include/proto.h | 3 ++- source3/libsmb/clidfs.c | 27 ++++++++++++++++----------- 3 files changed, 29 insertions(+), 18 deletions(-) (limited to 'source3') diff --git a/source3/client/client.c b/source3/client/client.c index adcbffe6fa..cfe33c46c2 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -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; } diff --git a/source3/include/proto.h b/source3/include/proto.h index 9d990207a0..5d70c1c2fc 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -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); diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c index 211aca2bd8..7ed66611bd 100644 --- a/source3/libsmb/clidfs.c +++ b/source3/libsmb/clidfs.c @@ -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; -- cgit