]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Avoid a direct access to share_mode_data->num_share_modes
authorVolker Lendecke <vl@samba.org>
Tue, 17 Dec 2019 13:23:16 +0000 (14:23 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 17 Dec 2019 22:40:32 +0000 (22:40 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index d1c3f6badc84aa484f3c946b11a0f19e17c25ab4..a999f86dd44b9a77afd014e4f1f12f2cb1cc0066 100644 (file)
@@ -1811,7 +1811,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        struct share_mode_data *d = lck->data;
        struct open_mode_check_state state;
        uint16_t new_flags;
-       bool ok, conflict;
+       bool ok, conflict, have_share_entries;
 
        if (is_stat_open(access_mask)) {
                /* Stat open that doesn't trigger oplock breaks or share mode
@@ -1836,7 +1836,12 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        }
 #endif
 
-       if (d->num_share_modes == 0) {
+       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;
        }