From a7e418dd45fe81af4ec4fbddfcfffb491487a8b7 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 8 Sep 2011 09:49:26 +0200 Subject: [PATCH] s3:libsmb: add CLI_FULL_CONNECTION_FORCE_ASCII metze --- source3/include/client.h | 2 ++ source3/libsmb/cliconnect.c | 3 ++- source3/libsmb/clientgen.c | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/source3/include/client.h b/source3/include/client.h index 6566769eac9..9eae2221404 100644 --- a/source3/include/client.h +++ b/source3/include/client.h @@ -114,6 +114,7 @@ struct cli_state { bool use_level_II_oplocks; /* should we use level II oplocks? */ bool force_dos_errors; + bool force_ascii; bool case_sensitive; /* False by default. */ /* Where (if anywhere) this is mounted under DFS. */ @@ -194,5 +195,6 @@ struct file_info { #define CLI_FULL_CONNECTION_LEVEL_II_OPLOCKS 0x0020 #define CLI_FULL_CONNECTION_USE_CCACHE 0x0040 #define CLI_FULL_CONNECTION_FORCE_DOS_ERRORS 0x0080 +#define CLI_FULL_CONNECTION_FORCE_ASCII 0x0100 #endif /* _CLIENT_H */ diff --git a/source3/libsmb/cliconnect.c b/source3/libsmb/cliconnect.c index 2ae7cbbcdeb..fd0536cb6fb 100644 --- a/source3/libsmb/cliconnect.c +++ b/source3/libsmb/cliconnect.c @@ -2723,8 +2723,9 @@ static void cli_negprot_done(struct tevent_req *subreq) cli->max_xmit = MIN(cli->max_xmit, CLI_BUFFER_SIZE); /* a way to force ascii SMB */ - if (getenv("CLI_FORCE_ASCII")) + if (cli->force_ascii) { cli->capabilities &= ~CAP_UNICODE; + } tevent_req_done(req); } diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index ad4274a2825..f274dc0b63f 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -206,6 +206,14 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, } if (flags & CLI_FULL_CONNECTION_FORCE_DOS_ERRORS) { cli->force_dos_errors = true; + } + + if (getenv("CLI_FORCE_ASCII")) { + cli->force_ascii = true; + } + if (flags & CLI_FULL_CONNECTION_FORCE_ASCII) { + cli->force_ascii = true; + } if (flags & CLI_FULL_CONNECTION_DONT_SPNEGO) { cli->use_spnego = false; -- 2.34.1