[PATCH] pathname cleanups

Jeremy Allison jra at samba.org
Fri May 19 15:47:47 UTC 2017


On Fri, May 19, 2017 at 06:54:05AM +0200, Volker Lendecke wrote:
> On Thu, May 18, 2017 at 08:40:57PM -0700, Jeremy Allison via samba-technical wrote:
> > I'm getting ready to move the @GMT snapshot
> > name handling into struct smb_filename to
> > clean up a lot of the shadow_copy2 code.
> 
> As you mention it: I've got a report from a customer that a certain
> access pattern does not work anymore: GPFS has the ability to show the
> .snapshots directory (the one where all the @GMT- subdirs show up) in
> all directories, with @GMT- subdirectories being relative to the
> current dir.
> 
> For clients that do not understand the @GMT- logic or the timewarp
> token, essentially all non-windows clients, we need to be able to
> access previous versions through the subdir/.snapshots/@GMT-../subdir
> path. I think in the shadow_copy2 module we need to also preserve the
> non-stripped name and try with that also. Any other ideas?

Ah. The patch I sent actually will fix that issue
(and I understand what changed - with the previous
security fixes, @GMT canonicalization moved into the filename
parsing instead of only being in the shadow_copy2 module).

Take a look at the last hunk:

diff --git a/source3/smbd/filename.c b/source3/smbd/filename.c
index fbe8eb4b325..084849d4ba1 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -434,6 +434,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
        bool allow_wcard_last_component =
            (ucf_flags & UCF_ALWAYS_ALLOW_WCARD_LCOMP);
        bool save_last_component = ucf_flags & UCF_SAVE_LCOMP;
+       bool snapshot_path = (ucf_flags & UCF_GMT_PATHNAME);
        NTSTATUS status;
        int ret = -1;
 
@@ -516,7 +517,7 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
        }
 
        /* Canonicalize any @GMT- paths. */
-       if (posix_pathnames == false) {
+       if (snapshot_path) {
                status = canonicalize_snapshot_path(smb_fname);
                if (!NT_STATUS_IS_OK(status)) {
                        goto err;

which will allow non-Windows clients not using unix
extensions to do exactly what you need.

Please review and push if happy !

Jeremy.



More information about the samba-technical mailing list