1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-03 04:22:09 +03:00

Change the multibyte character set support so that

Kanji support is one case of multibyte character
support, rather than being a specific case in
single byte character support.

This allows us to add Big5 Chinese support (code page 950)
and Korean Hangul support (code page 949) at very little
cost. Also allows us to easily add future multibyte
code pages.

Makefile: Added codepages 949, 950 as we now support more multibyte
codepages.
asyncdns.c: Fixed problem with child being re-spawned when parent killed.
charcnv.c
charset.c
client.c
clitar.c
kanji.c
kanji.h
smb.h
util.c
loadparm.c: Generic multibyte codepage support (adding Big5 Chinese
            and Korean Hangul).
nmbd.c: Fixed problem with child being re-spawned when parent killed.
mangle.c: Modified str_checksum so that first 15 characters have more
          effect on outcome. This helps with short name mangling as
          most 'long' names are still shorter than 15 chars (bug was
          foobar_mng and foobar_sum would hash to the same value, with
          the modified code they hash differently.
Jeremy.
(This used to be commit 299016338c)
This commit is contained in:
Jeremy Allison
1998-03-03 20:19:14 +00:00
parent f0e121d100
commit b7fb6c6b38
15 changed files with 594 additions and 219 deletions

View File

@ -42,7 +42,7 @@ int str_checksum(char *s)
while( *s )
{
c = *s;
res ^= (c << (i % 15)) ^ (c >> (15-(i%15)));
res ^= (c << (15-(i%15))) ^ (c >> (i % 15));
s++; i++;
}
return(res);
@ -130,38 +130,25 @@ BOOL is_8_3(char *fname, BOOL check_case)
dot_pos = strchr(fname,'.');
{
{
char *p = fname;
int skip;
if(lp_client_code_page() == KANJI_CODEPAGE)
dot_pos = 0;
while (*p)
{
if((skip = skip_multibyte_char( *p )) != 0)
p += skip;
else
{
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 (*p == '.' && !dot_pos)
dot_pos = (char *) p;
if (!isdoschar(*p))
return(False);
p++;
}
}
}
}
/* no dot and less than 9 means OK */
if (!dot_pos)
@ -542,6 +529,7 @@ void mangle_name_83(char *s)
char base[9];
int baselen = 0;
int extlen = 0;
int skip;
extension[0]=0;
base[0]=0;
@ -572,40 +560,29 @@ void mangle_name_83(char *s)
*p++ = 0;
while (*p && extlen < 3)
{
if(lp_client_code_page() == KANJI_CODEPAGE)
skip = skip_multibyte_char(*p);
if (skip == 2)
{
if (is_shift_jis (*p))
if (extlen < 2)
{
if (extlen < 2)
{
extension[extlen++] = p[0];
extension[extlen++] = p[1];
}
else
{
extension[extlen++] = base36 (((unsigned char) *p) % 36);
}
p += 2;
extension[extlen++] = p[0];
extension[extlen++] = p[1];
}
else
else
{
if( is_kana (*p) )
{
extension[extlen++] = p[0];
p++;
}
else
{
if (isdoschar (*p) && *p != '.')
extension[extlen++] = p[0];
p++;
}
extension[extlen++] = base36 (((unsigned char) *p) % 36);
}
p += 2;
}
else
else if( skip == 1 )
{
if (isdoschar(*p) && *p != '.')
extension[extlen++] = *p;
extension[extlen++] = p[0];
p++;
}
else
{
if (isdoschar (*p) && *p != '.')
extension[extlen++] = p[0];
p++;
}
}
@ -617,9 +594,8 @@ void mangle_name_83(char *s)
while (*p && baselen < 5)
{
if(lp_client_code_page() == KANJI_CODEPAGE)
{
if (is_shift_jis (*p))
skip = skip_multibyte_char(*p);
if (skip == 2)
{
if (baselen < 4)
{
@ -632,27 +608,17 @@ void mangle_name_83(char *s)
}
p += 2;
}
else
else if( skip == 1)
{
if( is_kana (*p) )
{
base[baselen++] = p[0];
p++;
}
else
{
if (isdoschar (*p) && *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;
p++;
}
}
base[baselen] = 0;
@ -679,6 +645,7 @@ static BOOL illegal_name(char *name)
static unsigned char illegal[256];
static BOOL initialised=False;
unsigned char *s;
int skip;
if( !initialised )
{
@ -690,26 +657,19 @@ static BOOL illegal_name(char *name)
illegal[*s] = True;
}
if(lp_client_code_page() == KANJI_CODEPAGE)
for (s = (unsigned char *)name; *s;)
{
for (s = (unsigned char *)name; *s;)
skip = skip_multibyte_char( *s );
if (skip != 0)
s += skip;
else
{
if (is_shift_jis (*s))
s += 2;
if (illegal[*s])
return(True);
else
{
if (illegal[*s])
return(True);
else
s++;
}
s++;
}
}
else
{
for (s = (unsigned char *)name;*s;s++)
if (illegal[*s]) return(True);
}
return(False);
} /* illegal_name */