Bug 1939 - nmblookup doesn't report multibyte characters correct
nmblookup doesn't report multibyte characters correct
Product: Samba 3.0
Classification: Unclassified
Component: Extended Characters
All Linux
: P3 enhancement
: none
Assigned To: Alexander Bokovoy
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2004-10-15 08:30 UTC by Lars Müller
Modified: 2009-11-30 09:43 UTC (History)
2 users (show)

See Also:

nmblookup report multibyte chars support (842 bytes, patch)
2006-05-19 00:23 UTC, Vladimir Voroshilov
no flags Details
nmblookup -d10 -A ip (3.76 KB, text/plain)
2007-06-14 17:49 UTC, integer
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Müller 2004-10-15 08:30:08 UTC
The workgroup of this system contains a german umlaut.

lmuelle@gray:~> nmblookup -A
Looking up status of
        TAIT            <00> -         B <ACTIVE> 
        TAIT            <03> -         B <ACTIVE> 
        TAIT            <20> -         B <ACTIVE> 
        ..__MSBROWSE__. <01> - <GROUP> B <ACTIVE> 
        TAIT..          <00> - <GROUP> B <ACTIVE> 
        TAIT..          <1b> -         B <ACTIVE> 
        TAIT..          <1c> -         B <ACTIVE> 
        TAIT..          <1d> -         B <ACTIVE> 
        TAIT..          <1e> - <GROUP> B <ACTIVE>
Comment 1 Vladimir Voroshilov 2006-05-19 00:23:17 UTC
Created attachment 1906 [details]
nmblookup report multibyte chars support

After applying this patch nmblookup corectly displays national chars in workgroup and machine's name.
Tested on 3.0.22
Comment 2 integer 2007-06-14 17:49:07 UTC
Created attachment 2758 [details]
nmblookup -d10 -A ip
Comment 3 integer 2007-06-14 17:50:07 UTC
I have such problem on FreeBSD 6.1.
Smbclient -L ip returns russian names, but nmblookup -A ip returns "......"
Comment 4 integer 2007-06-14 18:23:10 UTC
Comment on attachment 2758 [details]
nmblookup -d10 -A ip

# nmblookup -d10 -A
>INFO: Current debug levels:
>  all: True/10
>  tdb: False/0
>  printdrivers: False/0
>  lanman: False/0
>  smb: False/0
>  rpc_parse: False/0
>  rpc_srv: False/0
>  rpc_cli: False/0
>  passdb: False/0
>  sam: False/0
>  auth: False/0
>  winbind: False/0
>  vfs: False/0
>  idmap: False/0
>  quota: False/0
>  acls: False/0
>  locking: False/0
>  msdfs: False/0
>  dmapi: False/0
>lp_load: refreshing parameters
>Initialising global parameters
>params.c:pm_process() - Processing configuration file "/usr/local/etc/smb.conf"
>Processing section "[global]"
>doing parameter max log size = 50
>doing parameter display charset = cp1251
>Attempting to register new charset UCS-2LE
>Registered charset UCS-2LE
>Attempting to register new charset UTF-16LE
>Registered charset UTF-16LE
>Attempting to register new charset UCS-2BE
>Registered charset UCS-2BE
>Attempting to register new charset UTF-16BE
>Registered charset UTF-16BE
>Attempting to register new charset UTF8
>Registered charset UTF8
>Attempting to register new charset UTF-8
>Registered charset UTF-8
>Attempting to register new charset ASCII
>Registered charset ASCII
>Attempting to register new charset 646
>Registered charset 646
>Attempting to register new charset ISO-8859-1
>Registered charset ISO-8859-1
>Attempting to register new charset UCS2-HEX
>Registered charset UCS2-HEX
>doing parameter unix charset = cp1251
>doing parameter dos charset = cp866
>doing parameter preserve case = yes
>doing parameter short preserve case = yes
>pm_process() returned Yes
>lp_servicenumber: couldn't find homes
>set_server_role: role = ROLE_STANDALONE
>added interface ip= bcast= nmask=
>bind succeeded on port 0
>socket option SO_KEEPALIVE = 0
>socket option SO_REUSEADDR = 4
>socket option SO_BROADCAST = 32
>Could not test socket option TCP_NODELAY.
>socket option IPTOS_LOWDELAY = 0
>socket option IPTOS_THROUGHPUT = 0
>socket option SO_REUSEPORT = 512
>socket option SO_SNDBUF = 9216
>socket option SO_RCVBUF = 42080
>socket option SO_SNDLOWAT = 2048
>socket option SO_RCVLOWAT = 1
>socket option SO_SNDTIMEO = 0
>socket option SO_RCVTIMEO = 0
>Socket opened.
>lang_tdb_init: /usr/local/lib/samba/ru_RU.KOI8-R.msg: No such file or directory
>Looking up status of
>Sending a packet of len 50 to ( on port 137
>read_udp_socket: lastip lastport 137 read: 175
>parse_nmb: packet id = 31065
>Received a packet of len 175 from ( port 137
>nmb packet from header: id=31065 opcode=Query(0) response=Yes
>    header: flags: bcast=No rec_avail=No rec_des=No trunc=No auth=Yes
>    header: rcode=0 qdcount=0 ancount=1 nscount=0 arcount=0
>    answers: nmb_name=*<00> rr_type=33 rr_class=1 ttl=0
>    answers   0 char ......             hex 038B888B889220202020202020202020
>    answers  10 char ...MSHOME          hex 0004004D53484F4D4520202020202020
>    answers  20 char   ........         hex 20200084008B888B8892202020202020
>    answers  30 char      ....'.rn...   hex 20202020200400009027A3726E000000
>    answers  40 char ................   hex 00000000000000000000000000000000
>    answers  50 char ................   hex 00000000000000000000000000000000
>    answers  60 char .....   hex 0000000000
>-T-T-#00: flags = 0x04
>MSHOME#00: flags = 0x84
>-T-T-#20: flags = 0x04
>        .....           <00> -         B <ACTIVE>
>        MSHOME          <00> - <GROUP> B <ACTIVE>
>        .....           <20> -         B <ACTIVE>
>        MAC Address = 00-00-12-A3-72-6E
Comment 5 Björn Jacke 2007-06-15 11:08:18 UTC
Netbios does not handle character sets savely any other than ASCII and does an own HEX-to-ASCII presentation of non-ASCII names. If you give yourself a non-ASCII Netbios name your "real" Netbios name (in the HEX-to-ASCII presentation) depends on your client's local codepage. For that reason non-ASCII Netbios names have to be considered to be a broken setup. If this should be handeled by Samba at all, there should not be a conversion like suggested in comment #1 but instead non-ASCII should be printed in a \xxx HEX notation.

IMHO this is a "wontfix".
Comment 6 Alexander Bokovoy 2007-06-15 12:03:29 UTC
Björn, I think at least we need to allow displaying nmblookup output in 'display charset'. The patch from Vladimir is along the lines though it should be done through Samba existing facilities. 

As for NetBIOS names issue itself, the only fix here should to force the same encoding for all NetBIOS hosts on the local network. NetBIOS has no idea of encoding for NMB names, they are treated as binary ones. Samba allows them to be treated according to an encoding on the server but this is an administrative issue to follow rules on all hosts.

NetBIOS names using non-ASCII encoding are in common use, at least in Easter Europe, CIS countries, and Far East. They work perfectly if admins are careful. There is no need to forbid this usage at all.

So, I'd like to accept a patch that fixes nmblookup to follow 'display charset' if someone would write it.
Comment 7 Björn Jacke 2007-06-17 06:39:16 UTC
Alexander, as you just don't know the encoding of the Netbios name - from WHAT charset to "display charset" do you want to convert? You can simply guess that every Netbios name you see on the net is encoded in your DOS CHARSET and convert from dos charset to display charset but you cannot do that assumption.

- you will have to implement workarounds for cases where the conversion from dos charset to dispay charset fails and you will also see cases where

- you see wrong results is displayed because of different client codepages.
Comment 8 Karolin Seeger 2009-11-30 07:00:52 UTC
Björn, should we close this one?
Comment 9 Björn Jacke 2009-11-30 09:43:10 UTC
I think so, yes.