Remove unnecessary unbind in LDAP search+bind mode

Peter Eisentraut <peter@eisentraut.org>

Commit: f8d03ea727e48c894174c4e5e6ebafc3a17ab3f7
Author: Peter Eisentraut <peter@eisentraut.org>
Date: 2023-07-09T06:51:46Z
Releases: 17.0
Remove unnecessary unbind in LDAP search+bind mode

Comments in src/backend/libpq/auth.c say: (after successfully finding
the final DN to check the user-supplied password against)

/* Unbind and disconnect from the LDAP server */

and later

/*
 * Need to re-initialize the LDAP connection, so that we can bind to
 * it with a different username.
 */

But the protocol actually permits multiple subsequent authentications
("binds") over a single connection.

So, it seems like the whole connection re-initialization thing was
just a confusion and can be safely removed, thus saving quite a few
network round-trips, especially for the case of ldaps/starttls.

Author: Anatoly Zaretsky <anatoly.zaretsky@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CALbq6kmJ-1+58df4B51ctPfTOSyPbY8Qi2=ct8oR=i4TamkUoQ@mail.gmail.com

Files

PathChange+/−
doc/src/sgml/client-auth.sgml modified +3 −3
src/backend/libpq/auth.c modified +0 −25

Documentation touched

Discussion