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

Commit6290646

Browse files
committed
Fix some null pointer dereferences in LDAP auth code
An LDAP URL without a host name such as "ldap://" or without a base DNsuch 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 anull pointer, which could crash on some platforms.Author: Thomas Munro <thomas.munro@enterprisedb.com>Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
1 parent89afa72 commit6290646

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

‎src/backend/libpq/auth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2226,7 +2226,8 @@ CheckLDAPAuth(Port *port)
22262226
{
22272227
ereport(LOG,
22282228
(errmsg("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\": %s",
2229-
port->hba->ldapbinddn,port->hba->ldapserver,ldap_err2string(r))));
2229+
port->hba->ldapbinddn ?port->hba->ldapbinddn :"",
2230+
port->hba->ldapserver,ldap_err2string(r))));
22302231
returnSTATUS_ERROR;
22312232
}
22322233

‎src/backend/libpq/hba.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,9 +1471,11 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline, int line_num)
14711471
return false;
14721472
}
14731473

1474-
hbaline->ldapserver=pstrdup(urldata->lud_host);
1474+
if (urldata->lud_host)
1475+
hbaline->ldapserver=pstrdup(urldata->lud_host);
14751476
hbaline->ldapport=urldata->lud_port;
1476-
hbaline->ldapbasedn=pstrdup(urldata->lud_dn);
1477+
if (urldata->lud_dn)
1478+
hbaline->ldapbasedn=pstrdup(urldata->lud_dn);
14771479

14781480
if (urldata->lud_attrs)
14791481
hbaline->ldapsearchattribute=pstrdup(urldata->lud_attrs[0]);/* only use first one */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp