develooper Front page | perl.ldap | Postings from July 2011

Re: Problem with LDAP search filter containing a backslash ('\')

Thread Previous | Thread Next
From:
Chris Ridd
Date:
July 20, 2011 05:27
Subject:
Re: Problem with LDAP search filter containing a backslash ('\')
Message ID:
ABECF5AD-6877-4148-A136-989415EFA1A3@mac.com

On 20 Jul 2011, at 13:12, Clément OUDOT wrote:

> And what about doing this:
> 
> $filter = Net::LDAP::Filter::_escape( $filter );
> 
> Would this work?
> 

That's an internal method used to escape assertion values. If you run it on the whole filter string it will also escape the other characters that are special in LDAP search filter strings.

eg: Net::LDAP::Filter::_escape("(cn=foo)") returns '\28cn=foo\29'.

That is because "(" and ")" are special characters.

So you can't usefully run it on the entire filter string. You *could* run it on each assertion value you're using, with the caveat that it isn't a public supported method.

Graham, should _escape be made public? It seems like it would be useful. Or is manipulating the data structure returned from new the better approach?

Chris
Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About