[cifs-protocol] SMB2 File Rename

Jeremy Allison jra at samba.org
Fri Oct 20 21:30:20 UTC 2017


On Fri, Oct 20, 2017 at 09:27:29PM +0000, Jeff McCashland wrote:
> Thank you for the update, Jeremy!

No problem. In fact we *do* canonicalize the names for most
operations, but the client code has a bug where it's not doing
this for rename and some others.

I'll be logging bugzilla bugs and this should get fixed
for the next 4.6.x, 4.7.x Samba releases.

Cheers,

Jeremy.

> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> From: Jeremy Allison <jra at samba.org>
> Sent: Friday, October 20, 2017 2:10:12 PM
> To: Andreas Schneider
> Cc: Interoperability Documentation Help; cifs-protocol at lists.samba.org
> Subject: Re: [cifs-protocol] SMB2 File Rename
>  
> On Fri, Oct 20, 2017 at 03:21:27PM +0200, Andreas Schneider via cifs-protocol
> wrote:
> > Hello,
> >
> > I disovered that a file rename operation (SetInfo with
> > FILE_RENAME_INFORMATION_TYPE_2) fails for a SMB3 connection but works for
> > SMB1.
> >
> > I've run smbclient from Samba again Windows 2012:
> >
> > File rename (move) over SMB1 with smbclient:
> >
> > bin/smbclient //win-dc02.earth.milkyway.site/Test -Ubob1%Secret007! -mNT1
> > Try "help" to get a list of possible commands.
> > smb: \> cd dir1
> > smb: \dir1\> rename README ..\dir2\README
> > smb: \dir1\>
> >
> > This works!
> >
> > File rename (move) over SMB3 with smbclient:
> >
> > bin/smbclient //win-dc02.earth.milkyway.site/Test -Ubob1%Secret007! -mSMB3
> > Try "help" to get a list of possible commands.
> > smb: \> cd dir1
> > smb: \dir1\> rename README ..\dir2\README
> > NT_STATUS_OBJECT_NAME_NOT_FOUND renaming files \dir1\README -> \dir1\..
> > \dir2\README
> > smb: \dir1\>
> >
> > As you can see, it fails with NT_STATUS_OBJECT_NAME_NOT_FOUND.
> >
> > I do not see that we're doing anything wrong in the SetInfo request. The doc
> > does not mention that '..' is not allowed.
> >
> > Is a path of dir1\..\dir2\file not allowed?
> 
> Just a quick follow up after research. In MS-FCC.pdf it
> states:
> 
> 2.1.5.1 Dot Directory Names
> The pathname components of "." (single period) and ".." (two periods) are
> reserved as dot directory
> names.
> Except where explicitly permitted, a pathname component that is a dot directory
> name MUST NOT be
> sent over the wire.
> 
> so it looks like for SMB2 the server is expecting the
> client to canonicalize out all "." and ".." names before
> use.
> 
> Jeremy.



More information about the cifs-protocol mailing list