summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/client/client.c9
-rw-r--r--source3/include/smb.h5
-rw-r--r--source3/lib/charset.c15
-rw-r--r--source3/lib/system.c4
-rw-r--r--source3/lib/util.c72
-rw-r--r--source3/namepacket.c2
-rw-r--r--source3/nmbsync.c4
7 files changed, 72 insertions, 39 deletions
diff --git a/source3/client/client.c b/source3/client/client.c
index f9585c6de5..329956ce94 100644
--- a/source3/client/client.c
+++ b/source3/client/client.c
@@ -232,7 +232,8 @@ static int readfile(char *b, int size, int n, FILE *f)
n++;
}
- b[i++] = c;
+ if(i < n)
+ b[i++] = c;
}
return(i);
@@ -3878,7 +3879,7 @@ static BOOL list_servers(char *wk_grp)
p = skip_string(p,1);
SSVAL(p,0,uLevel);
- SSVAL(p,2,0x2000); /* buf length */
+ SSVAL(p,2,BUFFER_SIZE - SAFETY_MARGIN); /* buf length */
p += 4;
svtype_p = p;
@@ -3893,7 +3894,7 @@ static BOOL list_servers(char *wk_grp)
SIVAL(svtype_p,0,SV_TYPE_ALL);
if (call_api(PTR_DIFF(p+4,param),0,
- 8,10000,
+ 8,BUFFER_SIZE - SAFETY_MARGIN,
&rprcnt,&rdrcnt,
param,NULL,
&rparam,&rdata))
@@ -3932,7 +3933,7 @@ static BOOL list_servers(char *wk_grp)
SIVAL(svtype_p,0,SV_TYPE_DOMAIN_ENUM);
if (call_api(PTR_DIFF(p+4,param),0,
- 8,10000,
+ 8,BUFFER_SIZE - SAFETY_MARGIN,
&rprcnt,&rdrcnt,
param,NULL,
&rparam,&rdata))
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 1dbe04abc8..540aa0798d 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -923,8 +923,13 @@ enum case_handling {CASE_LOWER,CASE_UPPER};
#endif
+#ifdef KANJI
+/* Default client code page - 932 - Japanese */
+#define DEFAULT_CLIENT_CODE_PAGE 932
+#else /* KANJI */
/* Default client code page - 850 - Western European */
#define DEFAULT_CLIENT_CODE_PAGE 850
+#endif /* KANJI */
/* Size of buffer to use when moving files across filesystems. */
#define COPYBUF_SIZE (8*1024)
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;
diff --git a/source3/namepacket.c b/source3/namepacket.c
index 55b525d6c5..086e32d908 100644
--- a/source3/namepacket.c
+++ b/source3/namepacket.c
@@ -65,7 +65,7 @@ void debug_browse_data(char *outbuf, int len)
for (j = 0; j < 16; j++)
{
if (i+j >= len) break;
- DEBUG(4, (" %02x", outbuf[i+j]));
+ DEBUG(4, (" %02x", (unsigned char)outbuf[i+j]));
}
DEBUG(4, ("\n"));
diff --git a/source3/nmbsync.c b/source3/nmbsync.c
index a140b7a1bd..fd85c82e2c 100644
--- a/source3/nmbsync.c
+++ b/source3/nmbsync.c
@@ -75,7 +75,7 @@ static BOOL add_info(struct subnet_record *d, struct work_record *work, int serv
p = skip_string(p,1);
SSVAL(p,0,uLevel);
- SSVAL(p,2,0x2000); /* buf length */
+ SSVAL(p,2,BUFFER_SIZE - SAFETY_MARGIN); /* buf length */
p += 4;
SIVAL(p,0,servertype);
p += 4;
@@ -83,7 +83,7 @@ static BOOL add_info(struct subnet_record *d, struct work_record *work, int serv
strcpy(p, work->work_group);
p = skip_string(p,1);
- if (cli_call_api(PTR_DIFF(p,param),0, 8,10000,
+ if (cli_call_api(PTR_DIFF(p,param),0, 8,BUFFER_SIZE - SAFETY_MARGIN,
&rprcnt,&rdrcnt, param,NULL,
&rparam,&rdata))
{