Permalink
Browse files

Tests: Add to LDAP the base DN under which we search for users/groups

Net::LDAP::Server::Test versions after 0.14 started, correctly,
returning "No such object" if the search base didn't exist.  Previously
it didn't care if the base existed or not.
  • Loading branch information...
1 parent 61fd793 commit fe97ee4c7395fca62c90d516764604c800deda6c @tsibley tsibley committed Oct 26, 2012
Showing with 10 additions and 4 deletions.
  1. +4 −2 xt/ldap.t
  2. +1 −0 xt/ldap_escaping.t
  3. +1 −0 xt/ldap_group.t
  4. +4 −2 xt/ldap_privileged.t
View
@@ -17,14 +17,16 @@ ok( my $server = Net::LDAP::Server::Test->new( $ldap_port, auto_schema => 1 ),
my $ldap = Net::LDAP->new("localhost:$ldap_port");
$ldap->bind();
my $username = "testuser";
-my $dn = "uid=$username,dc=bestpractical,dc=com";
+my $base = "dc=bestpractical,dc=com";
+my $dn = "uid=$username,$base";
my $entry = {
cn => $username,
mail => "$username\@invalid.tld",
uid => $username,
objectClass => 'User',
userPassword => 'password',
};
+$ldap->add( $base );
$ldap->add( $dn, attr => [%$entry] );
RT->Config->Set( ExternalAuthPriority => ['My_LDAP'] );
@@ -37,7 +39,7 @@ RT->Config->Set(
'My_LDAP' => {
'type' => 'ldap',
'server' => "127.0.0.1:$ldap_port",
- 'base' => 'dc=bestpractical,dc=com',
+ 'base' => $base,
'filter' => '(objectClass=*)',
'd_filter' => '()',
'tls' => 0,
View
@@ -20,6 +20,7 @@ $ldap->bind();
my $users_dn = "ou=users,dc=bestpractical,dc=com";
my $group_dn = "cn=test group,ou=groups,dc=bestpractical,dc=com";
+$ldap->add($users_dn);
$ldap->add(
"cn=Smith\\, John,$users_dn",
attr => [
View
@@ -25,6 +25,7 @@ $ldap->bind();
my $users_dn = "ou=users,dc=bestpractical,dc=com";
my $group_dn = "cn=test group,ou=groups,dc=bestpractical,dc=com";
+$ldap->add($users_dn);
for (1 .. 3) {
my $uid = "testuser$_";
my $entry = {
@@ -16,14 +16,16 @@ ok( my $server = Net::LDAP::Server::Test->new( $ldap_port, auto_schema => 1 ),
my $ldap = Net::LDAP->new("localhost:$ldap_port");
$ldap->bind();
my $username = "testuser";
-my $dn = "uid=$username,dc=bestpractical,dc=com";
+my $base = "dc=bestpractical,dc=com";
+my $dn = "uid=$username,$base";
my $entry = {
cn => $username,
mail => "$username\@invalid.tld",
uid => $username,
objectClass => 'User',
userPassword => 'password',
};
+$ldap->add( $base );
$ldap->add( $dn, attr => [%$entry] );
RT->Config->Set( ExternalAuthPriority => ['My_LDAP'] );
@@ -36,7 +38,7 @@ RT->Config->Set(
'My_LDAP' => {
'type' => 'ldap',
'server' => "127.0.0.1:$ldap_port",
- 'base' => 'dc=bestpractical,dc=com',
+ 'base' => $base,
'filter' => '(objectClass=*)',
'tls' => 0,
'net_ldap_args' => [ version => 3 ],

0 comments on commit fe97ee4

Please sign in to comment.