From: Jeremy Allison Date: Wed, 27 Jul 2022 21:36:33 +0000 (-0700) Subject: s3: smbd: Ensure we set fsp->file_id in openat_pathref_dirfsp_nosymlink(). X-Git-Tag: samba-4.17.0rc1~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a653fdc4422450737ab885d2531db8bed9fcf03;p=thirdparty%2Fsamba.git s3: smbd: Ensure we set fsp->file_id in openat_pathref_dirfsp_nosymlink(). This is a subtle one. The dirfsp returned by openat_pathref_dirfsp_nosymlink() can be used inside open.c and passed to check_parent_access_fsp() to check if a delete_on_close flag has been set on an existing "real" open fsp. So the file_id must be correctly set in order for this to work. Without it, samba3.base.delete fails in deltest20 when we convert reply_open_and_X() to use filename_convert_dirfsp(). Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 9a81a16b3ec..afde81d3070 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -937,6 +937,12 @@ next: nt_errstr(status)); goto fail; } + /* + * We must correctly set fsp->file_id as code inside + * open.c will use this to check if delete_on_close + * has been set on the dirfsp. + */ + fsp->file_id = vfs_file_id_from_sbuf(conn, &fsp->fsp_name->st); result = cp_smb_filename(mem_ctx, fsp->fsp_name); if (result == NULL) {