Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base: d1bb144981
...
compare: d559ae443a
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Jul 27, 2012
@tsibley A scope of 'one' shouldn't include the base entry
From RFC 4511 section 4.5.1.2:

    singleLevel: The scope is constrained to the immediate
    subordinates of the entry named by baseObject.
5f42225
@tsibley Test that filters apply to all scopes under auto_schema d559ae4
Showing with 23 additions and 8 deletions.
  1. +2 −3 lib/Net/LDAP/Server/Test.pm
  2. +21 −5 t/05-scope.t
View
5 lib/Net/LDAP/Server/Test.pm
@@ -201,9 +201,8 @@ Only one user-level method is implemented: new().
my $dn_depth = scalar @{ ldap_explode_dn($dn) };
my $base_depth = scalar @{ ldap_explode_dn($base) };
- # If we're deeper, we're guaranteed to be under $base thanks to
- # the m// above
- next unless $dn eq $base or $dn_depth == $base_depth + 1;
+ # We're guaranteed to be at or under $base thanks to the m// above
+ next unless $dn_depth == $base_depth + 1;
}
my $entry = $Data{$dn};
View
26 t/05-scope.t
@@ -18,24 +18,26 @@ my @scopes = qw(base one sub);
my $dn = my $base = "dc=example,dc=com";
for my $level (@scopes) {
$dn = "cn=$level group,$dn";
- $ldap->add(
+ my $result = $ldap->add(
$dn,
attr => [
cn => "$level group",
objectClass => 'Group',
],
);
+ ok !$result->code, "added $dn: " . $result->error;
}
# Do scopes work?
my %expected = (
- 'base' => 1,
- 'one' => 2,
- 'sub' => 3,
+ 'base' => [qw(base)],
+ 'one' => [qw(one)],
+ 'sub' => [qw(base one sub)],
);
for my $scope (@scopes) {
- my $count = $expected{$scope};
+ my $cns = $expected{$scope};
+ my $count = scalar @$cns;
my $msg = $ldap->search(
base => "cn=base group,$base",
scope => $scope,
@@ -43,6 +45,20 @@ for my $scope (@scopes) {
);
ok $msg, "searched with scope $scope";
is $msg->count, $count, "found $count";
+
+ my %want = map { ("$_ group" => 1) } @$cns;
+ my %found = map { ($_->get_value('cn') => 1) } $msg->entries;
+ is((scalar grep { !$found{$_} } keys %want), 0, "found all expected CNs");
+ is((scalar grep { !$want{$_} } keys %found), 0, "expected all found CNs");
+
+ # test that filters apply correctly on all scopes
+ $msg = $ldap->search(
+ base => "cn=base group,$base",
+ scope => $scope,
+ filter => '(objectClass=404)',
+ );
+ ok $msg, "searched with scope $scope with a non-matching filter";
+ is $msg->count, 0, "found no entries";
}
ok $ldap->unbind, "unbound";

No commit comments for this range

Something went wrong with that request. Please try again.