freeing LDAPMessage in CheckLDAPAuth
Zhihong Yu <zyu@yugabyte.com>
From: Zhihong Yu <zyu@yugabyte.com>
To: PostgreSQL Developers <pgsql-hackers@lists.postgresql.org>
Date: 2022-09-04T00:00:30Z
Lists: pgsql-hackers
Attachments
- ldap-msg-free.patch (application/octet-stream) patch
Hi,
In CheckLDAPAuth(), around line 2606:
if (r != LDAP_SUCCESS)
{
ereport(LOG,
(errmsg("could not search LDAP for filter \"%s\" on
server \"%s\": %s",
It seems that the call to ldap_msgfree() is missing in the above case.
According to
https://www.openldap.org/software//man.cgi?query=ldap_search_s&sektion=3&apropos=0&manpath=OpenLDAP+2.4-Release
:
Note that *res* parameter of *ldap*_*search*_*ext*_*s()*
and *ldap*_*search*_*s()*
should be freed with *ldap*_*msgfree()* regardless of return
value of these
functions.
Please see the attached patch which frees the search_message in the above case.
Thanks
Commits
-
Free correctly LDAPMessage returned by ldap_search_s() in auth.c
- 799437e0bd32 16.0 landed