From: Ralph Boehme Date: Wed, 23 Oct 2024 13:38:01 +0000 (+0200) Subject: s3/locking: return parent_lease_key from get_delete_on_close_token() X-Git-Tag: tdb-1.4.13~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=113c5400dc4450bb9a4ea6df454d7b3e3d976697;p=thirdparty%2Fsamba.git s3/locking: return parent_lease_key from get_delete_on_close_token() Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index bf42b31be2f..dd963e4fbaa 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -37,6 +37,7 @@ #include "includes.h" #include "lib/util/time_basic.h" +#include "smbd/proto.h" #include "system/filesys.h" #include "lib/util/server_id.h" #include "share_mode_lock.h" @@ -1046,7 +1047,8 @@ static struct delete_token *find_delete_on_close_token( bool get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash, const struct security_token **pp_nt_tok, - const struct security_unix_token **pp_tok) + const struct security_unix_token **pp_tok, + struct smb2_lease_key *parent_lease_key) { struct share_mode_data *d = NULL; struct delete_token *dt; @@ -1070,6 +1072,7 @@ bool get_delete_on_close_token(struct share_mode_lock *lck, } *pp_nt_tok = dt->delete_nt_token; *pp_tok = dt->delete_token; + *parent_lease_key = dt->parent_lease_key; return true; } diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 7fc177d7aa6..8e03ad8cf5a 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -148,7 +148,8 @@ NTSTATUS remove_lease_if_stale(struct share_mode_lock *lck, bool get_delete_on_close_token(struct share_mode_lock *lck, uint32_t name_hash, const struct security_token **pp_nt_tok, - const struct security_unix_token **pp_tok); + const struct security_unix_token **pp_tok, + struct smb2_lease_key *parent_lease_key); void reset_delete_on_close_lck(files_struct *fsp, struct share_mode_lock *lck); void set_delete_on_close_lck(files_struct *fsp, diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 436b1cc876e..1563dbf40f1 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -296,6 +296,7 @@ struct close_share_mode_lock_state { enum file_close_type close_type; bool delete_object; bool got_tokens; + struct smb2_lease_key parent_lease_key; const struct security_unix_token *del_token; const struct security_token *del_nt_token; bool reset_delete_on_close; @@ -397,8 +398,11 @@ static void close_share_mode_lock_prepare(struct share_mode_lock *lck, */ *keep_locked = true; - state->got_tokens = get_delete_on_close_token(lck, fsp->name_hash, - &state->del_nt_token, &state->del_token); + state->got_tokens = get_delete_on_close_token(lck, + fsp->name_hash, + &state->del_nt_token, + &state->del_token, + &state->parent_lease_key); if (state->close_type != ERROR_CLOSE) { SMB_ASSERT(state->got_tokens); }