]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Simplify open_mode_check()
authorVolker Lendecke <vl@samba.org>
Thu, 3 Dec 2020 15:18:25 +0000 (16:18 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 4 Dec 2020 21:08:38 +0000 (21:08 +0000)
The call to share_mode_have_entries() was put in before
fresh_share_mode_lock() initialized d->flags to be completely
permissive. With that correct initialization the call to
share_conflict() a few lines down will also make open_mode_check()
pass for any share_access/access_mask.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index 3f5bc89cefee494a469461ca3924382812a214c0..bf6129704583d2dc63b9d8a3788463f858581f15 100644 (file)
@@ -1761,7 +1761,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
                                uint32_t share_access)
 {
        struct open_mode_check_state state;
-       bool ok, conflict, have_share_entries;
+       bool ok, conflict;
        bool modified = false;
 
        if (is_oplock_stat_open(access_mask)) {
@@ -1787,15 +1787,6 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        }
 #endif
 
-       have_share_entries = share_mode_have_entries(lck);
-       if (!have_share_entries) {
-               /*
-                * This is a fresh share mode lock where no conflicts
-                * can happen.
-                */
-               return NT_STATUS_OK;
-       }
-
        share_mode_flags_get(
                lck, &state.access_mask, &state.share_access, NULL);