NetBIOS names with dots in them!

Michael H. Warfield mhw at wittsend.com
Fri Nov 6 15:31:32 GMT 1998


Andrew Tridgell enscribed thusly:
> I've moved the discussion moved to samba-technical ...

> I'd like to first off point out that dots in netbios names is only a
> problem in the Samba clients. The server has no problem as there is no
> ambiguity. 

> In the client there is 2 issues:

> 1) name resolution
> 2) what to stick in the session request

> For name resolution I think the correct thing to do i to try the name
> "as is" with each of the resolve order methods then if they all fail
> try it with the "domain" stripped off.

> the main disadvantage of this is the speed of opening a connection. It
> will take several seconds for the netbios lookups to fail. If the name
> is more than 15 chars long we can skip the "as is" tests as we know
> they will fail.

> for the session request the obvious thing is to try:

> 1) the name "as is" if less than 16 chars.
> 2) the stripped name
> 3) *SMBSERVER

	Might be a little more complicated than that...

	Let's try my example from a previous message (apologies to those
on samba-technical who didn't receive the previous message)...

	plover.alcove.wittsend.com

	What we may need to try first is to go for the last dot that is
less than 16 characters and strip at that point.  That would then give
us this:

	plover.alcove

	Try than and if that then fails, loop and repeat the strip.

	That then gives us this:

	plover

	That no longer has any dots and is the terminus even if the lookup
fails.

	That would amount to something similar to this psuedo code...

=======================
	char name[16];

	Done = False;
	strncpy( name, netbiosname, 15 );
	name[16] = '\0';

	while( !Done && NULL != ( str_ptr = strrchr( name, '.' ) ) ) {
		*str_ptr = '\0';
		Done = do_lookup( name );
	}
	if( !Done ) {
		Done = do_lookup( name );
	}
=======================

	This would only add time in those cases where a name was
specified with one or more dots in the first 14 characters which then
fail.  Problem would be avoided when the user specified only the simple
netbios name (whether it had dots or not).  Longest name match would
always win.  (Is this the behavior that we want?)

	What about the situation where both plover and plover.alcove
exist?  I know, this would be and EXTREME example of user/admin
stupidity.  I'm just playing devils advocate at this point but, as
Heinlein said...  Never underestimate the power of human stupidity.
In other words - document the behavior, no matter which way we end
up so no-one can claim we didn't warn them.  Make sure the behavior
makes its way into the FAQ and any Samba Admininstration books as well.

	Reasonable?  Bogus?

> anyone like to volunteer to fix our client code to do all this?

	Mike
-- 
 Michael H. Warfield    |  (770) 985-6132   |  mhw at WittsEnd.com
  (The Mad Wizard)      |  (770) 925-8248   |  http://www.wittsend.com/mhw/
  NIC whois:  MHW9      |  An optimist believes we live in the best of all
 PGP Key: 0xDF1DD471    |  possible worlds.  A pessimist is sure of it!


More information about the samba-technical mailing list