]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: close_file() should never see an internal dirfsp.
authorJeremy Allison <jra@samba.org>
Thu, 17 Dec 2020 20:31:35 +0000 (12:31 -0800)
committerRalph Boehme <slow@samba.org>
Fri, 18 Dec 2020 16:27:38 +0000 (16:27 +0000)
Assert this is the case.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Fri Dec 18 16:27:38 UTC 2020 on sn-devel-184

source3/smbd/close.c

index e53faf98007e24237184d9449c020bd9af904f84..20f2ed8a17271b4be5ab08fbac4f73e268992ba1 100644 (file)
@@ -1291,13 +1291,11 @@ NTSTATUS close_file(struct smb_request *req, files_struct *fsp,
        NTSTATUS status;
        struct files_struct *base_fsp = fsp->base_fsp;
 
-       if (fsp->fsp_flags.is_dirfsp) {
-               /*
-                * The typical way to get here is via file_close_[conn|user]()
-                * and this is taken care of below.
-                */
-               return NT_STATUS_OK;
-       }
+       /*
+        * This fsp can never be an internal dirfsp. They must
+        * be explicitly closed by TALLOC_FREE of the dir handle.
+        */
+       SMB_ASSERT(!fsp->fsp_flags.is_dirfsp);
 
        if (fsp->fsp_flags.is_directory) {
                status = close_directory(req, fsp, close_type);