1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

s3: smbd: Change set_create_timespec_ea() to take the existing fsp.

Removes an unneeded synthetic_pathref() call.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>

Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May 20 19:59:44 UTC 2021 on sn-devel-184
This commit is contained in:
Jeremy Allison 2021-05-20 09:28:29 -07:00 committed by Ralph Boehme
parent 24fb40a812
commit 5a976b42f0
3 changed files with 9 additions and 35 deletions

View File

@ -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);
}

View File

@ -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);
dosmode = fdos_mode(fsp);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
dosmode = fdos_mode(psmb_fname->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;
}

View File

@ -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,