From d47f8ca1a769571dae73081cda6a01812c1a256c Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 30 Aug 2019 14:48:40 +0200 Subject: s3:smbd: ensure to update the File-ID in struct smb_filename Initialize the File-ID in fsp->fsp_name->st, any subsequent metadata fetch on this file-handle needs this, eg QFID SMB2 Create-Context or GETINFO SMB requests. It would be nice if SMB_VFS_SET_DOS_ATTRIBUTE() would do this, unfortunately it gets a const struct smb_filename. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14121 Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher (cherry picked from commit 3483b75fed8985bd2968bbf8c85985107115fba8) --- source3/smbd/open.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 2ee4a2c4fca..a5650ac9c2d 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -3710,6 +3710,15 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn, if (info == FILE_WAS_CREATED) { smb_fname->st.st_ex_iflags &= ~ST_EX_IFLAG_CALCULATED_ITIME; + + if (lp_store_dos_attributes(SNUM(conn)) && + smb_fname->st.st_ex_iflags & ST_EX_IFLAG_CALCULATED_FILE_ID) + { + uint64_t file_id; + + file_id = make_file_id_from_itime(&smb_fname->st); + update_stat_ex_file_id(&smb_fname->st, file_id); + } } if (info != FILE_WAS_OPENED) { @@ -3862,6 +3871,14 @@ static NTSTATUS mkdir_internal(connection_struct *conn, smb_dname->st.st_ex_iflags &= ~ST_EX_IFLAG_CALCULATED_ITIME; if (lp_store_dos_attributes(SNUM(conn))) { + if (smb_dname->st.st_ex_iflags & ST_EX_IFLAG_CALCULATED_FILE_ID) + { + uint64_t file_id; + + file_id = make_file_id_from_itime(&smb_dname->st); + update_stat_ex_file_id(&smb_dname->st, file_id); + } + if (!posix_open) { file_set_dosmode(conn, smb_dname, file_attributes | FILE_ATTRIBUTE_DIRECTORY, -- cgit v1.2.1