[jcifs] no name with type 0x00 with no scope for host

Allen, Michael B (RSCH) Michael_B_Allen at ml.com
Thu Feb 21 17:19:49 EST 2002


> -----Original Message-----
> From:	Christopher R. Hertel [SMTP:crh at ubiqx.org]
> 
>   If anything, telling them that the 0x00 name wasn't found
> when they were just doing the equivalent of an 'nbtstat -A <IP>' is
> providing too much information.
> 
	This particular message is generic to the least common denominator.

	  getAllByAddress( hostname )
	calls
	  getAllByAddress( hostname, 0x00, null )
	calls
	  getAllByAddress( getByName( hostname, 0x00, null ))

	so the message is thrown out of all of these methods.

> >         What if there really isn't a 00 name? Saying "no status response
> >         from host <ip>
> >         was received" sounds like something went wrong.
> 
> Hang on.  If you send a query using the wildcard name and the remote host
> doesn't have a <00> name you'll still get a response if the remote host is
> running NBT.  Getting a response to a wildcard NODE STATUS REQUEST has
> nothing to do with there being a <00> name there or not.
> 
	Well this is news to me. My understanding was that the hexCode in the query had
	to be advertised by the target. In fact I'm pretty sure it does for stuff other than 00.
	If you do a node status on a host with a hexCode that it doesn't advertise it will
	simply not respond. I've never seen a host that didn't advertise the 00 name. With
	the exception of XP (which we appear to be short on information about) when have
	you seen machines that didn't advertise 00 to come to this conclusion?

> If you are doing a simple name lookup (you don't have the IP yet, only the
> name) and the user does not supply the suffix value, then <00> is a good
> guess.  (If the goal is to set up an SMB session then it might be better to
> guess at the <20>, but that's neither here nor there.)
> 
	It does. When you try to connect with an NbtAddress it's hexCode will be a 0x20
	name, the last thing that NbtAddress.nextCalledName() will return is determined
	by calling getAllByAddress( this ) so 'this' meaning this object will have a 0x20
	name.

>   Anyway, if you are
> doing a name lookup then it makes sense to report that a name could not be
> found, and if you're guessing at the <00> suffix in order to do the name
> lookup, then it's probably worth-while telling the user what you did.  I'm
> not arguing against that.
> 
	Separate the getByName call (which does a standard name query request) from
	the getAllByAddress (which does a node status). If the getByName call fails you
	get an UnknownHostException but with a different message from the one in
	question.

> > ... but what's a status
> >         response? Does that mean the machine is down?!
> 
> It could, or it could mean that you're talking to an early W/95 box that
> doesn't know how to answer a query properly.
> 
	Or it could mean that the client isn't advertising an address that matches the
	'addr' argument in the getAllByAddress call in which case it really shouldn't
	respond to the node status and everything's ok.

	Remember, let's not forget the context of the whole argument here. You're arguing
	that the message returned by

	public static NbtAddress[] getAllByAddress( String host )
	public static NbtAddress[] getAllByAddress( String host, int type, String scope )
	public static NbtAddress[] getAllByAddress( NbtAddress addr )

	which are all described as:

	"Retrieve all addresses of a host by it's address. NetBIOS hosts can have many
	names for a given IP address. The name and IP address make the NetBIOS
	address. This [method] provides a way to retrieve the other names for a host with
	the same IP address. See getByName(java.lang.String) for a description of type
	and scope.
	  Parameters:
	    host - hostname to lookup all addresses for
	    type - the hexcode of the name
	    scope - the scope of the name "

	Kind of a crappy dummed-down description but notice no where does this mention
	anything about doing a node status request. It just so happends that the node
	status request is used to service this request but the user does not know this
	(although if you're messing around with NbtAddress it would be a good idea). So if
	this operation fails I believe the only exception you'll get besides datagram socket
	IO related stuff is:

	"UnknownHostException: no name with type 0x00 with no scope for host 10.0.100.114"

	if the callers arguments where "10.0.100.114", 0x51, foo.net you would get:

	"UnknownHostException: no name with type 0x51 with scope foo.net for host 10.0.100.114"

	You argue it should be:

	"UnknownHostException: no status response from host 10.0.100.114 was received"

	Now which message is more accurate?

	Back to you .... :~)

	Mike





More information about the jcifs mailing list