3

I'm using ldapsearch command to query an OpenLDAP server and, while working fine for most uses, isn't very smart regarding special characters as found in languages like spanish or french.

I mean, if I execute the query:

ldapsearch -h myhost "givenName=Ramón"

It will output people whose name is Ramón, but it won't ouput those whose name is input as Ramon (which is pretty frequent in order to avoid problems with special characters). I can be smart and just execute the query as:

ldapsearch -h myhost "givenName=Ram*n"

And it works fine, outputting all possible variations, but I wonder if there's some way to tell ldapsearch to just include accented versions of the characters in the search, so a search for Ramon includes both Ramon and Ramón results. Most search engines already do it nowadays, so perhaps there's a way to do it with LDAP.

Thanks in advance

jesjimher
  • 1,175
  • 1
  • 12
  • 17

1 Answers1

0

You will need to escape the string according to RFC 4515 String Representation of Search Filters

Generally, you need to escape the items listed in RFC 4515 String Representation of Search Filters and I would suggest, also any non-UTF8 character.

I also found some methods that may be helpful to get your started.

Finally, quit it. Start populating an searching for Description or some other non-naming attribute. (any attribute that is not part of the DN) Make your DNs never changing. No user should ever see a DN which should be only a path to an entry. You will have issues with many "off-the-shelve" tools if you continue this practice.

As far as returning "a" instead of an "umlaut" (or some thing like it). The good news is LDAP is lightweight and does not have all those fancy functions that do all the work for programmers. The bad news is the same.

LDAP does not provide any such capabilities to transform charters as you desire.

jwilleke
  • 10,467
  • 1
  • 30
  • 51
  • 2
    My problem isn't solved by escaping, in fact I can already perform searches with accented characters without problems. What I would like to achieve is that a single search, let's say for a word containing letter 'a', returned as results all appearances of letter a, but also those where the a is accented/umlauted/whatever. Right now it doesn't happen with ldapsearch, since every different version of 'a' has a different UTF-8 code and thus ldapsearch considers them as different characters, but treating all accented versions of a character as the same is standard behaviour in most search engines. – jesjimher May 26 '16 at 08:21