From: Samuel Cabrero Date: Wed, 14 Apr 2021 09:26:38 +0000 (+0200) Subject: s3: VFS: recycle: set the recycled file times using SMB_VFS_FNTIMES() X-Git-Tag: tevent-0.11.0~1135 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e677da50b49838c801d2e4ddc02fc3735de6a5c;p=thirdparty%2Fsamba.git s3: VFS: recycle: set the recycled file times using SMB_VFS_FNTIMES() Signed-off-by: Samuel Cabrero Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index 7ec2938ebfb..1c18f232c32 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -417,33 +417,38 @@ static void recycle_do_touch(vfs_handle_struct *handle, struct smb_filename *smb_fname_tmp = NULL; struct smb_file_time ft; int ret, err; + NTSTATUS status; init_smb_file_time(&ft); - smb_fname_tmp = cp_smb_filename(talloc_tos(), smb_fname); - if (smb_fname_tmp == NULL) { + status = synthetic_pathref(talloc_tos(), + handle->conn->cwd_fsp, + smb_fname->base_name, + smb_fname->stream_name, + NULL, + smb_fname->twrp, + smb_fname->flags, + &smb_fname_tmp); + if (!NT_STATUS_IS_OK(status)) { + DBG_DEBUG("synthetic_pathref for '%s' failed: %s\n", + smb_fname_str_dbg(smb_fname), nt_errstr(status)); return; } - if (SMB_VFS_STAT(handle->conn, smb_fname_tmp) != 0) { - DEBUG(0,("recycle: stat for %s returned %s\n", - smb_fname_str_dbg(smb_fname_tmp), strerror(errno))); - goto out; - } /* atime */ ft.atime = timespec_current(); /* mtime */ ft.mtime = touch_mtime ? ft.atime : smb_fname_tmp->st.st_ex_mtime; become_root(); - ret = SMB_VFS_NEXT_NTIMES(handle, smb_fname_tmp, &ft); + ret = SMB_VFS_NEXT_FNTIMES(handle, smb_fname_tmp->fsp, &ft); err = errno; unbecome_root(); if (ret == -1 ) { DEBUG(0, ("recycle: touching %s failed, reason = %s\n", smb_fname_str_dbg(smb_fname_tmp), strerror(err))); } - out: + TALLOC_FREE(smb_fname_tmp); }