From: Jeremy Allison Date: Thu, 20 May 2021 16:28:29 +0000 (-0700) Subject: s3: smbd: Change set_create_timespec_ea() to take the existing fsp. X-Git-Tag: tevent-0.11.0~775 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5a976b42f075b0a1ef4a5cc911659f0ed7884dd4;p=thirdparty%2Fsamba.git s3: smbd: Change set_create_timespec_ea() to take the existing fsp. Removes an unneeded synthetic_pathref() call. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Thu May 20 19:59:44 UTC 2021 on sn-devel-184 --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 50b00de2301..e384f8885d1 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2541,8 +2541,7 @@ static int vfswrap_fntimes(vfs_handle_struct *handle, } if (!is_omit_timespec(&ft->create_time)) { - set_create_timespec_ea(handle->conn, - fsp->fsp_name, + set_create_timespec_ea(fsp, ft->create_time); } diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index d5bb9e1fd41..a858edee558 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1302,51 +1302,27 @@ bool set_sticky_write_time_fsp(struct files_struct *fsp, struct timespec mtime) Set a create time EA. ******************************************************************/ -NTSTATUS set_create_timespec_ea(connection_struct *conn, - const struct smb_filename *psmb_fname, +NTSTATUS set_create_timespec_ea(struct files_struct *fsp, struct timespec create_time) { - struct smb_filename *smb_fname; uint32_t dosmode; int ret; - NTSTATUS status; - if (!lp_store_dos_attributes(SNUM(conn))) { + if (!lp_store_dos_attributes(SNUM(fsp->conn))) { return NT_STATUS_OK; } - status = synthetic_pathref(talloc_tos(), - conn->cwd_fsp, - psmb_fname->base_name, - NULL, - NULL, - psmb_fname->twrp, - psmb_fname->flags, - &smb_fname); - - if (!NT_STATUS_IS_OK(status)) { - return status; - } - - dosmode = fdos_mode(psmb_fname->fsp); + dosmode = fdos_mode(fsp); - smb_fname->st.st_ex_btime = create_time; - /* - * ensure if we pass fsp around we can get the create time - * from fsp->fsp_name - */ - smb_fname->fsp->fsp_name->st.st_ex_btime = create_time; - - ret = file_set_dosmode(conn, smb_fname, dosmode, NULL, false); + fsp->fsp_name->st.st_ex_btime = create_time; + ret = file_set_dosmode(fsp->conn, fsp->fsp_name, dosmode, NULL, false); if (ret == -1) { - TALLOC_FREE(smb_fname); return map_nt_error_from_unix(errno); } - DEBUG(10,("set_create_timespec_ea: wrote create time EA for file %s\n", - smb_fname_str_dbg(smb_fname))); + DBG_DEBUG("wrote create time EA for file %s\n", + smb_fname_str_dbg(fsp->fsp_name)); - TALLOC_FREE(smb_fname); return NT_STATUS_OK; } diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 1eb74628218..b9131ba5bd9 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -297,8 +297,7 @@ NTSTATUS set_ea_dos_attribute(connection_struct *conn, const struct smb_filename *smb_fname, uint32_t dosmode); -NTSTATUS set_create_timespec_ea(connection_struct *conn, - const struct smb_filename *smb_fname, +NTSTATUS set_create_timespec_ea(struct files_struct *fsp, struct timespec create_time); struct timespec get_create_timespec(connection_struct *conn,