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

Commitba06acf

Browse files
michaelpqpull[bot]
authored andcommitted
Free correctly LDAPMessage returned by ldap_search_s() in auth.c
The LDAP wiki states that the search message should be freed regardlessof the return value of ldap_search_s(), but we failed to do so in onebackend code path when searching LDAP with a filter. This is notcritical in an authentication code path failing in the backend as thiscauses such the process to exit promptly, but let's be clean and freethe search message appropriately, as documented by upstream.All the other code paths failing a LDAP operation do that already, andsomebody looking at this code in the future may miss what LDAP expectswith the search message.Author: Zhihong YuDiscussion:https://postgr.es/m/CALNJ-vTf5Y+8RtzZ4GjOGE9qWVHZ8awfhnFYc_qGm8fMLUNRAg@mail.gmail.com
1 parent813c884 commitba06acf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/libpq/auth.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,7 @@ CheckLDAPAuth(Port *port)
25682568
else
25692569
filter=psprintf("(uid=%s)",port->user_name);
25702570

2571+
search_message=NULL;
25712572
r=ldap_search_s(ldap,
25722573
port->hba->ldapbasedn,
25732574
port->hba->ldapscope,
@@ -2582,6 +2583,8 @@ CheckLDAPAuth(Port *port)
25822583
(errmsg("could not search LDAP for filter \"%s\" on server \"%s\": %s",
25832584
filter,server_name,ldap_err2string(r)),
25842585
errdetail_for_ldap(ldap)));
2586+
if (search_message!=NULL)
2587+
ldap_msgfree(search_message);
25852588
ldap_unbind(ldap);
25862589
pfree(passwd);
25872590
pfree(filter);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp