Writing to non-DFS directory on DFS share (using smbclient)

Gary Monson garym-samba at remasys.com
Wed Aug 23 07:06:34 GMT 2006


I am having an issue with the Linux smbclient program when connected to 
a DFS share setup on a Windows 2003 server.  I am trying to do a "put" 
to the remote share but getting back an error message.  The setup is as 

The main DFS share is at \\w2003\rootdfs.  This is where I connect to, 
without a problem.  It has 2 directories under it: \linkgary and 
\nolink.  \linkgary is a redirect to another samba share.  \nolink is 
just a plain directory sitting in the top-level of the \\w2003\rootdfs 

I recently upgraded smbclient from 3.0.1 to 3.0.23b to get access to the 
DFS compatibility.  Doing this allowed me to "put" a file into the 
\linkgary directory in the setup described above.  However, if I try to 
do a "put" into the \nolink directory (e.g. "put testfile", when I am 
currently in that directory), I get back the error 
NT_STATUS_FILE_IS_A_DIRECTORY.  In both cases, there is no file already 
in the directory I am writing to with the same name, let alone a 
directory with the same name.

I have no such problem when connecting to a non-DFS share (even when on 
a Windows server).  When connecting to the DFS share from Windows XP 
Professional, and copy/pasting a file into the \nolink directory, it 
works fine.

This made me think that maybe the server is not playing nice with 
smbclient, so I did an ethereal capture and discovered the following:-

 From smbclient, the "put" command sends the following SMB commands 
under the hood:

Open AndX Request
Write AndX Request
Close Request

Each of the commands receives a response like "Open AndX Response, FID: 
0x4000 (STATUS_SUCCESS)" where the FID seems to be a file descriptor 
used by the client in following connected requests (such as write and 
close).  However, in the case of doing a put when in the \nolink 
directory, the server responds to the "Open AndX Request" with a 

I then did a capture of the Windows client doing a copy/paste into the 
\nolink directory on the share, and got the following commands

NT Create AndX Request
Write AndX Request
Close Request

And each request had a response with STATUS_SUCCESS.  I have googled 
this and not been able to find any reference to "NT Create AndX Request" 
in any list of valid SMB commands.

Additional problems I have encountered are:

- In \nolink, doing a "mkdir testdir" results in 
"NT_STATUS_OBJECT_NAME_COLLISION making remote directory \nolink\testdir"
- In \nolink, doing a "del testfile" (on a file that exists at 
\nolink\testfile) results in "NT_STATUS_NO_SUCH_FILE listing 
- In \linkgary, doing a "del testfile" (on a file that exists at 
\linkgary\testfile) results in "NT_STATUS_FILE_IS_A_DIRECTORY deleting 
remote file \testfile"

So, my questions are:

- Is it valid (according to spec) to connect to a DFS share, cd to plain 
non-DFS directories under it, and "put" files there (perhaps Windows 
client just lets you do that (using undocumented SMB calls?) even though 
it is not part of spec?)
- If it is valid, does smbclient support it (i.e. am I just doing this 
wrong)?  If so, how do I put files into such a directory?
- If smbclient does not support it, will it in the future?  Is this a 
bug, or an unimplemented feature?

Thanks for any help anyone can provide,

More information about the smb-clients mailing list