summaryrefslogtreecommitdiff
path: root/src/test/ldap
diff options
context:
space:
mode:
authorThomas Munro2018-11-13 04:39:36 +0000
committerThomas Munro2018-11-13 04:46:28 +0000
commit257ef3cd4fec7ca1213f31b660486b492b1c7031 (patch)
tree74d5537fc7d0fe86bcf267901ee2ffff14c111a5 /src/test/ldap
parent6a3dcd28568a04b6e4aea2bf41ea2c7e9c7b0e96 (diff)
Fix handling of HBA ldapserver with multiple hostnames.
Commit 35c0754f failed to handle space-separated lists of alternative hostnames in ldapserver, when building a URI for ldap_initialize() (OpenLDAP). Such lists need to be expanded to space-separated URIs. Repair. Back-patch to 11, to fix bug report #15495. Author: Thomas Munro Reported-by: Renaud Navarro Discussion: https://postgr.es/m/15495-2c39fc196c95cd72%40postgresql.org
Diffstat (limited to 'src/test/ldap')
-rw-r--r--src/test/ldap/t/001_auth.pl18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/test/ldap/t/001_auth.pl b/src/test/ldap/t/001_auth.pl
index 67b406c981b..431ad6442c3 100644
--- a/src/test/ldap/t/001_auth.pl
+++ b/src/test/ldap/t/001_auth.pl
@@ -6,7 +6,7 @@ use Test::More;
if ($ENV{with_ldap} eq 'yes')
{
- plan tests => 19;
+ plan tests => 22;
}
else
{
@@ -179,6 +179,22 @@ test_access($node, 'test1', 2,
$ENV{"PGPASSWORD"} = 'secret1';
test_access($node, 'test1', 0, 'search+bind authentication succeeds');
+note "multiple servers";
+
+unlink($node->data_dir . '/pg_hba.conf');
+$node->append_conf('pg_hba.conf',
+ qq{local all all ldap ldapserver="$ldap_server $ldap_server" ldapport=$ldap_port ldapbasedn="$ldap_basedn"}
+);
+$node->restart;
+
+$ENV{"PGPASSWORD"} = 'wrong';
+test_access($node, 'test0', 2,
+ 'search+bind authentication fails if user not found in LDAP');
+test_access($node, 'test1', 2,
+ 'search+bind authentication fails with wrong password');
+$ENV{"PGPASSWORD"} = 'secret1';
+test_access($node, 'test1', 0, 'search+bind authentication succeeds');
+
note "LDAP URLs";
unlink($node->data_dir . '/pg_hba.conf');