From 4980e60dfc5b9e6b96ea8c8de4d2e911c9c2f011 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 14 Sep 2018 13:30:43 +0200 Subject: [PATCH] smbd: Use find_share_mode_lease() in downgrade_share_lease Simple simplification: In locking/ we did not have the direct reference to find_share_mode_lock. Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- source3/smbd/oplock.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index 57e4e699c4a..fdb87314d72 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -525,24 +525,18 @@ static NTSTATUS downgrade_share_lease(struct smbd_server_connection *sconn, { struct share_mode_data *d = lck->data; struct share_mode_lease *l; - uint32_t i; + int idx; *_l = NULL; - for (i=0; inum_leases; i++) { - if (smb2_lease_equal(&sconn->client->connections->smb2.client.guid, - key, - &d->leases[i].client_guid, - &d->leases[i].lease_key)) { - break; - } - } - if (i == d->num_leases) { + idx = find_share_mode_lease( + d, &sconn->client->connections->smb2.client.guid, key); + if (idx == -1) { DEBUG(10, ("lease not found\n")); return NT_STATUS_INVALID_PARAMETER; } - l = &d->leases[i]; + l = &d->leases[idx]; if (!l->breaking) { DBG_WARNING("Attempt to break from %"PRIu32" to %"PRIu32" - " -- 2.34.1