]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3/locking: return parent_lease_key from get_delete_on_close_token()
authorRalph Boehme <slow@samba.org>
Wed, 23 Oct 2024 13:38:01 +0000 (15:38 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Nov 2024 14:39:30 +0000 (14:39 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/locking/locking.c
source3/locking/proto.h
source3/smbd/close.c

index bf42b31be2f7759f1c77561be607c6470d67a00b..dd963e4fbaadd00d30fbda6175c1a615b1047720 100644 (file)
@@ -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;
 }
 
index 7fc177d7aa6d097039f6cfd920f3d64f6230b4fa..8e03ad8cf5a1f338fdc28bf9b186f1f77f9aab15 100644 (file)
@@ -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,
index 436b1cc876e23210866c84c474b25d20909a1e78..1563dbf40f11eb8ad37055241102a011b89b1ca7 100644 (file)
@@ -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);
        }