Blob Blame History Raw
Fix deadlock in init_ldap_connection()

From: Leonardo Chiquitto <leonardo.lists@gmail.com>

Commit 9fc20db13 ("fix crash due to thread unsafe use of libldap")
introduced a deadlock in init_ldap_connection(). When TLS is on,
this function will call itself recursively and try to lock a mutex
that's already owned by the thread. Fix the problem by using the
lockless version.
---
 CHANGELOG             |    1 +
 modules/lookup_ldap.c |    2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -106,6 +106,7 @@
 - fix mistake in assignment.
 - use open(2) instead of access(2) to trigger dependent mounts.
 - fix crash due to thread unsafe use of libldap.
+- fix deadlock in init_ldap_connection.
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/lookup_ldap.c
+++ autofs-5.0.7/modules/lookup_ldap.c
@@ -288,7 +288,7 @@ LDAP *__init_ldap_connection(unsigned lo
 				return NULL;
 			}
 			ctxt->use_tls = LDAP_TLS_DONT_USE;
-			ldap = init_ldap_connection(logopt, uri, ctxt);
+			ldap = __init_ldap_connection(logopt, uri, ctxt);
 			if (ldap)
 				ctxt->use_tls = LDAP_TLS_INIT;
 			return ldap;