BUG #15495: Ldap authentication not working with multiple server in Postgresql 11

The Post Office <noreply@postgresql.org>

From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: rnavarro@nocibe.fr
Date: 2018-11-09T15:47:59Z
Lists: pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15495
Logged by:          Renaud Navarro
Email address:      rnavarro@nocibe.fr
PostgreSQL version: 11.1
Operating system:   Oracle Linux 7.5
Description:        

Hi

After upgrade database from postgresql 10.5 to postgresql 11.1, LDAP
authentication no longer work with multiple ldap server specified.
The pg_hba.conf have the following line :
hostssl    all             all             172.20.0.0/16           ldap
ldapserver="dcinfrap01s.nocibe.net dcinfrap02s.nocibe.net"
ldapprefix="NOCIBE\" ldaptls=1 "
I have the following error in log file :
2018-11-09 16:32:45.407 CET [29629] LOG:  could not initialize LDAP: Bad
parameter to an ldap routine
2018-11-09 16:32:45.408 CET [29629] FATAL:  LDAP authentication failed for
user "admin_rnavarro"
If I modify the pg_hba.conf with one LDAP server, the authentication is
working.
The same entry with postgresql 10.5 work perfectly

Thanks for helping me

Kind Regards

Commits

  1. Fix handling of HBA ldapserver with multiple hostnames.

  2. Allow ldaps when using ldap authentication