rpms/autofs/devel autofs-5.0.2-foreground-logging.patch, NONE, 1.1 autofs-5.0.2-ldap-schema-discovery-config-update.patch, NONE, 1.1 autofs-5.0.2-libxml2-workaround.patch, NONE, 1.1 autofs.spec, 1.222, 1.223

Ian Kent (iankent) fedora-extras-commits at redhat.com
Mon Sep 24 06:59:18 UTC 2007


Author: iankent

Update of /cvs/pkgs/rpms/autofs/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv27011

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.2-foreground-logging.patch 
	autofs-5.0.2-ldap-schema-discovery-config-update.patch 
	autofs-5.0.2-libxml2-workaround.patch 
Log Message:
* Mon Sep 24 2007 Ian Kent <ikent at redhat.com> - 5.0.2-16
- add descriptive comments to config about LDAP schema discovery.
- work around segfault at exit caused by libxml2.
- fix foreground logging (also fixes shutdown needing extra signal bug).


autofs-5.0.2-foreground-logging.patch:

--- NEW FILE autofs-5.0.2-foreground-logging.patch ---
diff -up autofs-5.0.2/modules/lookup_ldap.c.foreground-logging autofs-5.0.2/modules/lookup_ldap.c
--- autofs-5.0.2/modules/lookup_ldap.c.foreground-logging	2007-09-24 14:42:28.000000000 +0800
+++ autofs-5.0.2/modules/lookup_ldap.c	2007-09-24 14:44:18.000000000 +0800
@@ -468,17 +468,17 @@ int parse_ldap_config(struct lookup_cont
 	ctxt->client_princ = client_princ;
 
 	debug(LOGOPT_NONE,
-	      "ldap authentication configured with the following options:\n");
+	      "ldap authentication configured with the following options:");
 	debug(LOGOPT_NONE,
 	      "use_tls: %u, "
 	      "tls_required: %u, "
 	      "auth_required: %u, "
-	      "sasl_mech: %s\n",
+	      "sasl_mech: %s",
 	      use_tls, tls_required, auth_required, authtype);
 	debug(LOGOPT_NONE,
 	      "user: %s, "
 	      "secret: %s, "
-	      "client principal: %s\n",
+	      "client principal: %s",
 	      user, secret ? "specified" : "unspecified",
 	      client_princ);
 
diff -up autofs-5.0.2/modules/cyrus-sasl.c.foreground-logging autofs-5.0.2/modules/cyrus-sasl.c
--- autofs-5.0.2/modules/cyrus-sasl.c.foreground-logging	2007-06-18 15:18:08.000000000 +0800
+++ autofs-5.0.2/modules/cyrus-sasl.c	2007-09-24 14:44:18.000000000 +0800
@@ -197,7 +197,7 @@ get_server_SASL_mechanisms(LDAP *ld)
 	if (mechanisms == NULL) {
 		/* Well, that was a waste of time. */
 		msg("No SASL authentication mechanisms are supported"
-		    " by the LDAP server.\n");
+		    " by the LDAP server.");
 		return NULL;
 	}
 
diff -up autofs-5.0.2/daemon/automount.c.foreground-logging autofs-5.0.2/daemon/automount.c
--- autofs-5.0.2/daemon/automount.c.foreground-logging	2007-09-24 14:42:28.000000000 +0800
+++ autofs-5.0.2/daemon/automount.c	2007-09-24 14:44:18.000000000 +0800
@@ -58,14 +58,13 @@ unsigned int random_selection;	/* use ra
 static int start_pipefd[2];
 static int st_stat = 0;
 static int *pst_stat = &st_stat;
+static pthread_t state_mach_thid;
 
 /* Pre-calculated kernel packet length */
 static size_t kpkt_len;
 
 /* Attribute to create detached thread */
 pthread_attr_t thread_attr;
-/* Attribute to create normal thread */
-pthread_attr_t thread_attr_nodetach;
 
 struct master_readmap_cond mrc = {
 	PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, NULL, 0, 0, 0, 0};
@@ -75,9 +74,6 @@ struct startup_cond suc = {
 
 pthread_key_t key_thread_stdenv_vars;
 
-/* re-entrant syslog default context data */
-#define AUTOFS_SYSLOG_CONTEXT {-1, 0, 0, LOG_PID, (const char *)0, LOG_DAEMON, 0xff};
-
 #define MAX_OPEN_FILES		10240
 
 static int umount_all(struct autofs_point *ap, int force);
@@ -792,7 +788,6 @@ static void become_daemon(unsigned foreg
 {
 	FILE *pidfp;
 	char buf[MAX_ERR_BUF];
-	unsigned to_stderr = 0;
 	pid_t pid;
 
 	/* Don't BUSY any directories unnecessarily */
@@ -809,7 +804,9 @@ static void become_daemon(unsigned foreg
 	}
 
 	/* Detach from foreground process */
-	if (!foreground) {
+	if (foreground)
+		log_to_stderr();
+	else {
 		pid = fork();
 		if (pid > 0) {
 			int r;
@@ -834,13 +831,8 @@ static void become_daemon(unsigned foreg
 			fprintf(stderr, "setsid: %s", estr);
 			exit(1);
 		}
-	}
-
-	/* Setup logging */
-	if (to_stderr)
-		log_to_stderr();
-	else
 		log_to_syslog();
+	}
 
 	/* Write pid file if requested */
 	if (pid_file) {
@@ -929,7 +921,7 @@ static pthread_t do_signals(struct maste
 	if (status)
 		fatal(status);
 
-	status = pthread_create(&thid, &thread_attr_nodetach, do_notify_state, &r_sig);
+	status = pthread_create(&thid, &thread_attr, do_notify_state, &r_sig);
 	if (status) {
 		error(master->default_logging,
 		      "mount state notify thread create failed");
@@ -1043,7 +1035,6 @@ static int do_hup_signal(struct master *
 /* Deal with all the signal-driven events in the state machine */
 static void *statemachine(void *arg)
 {
-	pthread_t thid = 0;
 	sigset_t signalset;
 	int sig;
 
@@ -1056,15 +1047,12 @@ static void *statemachine(void *arg)
 
 		switch (sig) {
 		case SIGTERM:
+		case SIGINT:
 		case SIGUSR2:
+			if (master_list_empty(master_list))
+				return NULL;
 		case SIGUSR1:
-			thid = do_signals(master_list, sig);
-			if (thid) {
-				pthread_join(thid, NULL);
-				if (master_list_empty(master_list))
-					return NULL;
-				thid = 0;
-			}
+			do_signals(master_list, sig);
 			break;
 
 		case SIGHUP:
@@ -1179,6 +1167,10 @@ static void handle_mounts_cleanup(void *
 
 	msg("shut down path %s", path);
 
+	/* If we are the last tell the state machine to shutdown */
+	if (!submount && master_list_empty(master_list))
+		pthread_kill(state_mach_thid, SIGTERM);
+	
 	return;
 }
 
@@ -1357,7 +1349,7 @@ static void usage(void)
 		"	-v --verbose	be verbose\n"
 		"	-d --debug	log debuging info\n"
 		"	-D --define	define global macro variable\n"
-		/*"	-f --foreground do not fork into background\n" */
+		"	-f --foreground do not fork into background\n"
 		"	-r --random-multimount-selection\n"
 		"			use ramdom replicated server selection\n"
 		"	-O --global-options\n"
@@ -1632,14 +1624,6 @@ int main(int argc, char *argv[])
 	}
 #endif
 
-	if (pthread_attr_init(&thread_attr_nodetach)) {
-		crit(LOGOPT_ANY,
-		     "%s: failed to init thread attribute struct!",
-		     program);
-		close(start_pipefd[1]);
-		exit(1);
-	}
-
 	msg("Starting automounter version %s, master map %s",
 		version, master_list->name);
 	msg("using kernel protocol version %d.%02d",
@@ -1684,6 +1668,7 @@ int main(int argc, char *argv[])
 	res = write(start_pipefd[1], pst_stat, sizeof(pst_stat));
 	close(start_pipefd[1]);
 
+	state_mach_thid = pthread_self();
 	statemachine(NULL);
 
 	master_kill(master_list);
diff -up autofs-5.0.2/lib/master.c.foreground-logging autofs-5.0.2/lib/master.c
--- autofs-5.0.2/lib/master.c.foreground-logging	2007-09-24 14:42:28.000000000 +0800
+++ autofs-5.0.2/lib/master.c	2007-09-24 14:44:18.000000000 +0800
@@ -954,6 +954,7 @@ void master_notify_state_change(struct m
 
 		switch (sig) {
 		case SIGTERM:
+		case SIGINT:
 			if (ap->state != ST_SHUTDOWN_PENDING &&
 			    ap->state != ST_SHUTDOWN_FORCE) {
 				next = ST_SHUTDOWN_PENDING;
diff -up autofs-5.0.2/lib/log.c.foreground-logging autofs-5.0.2/lib/log.c
--- autofs-5.0.2/lib/log.c.foreground-logging	2007-06-18 15:18:08.000000000 +0800
+++ autofs-5.0.2/lib/log.c	2007-09-24 14:44:18.000000000 +0800
@@ -27,9 +27,6 @@
 
 #include "automount.h"
 
-/* re-entrant syslog default context data */
-#define AUTOFS_SYSLOG_CONTEXT {-1, 0, 0, LOG_PID, (const char *) 0, LOG_DAEMON, 0xff};
-
 /*
 struct syslog_data syslog_context = AUTOFS_SYSLOG_CONTEXT;
 struct syslog_data *slc = &syslog_context;
@@ -134,30 +131,40 @@ static void syslog_debug(unsigned int lo
 	va_end(ap);
 }
 
+static void to_stderr(unsigned int logopt, const char *msg, ...)
+{
+	va_list ap;
+	va_start(ap, msg);
+	vfprintf(stderr, msg, ap);
+	fputc('\n',stderr);
+	va_end(ap);
+}
+
 void set_mnt_logging(struct autofs_point *ap)
 {
 	unsigned int opt_verbose = ap->logopt & LOGOPT_VERBOSE;
 	unsigned int opt_debug = ap->logopt & LOGOPT_DEBUG;
 
-	if (opt_debug)
-		log_debug = syslog_debug;
+	if (opt_debug) {
+		if (logging_to_syslog)
+			log_debug = syslog_debug;
+		else
+			log_debug = to_stderr;
+	}
 
 	if (opt_verbose || opt_debug) {
-		log_info = syslog_info;
-		log_notice = syslog_notice;
-		log_warn = syslog_warn;
+		if (logging_to_syslog) {
+			log_info = syslog_info;
+			log_notice = syslog_notice;
+			log_warn = syslog_warn;
+		} else {
+			log_info = to_stderr;
+			log_notice = to_stderr;
+			log_warn = to_stderr;
+		}
 	}
 }
 
-static void to_stderr(unsigned int logopt, const char *msg, ...)
-{
-	va_list ap;
-	va_start(ap, msg);
-	vfprintf(stderr, msg, ap);
-	fputc('\n',stderr);
-	va_end(ap);
-}
-
 void log_to_syslog(void)
 {
 	char buf[MAX_ERR_BUF];
diff -up autofs-5.0.2/man/automount.8.foreground-logging autofs-5.0.2/man/automount.8
--- autofs-5.0.2/man/automount.8.foreground-logging	2007-09-24 14:42:28.000000000 +0800
+++ autofs-5.0.2/man/automount.8	2007-09-24 14:44:18.000000000 +0800
@@ -47,6 +47,9 @@ Define a global macro substitution varia
 are over-ridden macro definitions of the same name specified in
 mount entries.
 .TP
+.I "\-f, \-\-foreground"
+Run the daemon in the forground and log to stderr instead of syslog."
+.TP
 .I "\-r, \-\-random-multimount-selection"
 Enables the use of ramdom selection when choosing a host from a
 list of replicated servers.

autofs-5.0.2-ldap-schema-discovery-config-update.patch:

--- NEW FILE autofs-5.0.2-ldap-schema-discovery-config-update.patch ---
diff --git a/redhat/autofs.sysconfig.in b/redhat/autofs.sysconfig.in
index 8299b55..85f4e34 100644
--- a/redhat/autofs.sysconfig.in
+++ b/redhat/autofs.sysconfig.in
@@ -21,9 +21,12 @@ BROWSE_MODE="no"
 #
 #LOGGING="none"
 #
-# Define the default LDAP schema to use for lookups
+# Define the LDAP schema to used for lookups
 #
-# System default
+# If no schema is set autofs will check each of the schemas
+# below in the order given to try and locate an appropriate
+# basdn for lookups. If you want to minimize the number of
+# queries to the server set the values here.
 #
 #MAP_OBJECT_CLASS="nisMap"
 #ENTRY_OBJECT_CLASS="nisObject"
diff --git a/samples/autofs.conf.default.in b/samples/autofs.conf.default.in
index 8299b55..85f4e34 100644
--- a/samples/autofs.conf.default.in
+++ b/samples/autofs.conf.default.in
@@ -21,9 +21,12 @@ BROWSE_MODE="no"
 #
 #LOGGING="none"
 #
-# Define the default LDAP schema to use for lookups
+# Define the LDAP schema to used for lookups
 #
-# System default
+# If no schema is set autofs will check each of the schemas
+# below in the order given to try and locate an appropriate
+# basdn for lookups. If you want to minimize the number of
+# queries to the server set the values here.
 #
 #MAP_OBJECT_CLASS="nisMap"
 #ENTRY_OBJECT_CLASS="nisObject"

autofs-5.0.2-libxml2-workaround.patch:

--- NEW FILE autofs-5.0.2-libxml2-workaround.patch ---
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);
 }


Index: autofs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -r1.222 -r1.223
--- autofs.spec	5 Sep 2007 05:11:13 -0000	1.222
+++ autofs.spec	24 Sep 2007 06:58:44 -0000	1.223
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems
 Name: autofs
 Version: 5.0.2
-Release: 15
+Release: 16
 Epoch: 1
 License: GPL
 Group: System Environment/Daemons
@@ -28,6 +28,9 @@
 Patch15: autofs-5.0.2-fix-mount-nfs-nosymlink.patch
 Patch16: autofs-5.0.2-default-nsswitch.patch
 Patch17: autofs-5.0.2-add-ldap-schema-discovery.patch
+Patch18: autofs-5.0.2-ldap-schema-discovery-config-update.patch
+Patch19: autofs-5.0.2-libxml2-workaround.patch
+Patch20: autofs-5.0.2-foreground-logging.patch
 Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: autoconf, hesiod-devel, openldap-devel, bison, flex, libxml2-devel, cyrus-sasl-devel, openssl-devel module-init-tools util-linux nfs-utils e2fsprogs
 Conflicts: kernel < 2.6.17
@@ -87,6 +90,9 @@
 %patch15 -p1
 %patch16 -p1
 %patch17 -p1
+%patch18 -p1
+%patch19 -p1
+%patch20 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -139,6 +145,11 @@
 %{_libdir}/autofs/
 
 %changelog
+* Mon Sep 24 2007 Ian Kent <ikent at redhat.com> - 5.0.2-16
+- add descriptive comments to config about LDAP schema discovery.
+- work around segfault at exit caused by libxml2.
+- fix foreground logging (also fixes shutdown needing extra signal bug).
+
 * Wed Sep 5 2007 Ian Kent <ikent at redhat.com> - 5.0.2-15
 - fix LDAP schema discovery.
 




More information about the fedora-extras-commits mailing list