1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

smbd: Simplify check_parent_access_fsp()

We don't need to explicitly call fetch_share_mode_unlocked,
get_file_infos does it for us behind the scenes

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Volker Lendecke 2024-05-14 16:30:21 +02:00 committed by Jeremy Allison
parent c422002ce5
commit aca70be782

View File

@ -341,7 +341,6 @@ NTSTATUS check_parent_access_fsp(struct files_struct *fsp,
NTSTATUS status;
struct security_descriptor *parent_sd = NULL;
uint32_t access_granted = 0;
struct share_mode_lock *lck = NULL;
uint32_t name_hash;
bool delete_on_close_set;
TALLOC_CTX *frame = talloc_stackframe();
@ -410,20 +409,7 @@ NTSTATUS check_parent_access_fsp(struct files_struct *fsp,
goto out;
}
/*
* Don't take a lock here. We just need a snapshot
* of the current state of delete on close and this is
* called in a codepath where we may already have a lock
* (and we explicitly can't hold 2 locks at the same time
* as that may deadlock).
*/
lck = fetch_share_mode_unlocked(frame, fsp->file_id);
if (lck == NULL) {
status = NT_STATUS_OK;
goto out;
}
delete_on_close_set = is_delete_on_close_set(lck, name_hash);
get_file_infos(fsp->file_id, name_hash, &delete_on_close_set, NULL);
if (delete_on_close_set) {
status = NT_STATUS_DELETE_PENDING;
goto out;