]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: use get_deferred_open_message_state() in open_directory()
authorRalph Boehme <slow@samba.org>
Fri, 6 Sep 2024 09:46:12 +0000 (11:46 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 5 Nov 2024 14:39:30 +0000 (14:39 +0000)
"deferred" will be used in the function by a later commit...

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/open.c

index 925d23d1e1ee9ea530b3a36be4d2f391644af366..0ee0872d15a6de48b7cce9f005db834b257339be 100644 (file)
@@ -5160,6 +5160,7 @@ static NTSTATUS open_directory(connection_struct *conn,
 {
        struct smb_filename *smb_dname = fsp->fsp_name;
        bool dir_existed = VALID_STAT(smb_dname->st);
+       bool deferred = false;
        struct open_ntcreate_lock_state lck_state = {};
        bool keep_locked = false;
        NTSTATUS status;
@@ -5190,6 +5191,23 @@ static NTSTATUS open_directory(connection_struct *conn,
                 create_disposition,
                 file_attributes);
 
+       if (req == NULL) {
+               /* Ensure req == NULL means INTERNAL_OPEN_ONLY */
+               SMB_ASSERT(oplock_request == INTERNAL_OPEN_ONLY);
+       } else {
+               /* And req != NULL means no INTERNAL_OPEN_ONLY */
+               SMB_ASSERT((oplock_request & INTERNAL_OPEN_ONLY) == 0);
+       }
+
+       if (req != NULL) {
+               struct deferred_open_record *open_rec = NULL;
+
+               deferred = get_deferred_open_message_state(req, NULL, &open_rec);
+               if (deferred) {
+                       remove_deferred_open_message_smb(req->xconn, req->mid);
+               }
+       }
+
        status = smbd_calculate_access_mask_fsp(parent_dir_fname->fsp,
                                        smb_dname->fsp,
                                        false,