resolving NetBIOS names with a dot

Remco van Mook remco at biereco.student.utwente.nl
Wed Apr 1 13:21:34 GMT 1998



Hi there,

again, while debugging smb2www, I encountered the following:

biereco:~$ smbclient -L "NET.BARF." -d2
Added interface ip=130.89.227.132 bcast=130.89.255.255 nmask=255.255.0.0
Got a positive name query response from 130.89.xxx.yyy ( 130.89.225.149 )
Session request failed (131,130) with myname=BIERECO destname=NET.BARF.
Called name not present
Try to connect to another name (instead of NET.BARF.)
You may find the -I option useful for this

The output of tcpdump gave me the following:

1. The name was first resolved correctly

2. A connection was established

3. The session request failed miserably ! 
   It asked for a session with "NET". 

4. The other side denies the existence of "NET"

5. The connection is cancelled. "Called name not present"

While chasing the samba code for this peculiarity, I found the following:


samba-1.9..18p4 util.c: lines 789-793

/* Add the scope string. */
  for( i = 0, len = 0; NULL != scope; i++, len++ )
    {
    switch( scope[i] )
      {
      
      [..]

      case '.':
        p[0] = len;
        p   += (len + 1);
        len  = 0;
        break;
 
      [..]

      }
    }

I think this is the place where things go wrong. I'm hesitant to make any
changes to it as of now, because I'm afraid it's going to break all kinds
of good things, such as resolving DNS names.

Now, my idea is to be a bit more prudent about names with a '.' in them.
If it's a IP hostname, gethostbyname() will verify that and proceed as
usual.. If it doesn't, assume it's a NetBIOS name with a '.' in it.

Any ideas/suggestions ?

Remco
Who agrees that the whole idea of having dots in NetBIOS is sick beyond
all medication, but it's here so let's deal with it. 




More information about the samba-technical mailing list