smbd: Use leases_db in get_lease_type()
authorVolker Lendecke <vl@samba.org>
Thu, 13 Sep 2018 10:48:30 +0000 (12:48 +0200)
committerChristof Schmitt <cs@samba.org>
Sun, 14 Apr 2019 04:01:31 +0000 (04:01 +0000)
Remove a reference to share_mode_data->leases[]

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/smbd/oplock.c

index 7dfe186..95983c6 100644 (file)
@@ -176,7 +176,21 @@ uint32_t get_lease_type(const struct share_mode_data *d,
                        const struct share_mode_entry *e)
 {
        if (e->op_type == LEASE_OPLOCK) {
-               return d->leases[e->lease_idx].current_state;
+               NTSTATUS status;
+               uint32_t current_state;
+
+               status = leases_db_get(
+                       &e->client_guid,
+                       &e->lease_key,
+                       &d->id,
+                       &current_state,
+                       NULL,   /* breaking */
+                       NULL,   /* breaking_to_requested */
+                       NULL,   /* breaking_to_required */
+                       NULL,   /* lease_version */
+                       NULL);  /* epoch */
+               SMB_ASSERT(NT_STATUS_IS_OK(status));
+               return current_state;
        }
        return map_oplock_to_lease_type(e->op_type);
 }