summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/client.h1
-rw-r--r--source3/libsmb/clistr.c9
2 files changed, 6 insertions, 4 deletions
diff --git a/source3/include/client.h b/source3/include/client.h
index 1f4cd55a83..1296b03370 100644
--- a/source3/include/client.h
+++ b/source3/include/client.h
@@ -34,6 +34,7 @@
#define CLISTR_TERMINATE 1
#define CLISTR_CONVERT 2
#define CLISTR_UPPER 4
+#define CLISTR_ASCII 8
/*
* These definitions depend on smb.h
diff --git a/source3/libsmb/clistr.c b/source3/libsmb/clistr.c
index 4c7c8e3077..da40fba9e6 100644
--- a/source3/libsmb/clistr.c
+++ b/source3/libsmb/clistr.c
@@ -35,6 +35,7 @@ flags can have:
CLISTR_TERMINATE means include the null termination
CLISTR_CONVERT means convert from unix to dos codepage
CLISTR_UPPER means uppercase in the destination
+ CLISTR_ASCII use ascii even with unicode servers
dest_len is the maximum length allowed in the destination. If dest_len
is -1 then no maxiumum is used
****************************************************************************/
@@ -47,14 +48,14 @@ int clistr_push(struct cli_state *cli, void *dest, char *src, int dest_len, int
dest_len = sizeof(pstring);
}
- if (clistr_align(cli, PTR_DIFF(dest, cli->outbuf))) {
+ if (!(flags & CLISTR_ASCII) && clistr_align(cli, PTR_DIFF(dest, cli->outbuf))) {
*(char *)dest = 0;
dest++;
dest_len--;
len++;
}
- if (!cli_use_unicode || !(cli->capabilities & CAP_UNICODE)) {
+ if ((flags & CLISTR_ASCII) || !cli_use_unicode || !(cli->capabilities & CAP_UNICODE)) {
/* the server doesn't want unicode */
safe_strcpy(dest, src, dest_len);
len = strlen(dest);
@@ -90,9 +91,9 @@ int clistr_push_size(struct cli_state *cli, void *dest, char *src, int dest_len,
{
int len = strlen(src);
if (flags & CLISTR_TERMINATE) len++;
- if (cli_use_unicode && (cli->capabilities & CAP_UNICODE)) len *= 2;
+ if (!(flags & CLISTR_ASCII) && cli_use_unicode && (cli->capabilities & CAP_UNICODE)) len *= 2;
- if (dest && clistr_align(cli, PTR_DIFF(cli->outbuf, dest))) {
+ if (!(flags & CLISTR_ASCII) && dest && clistr_align(cli, PTR_DIFF(cli->outbuf, dest))) {
len++;
}