Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

FilterMatch.pm: improve distinguishedNameMatch

  • Loading branch information...
commit c8d3ae8fd75925f4a935865796ba3c264eb927e3 1 parent 107b462
@marschap marschap authored
Showing with 13 additions and 3 deletions.
  1. +13 −3 lib/Net/LDAP/FilterMatch.pm
View
16 lib/Net/LDAP/FilterMatch.pm
@@ -14,7 +14,7 @@ use strict;
use Net::LDAP::Filter;
use Net::LDAP::Schema;
-our $VERSION = '0.22';
+our $VERSION = '0.23';
sub import {
shift;
@@ -25,7 +25,7 @@ sub import {
package Net::LDAP::Filter;
-use Net::LDAP::Util qw(ldap_explode_dn);
+use Net::LDAP::Util qw(canonical_dn ldap_explode_dn);
our @approxMatchers = qw(
String::Approx
@@ -37,6 +37,7 @@ sub _filterMatch($@);
# specific matching rules
sub _booleanMatch($$@);
+sub _distinguishedNameMatch($$@);
sub _integerBitAndMatch($$@);
sub _integerBitOrMatch($$@);
@@ -81,7 +82,6 @@ sub _exact_substrings($$@);
*_CSNSIDMatch = \&_exact_equalityMatch; # this may need to be reworked
#*_directoryComponentsMatch
*_directoryStringApproxMatch = \&_cis_approxMatch;
-*_distinguishedNameMatch = \&_exact_equalityMatch;
#*_dnOneLevelMatch
#*_dnSubordinateMatch
#*_dnSubtreeMatch
@@ -258,6 +258,16 @@ sub _booleanMatch($$@)
return grep(/^\Q$assertion\E$/i, @_) ? 1 : 0;
}
+sub _distinguishedNameMatch($$@)
+{
+ my $assertion = canonical_dn(shift);
+ my $op = shift;
+ my @vals = map { canonical_dn($_) } @_;
+
+ return undef if (!defined($assertion));
+ return grep(/^\Q$assertion\E$/i, @vals) ? 1 : 0;
+}
+
sub _integerBitAndMatch($$@)
{
my $assertion = shift;
Please sign in to comment.
Something went wrong with that request. Please try again.