summaryrefslogtreecommitdiff
path: root/source3/libsmb/clistr.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-02-21 02:51:22 +0000
committerAndrew Tridgell <tridge@samba.org>2001-02-21 02:51:22 +0000
commit3910d7baca440b21e66c1dc15556748c6f028085 (patch)
tree9b9315c3f53aa0a8ca6ec3171cb2ad7518b696d8 /source3/libsmb/clistr.c
parent6cb19fbd3a0da051010fd704bfd1dfe5bc594210 (diff)
downloadsamba-3910d7baca440b21e66c1dc15556748c6f028085.tar.gz
samba-3910d7baca440b21e66c1dc15556748c6f028085.tar.bz2
samba-3910d7baca440b21e66c1dc15556748c6f028085.zip
added support for a CLISTR_ASCII flag so we can use a uniform
interface for ascii-only fields (This used to be commit cdf0316610803e6743936b29f232b32f9ec81422)
Diffstat (limited to 'source3/libsmb/clistr.c')
-rw-r--r--source3/libsmb/clistr.c9
1 files changed, 5 insertions, 4 deletions
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++;
}