Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Zend\Ldap\Dn::isChildOf - should it be case insensitive?  #54

@gvde

Description

@gvde

This is a "reopen" of zendframework/zendframework#6299

I just ran into the same problem. The comparison in isChildOf is case sensitive in regard to the attribute values (not the attribute names which have been changed to lower case before). This is incorrect if the attribute is, for instance, of type DirectoryString using matching rule caseIgnoreMatch for equality match.

For example, we use base DN "ou=people,o=ldap". A user DN might be "uid=test,ou=People,o=ldap" (note the capital "P").

isChildOf won't match in this case, even though the user DN is of a child of the base DN. This is incorrect as the ou attribute must be checked case insensitive.

As a quick workaround I modified the line

if ($cdn[$i + $startIndex] != $pdn[$i]) {

in Dn.php to this test:

$result = array_udiff_uassoc($cdn[$i + $startIndex], $cdn[$i + $startIndex], 'strcasecmp', 'strcasecmp');
if (! empty($result) ) {

This compares attribute names and values case insensitive. Of course, this is not complete as whitespace should be removed as well and some attributes in the DN might actually be case sensitive. Thus I guess ideally, the test should be done by an ldap query instead...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions