summaryrefslogtreecommitdiffstats
path: root/source/lib/util_unistr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-06-23 07:21:25 +0000
committerJeremy Allison <jra@samba.org>2001-06-23 07:21:25 +0000
commit2e7e09331a445117c52b007dba8a7093899a331d (patch)
treedfa67649422bf714ac8314ecb8779de95566d749 /source/lib/util_unistr.c
parentc0782c1a365a26ebba584539cd58cd28304f76f1 (diff)
downloadsamba-2e7e09331a445117c52b007dba8a7093899a331d.tar.gz
samba-2e7e09331a445117c52b007dba8a7093899a331d.tar.xz
samba-2e7e09331a445117c52b007dba8a7093899a331d.zip
Added "other_safe_chars" to alpha_strcpy(). Needs testing but is a better
API fix for the problem. Jeremy.
Diffstat (limited to 'source/lib/util_unistr.c')
-rw-r--r--source/lib/util_unistr.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index f6bb7e80681..9b3e25dd7ea 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -1580,9 +1580,10 @@ BOOL str_is_all_w(const smb_ucs2_t *s,smb_ucs2_t c)
maxlength is in ucs2 units.
********************************************************************/
-smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxlength)
+smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, const smb_ucs2_t *other_safe_chars, size_t maxlength)
{
size_t len, i;
+ smb_ucs2_t nullstr_w = (smb_ucs2_t)0;
if (!dest) {
DEBUG(0,("ERROR: NULL dest in alpha_strcpy_w\n"));
@@ -1598,9 +1599,12 @@ smb_ucs2_t *alpha_strcpy_w(smb_ucs2_t *dest, const smb_ucs2_t *src, size_t maxle
if (len >= maxlength)
len = maxlength - 1;
+ if (!other_safe_chars)
+ other_safe_chars = &nullstr_w;
+
for(i = 0; i < len; i++) {
smb_ucs2_t val = src[i];
- if(isupper_w(val) ||islower_w(val) || isdigit_w(val))
+ if(isupper_w(val) ||islower_w(val) || isdigit_w(val) || strchr_w(other_safe_chars, val))
dest[i] = src[i];
else
dest[i] = (smb_ucs2_t)'_';