smbd: Use share_mode_entry's lease data in remove_share_mode_lease()
authorVolker Lendecke <vl@samba.org>
Wed, 19 Sep 2018 12:14:32 +0000 (14:14 +0200)
committerChristof Schmitt <cs@samba.org>
Sun, 14 Apr 2019 04:01:31 +0000 (04:01 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
source3/locking/locking.c

index b70d0d62bb19613bdfa63154eceb2545e1786ebb..0e14a4ef0529b991950721f7fc9bb31560a8ca42 100644 (file)
@@ -684,14 +684,19 @@ static void remove_share_mode_lease(struct share_mode_data *d,
        e->lease_idx = UINT32_MAX;
 
        for (i=0; i<d->num_share_modes; i++) {
-               if (d->share_modes[i].stale) {
+               struct share_mode_entry *e2 = &d->share_modes[i];
+
+               if (e2->stale) {
                        continue;
                }
-               if (e == &d->share_modes[i]) {
+               if (e == e2) {
                        /* Not ourselves. */
                        continue;
                }
-               if (d->share_modes[i].lease_idx == lease_idx) {
+               if (smb2_lease_equal(&e->client_guid,
+                                    &e->lease_key,
+                                    &e2->client_guid,
+                                    &e2->lease_key)) {
                        break;
                }
        }