pgsql: Improve LDAP cleanup code in error paths.

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Improve LDAP cleanup code in error paths.
Date: 2017-10-13 02:55:07
Message-ID: E1e2q7v-00086O-GA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-10-13 03:51:00 pgsql: Attempt to fix LDAP build
Previous Message Tom Lane 2017-10-13 02:44:20 Re: pgsql: Improve performance of SendRowDescriptionMessage.