[jcifs] RE: NetBIOS adapter status request

Glass, Eric eric.glass at capitalone.com
Tue Feb 4 00:27:33 EST 2003


> There are two ways to send an Adapter Status Query:
> 
> 1)  Send it to a specific NetBIOS name.  jCIFS will use the 
> NBT layer to 
>     convert the name to an IP address and will send the query to that 
>     address.  If the hostname is not found then you'd get an 
> exception.
>     + Note that if you do not specify a suffix jCIFS must 
> make a guess.
>       The best guess is the 0x00 suffix.  Almost all Windows systems 
>       register the <host>00 name.  WindowsXP, annoyingly, is 
> an exception.
> 
> 2)  The more common way to send the Adapter Status Query is 
> to specify 
>     the IP address and query for the wildcard name (which is 
> an asterisk
>     followed by 15 nul bytes).  The Adapter Status is 
> commonly used as a 
>     reverse lookup tool.  If the target node is running NBT, 
> it will reply 
>     to a wildcard query.
> 
> Note that there is one more caveat:  Original W/95 systems 
> reply to the
> wrong port when sent an Adapter Status query.  They always 
> reply to port
> 137/UDP.  As a result, some W/95 systems will (mysteriously) 
> "not respond"
> to an Adapter Status Query.
> 
> I should mention, though, that I am confused by the wording of the 
> exception above:
> 
>   Exception in thread "main" java.net.UnknownHostException:
>     no name with type 0x00 with no scope for host 10.60.38.202
> 
> It suggests that the host was specified by IP address.  If it 
> was a W/XP 
> machine, then it won't have an 0x00 name in the list.  It may have an 
> 0x20, but not necessarily.
> 
>

That kind of confused me as well -- I specified the hostname, and it was
able to do some sort of lookup to get the IP.  I specified "WINS" as the
only resolution method for jCIFS, and we don't have DNS entries for these
boxes.  It seems to have found the IP address (I'm guessing via the first
method listed above), but fails to connect.

Attached is the test program I was using (nbttest.java), along with some
sample output.

nbttest1.txt is the output when run against a host NOT running the "Server"
service (it fails).
nbtstat1.txt is the output of nbtstat -a for the same host ("nbtstat -a
TEST1").

nbttest2.txt is the output when run against a host that IS running the
"Server" service (it succeeds).
nbtstat2.txt is the output of nbtstat -a for that host ("nbtstat -a TEST2").

Both boxes are Windows 2000.


Eric

 
**************************************************************************
The information transmitted herewith is sensitive information intended only
for use by the individual or entity to which it is addressed. If the reader
of this message is not the intended recipient, you are hereby notified that
any review, retransmission, dissemination, distribution, copying or other
use of, or taking of any action in reliance upon this information is
strictly prohibited. If you have received this communication in error,
please contact the sender and delete the material from your computer.
          

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nbttest.java
Type: application/octet-stream
Size: 857 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20030203/b9355da3/nbttest.obj
-------------- next part --------------
TEST1<00>/10.60.38.207
java.net.UnknownHostException: no name with type 0x00 with no scope for host 10.60.38.207
	at jcifs.netbios.NbtAddress.getAllByAddress(NbtAddress.java:523)
	at jcifs.netbios.NbtAddress.checkNodeStatusData(NbtAddress.java:666)
	at jcifs.netbios.NbtAddress.getMacAddress(NbtAddress.java:749)
	at nbttest.main(nbttest.java:12)
Exception in thread "main" 
-------------- next part --------------
    
VMware Virtual Ethernet Adapter (basic host-only support for VMnet1):
Node IpAddress: [192.168.49.1] Scope Id: []

    Host not found.
    
\Device\NetBT_Tcpip_{38506A0A-BD8F-4622-AF22-71EE6BF7FD5F}:
Node IpAddress: [0.0.0.0] Scope Id: []

    Host not found.
    
Local Area Connection:
Node IpAddress: [0.0.0.0] Scope Id: []

    Host not found.
    
Local Area Connection 2:
Node IpAddress: [10.60.38.202] Scope Id: []

           NetBIOS Remote Machine Name Table

       Name               Type         Status
    ---------------------------------------------
    TEST1          <00>  UNIQUE      Registered 
    US             <00>  GROUP       Registered 

    MAC Address = 00-02-B3-AA-71-E9

-------------- next part --------------
TEST2<00>/10.60.26.212
00-08-02-1D-2B-AF
-------------- next part --------------
    
VMware Virtual Ethernet Adapter (basic host-only support for VMnet1):
Node IpAddress: [192.168.49.1] Scope Id: []

    Host not found.
    
\Device\NetBT_Tcpip_{38506A0A-BD8F-4622-AF22-71EE6BF7FD5F}:
Node IpAddress: [0.0.0.0] Scope Id: []

    Host not found.
    
Local Area Connection:
Node IpAddress: [0.0.0.0] Scope Id: []

    Host not found.
    
Local Area Connection 2:
Node IpAddress: [10.60.38.202] Scope Id: []

           NetBIOS Remote Machine Name Table

       Name               Type         Status
    ---------------------------------------------
    TEST2          <00>  UNIQUE      Registered 
    US             <00>  GROUP       Registered 
    TEST2          <20>  UNIQUE      Registered 
    TEST2          <03>  UNIQUE      Registered 
    US             <1E>  GROUP       Registered 

    MAC Address = 00-08-02-1D-2B-AF



More information about the jcifs mailing list