[jcifs] SmbFile.mkdirs() and DFS

Sameer Mehta Sameer_Mehta at symantec.com
Mon Jun 7 17:31:09 MDT 2010

Some interesting results --

* SmbFile.mkdirs() with jcifs1.2.24 and 1.2.25 works fine with a nested DFS directory structure.
* Looking at the Wireshark trace and jCIFS debug logs (logging level > 3), I see that we're sending SMB_COM_CREATE_DIRECTORY requests with only (1) tree id (2k8dfs-1 in this scenario), even though the DFS domain consists of more than (1) target servers (2k8sdfs-1 and 2k8dfs-2)

* SmbFile.mkdirs() with jcifs1.3.14 does not work fine with a nested DFS directory structure.
* Looking at the Wireshark trace and the jCIFS debug logs (logging level > 3), I see that we're sending a SMB_COM_CREATE_DIRECTORY requests with different tree ids, which is where the problem seems appears to be. I confirmed that SMB_SESSION_SETUP and SMB_TREE_CONNECT requests were successful, which means that the client was successfully able to login and connect to the DFS target server (2k8dfs-2 in my case). However, mkdir request is failing with NT_STATUS_OBJECT_PATH_NOT_FOUND or human readable message as " The system cannot find the path specified.". 

Could be this be related to changes in "jcifs-1.3.9 released / Robust Retry of Replicated DFS Targets, copyTo Fix, UTF-16LE, and More" ? Also, the changelist description says " JCIFS will now iteratively try multiple replicated DFS targets if some are not enabled (whereas previously JCIFS would quit if the first root target was not accessible)". Wondering if there is a regression in this area for DFS domains with multiple DFS targets ?

Thoughts ?

Thanks in Advance.

-----Original Message-----
From: Sameer Mehta
Sent: Thursday, June 03, 2010 10:16 AM
To: Sameer Mehta; jcifs at lists.samba.org
Subject: RE: [jcifs] SmbFile.mkdirs() and DFS

Hello All,

Anyone had a chance to review this ? If so, any thoughts ? i.e. yes, it is a known issue ? Are developers using SmbFile.mkdirs with DFS to create nested directories ? Any feedback is much appreciated.


-----Original Message-----
From: jcifs-bounces at lists.samba.org [mailto:jcifs-bounces at lists.samba.org <mailto:jcifs-bounces at lists.samba.org> ] On Behalf Of sameermehta
Sent: Thursday, May 27, 2010 7:10 PM
To: jcifs at lists.samba.org
Subject: [jcifs] SmbFile.mkdirs() and DFS

I'm using the latest jcifs library i.e. 1.3.14 and noticed that
SmbFile.mkdirs() fails for DFS file paths i.e. file path must include nested
directories that don't exist, however, the same works fine when I replace
DFS links with Windows file share (result of a DFS referral). For e.g.
consider the following DFS file path.

27, 10 5-07-45p\dar.engdlp.symantec.com\2k8dfs_namespace1\2k8dfs_folder\test

In the above e.g. part of the file path exists and rest does not hence I am
using mkdirs().

exists, while DFS\May 27, 10
5-07-45p\dar.engdlp.symantec.com\2k8dfs_namespace1\2k8dfs_folder\test does

While using mkdirs() function with DFS file path and looking at the tcpdump
I see that jcifs client issues a create directory smb request (filename:
\remediation\DFS\May 27, 10 5-07-45p) and succeeds (NT_STATUS for this
request is set to STATUS_SUCCESS). However, when it tries to create a child
directory within  May 27, 10 5-07-45p (filename:\remediation\DFS\May 27, 10
5-07-45p\dar.engdlp.symantec.com), the request fails with error

Having said this -- eventually i.e. executing the same program more than
once, leads to successful parent and child directory creation. This leads me
to believe that SmbFile.mkdirs is not handling DFS file paths correctly
especially when path includes nested directories that don't exist. The same
program works fine if the path is replaced with DFS referral i.e. in my case

27, 10
 \\2K8DFS-1\2k8dfs_folder\remediation\DFS\May 27, 10

Attaching a test program which reproduces this issue --
http://old.nabble.com/file/p28702003/OpenSmbFile.java.txt <http://old.nabble.com/file/p28702003/OpenSmbFile.java.txt> 
OpenSmbFile.java.txt .


View this message in context: http://old.nabble.com/SmbFile.mkdirs%28%29-and-DFS-tp28702003p28702003.html <http://old.nabble.com/SmbFile.mkdirs%28%29-and-DFS-tp28702003p28702003.html> 
Sent from the Samba - jcifs mailing list archive at Nabble.com.

More information about the jCIFS mailing list