|
|
6bbd11 |
autofs-5.0.8 - extend libldap serialization
|
|
|
6bbd11 |
|
|
|
6bbd11 |
From: Leonardo Chiquitto <leonardo.lists@gmail.com>
|
|
|
6bbd11 |
|
|
|
6bbd11 |
It's necessary to serialize calls to ldap_unbind() as well as the
|
|
|
6bbd11 |
initial bind.
|
|
|
6bbd11 |
---
|
|
|
6bbd11 |
CHANGELOG | 1 +
|
|
|
6bbd11 |
modules/lookup_ldap.c | 20 ++++++++++++++++----
|
|
|
6bbd11 |
2 files changed, 17 insertions(+), 4 deletions(-)
|
|
|
6bbd11 |
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/CHANGELOG
|
|
|
6bbd11 |
+++ autofs-5.0.7/CHANGELOG
|
|
|
6bbd11 |
@@ -107,6 +107,7 @@
|
|
|
6bbd11 |
- use open(2) instead of access(2) to trigger dependent mounts.
|
|
|
6bbd11 |
- fix crash due to thread unsafe use of libldap.
|
|
|
6bbd11 |
- fix deadlock in init_ldap_connection.
|
|
|
6bbd11 |
+- extend fix for crash due to thread unsafe use of libldap.
|
|
|
6bbd11 |
|
|
|
6bbd11 |
25/07/2012 autofs-5.0.7
|
|
|
6bbd11 |
=======================
|
|
|
6bbd11 |
--- autofs-5.0.7.orig/modules/lookup_ldap.c
|
|
|
6bbd11 |
+++ autofs-5.0.7/modules/lookup_ldap.c
|
|
|
6bbd11 |
@@ -53,8 +53,9 @@ static struct ldap_schema common_schema[
|
|
|
6bbd11 |
static unsigned int common_schema_count = sizeof(common_schema)/sizeof(struct ldap_schema);
|
|
|
6bbd11 |
|
|
|
6bbd11 |
/*
|
|
|
6bbd11 |
- * Initialization of LDAP and OpenSSL must be always serialized to
|
|
|
6bbd11 |
- * avoid corruption of context structures inside these libraries.
|
|
|
6bbd11 |
+ * Initialization and de-initialization of LDAP and OpenSSL must be
|
|
|
6bbd11 |
+ * always serialized to avoid corruption of context structures inside
|
|
|
6bbd11 |
+ * these libraries.
|
|
|
6bbd11 |
*/
|
|
|
6bbd11 |
pthread_mutex_t ldapinit_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
@@ -203,7 +204,7 @@ int bind_ldap_simple(unsigned logopt, LD
|
|
|
6bbd11 |
return 0;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
-int unbind_ldap_connection(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
|
|
6bbd11 |
+int __unbind_ldap_connection(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
|
|
6bbd11 |
{
|
|
|
6bbd11 |
int rv;
|
|
|
6bbd11 |
|
|
|
6bbd11 |
@@ -220,6 +221,17 @@ int unbind_ldap_connection(unsigned logo
|
|
|
6bbd11 |
return rv;
|
|
|
6bbd11 |
}
|
|
|
6bbd11 |
|
|
|
6bbd11 |
+int unbind_ldap_connection(unsigned logopt, LDAP *ldap, struct lookup_context *ctxt)
|
|
|
6bbd11 |
+{
|
|
|
6bbd11 |
+ int rv;
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ ldapinit_mutex_lock();
|
|
|
6bbd11 |
+ rv = __unbind_ldap_connection(logopt, ldap, ctxt);
|
|
|
6bbd11 |
+ ldapinit_mutex_unlock();
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
+ return rv;
|
|
|
6bbd11 |
+}
|
|
|
6bbd11 |
+
|
|
|
6bbd11 |
LDAP *__init_ldap_connection(unsigned logopt, const char *uri, struct lookup_context *ctxt)
|
|
|
6bbd11 |
{
|
|
|
6bbd11 |
LDAP *ldap = NULL;
|
|
|
6bbd11 |
@@ -280,7 +292,7 @@ LDAP *__init_ldap_connection(unsigned lo
|
|
|
6bbd11 |
|
|
|
6bbd11 |
rv = ldap_start_tls_s(ldap, NULL, NULL);
|
|
|
6bbd11 |
if (rv != LDAP_SUCCESS) {
|
|
|
6bbd11 |
- unbind_ldap_connection(logopt, ldap, ctxt);
|
|
|
6bbd11 |
+ __unbind_ldap_connection(logopt, ldap, ctxt);
|
|
|
6bbd11 |
if (ctxt->tls_required) {
|
|
|
6bbd11 |
error(logopt, MODPREFIX
|
|
|
6bbd11 |
"TLS required but START_TLS failed: %s",
|