NetBIOS Name Syntax

Christopher R. Hertel crh at nts.umn.edu
Wed Jan 3 18:14:07 GMT 2001


Following up on a recent thread...

Richard Sharpe paraphrased the old IBM documentation regarding the syntax 
of NetBIOS names:

<quote verbatim="not quite">
NetBIOS names are always converted to uppercase when sent to other
systems, and may consist of any character, except: 
  - Any character less than a space (0x20)
  - the characters " . / \ [ ] : | < > + = ; ,
</quote>

I tried the following two tests:

1) On a W/95 box I ran nbtstat and tried feeding it all sorts of garbage 
   names.  As long as DOS could handle the characters (within quotes), 
   nbtstat happily generated queries from strings such as:

   C:\> nbtstat -a "[*	Goob+]"

   where the blank space after the asterisk is a tab character, 0x09.

   However...

2) I went to ControlPanel-->Network-->Identification and tried simply 
   adding a plus sign ('+') to the machine name.  I got a requestor 
   stating that the only legal characters are:

          '!' == 0x21                 '-' == 0x2D
          '#' == 0x23                 '.' == 0x2E
          '$' == 0x24                 '@' == 0x40
          '%' == 0x25                 '^' == 0x5E
          '&' == 0x26                 '_' == 0x5F
          '\'' == 0x27 (single quote) '{' == 0x7B
          '(' == 0x28                 '}' == 0x7D
          ')' == 0x29                 '~' == 0x7E
          Alpha-numeric characters.

   This is close to IBMs original sytax, if you assume that IBM disallowed
   any character above 126 (0x7E).  Microsoft allows the dot, while IBM
   didn't.  The characters '*', '?', and '`' are not in MS' allowed set,
   but are not disallowed by IBM.  The '*', of course, cannot be the first
   character of the name, and Windows/95's requestor states that the name
   may not be made up entirely of dots.  Finally, the requestor doesn't 
   seem to show the space character in the list, but I was able to change 
   my machine's name from "Zathras" to "Zath Ras" without complaint. 

Point is, it is the applications, not the NBT transport, that care about
name syntax.  From my testing, it seems that Microsoft compares the
encoded NBT names rather than wasting cycles by decoding the names and
comparing them that way.  The encoded form is made up of characters in the
range A..P, and can encode any octal value. 

Samba does decode before comparing.  In a sense, this makes Samba more
robust as it can do a case-insensitive compare and account for
implementations that don't handle names properly.  I don't imagine any
such implementations exist, however, since they would not work with
Windows. 

Chris -)-----




More information about the samba-technical mailing list