summaryrefslogtreecommitdiff
path: root/source3/smbd/mangle_hash2.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-08-27 19:01:55 +0000
committerJeremy Allison <jra@samba.org>2003-08-27 19:01:55 +0000
commit46765d97fae2930836582a2590a4bfb9f2a78e9a (patch)
tree9e586afc87f21c6af285551b82f90b0f559b9765 /source3/smbd/mangle_hash2.c
parent9511c987df258a9c558f9ade18c5e5549c24eafb (diff)
downloadsamba-46765d97fae2930836582a2590a4bfb9f2a78e9a.tar.gz
samba-46765d97fae2930836582a2590a4bfb9f2a78e9a.tar.bz2
samba-46765d97fae2930836582a2590a4bfb9f2a78e9a.zip
Check for embedded mb chars when testing for illegal characters like /.
Should fix mangling for Japanese language. Jeremy. (This used to be commit a238bcc440e310a9ea7800e4fb0b4d39c1f0a0d7)
Diffstat (limited to 'source3/smbd/mangle_hash2.c')
-rw-r--r--source3/smbd/mangle_hash2.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/source3/smbd/mangle_hash2.c b/source3/smbd/mangle_hash2.c
index ee0ef69feb..9cd0438d51 100644
--- a/source3/smbd/mangle_hash2.c
+++ b/source3/smbd/mangle_hash2.c
@@ -304,7 +304,8 @@ static BOOL is_8_3(const char *name, BOOL check_case, BOOL allow_wildcards)
the result we need in this case. Using strlen_m would not
only be slower, it would be incorrect */
len = strlen(name);
- if (len > 12) return False;
+ if (len > 12)
+ return False;
/* find the '.'. Note that once again we use the non-multibyte
function */
@@ -448,6 +449,27 @@ static BOOL is_legal_name(const char *name)
size_t numdots = 0;
while (*name) {
+ if (((unsigned int)name[0]) > 128 && (name[1] != 0)) {
+ /* Possible start of mb character. */
+ char mbc[2];
+ /*
+ * We know the following will return 2 bytes. What
+ * we need to know was if errno was set.
+ * Note that if CH_UNIX is utf8 a string may be 3
+ * bytes, but this is ok as mb utf8 characters don't
+ * contain embedded ascii bytes. We are really checking
+ * for mb UNIX asian characters like Japanese (SJIS) here.
+ * JRA.
+ */
+ errno = 0;
+ convert_string(CH_UNIX, CH_UCS2, name, 2, mbc, 2);
+ if (!errno) {
+ /* Was a good mb string. */
+ name += 2;
+ continue;
+ }
+ }
+
if (FLAG_CHECK(name[0], FLAG_ILLEGAL)) {
return False;
}