8000 Produce textual error messages for LDAP issues instead of numeric codes · postgrespro/postgres_cluster@edc9109 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit edc9109

Browse files
committed
Produce textual error messages for LDAP issues instead of numeric codes
1 parent 70bc583 commit edc9109

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/backend/libpq/auth.c

Lines changed: 9 additions & 10 deletions
< 318D /tr>
Original file line numberDiff line numberDiff line change
@@ -2037,8 +2037,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
20372037
{
20382038
#ifndef WIN32
20392039
ereport(LOG,
2040-
(errmsg("could not initialize LDAP: error code %d",
2041-
errno)));
2040+
(errmsg("could not initialize LDAP: %m")));
20422041
#else
20432042
ereport(LOG,
20442043
(errmsg("could not initialize LDAP: error code %d",
@@ -2051,7 +2050,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
20512050
{
20522051
ldap_unbind(*ldap);
20532052
ereport(LOG,
2054-
(errmsg("could not set LDAP protocol version: error code %d", r)));
2053+
(errmsg("could not set LDAP protocol version: %s", ldap_err2string(r))));
20552054
return STATUS_ERROR;
20562055
}
20572056

@@ -2104,7 +2103,7 @@ InitializeLDAPConnection(Port *port, LDAP **ldap)
21042103
{
21052104
ldap_unbind(*ldap);
21062105
ereport(LOG,
2107-
(errmsg("could not start LDAP TLS session: error code %d", r)));
2106+
(errmsg("could not start LDAP TLS session: %s", ldap_err2string(r))));
21082107
return STATUS_ERROR;
21092108
}
21102109
}
@@ -2193,8 +2192,8 @@ CheckLDAPAuth(Port *port)
21932192
if (r != LDAP_SUCCESS)
21942193
{
21952194
ereport(LOG,
2196-
(errmsg("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\": error code %d",
2197-
port->hba->ldapbinddn, port->hba->ldapserver, r)));
2195+
(errmsg("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\": %s",
2196+
port->hba->ldapbinddn, port->hba->ldapserver, ldap_err2string(r))));
21982197
return STATUS_ERROR;
21992198
}
22002199

@@ -2218,8 +2217,8 @@ CheckLDAPAuth(Port *port)
22182217
if (r != LDAP_SUCCESS)
22192218
{
22202219
ereport(LOG,
2221-
(errmsg("could not search LDAP for filter \"%s\" on server \"%s\": error code %d",
2222-
filter, port->hba->ldapserver, r)));
2220+
(errmsg("could not search LDAP for filter \"%s\" on server \"%s\": %s",
2221+
filter, port->hba->ldapserver, ldap_err2string(r))));
22232222
pfree(filter);
22242223
return STATUS_ERROR;
22252224
}
@@ -2306,8 +2305,8 @@ CheckLDAPAuth(Port *port)
23062305
if (r != LDAP_SUCCESS)
23072306
{
23082307
ereport(LOG,
2309-
(errmsg("LDAP login failed for user \"%s\" on server \"%s\": error code %d",
2310-
fulluser, port->hba->ldapserver, r)));
2308+
(errmsg("LDAP login failed for user \"%s\" on server \"%s\": %s",
2309+
fulluser, port->hba->ldapserver, ldap_err2string(r))));
23112310
pfree(fulluser);
23122311
return STATUS_ERROR;
23132312
}

0 commit comments

Comments
 (0)
0