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

Commitf9e2885

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 parentd33fc27 commitf9e2885

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
@@ -2474,7 +2474,8 @@ CheckLDAPAuth(Port *port)
24742474
{
24752475
ereport(LOG,
24762476
(errmsg("could not perform initial LDAP bind for ldapbinddn \"%s\" on server \"%s\": %s",
2477-
port->hba->ldapbinddn,port->hba->ldapserver,ldap_err2string(r))));
2477+
port->hba->ldapbinddn ?port->hba->ldapbinddn :"",
2478+
port->hba->ldapserver,ldap_err2string(r))));
24782479
pfree(passwd);
24792480
returnSTATUS_ERROR;
24802481
}

‎src/backend/libpq/hba.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,9 +1721,11 @@ parse_hba_auth_opt(char *name, char *val, HbaLine *hbaline,
17211721
return false;
17221722
}
17231723

1724-
hbaline->ldapserver=pstrdup(urldata->lud_host);
1724+
if (urldata->lud_host)
1725+
hbaline->ldapserver=pstrdup(urldata->lud_host);
17251726
hbaline->ldapport=urldata->lud_port;
1726-
hbaline->ldapbasedn=pstrdup(urldata->lud_dn);
1727+
if (urldata->lud_dn)
1728+
hbaline->ldapbasedn=pstrdup(urldata->lud_dn);
17271729

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp