samba4: bad called name for *SMBSERVER

Karl Melcher kmelcher at gmail.com
Mon Feb 14 22:13:03 GMT 2005


I ran across the following error after reconciling the samba4 source. 
This was found while diagnosing a call to the smbcli_full_connection()
function.

When the host is an IP address, the called name is set to *SMBSERVER. 
Later in the layers, as the NetBIOS name is being encoded, the padding
is modified  if the name starts with an asterisk.  A lone asterisk
should be null padded, but *SMBSERVER should be suffixed with 0x20
then padded.  From a packet trace I was seeing
*SMBSERVER<00><00>...<00><20>

The following code change seems to fix this problem:

from source/libcli/nbt/nbtname.c around line 136 (version 3.9.0-SVN-build-5397)

original code:
	if (name[0] == '*') {
		pad_char = 0;
	} else {
		pad_char = ' ';
	}


Fixed code 
	if (name[0] == '*' && name[1] == 0) {
		pad_char = 0;
	} else {
		pad_char = ' ';
	}


Karl


More information about the samba-technical mailing list