Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6c4637a

Browse files
committed
Disallow empty passwords in LDAP authentication, the same way
we already do it for PAM.
1 parent 4183b10 commit 6c4637a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/backend/libpq/auth.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.182 2009/06/11 14:48:57 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/libpq/auth.c,v 1.183 2009/06/25 11:30:08 mha Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -2066,6 +2066,13 @@ CheckLDAPAuth(Port *port)
20662066
if (passwd == NULL)
20672067
return STATUS_EOF; /* client wouldn't send password */
20682068

2069+
if (strlen(passwd) == 0)
2070+
{
2071+
ereport(LOG,
2072+
(errmsg("empty password returned by client")));
2073+
return STATUS_ERROR;
2074+
}
2075+
20692076
ldap = ldap_init(port->hba->ldapserver, port->hba->ldapport);
20702077
if (!ldap)
20712078
{

0 commit comments

Comments
 (0)