On Feb 8, 2007, at 7:48 AM, Victor Zhestkov wrote:
When I try to search using binary filter which contains \ac directly or this symbol, Filter->parse exclud this from
filter at all.
It's a shit, I can't use such filter (&(objectClass=inetOrgPerson) (networkAddress=1#\0a\00\01\ac)) it will be converted through this function, exactly Filter->_escape and Filter- >_unescape, without \ac

I assume that filter string is in 's or you double the \'s if in "s ?

The \ac is there, it is just the ->as_string formatter is not encoding it correctly

perl -MData::Dumper -MNet::LDAP::Filter -le \
use Data::Dumper;
use Net::LDAP::Filter;

$f=Net::LDAP::Filter->new('(&(objectClass=inetOrgPerson) (networkAddress=1#\0a\00\01\ac))'); print $f->as_string,"\n",Dumper($f),unpack("H*",$f->{and}[1] {equalityMatch}{assertionValue}),"\n";



(&(objectClass=inetOrgPerson)(networkAddress=1#\0a\00\01?))
$VAR1 = bless( {
                 'and' => [
                            {
                              'equalityMatch' => {
'assertionValue' => 'inetOrgPerson', 'attributeDesc' => 'objectClass'
                                                 }
                            },
                            {
                              'equalityMatch' => {
'assertionValue' => '1#
?',
'attributeDesc' => 'networkAddress'
                                                 }
                            }
                          ]
               }, 'Net::LDAP::Filter' );
31230a0001ac

You can see from the hex at the end that it is encoded properly. However If you had your filter inside "'s like

$f=Net::LDAP::Filter->new("(&(objectClass=inetOrgPerson) (networkAddress=1#\0a\00\01\ac))");

Then the hex would look like

3123006100010763

With the attached patch then the filter will print correctly

Graham.

Attachment: filter.patch
Description: Binary data

Reply via email to