diff options
author | Volker Lendecke <vl@samba.org> | 2022-02-09 17:23:03 +0100 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2022-02-14 17:46:14 +0000 |
commit | 521178327e4ca5581d741966e8c288253be3d8f3 (patch) | |
tree | c96ae1373ff32e15c243a5a0449a6289b74c02cf | |
parent | 4cc60cbdb70172e3b996fe55968003320bd10f2c (diff) | |
download | samba-521178327e4ca5581d741966e8c288253be3d8f3.tar.gz |
smbd: Factor out fsp_unbind_smb() from file_free()
For example, remove our entry from smbXsrv_open_global.tdb
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14975
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit e751c6237b750adb4cb59df4a42bb9f39354e7e4)
-rw-r--r-- | source3/smbd/files.c | 16 | ||||
-rw-r--r-- | source3/smbd/proto.h | 1 |
2 files changed, 13 insertions, 4 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c index be93d0e884e..677b600d0a6 100644 --- a/source3/smbd/files.c +++ b/source3/smbd/files.c @@ -1217,11 +1217,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; } @@ -1262,6 +1262,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); diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 67a4edb4f88..45519d87ef7 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -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, |