]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: refactor canonicalize_snapshot_path()
authorRalph Boehme <slow@samba.org>
Thu, 30 Apr 2020 12:13:44 +0000 (14:13 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 5 May 2020 19:18:40 +0000 (19:18 +0000)
This prepares for adding additional code after calling rearrange_snapshot_path().

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/filename.c

index 9de550a730e802b57aa75a7be02ec9273af7a129..6cfc18559931529c61f6dba68f841b1de818ab54 100644 (file)
@@ -369,6 +369,7 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname)
        char *startp = strchr_m(smb_fname->base_name, '@');
        char *endp = NULL;
        struct tm tm;
+       NTSTATUS status;
 
        if (startp == NULL) {
                /* No @ */
@@ -392,13 +393,7 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname)
                return NT_STATUS_OK;
        }
 
-       if ( endp[0] == '\0') {
-               return rearrange_snapshot_path(smb_fname,
-                                       startp,
-                                       endp);
-       }
-
-       if (endp[0] != '/') {
+       if (endp[0] != '\0' && endp[0] != '/') {
                /*
                 * It is not a complete path component, i.e. the path
                 * component continues after the gmt-token.
@@ -406,9 +401,12 @@ static NTSTATUS canonicalize_snapshot_path(struct smb_filename *smb_fname)
                return NT_STATUS_OK;
        }
 
-       return rearrange_snapshot_path(smb_fname,
-                               startp,
-                               endp);
+       status = rearrange_snapshot_path(smb_fname, startp, endp);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       return NT_STATUS_OK;
 }
 
 /*