Thread: [COMMITTERS] pgsql: Improve LDAP cleanup code in error paths.

[COMMITTERS] pgsql: Improve LDAP cleanup code in error paths.

From
Peter Eisentraut
Date:
Improve LDAP cleanup code in error paths.

After calling ldap_unbind_s() we probably shouldn't try to use the LDAP
connection again to call ldap_get_option(), even if it failed.  The OpenLDAP
man page for ldap_unbind[_s] says "Once it is called, the connection to the
LDAP server is closed, and the ld structure is invalid."  Otherwise, as a
general rule we should probably call ldap_unbind() before returning in all
paths to avoid leaking resources.  It is unlikely there is any practical
leak problem since failure to authenticate currently results in the backend
exiting soon afterwards.

Author: Thomas Munro
Reviewed-By: Alvaro Herrera, Peter Eisentraut
Discussion: https://postgr.es/m/20170914141205.eup4kxzlkagtmfac%40alvherre.pgsql

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1feff99fe4576d4685c14dff18d1f845a1456f10

Modified Files
--------------
src/backend/libpq/auth.c | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)


--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers