diff -up autofs-5.0.2/configure.libxml2-workaround autofs-5.0.2/configure
--- autofs-5.0.2/configure.libxml2-workaround 2007-09-24 14:25:06.000000000 +0800
+++ autofs-5.0.2/configure 2007-09-24 14:26:09.000000000 +0800
@@ -2498,6 +2498,23 @@ echo "${ECHO_T}yes" >&6; }
HAVE_LIBXML=1
XML_LIBS=`$XML_CONFIG --libs`
XML_FLAGS=`$XML_CONFIG --cflags`
+ XML_VER=`$XML_CONFIG --version`
+ XML_MAJOR=`echo $XML_VER|cut -d\. -f1`
+ if test $XML_MAJOR -le 2
+ then
+ XML_MINOR=`echo $XML_VER|cut -d\. -f2`
+ if test $XML_MINOR -le 6
+ then
+ XML_REV=`echo $XML_VER|cut -d\. -f3`
+ if test $XML_REV -le 99; then
+
+cat >>confdefs.h <<\_ACEOF
+#define LIBXML2_WORKAROUND 1
+_ACEOF
+
+ fi
+ fi
+ fi
fi
#
diff -up autofs-5.0.2/include/config.h.in.libxml2-workaround autofs-5.0.2/include/config.h.in
--- autofs-5.0.2/include/config.h.in.libxml2-workaround 2007-09-24 14:25:06.000000000 +0800
+++ autofs-5.0.2/include/config.h.in 2007-09-24 14:26:09.000000000 +0800
@@ -60,6 +60,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
+/* Use libxml2 tsd usage workaround */
+#undef LIBXML2_WORKAROUND
+
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
diff -up autofs-5.0.2/aclocal.m4.libxml2-workaround autofs-5.0.2/aclocal.m4
--- autofs-5.0.2/aclocal.m4.libxml2-workaround 2007-09-24 14:25:06.000000000 +0800
+++ autofs-5.0.2/aclocal.m4 2007-09-24 14:26:09.000000000 +0800
@@ -167,6 +167,19 @@ else
HAVE_LIBXML=1
XML_LIBS=`$XML_CONFIG --libs`
XML_FLAGS=`$XML_CONFIG --cflags`
+ XML_VER=`$XML_CONFIG --version`
+ XML_MAJOR=`echo $XML_VER|cut -d\. -f1`
+ if test $XML_MAJOR -le 2
+ then
+ XML_MINOR=`echo $XML_VER|cut -d\. -f2`
+ if test $XML_MINOR -le 6
+ then
+ XML_REV=`echo $XML_VER|cut -d\. -f3`
+ if test $XML_REV -le 99; then
+ AC_DEFINE(LIBXML2_WORKAROUND,1, [Use libxml2 tsd usage workaround])
+ fi
+ fi
+ fi
fi])
dnl --------------------------------------------------------------------------
diff -up autofs-5.0.2/modules/lookup_ldap.c.libxml2-workaround autofs-5.0.2/modules/lookup_ldap.c
--- autofs-5.0.2/modules/lookup_ldap.c.libxml2-workaround 2007-09-24 14:25:06.000000000 +0800
+++ autofs-5.0.2/modules/lookup_ldap.c 2007-09-24 14:26:09.000000000 +0800
@@ -1929,9 +1929,6 @@ int lookup_done(void *context)
struct lookup_context *ctxt = (struct lookup_context *) context;
int rv = close_parse(ctxt->parse);
#ifdef WITH_SASL
- EVP_cleanup();
- ERR_free_strings();
-
autofs_sasl_done(ctxt);
#endif
free_context(ctxt);
diff -up autofs-5.0.2/daemon/automount.c.libxml2-workaround autofs-5.0.2/daemon/automount.c
--- autofs-5.0.2/daemon/automount.c.libxml2-workaround 2007-09-24 14:25:06.000000000 +0800
+++ autofs-5.0.2/daemon/automount.c 2007-09-24 14:28:56.000000000 +0800
@@ -40,6 +40,9 @@
#include <sys/utsname.h>
#include "automount.h"
+#ifdef LIBXML2_WORKAROUND
+#include <dlfcn.h>
+#endif
const char *program; /* Initialized with argv[0] */
const char *version = VERSION_STRING; /* Program version */
@@ -1266,22 +1269,6 @@ void *handle_mounts(void *arg)
}
pthread_cleanup_pop(1);
-
- /*
- * A cowboy .. me!
- * That noise yu ear aint spuurs sonny!!
- *
- * The libkrb5support destructor called indirectly through
- * libgssapi_krb5 which is used bt libkrb5 (somehow) must run
- * to completion before the last thread using it exits so
- * that it's per thread data keys are deleted or we get a
- * little segfault at exit. So much for dlclose being
- * syncronous.
- *
- * So, the solution is a recipe for disaster.
- * Hope we don't get a really busy system!
- */
- /*sleep(1);*/
sched_yield();
return NULL;
@@ -1681,6 +1668,11 @@ int main(int argc, char *argv[])
close(start_pipefd[1]);
exit(1);
}
+
+#ifdef LIBXML2_WORKAROUND
+ void *dh = dlopen("libxml2.so", RTLD_NOW);
+#endif
+
if (!master_read_master(master_list, age, 0)) {
master_kill(master_list);
*pst_stat = 3;
@@ -1702,5 +1694,9 @@ int main(int argc, char *argv[])
}
closelog();
+#ifdef LIBXML2_WORKAROUND
+ if (dh)
+ dlclose(dh);
+#endif
exit(0);
}