Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connector/ldap: treat attributes as case-insensitive all the way #1251

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

srenatus
Copy link
Contributor

LDAP itself doesn't match attributes case-sensitively, so a query for

(fOO=bar)

will return all the entries having foo: bar, regardless of how the
attribute name is defined in the schema.

However, the result entries we get will have the case according to what
the server returned. So, assuming the schema calls it foo, this is
what we're given.

Now, for certain attributes that are user-configurable -- NameAttr for
example -- this can cause trouble: the query returns the right results,
but the LDAP connector can't make sense of it as it's looking for an
attribute called fOO.

The real life case underlying this conundrum is Active Directory's
sAMAccountName.

Note that this is a bit of a workaround. Ideally, we'd use
(*ldap.Entry).GetAttributes(string) []string to access the attributes;
but until the case sensitivity issue is fixed there1, changing the way
we read the results doesn't help us.

LDAP itself doesn't match attributes case-sensitively, so a query for

    (fOO=bar)

will return all the entries having `foo: bar`, regardless of how the
attribute name is defined in the schema.

However, the result entries we get will have the case according to what
the server returned. So, assuming the schema calls it `foo`, this is
what we're given.

Now, for certain attributes that are user-configurable -- NameAttr for
example -- this can cause trouble: the query returns the right results,
but the LDAP connector can't make sense of it as it's looking for an
attribute called `fOO`.

The real life case underlying this conundrum is Active Directory's
sAMAccountName.

Note that this is a bit of a workaround. Ideally, we'd use
`(*ldap.Entry).GetAttributes(string) []string` to access the attributes;
but until the case sensitivity issue is fixed there[1], changing the way
we read the results doesn't help us.

[1]: go-ldap/ldap#111

Signed-off-by: Stephan Renatus <srenatus@chef.io>
@srenatus
Copy link
Contributor Author

srenatus commented Jul 4, 2018

Does anyone have a moment to consider this, please? 😃

@srenatus
Copy link
Contributor Author

srenatus commented Sep 6, 2018

@ericchiang Another small LDAP improvement I'd like to get in. Any thoughts? 😃

@sks
Copy link
Contributor

sks commented Sep 6, 2018

Does it make sense to do case insensitive test for DN as well ?

I had small case dn in my config and it took me 30 mins to figure out this issue.

Just started reading http://www.zytrax.com/books/ldap/

@srenatus
Copy link
Contributor Author

srenatus commented Sep 6, 2018

@sks I frequently find https://ldapwiki.com/ quite useful, too. 😃

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.

2 participants