vfs_shadow_copy2: use smb_fname->twrp in shadow_copy2_strip_snapshot_internal()
authorRalph Boehme <slow@samba.org>
Fri, 1 May 2020 14:36:09 +0000 (16:36 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 5 May 2020 19:18:42 +0000 (19:18 +0000)
Use smb_fname->twrp instead if the @GMT token and assert both the twrp value and
the converted @GMT string token have the same value.

With this commit passing CI (which it did), we can somewhat safely assume that
anything that calls into the VFS stack is correctly passing struct
smb_filename.twrp from unix_convert() to the VFS without loosing the twrp value
in one of the myriad places where we copy the original struct smb_filename value
one way or another.

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

index 0d52dd398a9679a69edf6a334d4354cfad48f24b..c50688c0d5f9ee794339a3d6cff5a651f78a1a1e 100644 (file)
@@ -751,6 +751,13 @@ 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;