SQL/LDAP are not able to honor multiple filters in driver_hints.Hints()

Bug #1424745 reported by Samuel de Medeiros Queiroz
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Fix Released
Medium
Samuel de Medeiros Queiroz

Bug Description

When iterating over the list of filters to honor them [1] [2], the method remove elements from that list at the same time [3] [4].

This way, not all filters are honored since the internal idx used by python is not aware of the removal while iterating. The following example code exposes this behavior:

a=[1,2]
for b in a:
    print b
    a.remove(b)

It prints 1 and the list ends with element 2.

[1] https://github.com/openstack/keystone/blob/master/keystone/common/sql/core.py#L319-L325
[2] https://github.com/openstack/keystone/blob/master/keystone/common/ldap/core.py#L1750-L1755
[3] https://github.com/openstack/keystone/blob/master/keystone/common/sql/core.py#L314
[4] https://github.com/openstack/keystone/blob/master/keystone/common/ldap/core.py#L1742

Changed in keystone:
assignee: nobody → Samuel de Medeiros Queiroz (samueldmq)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix proposed to keystone (master)

Related fix proposed to branch: master
Review: https://review.openstack.org/158412

Boris Bobrov (bbobrov)
Changed in keystone:
status: New → In Progress
description: updated
summary: - SQL is not able to honor multiple filters in driver_hints.Hints()
+ SQL/LDAP are not able to honor multiple filters in driver_hints.Hints()
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to keystone (master)

Fix proposed to branch: master
Review: https://review.openstack.org/161702

David Stanek (dstanek)
Changed in keystone:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Related fix merged to keystone (master)

Reviewed: https://review.openstack.org/158412
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=047f8744773714c5d9df171a7183bafba9d309fc
Submitter: Jenkins
Branch: master

commit 047f8744773714c5d9df171a7183bafba9d309fc
Author: Samuel de Medeiros Queiroz <email address hidden>
Date: Mon Feb 23 15:06:24 2015 -0300

    Exposes bug in SQL/LDAP when honoring driver_hints

    SQL and LDAP backends fails to honor multiple
    valued driver_hints due to a wrong manipulation
    of the list of filters.

    This patch exposes this bug.

    Related-Bug: #1424745

    Change-Id: I505cb5e1e9e63a2c93a1fda9f81f8d188e09c233

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to keystone (master)

Reviewed: https://review.openstack.org/161702
Committed: https://git.openstack.org/cgit/openstack/keystone/commit/?id=437b282001e16ae9d55ca772c2578895ae24c708
Submitter: Jenkins
Branch: master

commit 437b282001e16ae9d55ca772c2578895ae24c708
Author: Samuel de Medeiros Queiroz <email address hidden>
Date: Thu Mar 5 07:59:19 2015 -0300

    Fixes bug in SQL/LDAP when honoring driver_hints

    SQL and LDAP backends failed to honor multiple
    valued driver_hints due to a wrong manipulation
    of the list of filters.

    When iterating over the list of filters, the
    method removes elements from it at the same time.
    As result, filters in odd indexes are skipped.

    This patch fixes this bug and assert the expected
    behavior.

    Closes-Bug: #1424745

    Change-Id: Idc755de01d5dfd1013d6825c2c77436b256da096

Changed in keystone:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in keystone:
milestone: none → kilo-3
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in keystone:
milestone: kilo-3 → 2015.1.0
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.