Skip to content

Conversation

sahglie
Copy link
Contributor

@sahglie sahglie commented Sep 5, 2013

ruby-net-ldap is choking on queries that work with our university LDAP using the ldapsearch utility. Here is an example of such a query:

ldapsearch -H ldaps://ldap.berkeley.edu -x -D "<bind>" -W -s sub -b "ou=people,dc=berkeley,dc=edu" "(&(objectclass=person)(ismemberof=cn=edu:berkeley:app:calmessages:deans,ou=campus groups,dc=berkeley,dc=edu))" "uid"

In this case, ruby-net-ldap would raise Net::LDAP::LdapError: Invalid filter syntax

I've also run this query using the python ldap library and like ldapsearch it works fine.

While debugging this I isolated the problem down to the parse_filter_branch method: the scanner doesn't include ':' in its regex when--I believe--it should. After updating the regex everything worked as expected for me. Please let me know if you have any questions.

@slbug
Copy link

slbug commented Apr 4, 2014

also '/' valid too

2.1.1 :010 > Net::LDAP::Filter.construct("(|(loginShell=/bin/bash)(loginShell=/bin/zsh))")
Net::LDAP::LdapError: Invalid filter syntax.
2.1.1 :002 > (Net::LDAP::Filter.eq('loginShell', '/bin/bash') | Net::LDAP::Filter.eq('loginShell', '/bin/zsh')).to_s
 => "(|(loginShell=/bin/bash)(loginShell=/bin/zsh))" 

schaary added a commit that referenced this pull request Aug 4, 2014
colons are ':' valid filter characters
@schaary schaary merged commit bbf351b into ruby-ldap:master Aug 4, 2014
astratto pushed a commit to astratto/ruby-net-ldap that referenced this pull request Dec 18, 2015
colons are ':' valid filter characters
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.

3 participants