Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

Commit6bd1760

Browse files
committed
Improve some LDAP authentication error messages
1 parentce75457 commit6bd1760

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎src/backend/libpq/auth.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,6 +2161,7 @@ CheckLDAPAuth(Port *port)
21612161
char*attributes[2];
21622162
char*dn;
21632163
char*c;
2164+
intcount;
21642165

21652166
/*
21662167
* Disallow any characters that we would otherwise need to escape,
@@ -2223,17 +2224,21 @@ CheckLDAPAuth(Port *port)
22232224
returnSTATUS_ERROR;
22242225
}
22252226

2226-
if (ldap_count_entries(ldap,search_message)!=1)
2227+
count=ldap_count_entries(ldap,search_message);
2228+
if (count!=1)
22272229
{
2228-
if (ldap_count_entries(ldap,search_message)==0)
2230+
if (count==0)
22292231
ereport(LOG,
2230-
(errmsg("LDAP search failed for filter \"%s\" on server \"%s\": no such user",
2231-
filter,port->hba->ldapserver)));
2232+
(errmsg("LDAP user \"%s\" does not exist",port->user_name),
2233+
errdetail("LDAP search for filter \"%s\" on server \"%s\" returned no entries.",
2234+
filter,port->hba->ldapserver)));
22322235
else
22332236
ereport(LOG,
2234-
(errmsg("LDAP search failed for filter \"%s\" on server \"%s\": user is not unique (%ld matches)",
2235-
filter,port->hba->ldapserver,
2236-
(long)ldap_count_entries(ldap,search_message))));
2237+
(errmsg("LDAP user \"%s\" is not unique",port->user_name),
2238+
errdetail_plural("LDAP search for filter \"%s\" on server \"%s\" returned %d entry.",
2239+
"LDAP search for filter \"%s\" on server \"%s\" returned %d entries.",
2240+
count,
2241+
filter,port->hba->ldapserver,count)));
22372242

22382243
pfree(filter);
22392244
ldap_msgfree(search_message);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp