diff options
author | Jeremy Allison <jra@samba.org> | 2000-05-10 22:47:09 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-05-10 22:47:09 +0000 |
commit | 612738a9e14b6fb6a2687993d6416bbe6c3ea94d (patch) | |
tree | 55a78e514091bf38c7bd7cc445aade76338942af /source3/lib | |
parent | 2c978311dcb869b91a7787feba7f537056f4b90d (diff) | |
download | samba-612738a9e14b6fb6a2687993d6416bbe6c3ea94d.tar.gz samba-612738a9e14b6fb6a2687993d6416bbe6c3ea94d.tar.bz2 samba-612738a9e14b6fb6a2687993d6416bbe6c3ea94d.zip |
lib/util_unistr.c:
libsmb/clilist.c:
rpc_server/srv_spoolss_nt.c:
smbd/trans2.c: Changed unistr_to_ascii to unistr_to_dos - do codepage conversion.
msdfs/msdfs.c: Removed stub unistr_to_dos.
libsmb/pwd_cache.c: Removed obfuscation functions as they don't do anything and
don't add any security.
Jeremy.
(This used to be commit 1ed146467e764e6a81d8f78cd58fb5765ebf5d21)
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/util_unistr.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c index 0ca148ba94..4a66adc0fd 100644 --- a/source3/lib/util_unistr.c +++ b/source3/lib/util_unistr.c @@ -91,7 +91,7 @@ int dos_PutUniCode(char *dst,const char *src, ssize_t len, BOOL null_terminate) Help ! Fix Me ! Fix Me ! ********************************************************************/ -void ascii_to_unistr(char *dest, const char *src, int maxlen) +void ascii_to_unistr(char *dest, const char *src, size_t maxlen) { char *destend = dest + maxlen; char c; @@ -107,24 +107,28 @@ void ascii_to_unistr(char *dest, const char *src, int maxlen) } /******************************************************************* - Pull an ASCII string out of a UNICODE array . - - Warning: doesn't do any codepage !!! BAD !!! - - Help ! Fix Me ! Fix Me ! + Pull a DOS codepage string out of a UNICODE array. len is in bytes. ********************************************************************/ -void unistr_to_ascii(char *dest, char *src, int len) +void unistr_to_dos(char *dest, char *src, size_t len) { char *destend = dest + len; - uint16 c; while (dest < destend) { - c = SVAL(src, 0); + uint16 ucs2_val = SVAL(src,0); + uint16 cp_val = ucs2_to_doscp[ucs2_val]; + src += 2; - if (c == 0) break; - *(dest++) = (char)c; + if (ucs2_val == 0) + break; + + if (cp_val < 256) + *dest++ = (char)cp_val; + else { + *dest++ = (cp_val >> 8) & 0xff; + *dest++ = (cp_val & 0xff); + } } *dest = 0; |