vfs_shadow_copy2: use struct smb_filename.twrp instead of @GMT string token
authorRalph Boehme <slow@samba.org>
Sat, 2 May 2020 10:10:38 +0000 (12:10 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 5 May 2020 19:18:42 +0000 (19:18 +0000)
Removes the asserts which were only needed to prove patchset correctness.

If smb_fname->twrp is zero, the path won't contain an @GMT token, so we can skip
the stripping logic and directly goto out.

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

index c50688c0d5f9ee794339a3d6cff5a651f78a1a1e..b33a6f64223eccd52e63ef9dde57f12b6664eb4f 100644 (file)
@@ -644,6 +644,14 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
                goto out;
        }
 
+       if (smb_fname->twrp == 0) {
+               goto out;
+       }
+
+       if (ptimestamp != NULL) {
+               *ptimestamp = nt_time_to_unix(smb_fname->twrp);
+       }
+
        /*
         * From here we're only looking to strip an
         * SMB-layer @GMT- token.
@@ -751,14 +759,7 @@ static bool shadow_copy2_strip_snapshot_internal(TALLOC_CTX *mem_ctx,
                }
                *pstripped = stripped;
        }
-       if (timestamp != 0) {
-               time_t smb_fname_timestamp;
 
-               SMB_ASSERT(smb_fname->twrp != 0);
-               smb_fname_timestamp = nt_time_to_unix(smb_fname->twrp);
-               SMB_ASSERT(smb_fname_timestamp == timestamp);
-       }
-       *ptimestamp = timestamp;
        ret = true;
 
   out: