Skip to content

Conversation

@sunweaver
Copy link
Contributor

@sunweaver sunweaver commented Nov 26, 2020

LDAP DNs in LDAP servers are normally matched in a case-insensitive way. So for MockLDAP, we search our mock directory and try to find a case-insensitive match of the given DN.

Saying this, we always have to return the requested DN with the capitalization as stored in our mock LDAP directory. Otherwise, MockLDAP would behave differently from live LDAP server.

This PR includes the changes from PR #18. So, please, look at #18 first, merge it and then proceed to this PR.

…stent keys of MockLDAP.directory.

 The implementation of the internal MockLDAP.directory dictionary is
 defined via

    self.directory = defaultdict(lambda: {})

 This results in a dictionary that always returns an empty dict for any
 key requested:

    >>> print (self.directory['some_key'])
    {}

 Thus, we cannot rely on the raisal of KeyError exceptions when accessing
 a non-existing LDAP DNs in the MockLDAP.directory.

 Instead, we check if MockLDAP.directory['some_key'] returns an empty
 dict {} value.
…und in the mock directory.

 LDAP DNs in LDAP servers are normally matched in a case-insensitive way.
 So for MockLDAP, we search our mock directory and try to find a
 case-insensitive match of the given DN.

 Saying this, we always have to return the requested DN with the
 capitalization as stored in our mock LDAP directory. Otherwise, MockLDAP
 would behave differently from live LDAP server.
@sunweaver
Copy link
Contributor Author

Please wait with the PR unti #21 has been finally merged. Thanks!

@sunweaver sunweaver changed the title Match DNs in a case-insensitive way, always use the object's DN as found in the mock directory. WIP: Match DNs in a case-insensitive way, always use the object's DN as found in the mock directory. Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant