diff --git a/src/backend/libpq/auth.c b/src/backend/libpq/auth.c index bf94e941e42..f9d4488d569 100644 --- a/src/backend/libpq/auth.c +++ b/src/backend/libpq/auth.c @@ -2013,7 +2013,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, ldap_err2string(r)))); + port->hba->ldapbinddn ? port->hba->ldapbinddn : "", + port->hba->ldapserver, ldap_err2string(r)))); return STATUS_ERROR; } diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index 2aac2299b9d..a9506fe7f0c 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -1453,9 +1453,11 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, int line_num) return false; } - hbaline->ldapserver = pstrdup(urldata->lud_host); + if (urldata->lud_host) + hbaline->ldapserver = pstrdup(urldata->lud_host); hbaline->ldapport = urldata->lud_port; - hbaline->ldapbasedn = pstrdup(urldata->lud_dn); + if (urldata->lud_dn) + hbaline->ldapbasedn = pstrdup(urldata->lud_dn); if (urldata->lud_attrs) hbaline->ldapsearchattribute = pstrdup(urldata->lud_attrs[0]); /* only use first one */