aboutsummaryrefslogtreecommitdiff
path: root/src/backend/libpq/auth.c
diff options
context:
space:
mode:
authorPeter Eisentraut <peter_e@gmx.net>2017-11-10 14:21:32 -0500
committerPeter Eisentraut <peter_e@gmx.net>2017-11-10 14:21:32 -0500
commit0c98d0dd5c85ce0c8485ae1a8351a26b83c4338b (patch)
tree6487961a2f5be579752f732a9aed7a33be401f66 /src/backend/libpq/auth.c
parent0e1539ba0d0a43de06c6e0572a565e73b9472538 (diff)
downloadpostgresql-0c98d0dd5c85ce0c8485ae1a8351a26b83c4338b.tar.gz
postgresql-0c98d0dd5c85ce0c8485ae1a8351a26b83c4338b.zip
Fix some null pointer dereferences in LDAP auth code
An LDAP URL without a host name such as "ldap://" or without a base DN such as "ldap://localhost" would cause a crash when reading pg_hba.conf. If no binddn is configured, an error message might end up trying to print a null pointer, which could crash on some platforms. Author: Thomas Munro <thomas.munro@enterprisedb.com> Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
Diffstat (limited to 'src/backend/libpq/auth.c')
-rw-r--r--src/backend/libpq/auth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c
index 6505b1f2b9b..6c915a72890 100644
--- a/src/backend/libpq/auth.c
+++ b/src/backend/libpq/auth.c
@@ -2520,7 +2520,8 @@ CheckLDAPAuth(Port *port)
{
ereport(LOG,
(errmsg("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\": %s",
- port->hba->ldapbinddn, port->hba->ldapserver,
+ port->hba->ldapbinddn ? port->hba->ldapbinddn : "",
+ port->hba->ldapserver,
ldap_err2string(r)),
errdetail_for_ldap(ldap)));
ldap_unbind(ldap);