From: Ralph Boehme Date: Sat, 2 May 2020 10:10:38 +0000 (+0200) Subject: vfs_shadow_copy2: use struct smb_filename.twrp instead of @GMT string token X-Git-Tag: ldb-2.2.0~667 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3515ab6c3da93c55a5a1c366767498ba62208432;p=thirdparty%2Fsamba.git vfs_shadow_copy2: use struct smb_filename.twrp instead of @GMT string token 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index c50688c0d5f..b33a6f64223 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -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: