diff options
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/mangle.c | 205 | ||||
-rw-r--r-- | source3/smbd/trans2.c | 8 |
2 files changed, 117 insertions, 96 deletions
diff --git a/source3/smbd/mangle.c b/source3/smbd/mangle.c index a08402a85e..3f753cf855 100644 --- a/source3/smbd/mangle.c +++ b/source3/smbd/mangle.c @@ -123,30 +123,34 @@ BOOL is_8_3(char *fname, BOOL check_case) { char *p = fname; -#ifdef KANJI - dot_pos = 0; - while (*p) + if(lp_client_code_page() == KANJI_CODEPAGE) + { + dot_pos = 0; + while (*p) { - if (is_shift_jis (*p)) { - p += 2; - } else if (is_kana (*p)) { - p ++; - } else { - if (*p == '.' && !dot_pos) - dot_pos = (char *) p; - if (!isdoschar(*p)) - return(False); - p++; - } - } -#else - while (*p) + if (is_shift_jis (*p)) + p += 2; + else if (is_kana (*p)) + p ++; + else + { + if (*p == '.' && !dot_pos) + dot_pos = (char *) p; + if (!isdoschar(*p)) + return(False); + p++; + } + } + } + else + { + while (*p) { - if (!isdoschar(*p)) - return(False); - p++; + if (!isdoschar(*p)) + return(False); + p++; } -#endif /* KANJI */ + } } /* no dot and less than 9 means OK */ @@ -498,84 +502,90 @@ void mangle_name_83(char *s) DEBUG(5,("Mangling name %s to ",s)); if (p) - { - if (p == s) - strcpy(extension,"___"); - else + { + if (p == s) + strcpy(extension,"___"); + else { *p++ = 0; while (*p && extlen < 3) - { -#ifdef KANJI - if (is_shift_jis (*p)) - { - if (extlen < 2) - { - extension[extlen++] = p[0]; - extension[extlen++] = p[1]; - } - else - { - extension[extlen++] = base36 (((unsigned char) *p) % 36); - } - p += 2; - } - else if (is_kana (*p)) - { - extension[extlen++] = p[0]; - p++; - } - else - { - if (isdoschar (*p) && *p != '.') - extension[extlen++] = p[0]; - p++; - } -#else - if (isdoschar(*p) && *p != '.') - extension[extlen++] = *p; - p++; -#endif /* KANJI */ - } + { + if(lp_client_code_page() == KANJI_CODEPAGE) + { + if (is_shift_jis (*p)) + { + if (extlen < 2) + { + extension[extlen++] = p[0]; + extension[extlen++] = p[1]; + } + else + { + extension[extlen++] = base36 (((unsigned char) *p) % 36); + } + p += 2; + } + else if (is_kana (*p)) + { + extension[extlen++] = p[0]; + p++; + } + else + { + if (isdoschar (*p) && *p != '.') + extension[extlen++] = p[0]; + p++; + } + } + else + { + if (isdoschar(*p) && *p != '.') + extension[extlen++] = *p; + p++; + } + } extension[extlen] = 0; - } } + } p = s; while (*p && baselen < 5) + { + if(lp_client_code_page() == KANJI_CODEPAGE) { -#ifdef KANJI if (is_shift_jis (*p)) - { - if (baselen < 4) - { - base[baselen++] = p[0]; - base[baselen++] = p[1]; - } - else - { + { + if (baselen < 4) + { + base[baselen++] = p[0]; + base[baselen++] = p[1]; + } + else + { base[baselen++] = base36 (((unsigned char) *p) % 36); - } - p += 2; - } + } + p += 2; + } else if (is_kana (*p)) - { - base[baselen++] = p[0]; - p++; - } + { + base[baselen++] = p[0]; + p++; + } else - { - if (isdoschar (*p) && *p != '.') - base[baselen++] = p[0]; - p++; - } -#else + { + if (isdoschar (*p) && *p != '.') + base[baselen++] = p[0]; + p++; + } + } + else + { if (isdoschar(*p) && *p != '.') - base[baselen++] = *p; + base[baselen++] = *p; p++; -#endif /* KANJI */ } + } base[baselen] = 0; csum = csum % (36*36); @@ -601,7 +611,8 @@ static BOOL illegal_name(char *name) static BOOL initialised=False; unsigned char *s; - if (!initialised) { + if (!initialised) + { char *ill = "*\\/?<>|\":{}"; initialised = True; @@ -610,21 +621,23 @@ static BOOL illegal_name(char *name) illegal[*s] = True; } -#ifdef KANJI - for (s = (unsigned char *)name; *s;) { - if (is_shift_jis (*s)) { - s += 2; - } else if (illegal[*s]) { - return(True); - } else { - s++; + if(lp_client_code_page() == KANJI_CODEPAGE) + { + for (s = (unsigned char *)name; *s;) { + if (is_shift_jis (*s)) { + s += 2; + } else if (illegal[*s]) { + return(True); + } else { + s++; + } } } -#else - for (s = (unsigned char *)name;*s;s++) - if (illegal[*s]) return(True); -#endif - + else + { + for (s = (unsigned char *)name;*s;s++) + if (illegal[*s]) return(True); + } return(False); } diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 19c1158658..c8e726d36e 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1347,6 +1347,14 @@ static int call_trans2setfilepathinfo(char *inbuf, char *outbuf, int length, tvs.modtime=MAX(interpret_long_date(pdata+16), interpret_long_date(pdata+24)); +#if 0 /* Needs more testing... */ + /* Test from Luke to prevent Win95 from + setting incorrect values here. + */ + if (tvs.actime < tvs.modtime) + return(ERROR(ERRDOS,ERRnoaccess)); +#endif /* Needs more testing... */ + /* attributes */ mode = IVAL(pdata,32); break; |