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

[email protected] (Clément OUDOT)
Newsgroups perl.ldap
Message-ID <CAK_oV49F9_Uu8nhjHiyi-9SmayGpqn2dT1LOe8WrXQMLagD4WA@mail.gmail.com>
Hi,

I have a piece of code where I build a search filter with some
variables, like this:

    my $searchFilter =
      "(&(objectClass=" . $portal->{ldapGroupObjectClass} . ")(|";
    foreach ( split( $portal->{multiValuesSeparator}, $value ) ) {
        $searchFilter .= "(" . $key . "=" . $_ . ")";
    }
    $searchFilter .= "))";

This works well, excepted when the value (in the key=value syntax)
contains a backslash ('\'). This is the case for example if the value
is a DN like this : cn=OUDOT\, Clement, ou=users, dc=example, dc=com

To make this works, I added this line :

$searchFilter =~ s/\\/\\\\/;


My question: is this a bug in my code, or can this be a Perl-LDAP bug?
I am using version 0.4001.


Thanks for your help,


Clément OUDOT
http://lemonldap-ng.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.