[jcifs] DFS with jCIFS 1.2.3 and w2k3 sp1

Michael B Allen mba2000 at ioplex.com
Sat Sep 10 01:09:03 GMT 2005


On Sat, 10 Sep 2005 01:53:10 +0200
Thomas Bley <thomas.bley at simple-groupware.de> wrote:

> Hi Mike,
> 
> I digged a bit deeper into DFS.
> 
> First I tried:
> (192.168.0.5 is w2k3-server sp1 and "testlink" links to smb://testw2k3/temp)
> 
> SmbFile f = new SmbFile( 
> "smb://administrator:admin@192.168.0.5/MyRoot/testlink/" );
> System.out.println( f.getDfsPath() );
> 
> This gave me:
> jcifs.smb.SmbException: testw2k3
> java.net.UnknownHostException: testw2k3
> 	at jcifs.UniAddress.getByName(UniAddress.java:297)
> 	at jcifs.UniAddress.getByName(UniAddress.java:201)
> 	at jcifs.smb.SmbFile.send(SmbFile.java:672)
> 	at jcifs.smb.SmbFile.queryPath(SmbFile.java:1200)
> 	at jcifs.smb.SmbFile.exists(SmbFile.java:1256)
> 	at jcifs.smb.SmbFile.getDfsPath(SmbFile.java:1379)
> 	at GetDfsPath.main(GetDfsPath.java:8)
> 
> 	at jcifs.smb.SmbFile.send(SmbFile.java:674)
> 	at jcifs.smb.SmbFile.queryPath(SmbFile.java:1200)
> 	at jcifs.smb.SmbFile.exists(SmbFile.java:1256)
> 	at jcifs.smb.SmbFile.getDfsPath(SmbFile.java:1379)
> 	at GetDfsPath.main(GetDfsPath.java:8)
> Exception in thread "main"
> 
> 
> Then I put the hostname "testw2k3" into the lookup-file 
> winnt/system32/drivers/hosts:
> e.g. "192.168.0.5	testw2k3"
> 
> Then it gave me (no exception):
> smb://testw2k3/temp

This is wrong. There should be a trailing slash like smb://testw2k3/temp/

> 
> seems like there is a lookup for "testw2k3" going on ?

Sure. The way DFS works is it's basically a redirection mechanism. If jCIFS connects to 192.168.0.5/MyRoot/ and queries the path /testlink and it's "InDfs" the client should get an error STATUS_PATH_NOT_COVERED. That will trigger JCIFS to query the server for a "referral". The referral response should contain the server and path that corresponds to the DFS link (e.g. testw2k3 and path /temp). Then JCIFS will try to communicate with smb://testw2k3/temp/ like any other target. This of course involves a name lookup for 'testw2k3' so if that name is not valid you will get an error.

> When I set the dfslink to "smb://192.168.0.5/temp" there is no lookup.

Natrually as there is no reason to lookup an IP address.

You can see all of this using Ethereal. To do this kind of work you MUST use Ethereal. If you don't you are wasting your time. I suggest you put down what your doing and figure out how to get Etheral working (or Netmon if you're using Windows but Ethereal is 2x better).

Mike


More information about the jcifs mailing list