Invalid Netbios Names? Re: [SCM] Samba Shared Repository - branch master updated

Christopher R. Hertel crh at samba.org
Sat Oct 30 12:51:15 MDT 2010


Note the comment below in the source code clip.

Section 1.4.1.1 says that *any* octet can be encoded as part of a NetBIOS
name, and that "restrictions are implemented at the application layer, and
should be considered artificial".  The RFCs place only two restrictions on
NetBIOS names:
  1) Only the wildcard name may begin with an asterisk.
  2) They must be exactly 16 bytes (including padding) in length.
     No mention is made of the suffix byte.

I have seen mixed case names.  I have seen raw Unicode names (including the
NUL bytes).  I've seen all sorts of other oddities.  Also, an asterisk is
okay as long as it is not the first character.

In the 1984 protocol specification, IBM placed the following restrictions
(which are now almost universally ignored) on NetBIOS names:

	16 characters of the following format
	ccccccccccccccpx
	where:
	c = 1 to 15 characters of the
	    same ASCIIZ characters as
	    filename
	p = blanks padding the
	    remainder of the 15
	    characters above
	x = 00H Network name is
	    Redirector name
	    03H Network name is a
	    Main or Additional
	    User name
	    05H Network name is a
	    Forwarded name
	    20H Network name is
	    Server name

Valid filename characters (octets) were defined by IBM as excluding the
following:
  " . / \ [ ] : | < > + = ; ,
  All characters less than 20H

All other octet values are (were) considered valid.

Chris -)-----


Matthieu Patou wrote:
> 
>>> def valid_netbios_name(name):
>>>       """Check whether a name is valid as a NetBIOS name. """
>>>       # See crh's book (1.4.1.1)
>>>       if len(name)>  15:
>>>           return False
>>>       for x in name:
>>>           if not x.isalnum() and not x in " !#$%&'()-.@^_{}~":
>>>               return False
>>>       return True
>>>
>>> So I guess this function is wrong.
>>>
>>> Because I made my function based on this test ...
>> That function does allow -, it will return false if there are characters
>> that are not in that list. - is part of the list.
>>
> Sorry my fault next time I'll learn how to read :-)
> 
> Will fix it soon.
> 

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list