From: Noel Power Date: Thu, 18 Feb 2021 10:54:23 +0000 (+0000) Subject: s3/smbd: set_create_timespec_ea should create smb_fname with valid fsp X-Git-Tag: tevent-0.11.0~1588 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4031206478eb9d5fc23630fb9ce7e6d08771c72d;p=thirdparty%2Fsamba.git s3/smbd: set_create_timespec_ea should create smb_fname with valid fsp we need to call file_set_dosmode (which ends up calling SMB_VFS_FSETXATTR via set_ea_dos_attribute) has smb_fname set up with a valid smb_fname->fsp Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c index ea225a9b1ef..d994b590381 100644 --- a/source3/smbd/dosmode.c +++ b/source3/smbd/dosmode.c @@ -1284,20 +1284,23 @@ NTSTATUS set_create_timespec_ea(connection_struct *conn, struct smb_filename *smb_fname; uint32_t dosmode; int ret; + NTSTATUS status; if (!lp_store_dos_attributes(SNUM(conn))) { return NT_STATUS_OK; } - smb_fname = synthetic_smb_fname(talloc_tos(), + status = synthetic_pathref(talloc_tos(), + conn->cwd_fsp, psmb_fname->base_name, NULL, - &psmb_fname->st, + NULL, psmb_fname->twrp, - psmb_fname->flags); + psmb_fname->flags, + &smb_fname); - if (smb_fname == NULL) { - return NT_STATUS_NO_MEMORY; + if (!NT_STATUS_IS_OK(status)) { + return status; } dosmode = fdos_mode(psmb_fname->fsp); @@ -1306,12 +1309,14 @@ NTSTATUS set_create_timespec_ea(connection_struct *conn, ret = file_set_dosmode(conn, smb_fname, 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))); + TALLOC_FREE(smb_fname); return NT_STATUS_OK; }