Fwd: Net::LDAP::FilterMatch issue
Graham Barr <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.ldap |
|---|---|
| Message-ID | <[email protected]> |
Begin forwarded message: > From: Adam Rosenstein <[email protected]> > Date: May 8, 2009 7:48:30 PM CDT > To: <[email protected]> > Message-Id: <1241830110.5502.7.camel@adam-60tp> > > Thanks for the awesome Net::LDAP > > When making a server and using running attr=a* filter against it I > found > it would never match beacuse: > > sub _filterMatch($@) > { > . > . > . > # handle basic filters > if ($op =~ /^(equalityMatch|greaterOrEqual|lessOrEqual|approxMatch| > substrings)/o) { > my $attr; > my $assertion; > my $match; > > if ($op eq 'substrings') { > > $attr = $args->{'type'}; > > # build a regexp as assertion value > $assertion = join('.*', map { "\Q$_\E" } map { values %$_ } > @{$args->{'substrings'}}); > $assertion = '^'. $assertion if (exists $args->{'substrings'} > [0]{'initial'}); > $assertion .= '$' if (exists $args->{'substrings'}[-1] > {'final'}); > > > Sticks a '^' into the $regex. and then > > > sub _cis_substrings($@) > { > my $regex=shift; > my $op=shift; > return 1 if ($regex =~ /^$/); > return grep(/\Q$regex\E/i, @_) ? 1 : 0; > } > > uses \Q...\E (again) and therefore tries to match \^ . > > Thanks again for your great software. >