summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/charset.c15
-rw-r--r--source3/lib/system.c4
-rw-r--r--source3/lib/util.c72
3 files changed, 59 insertions, 32 deletions
diff --git a/source3/lib/charset.c b/source3/lib/charset.c
index 55e2239b55..0bbf99e29f 100644
--- a/source3/lib/charset.c
+++ b/source3/lib/charset.c
@@ -157,6 +157,11 @@ unsigned char cp_437[][4] = {
{0xEF,0,0,0},
{0,0,0,0}
};
+
+/* lower->upper mapping for IBM Code Page 932 - MS-DOS Japanese SJIS */
+unsigned char cp_932[][4] = {
+ {0,0,0,0}
+};
char xx_dos_char_map[256];
char xx_upper_char_map[256];
@@ -255,11 +260,21 @@ void codepage_initialise(int client_codepage)
case 437:
cp = cp_437;
break;
+ case 932:
+ cp = cp_932;
+ break;
default:
+#ifdef KANJI
+ /* Use default codepage - currently 932 */
+ DEBUG(6,("codepage_initialise: Using default client codepage %d\n",
+ 932));
+ cp = cp_932;
+#else /* KANJI */
/* Use default codepage - currently 850 */
DEBUG(6,("codepage_initialise: Using default client codepage %d\n",
850));
cp = cp_850;
+#endif /* KANJI */
break;
}
diff --git a/source3/lib/system.c b/source3/lib/system.c
index 39f845b30e..447a4f88ac 100644
--- a/source3/lib/system.c
+++ b/source3/lib/system.c
@@ -378,6 +378,7 @@ apparent reason.
****************************************************************************/
struct hostent *sys_gethostbyname(char *name)
{
+#ifdef REDUCE_ROOT_DNS_LOOKUPS
char query[256], hostname[256];
char *domain;
@@ -406,5 +407,8 @@ struct hostent *sys_gethostbyname(char *name)
sprintf(query, "%s%s", name, domain);
return(gethostbyname(query));
+#else /* REDUCE_ROOT_DNS_LOOKUPS */
+ return(gethostbyname(name));
+#endif /* REDUCE_ROOT_DNS_LOOKUPS */
}
diff --git a/source3/lib/util.c b/source3/lib/util.c
index 6f6e03fbd6..d78ecf2728 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -808,7 +808,8 @@ int StrCaseCmp(const char *s, const char *t)
/* We *must* use toupper rather than tolower here due to the
asynchronous upper to lower mapping.
*/
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
int diff;
for (;;)
{
@@ -865,7 +866,8 @@ int StrnCaseCmp(const char *s, const char *t, int n)
/* We *must* use toupper rather than tolower here due to the
asynchronous upper to lower mapping.
*/
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
int diff;
for (;n > 0;)
{
@@ -962,7 +964,8 @@ void strlower(char *s)
{
while (*s)
{
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
if (is_shift_jis (*s)) {
if (is_sj_upper (s[0], s[1])) {
s[1] = sj_tolower2 (s[1]);
@@ -990,7 +993,8 @@ void strupper(char *s)
{
while (*s)
{
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
if (is_shift_jis (*s)) {
if (is_sj_lower (s[0], s[1])) {
s[1] = sj_toupper2 (s[1]);
@@ -1041,7 +1045,8 @@ void string_replace(char *s,char oldc,char newc)
{
while (*s)
{
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
if (is_shift_jis (*s)) {
s += 2;
} else if (is_kana (*s)) {
@@ -1136,8 +1141,8 @@ void show_msg(char *buf)
if (j == 7) DEBUG(10, (" "));
}
- DEBUG(10,("\n"));
- }
+ DEBUG(10,("\n"));
+}
}
/*******************************************************************
@@ -1679,7 +1684,8 @@ BOOL strhasupper(char *s)
{
while (*s)
{
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
if (is_shift_jis (*s)) {
s += 2;
} else if (is_kana (*s)) {
@@ -1703,7 +1709,8 @@ BOOL strhaslower(char *s)
{
while (*s)
{
-#ifdef KANJI
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
if (is_shift_jis (*s)) {
if (is_sj_upper (s[0], s[1])) return(True);
if (is_sj_lower (s[0], s[1])) return (True);
@@ -1728,17 +1735,18 @@ find the number of chars in a string
int count_chars(char *s,char c)
{
int count=0;
-#ifdef KANJI
- while (*s)
- {
+#if defined(KANJI) && !defined(KANJI_WIN95_COMPATIBILITY)
+ /* Win95 treats full width ascii characters as case sensitive. */
+ while (*s)
+ {
if (is_shift_jis (*s))
s += 2;
else
{
- if (*s == c)
- count++;
- s++;
- }
+ if (*s == c)
+ count++;
+ s++;
+ }
}
#else /* KANJI */
while (*s)
@@ -3294,15 +3302,15 @@ Rewritten by Stefaan A Eeckels <Stefaan.Eeckels@ecc.lu> and
Paul Rippin <pr3245@nopc.eurostat.cec.be>
********************************************************************/
void standard_sub_basic(char *string)
-{
+ {
char *s, *p;
- char pidstr[10];
+ char pidstr[10];
struct passwd *pass;
for (s = string ; (p = strchr(s,'%')) != NULL ; s = p )
{
switch (*(p+1))
- {
+ {
case 'G' : if ((pass = Get_Pwnam(sesssetup_user,False))!=NULL)
string_sub(p,"%G",gidtoname(pass->pw_gid));
else
@@ -3561,10 +3569,10 @@ BOOL is_in_path(char *name, name_compare_entry *namelist)
/* if we have no list it's obviously not in the path */
if((namelist == NULL ) || ((namelist != NULL) && (namelist[0].name == NULL)))
- {
+ {
DEBUG(5,("is_in_path: no name list.\n"));
return False;
- }
+}
/* Get the last component of the unix name. */
p = strrchr(name, '/');
@@ -3593,7 +3601,7 @@ BOOL is_in_path(char *name, name_compare_entry *namelist)
}
}
DEBUG(5,("is_in_path: match not found\n"));
-
+
return False;
}
@@ -3608,7 +3616,7 @@ BOOL is_in_path(char *name, name_compare_entry *namelist)
* We also check if the entry contains a wildcard to
* remove a potentially expensive call to mask_match
* if possible.
- */
+ */
void set_namearray(name_compare_entry **ppname_array, char *namelist)
{
@@ -3626,14 +3634,14 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
first to count the number of elements, the second
to split it.
*/
- while (*nameptr )
+ while(*nameptr)
{
if ( *nameptr == '/' )
- {
+ {
/* cope with multiple (useless) /s) */
nameptr++;
continue;
- }
+ }
/* find the next / */
name_end = strchr(nameptr, '/');
@@ -3651,16 +3659,16 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
if(( (*ppname_array) = (name_compare_entry *)malloc(
(num_entries + 1) * sizeof(name_compare_entry))) == NULL)
- {
+ {
DEBUG(0,("set_namearray: malloc fail\n"));
return;
- }
+ }
/* Now copy out the names */
nameptr = namelist;
i = 0;
while(*nameptr)
- {
+ {
if ( *nameptr == '/' )
{
/* cope with multiple (useless) /s) */
@@ -3671,10 +3679,10 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
if ((name_end = strchr(nameptr, '/')) != NULL)
{
*name_end = 0;
- }
+ }
/* oops - the last check for a / didn't find one. */
- if (name_end == NULL)
+ if(name_end == NULL)
break;
(*ppname_array)[i].is_wild = ((strchr( nameptr, '?')!=NULL) ||
@@ -3689,7 +3697,7 @@ void set_namearray(name_compare_entry **ppname_array, char *namelist)
nameptr = name_end + 1;
i++;
}
-
+
(*ppname_array)[i].name = NULL;
return;