teaching smbmount japanese?

David Wuertele dave-gnus at bfnet.com
Fri Sep 17 21:53:42 GMT 2004

I have to mount some shares that are exported from Japanese Windows
2000 hosts on my linux-2.4.18 system using smbfs.  The sharenames
themselves are in Japanese.

I have written a program to do the share discovery using the
NetrShareEnum RPC.  This works great, and gets all the correct
Japanese share names.  But when I try to run smbmount on that
sharename, smbmount complains.

For example, here's a little program that works:

  int main () {  execl ("/bin/smbmount", 
                        "/bin/smbmount", "//server/english", "/mnt/english",
                        "-o", "iocharset=utf8,codepage=cp932", 0x0);

And here's a little program (saved as a UTF-8 encoded file) that

  int main () {  execl ("/bin/smbmount", 
                        "/bin/smbmount", "//server/ÆüËܸì", "/mnt/ÆüËܸì",
                        "-o", "iocharset=utf8,codepage=cp932", 0x0);

When I strace this program, I get this:

  execve("/bin/smbmount", ["/bin/smbmount", "//server/\346\227\245\346\234\254\350\252\236", "/mnt/\346\227\245\346\234\254\350\252\236", "-o", "iocharset=utf8,codepage=cp932"], [/* 9 vars */]) = 0

The escaped-octal character string in the argument is a perfectly
accurate representation of the UTF-8 string "ÆüËܸì" used in the
program.  So I know that the smbmount program is getting the correct

But when smbmount tries to send the SMB command to the server, it
sends this:

  send(4, "\0\0\0D\377SMBu\0\0\0\0\10\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\334\1\0\10\3\0\4\377\0\0\0\0\0\1\0\31\0\0\\\\HDMA-SERVER\\e,\36\0?????\0", 72, 0) = 72

This is a total mangling of the Japanese sharename.  What gives?


More information about the samba-technical mailing list