browselist bug in Multibyte environment

Hiroshi MIURA miura at samba.gr.jp
Wed Aug 9 09:21:10 GMT 2000


I found a bug and make patch.
The problem was reported before.

I attached a patch. This patch is for the cvs repository
SAMBA2_0. 

The problem only happens with Japanese.

Main issue is that the function 'cli_NetServerEnum()' in libsmb/clirap.c
is called from  client/client.c and nmbd/nmbd_synclists.c(line 105 and 53).
In client.c, its internal charcode is UNIX code and an internal code of 
the nmbd_synclists.c is DOS code. cli_NetServerEnum() assumes the 
code is UNIX code in callback function.

The function "callback" in line 53 on nmbd_synclists.c, it writes "browse.dat".
Its file must be written with the DOS code, bacause any other in functions in nmbd
is NOT convert internal code to UNIX code. 

The patch is fix the cli_NetServerEnum() to use DOS code for its internal
char code.

Hiroshi.

In message "browselist bug in Multibyte environment"
    on 00/07/06, Hiroshi MIURA <miura at samba.gr.jp> writes:
> 
> I've reciept a bug report in samba 2.0.6 and later.
> The problem as follows:
> 
> He, the reporter, use a multibyte netbios name. In MS specification,
> it is ok that we use multibyte netbios name on the NT and the 95/98.
> In this case, coding system=euc and client code page =932.
> 
> But, now, he saw a MOJI BAKE (unintelligible sequence of characters)
> on his 'Netowork Computer' on the Windows desktop.
> I am starting read nmbd soruces, but I cannot understand the logic, yet.
> I am trying to reappear it, and I get it. For investigating, 
> I look into  the browse.dat, so it has two same name with diferrent
> codes. When I set up coding sysmtem to EUC, so in the browse.dat
> there are EUC(unix code) name and SJIS(windows native code) name.
> 
> That , I think, is because that some function in nmbd 
> forget a transform function call which convert sjis to euc
> (unix_to_dos() or dos_to_unix()).



--- source/client/client.c.orig	Thu Jun  1 04:28:49 2000
+++ source/client/client.c	Wed Aug  9 17:50:46 2000
@@ -1577,7 +1577,8 @@
 ****************************************************************************/
 static void server_fn(const char *name, uint32 m, const char *comment)
 {
-        printf("\t%-16.16s     %s\n", name, comment);
+        printf("\t%-16.16s     %s\n", dos_to_unix((char *)name, False), 
+			              dos_to_unix((char *)comment, False));
 }
 
 /****************************************************************************
--- source/libsmb/clirap.c.orig	Wed Aug  9 17:35:09 2000
+++ source/libsmb/clirap.c	Wed Aug  9 17:35:50 2000
@@ -262,8 +262,6 @@
 
 				stype = IVAL(p,18) & ~SV_TYPE_LOCAL_LIST_ONLY;
 
-				dos_to_unix(sname, True);
-				dos_to_unix(cmnt, True);
 				fn(sname, stype, cmnt);
 			}
 		}
--- source/smbwrapper/smbw_dir.c.orig	Wed Aug  9 17:45:56 2000
+++ source/smbwrapper/smbw_dir.c	Wed Aug  9 17:46:27 2000
@@ -128,6 +128,8 @@
 	pstrcpy(finfo.name, name);
 	finfo.mode = aRONLY | aDIR;	
 
+	dos_to_unix(finfo.name, True);
+
 	smbw_dir_add(&finfo, NULL);
 }
 
--- source/utils/torture.c.orig	Wed Aug  9 17:46:40 2000
+++ source/utils/torture.c	Wed Aug  9 17:48:50 2000
@@ -1238,7 +1238,7 @@
 static void browse_callback(const char *sname, uint32 stype, 
 			    const char *comment)
 {
-	printf("\t%20.20s %08x %s\n", sname, stype, comment);
+	printf("\t%20.20s %08x %s\n", dos_to_unix((char *)sname, False), stype, dos_to_unix((char *)comment, False));
 }
 
 

-- 
SAMBA User Group Japan,  staff    http://www.samba.gr.jp/
Linux Kernel Hack Japan 	http://lkh.linux.or.jp/ (Now Constructing)
Project BLUE 				http://www.blue.gr.jp/
LUGS:=YLUGダイエット部,TLUC関東支部,TLUG,CLUG,たん清,ダンケ,すぃすぃ
三浦広志 ----- MIURA, Hiroshi 		http://www.momokuri.org/






More information about the samba-technical mailing list