summaryrefslogtreecommitdiff
path: root/usr/src/lib/libsldap/common/ns_connect.c
diff options
context:
space:
mode:
authormj162486 <none@none>2008-05-27 13:50:08 -0700
committermj162486 <none@none>2008-05-27 13:50:08 -0700
commitb5d0e4ebb3481165a26b3df1ad7d6b8dc4cfc027 (patch)
tree1b68d750939405e1c2f75a61a1be52b45a792381 /usr/src/lib/libsldap/common/ns_connect.c
parent9d2d3daa90dc2bc61e6773e7aa4dc4930f1fb20a (diff)
downloadillumos-gate-b5d0e4ebb3481165a26b3df1ad7d6b8dc4cfc027.tar.gz
6674553 getpwuid are slow with fix for CR6540209 - native ldap client config w/compat and use of netgroups
Diffstat (limited to 'usr/src/lib/libsldap/common/ns_connect.c')
-rw-r--r--usr/src/lib/libsldap/common/ns_connect.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/usr/src/lib/libsldap/common/ns_connect.c b/usr/src/lib/libsldap/common/ns_connect.c
index 484a4c89b7..b3d2d0cd63 100644
--- a/usr/src/lib/libsldap/common/ns_connect.c
+++ b/usr/src/lib/libsldap/common/ns_connect.c
@@ -1706,6 +1706,11 @@ _DropConnection(ConnectionID cID, int flag, int fini)
Connection *cp;
int id;
int use_lock = !fini;
+ struct timeval zerotime;
+ LDAPMessage *res;
+
+ zerotime.tv_sec = zerotime.tv_usec = 0L;
+
#ifdef DEBUG
thread_t t = thr_self();
#endif /* DEBUG */
@@ -1754,6 +1759,17 @@ _DropConnection(ConnectionID cID, int flag, int fini)
cp->shared--;
cp->usedBit = B_FALSE;
cp->threadID = 0; /* unmark the threadID */
+ /*
+ * Do sanity cleanup of remaining results if connection is not
+ * shared by any requests.
+ */
+ if (cp->shared <= 0) {
+ while (ldap_result(cp->ld, LDAP_RES_ANY, LDAP_MSG_ALL,
+ &zerotime, &res) > 0) {
+ if (res != NULL)
+ (void) ldap_msgfree(res);
+ }
+ }
if (use_lock)
(void) rw_unlock(&sessionPoolLock);
} else {