[jcifs] DFS with jCIFS 1.2.3 and w2k3 sp1

Thomas Bley thomas.bley at simple-groupware.de
Sat Sep 10 12:17:42 GMT 2005


Hi,

thanks for the great details,

  >>Then it gave me (no exception):
  >>smb://testw2k3/temp
  >
  >
  > This is wrong. There should be a trailing slash like 
smb://testw2k3/temp/

in the code I found (smbfile.java):

      String unc;                      // Initially null; set by
getUncPath; never ends with '/'

and (in getdfspath):

          return "smb:/" + (new String( dfsReferral.node + unc
)).replace( '\\', '/' );

for me it is logical that the "/" is missing at the end, bug ?



In more detail (is it ok that there is a
"java.net.SocketTimeoutException: Receive timed out" ?):
(for the rest, see the ethereal dump attached)

I configured dfs to link to \\192.168.0.5\temp (I cannot use
\\192.168.0.5\temp\ because windows says it is not a valid unc-path)

my code:

SmbFile f = new SmbFile(
"smb://administrator:admin@192.168.0.5/MyRoot/testlink/" );
System.out.println( f.getDfsPath() );

the results:

#JCIFS PROPERTIES
#Sat Sep 10 13:43:20 CEST 2005
java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition
sun.boot.library.path=C\:\\Programme\\Java2SDK 1-41\\jre\\bin
java.vm.version=1.4.1_01-b01
java.vm.vendor=Sun Microsystems Inc.
java.vendor.url=http\://java.sun.com/
path.separator=;
java.vm.name=Java HotSpot(TM) Client VM
file.encoding.pkg=sun.io
user.country=DE
sun.os.patch.level=Service Pack 4
java.vm.specification.name=Java Virtual Machine Specification
user.dir=d\:\\workspace\\jcifs
java.runtime.version=1.4.1_01-b01
java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
java.endorsed.dirs=C\:\\Programme\\Java2SDK 1-41\\jre\\lib\\endorsed
os.arch=x86
java.io.tmpdir=C\:\\DOKUME~1\\ADMINI~1\\LOKALE~1\\Temp\\
line.separator=\r\n
java.vm.specification.vendor=Sun Microsystems Inc.
user.variant=
os.name=Windows 2000
sun.java2d.fontpath=
java.library.path=C\:\\Programme\\Java2SDK
1-41\\bin;.;C\:\\WINNT\\system32;C\:\\WINNT;C\:\\Programme\\Java2SDK
1-41\\bin;C\:\\WINNT\\system32;C\:\\WINNT;C\:\\WINNT\\System32\\Wbem;C\:\\Programme\\Gemeinsame 

Dateien\\GTK\\2.0\\bin;C\:\\Programme\\Perforce
java.specification.name=Java Platform API Specification
java.class.version=48.0
java.util.prefs.PreferencesFactory=java.util.prefs.WindowsPreferencesFactory
os.version=5.0
user.home=C\:\\Dokumente und Einstellungen\\Administrator
user.timezone=
java.awt.printerjob=sun.awt.windows.WPrinterJob
file.encoding=Cp1252
java.specification.version=1.4
jcifs.util.loglevel=10
user.name=Administrator
java.class.path=d\:\\workspace\\jcifs\\bin;D\:\\webdisk\\lib\\servlet-api.jar
java.vm.specification.version=1.0
sun.arch.data.model=32
java.home=C\:\\Programme\\Java2SDK 1-41\\jre
java.specification.vendor=Sun Microsystems Inc.
user.language=de
awt.toolkit=sun.awt.windows.WToolkit
java.vm.info=mixed mode
java.version=1.4.1_01
java.ext.dirs=C\:\\Programme\\Java2SDK 1-41\\jre\\lib\\ext
sun.boot.class.path=C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\rt.jar;C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\i18n.jar;C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\sunrsasign.jar;C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\jsse.jar;C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\jce.jar;C\:\\Programme\\Java2SDK
1-41\\jre\\lib\\charsets.jar;C\:\\Programme\\Java2SDK 1-41\\jre\\classes
java.vendor=Sun Microsystems Inc.
file.separator=\\
java.vendor.url.bug=http\://java.sun.com/cgi-bin/bugreport.cgi
sun.cpu.endian=little
sun.io.unicode.encoding=UnicodeLittle
sun.cpu.isalist=pentium i486 i386
New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 72 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBr......À....|
00010: 00 00 00 00 00 00 00 00 00 00 F4 17 00 00 01 00  |..........ô.....|


byteCount=46 but readBytesWireFormat returned 26
NodeStatusRequest[nameTrnId=1,isResponse=false,opCode=QUERY,isAuthAnswer=false,isTruncated=false,isRecurAvailable=false,isRecurDesired=false,isBroadcast=false,resultCode=0,questionCount=1,answerCount=0,authorityCount=0,additionalCount=0,questionName=*
00000: 00 01 00 00 00 01 00 00 00 00 00 00 20 43 4B 41  |............ CKA|
00010: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
00020: 41 41 41 41 41 41 41 41 41 41 41 41 41 00 00 21  |AAAAAAAAAAAAA..!|
00030: 00 01                                            |..              |

NodeStatusRequest[nameTrnId=2,isResponse=false,opCode=QUERY,isAuthAnswer=false,isTruncated=false,isRecurAvailable=false,isRecurDesired=false,isBroadcast=false,resultCode=0,questionCount=1,answerCount=0,authorityCount=0,additionalCount=0,questionName=*
00000: 00 02 00 00 00 01 00 00 00 00 00 00 20 43 4B 41  |............ CKA|
00010: 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41  |AAAAAAAAAAAAAAAA|
00020: 41 41 41 41 41 41 41 41 41 41 41 41 41 00 00 21  |AAAAAAAAAAAAA..!|
00030: 00 01                                            |..              |

java.net.SocketTimeoutException: Receive timed out
	at java.net.PlainDatagramSocketImpl.receive(Native Method)
	at java.net.DatagramSocket.receive(DatagramSocket.java:671)
	at jcifs.netbios.NameServiceClient.run(NameServiceClient.java:184)
	at java.lang.Thread.run(Thread.java:536)
treeConnect: unc=\\192.168.0.5\MYROOT,service=?????
sessionSetup: accountName=administrator,primaryDomain=?
SmbComSessionSetupAndX[command=SMB_COM_SESSION_SETUP_ANDX,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=6132,uid=0,mid=2,wordCount=13,byteCount=119,andxCommand=0x75,andxOffset=180,snd_buf_size=4356,maxMpxCount=10,VC_NUMBER=1,sessionKey=0,passwordLength=24,unicodePasswordLength=24,capabilities=4180,accountName=administrator,primaryDomain=?,NATIVE_OS=Windows 

2000,NATIVE_LANMAN=jCIFS]
SmbComTreeConnectAndX[command=SMB_COM_TREE_CONNECT_ANDX,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0x0000,signSeq=0,tid=0,pid=6132,uid=0,mid=0,wordCount=4,byteCount=49,andxCommand=0xFF,andxOffset=0,disconnectTid=false,passwordLength=1,password=,path=\\192.168.0.5\MYROOT,service=?????]
00000: FF 53 4D 42 73 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMBs......À....|
00010: 00 00 00 00 00 00 00 00 00 00 F4 17 00 00 02 00  |..........ô.....|
00020: 0D 75 00 B4 00 04 11 0A 00 01 00 00 00 00 00 18  |.u.´............|
00030: 00 18 00 00 00 00 00 54 10 00 00 77 00 A1 AA 30  |.......T...w.¡ª0|
00040: 06 11 0C 12 B3 E7 54 2B DC E8 3B 7F BD 7C 95 2A  |....³çT+Üè;.½|.*|
00050: AB 43 2E ED BD BC 27 BC 6E EF 35 D7 DF E0 60 54  |«C.í½¼'¼nï5×ßà`T|
00060: 70 4B F7 EC 98 AC D1 79 2F A0 FA B3 C5 00 61 00  |pK÷ì.¬Ñy/ ú³Å.a.|
00070: 64 00 6D 00 69 00 6E 00 69 00 73 00 74 00 72 00  |d.m.i.n.i.s.t.r.|
00080: 61 00 74 00 6F 00 72 00 00 00 3F 00 00 00 57 00  |a.t.o.r...?...W.|
00090: 69 00 6E 00 64 00 6F 00 77 00 73 00 20 00 32 00  |i.n.d.o.w.s. .2.|
000A0: 30 00 30 00 30 00 00 00 6A 00 43 00 49 00 46 00  |0.0.0...j.C.I.F.|
000B0: 53 00 00 00 04 FF 00 00 00 00 00 01 00 31 00 00  |S....ÿ.......1..|
000C0: 5C 00 5C 00 31 00 39 00 32 00 2E 00 31 00 36 00  |\.\.1.9.2...1.6.|
000D0: 38 00 2E 00 30 00 2E 00 35 00 5C 00 4D 00 59 00  |8...0...5.\.M.Y.|
000E0: 52 00 4F 00 4F 00 54 00 00 00 3F 3F 3F 3F 3F 00  |R.O.O.T...?????.|

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 73 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBs......À....|
00010: 00 00 00 00 00 00 00 00 00 18 F4 17 02 18 02 00  |..........ô.....|



queryPath: \testlink
Trans2QueryPathInformation[command=SMB_COM_TRANSACTION2,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xD003,signSeq=0,tid=6144,pid=6132,uid=6146,mid=3,wordCount=15,byteCount=65,totalParameterCount=64,totalDataCount=0,maxParameterCount=2,maxDataCount=40,maxSetupCount=0,flags=0x00,timeout=0,parameterCount=64,parameterOffset=66,parameterDisplacement=0,dataCount=0,dataOffset=130,dataDisplacement=0,setupCount=1,pad=1,pad1=0,informationLevel=0x101,filename=\192.168.0.5\MYROOT\testlink]
00000: FF 53 4D 42 32 00 00 00 00 18 03 D0 00 00 00 00  |ÿSMB2......Ð....|
00010: 00 00 00 00 00 00 00 00 00 18 F4 17 02 18 03 00  |..........ô.....|
00020: 0F 40 00 00 00 02 00 28 00 00 00 00 00 00 00 00  |. at .....(........|
00030: 00 00 00 40 00 42 00 00 00 00 00 01 00 05 00 41  |... at .B.........A|
00040: 00 00 01 01 00 00 00 00 5C 00 31 00 39 00 32 00  |........\.1.9.2.|
00050: 2E 00 31 00 36 00 38 00 2E 00 30 00 2E 00 35 00  |..1.6.8...0...5.|
00060: 5C 00 4D 00 59 00 52 00 4F 00 4F 00 54 00 5C 00  |\.M.Y.R.O.O.T.\.|
00070: 74 00 65 00 73 00 74 00 6C 00 69 00 6E 00 6B 00  |t.e.s.t.l.i.n.k.|
00080: 00 00                                            |..              |

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 32 57 02 00 C0 98 03 C0 00 00 00 00  |ÿSMB2W..À..À....|
00010: 00 00 00 00 00 00 00 00 00 18 F4 17 02 18 03 00  |..........ô.....|

treeConnect: unc=\\192.168.0.5\IPC$,service=?????
SmbComTreeConnectAndX[command=SMB_COM_TREE_CONNECT_ANDX,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=6132,uid=6146,mid=4,wordCount=4,byteCount=45,andxCommand=0xFF,andxOffset=0,disconnectTid=false,passwordLength=1,password=,path=\\192.168.0.5\IPC$,service=?????]
00000: FF 53 4D 42 75 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMBu......À....|
00010: 00 00 00 00 00 00 00 00 00 00 F4 17 02 18 04 00  |..........ô.....|
00020: 04 FF 00 00 00 00 00 01 00 2D 00 00 5C 00 5C 00  |.ÿ.......-..\.\.|
00030: 31 00 39 00 32 00 2E 00 31 00 36 00 38 00 2E 00  |1.9.2...1.6.8...|
00040: 30 00 2E 00 35 00 5C 00 49 00 50 00 43 00 24 00  |0...5.\.I.P.C.$.|
00050: 00 00 3F 3F 3F 3F 3F 00                          |..?????.        |

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 75 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBu......À....|
00010: 00 00 00 00 00 00 00 00 02 18 F4 17 02 18 04 00  |..........ô.....|

Trans2GetDfsReferral[command=SMB_COM_TRANSACTION2,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xC003,signSeq=0,tid=6146,pid=6132,uid=6146,mid=5,wordCount=15,byteCount=61,totalParameterCount=60,totalDataCount=0,maxParameterCount=0,maxDataCount=4096,maxSetupCount=0,flags=0x00,timeout=0,parameterCount=60,parameterOffset=66,parameterDisplacement=0,dataCount=0,dataOffset=126,dataDisplacement=0,setupCount=1,pad=1,pad1=0,maxReferralLevel=0x3,filename=\192.168.0.5\MYROOT\testlink]
00000: FF 53 4D 42 32 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMB2......À....|
00010: 00 00 00 00 00 00 00 00 02 18 F4 17 02 18 05 00  |..........ô.....|
00020: 0F 3C 00 00 00 00 00 00 10 00 00 00 00 00 00 00  |.<..............|
00030: 00 00 00 3C 00 42 00 00 00 00 00 01 00 10 00 3D  |...<.B.........=|
00040: 00 00 03 00 5C 00 31 00 39 00 32 00 2E 00 31 00  |....\.1.9.2...1.|
00050: 36 00 38 00 2E 00 30 00 2E 00 35 00 5C 00 4D 00  |6.8...0...5.\.M.|
00060: 59 00 52 00 4F 00 4F 00 54 00 5C 00 74 00 65 00  |Y.R.O.O.T.\.t.e.|
00070: 73 00 74 00 6C 00 69 00 6E 00 6B 00 00 00        |s.t.l.i.n.k...  |

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 32 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMB2......À....|
00010: 00 00 00 00 00 00 00 00 02 18 F4 17 02 18 05 00  |..........ô.....|

treeConnect: unc=\\192.168.0.5\TEMP,service=?????
SmbComTreeConnectAndX[command=SMB_COM_TREE_CONNECT_ANDX,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xC003,signSeq=0,tid=0,pid=6132,uid=6146,mid=6,wordCount=4,byteCount=45,andxCommand=0xFF,andxOffset=0,disconnectTid=false,passwordLength=1,password=,path=\\192.168.0.5\TEMP,service=?????]
00000: FF 53 4D 42 75 00 00 00 00 18 03 C0 00 00 00 00  |ÿSMBu......À....|
00010: 00 00 00 00 00 00 00 00 00 00 F4 17 02 18 06 00  |..........ô.....|
00020: 04 FF 00 00 00 00 00 01 00 2D 00 00 5C 00 5C 00  |.ÿ.......-..\.\.|
00030: 31 00 39 00 32 00 2E 00 31 00 36 00 38 00 2E 00  |1.9.2...1.6.8...|
00040: 30 00 2E 00 35 00 5C 00 54 00 45 00 4D 00 50 00  |0...5.\.T.E.M.P.|
00050: 00 00 3F 3F 3F 3F 3F 00                          |..?????.        |

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 75 00 00 00 00 98 03 C0 00 00 00 00  |ÿSMBu......À....|
00010: 00 00 00 00 00 00 00 00 01 18 F4 17 02 18 06 00  |..........ô.....|


Trans2QueryPathInformation[command=SMB_COM_TRANSACTION2,received=false,errorCode=The 

operation completed
successfully.,flags=0x0018,flags2=0xD003,signSeq=0,tid=6145,pid=6132,uid=6146,mid=7,wordCount=15,byteCount=9,totalParameterCount=8,totalDataCount=0,maxParameterCount=2,maxDataCount=40,maxSetupCount=0,flags=0x00,timeout=0,parameterCount=8,parameterOffset=66,parameterDisplacement=0,dataCount=0,dataOffset=74,dataDisplacement=0,setupCount=1,pad=1,pad1=0,informationLevel=0x101,filename=]
00000: FF 53 4D 42 32 00 00 00 00 18 03 D0 00 00 00 00  |ÿSMB2......Ð....|
00010: 00 00 00 00 00 00 00 00 01 18 F4 17 02 18 07 00  |..........ô.....|
00020: 0F 08 00 00 00 02 00 28 00 00 00 00 00 00 00 00  |.......(........|
00030: 00 00 00 08 00 42 00 00 00 00 00 01 00 05 00 09  |.....B..........|
00040: 00 00 01 01 00 00 00 00 00 00                    |..........      |

New data read: Transport1[0.0.0.0<00>/192.168.0.5:445]
00000: FF 53 4D 42 32 00 00 00 00 98 03 D0 00 00 00 00  |ÿSMB2......Ð....|
00010: 00 00 00 00 00 00 00 00 01 18 F4 17 02 18 07 00  |..........ô.....|

smb://192.168.0.5/temp


Michael B Allen wrote:
> 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
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: getdfspath.dump
Type: application/octet-stream
Size: 6098 bytes
Desc: not available
Url : http://lists.samba.org/archive/jcifs/attachments/20050910/026d1be6/getdfspath.obj


More information about the jcifs mailing list