]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Factor out fsp_unbind_smb() from file_free()
authorVolker Lendecke <vl@samba.org>
Wed, 9 Feb 2022 16:23:03 +0000 (17:23 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 10 Feb 2022 18:16:36 +0000 (18:16 +0000)
For example, remove our entry from smbXsrv_open_global.tdb

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/files.c
source3/smbd/proto.h

index 917f854aa7eaafe9a3833d755ae3e4c9702598bb..3fc1992ce4d503b9722dedcfe8d872d3611d288e 100644 (file)
@@ -1224,11 +1224,11 @@ static void fsp_free(files_struct *fsp)
        TALLOC_FREE(fsp);
 }
 
-void file_free(struct smb_request *req, files_struct *fsp)
+/*
+ * Rundown of all smb-related sub-structures of an fsp
+ */
+void fsp_unbind_smb(struct smb_request *req, files_struct *fsp)
 {
-       struct smbd_server_connection *sconn = fsp->conn->sconn;
-       uint64_t fnum = fsp->fnum;
-
        if (fsp == fsp->conn->cwd_fsp) {
                return;
        }
@@ -1269,6 +1269,14 @@ void file_free(struct smb_request *req, files_struct *fsp)
         * pointers in the SMB2 request queue.
         */
        remove_smb2_chained_fsp(fsp);
+}
+
+void file_free(struct smb_request *req, files_struct *fsp)
+{
+       struct smbd_server_connection *sconn = fsp->conn->sconn;
+       uint64_t fnum = fsp->fnum;
+
+       fsp_unbind_smb(req, fsp);
 
        /* Drop all remaining extensions. */
        vfs_remove_all_fsp_extensions(fsp);
index e1443c1186fd4d5a494ea7437b27798258e40f64..008de8baf37aa0a7a899fd2c2a867cb123be490c 100644 (file)
@@ -412,6 +412,7 @@ struct files_struct *file_find_one_fsp_from_lease_key(
        struct smbd_server_connection *sconn,
        const struct smb2_lease_key *lease_key);
 bool file_find_subpath(files_struct *dir_fsp);
+void fsp_unbind_smb(struct smb_request *req, files_struct *fsp);
 void file_free(struct smb_request *req, files_struct *fsp);
 files_struct *file_fsp(struct smb_request *req, uint16_t fid);
 struct files_struct *file_fsp_get(struct smbd_smb2_request *smb2req,