diff options
author | Ralph Boehme <slow@samba.org> | 2019-08-30 14:48:40 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2019-09-10 21:13:09 +0000 |
commit | d47f8ca1a769571dae73081cda6a01812c1a256c (patch) | |
tree | cd746b0a251578c8ed464ca11ba6e10787dea9c3 | |
parent | 6dfeecf345c0a009fff6b233241156eff3160467 (diff) | |
download | samba-d47f8ca1a769571dae73081cda6a01812c1a256c.tar.gz |
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 <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 3483b75fed8985bd2968bbf8c85985107115fba8)
-rw-r--r-- | source3/smbd/open.c | 17 |
1 files changed, 17 insertions, 0 deletions
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, |