]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Ensure we set fsp->file_id in openat_pathref_dirfsp_nosymlink().
authorJeremy Allison <jra@samba.org>
Wed, 27 Jul 2022 21:36:33 +0000 (14:36 -0700)
committerVolker Lendecke <vl@samba.org>
Thu, 28 Jul 2022 15:38:38 +0000 (15:38 +0000)
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 <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/files.c

index 9a81a16b3ec745584c4bcf79d5c143939ff44870..afde81d30706b734cd55c28c85cf38996655a7bb 100644 (file)
@@ -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) {