rpms/autofs/devel autofs-5.0.0_beta3-hesiod-update.patch, NONE, 1.1 autofs.spec, 1.89, 1.90 autofs-4.1.4-hesiod-bind.patch, 1.1, NONE

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Sat May 27 07:59:49 UTC 2006


Author: ikent

Update of /cvs/dist/rpms/autofs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv14155

Modified Files:
	autofs.spec 
Added Files:
	autofs-5.0.0_beta3-hesiod-update.patch 
Removed Files:
	autofs-4.1.4-hesiod-bind.patch 
Log Message:
* Sat May 27 2006 Ian Kent <ikent at redhat.com> - 5.0.0_beta3-3
- update hesiod module (Jeff Moyer).
  - add mutex to protect against overlapping mount requests.
  - update return from mount request to give more sensible NSS_*
    values.


autofs-5.0.0_beta3-hesiod-update.patch:
 CHANGELOG               |    4 +++
 configure               |   20 +++++++++----------
 configure.in            |    2 -
 modules/lookup_hesiod.c |   50 +++++++++++++++++++++++++++++++++++++++---------
 4 files changed, 56 insertions(+), 20 deletions(-)

--- NEW FILE autofs-5.0.0_beta3-hesiod-update.patch ---
--- autofs-5.0.0_beta3/modules/lookup_hesiod.c.hesiod-update	2006-05-22 23:28:48.000000000 -0400
+++ autofs-5.0.0_beta3/modules/lookup_hesiod.c	2006-05-27 03:53:13.000000000 -0400
@@ -29,8 +29,11 @@
 
 struct lookup_context {
 	struct parse_mod *parser;
+	void *hesiod_context;
 };
 
+static pthread_mutex_t hesiod_mutex = PTHREAD_MUTEX_INITIALIZER;
+
 int lookup_version = AUTOFS_LOOKUP_VERSION;	/* Required by protocol */
 
 /* This initializes a context (persistent non-global data) for queries to
@@ -51,6 +54,13 @@
 	/* Initialize the resolver. */
 	res_init();
 
+	/* Initialize the hesiod context. */
+	if (hesiod_init(&(ctxt->hesiod_context)) != 0) {
+		char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
+		crit(MODPREFIX "hesiod_init(): %s", estr);
+		return 1;
+	}
+
 	/* If a map type isn't explicitly given, parse it as hesiod entries. */
 	if (!mapfmt)
 		mapfmt = MAPFMT_DEFAULT;
@@ -69,15 +79,17 @@
 	return NSS_STATUS_UNKNOWN;
 }
 
-/* Lookup and act on a filesystem name.  In this case, lookup the "filsys"
-   record in hesiod.  If it's an AFS or NFS filesyste, parse it out.  If
-   it's an ERR filesystem, it's an error message we should log.  Otherwise,
-   assume it's something we know how to deal with already (generic). */
+/*
+ * Lookup and act on a filesystem name.  In this case, lookup the "filsys"
+ * record in hesiod.  If it's an AFS or NFS filesystem, parse it out.  If
+ * it's an ERR filesystem, it's an error message we should log.  Otherwise,
+ * assume it's something we know how to deal with already (generic).
+ */
 int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *context)
 {
 	char **hes_result;
 	struct lookup_context *ctxt = (struct lookup_context *) context;
-	int rv;
+	int status, rv;
 	char **record, *best_record = NULL, *p;
 	int priority, lowest_priority = INT_MAX;	
 
@@ -86,11 +98,16 @@
 	chdir("/");		/* If this is not here the filesystem stays
 				   busy, for some reason... */
 
-	hes_result = hes_resolve(name, "filsys");
+	status = pthread_mutex_lock(&hesiod_mutex);
+	if (status)
+		fatal(status);
 
+	hes_result = hesiod_resolve(ctxt->hesiod_context, name, "filsys");
 	if (!hes_result || !hes_result[0]) {
+		/* Note: it is not clear to me how to distinguish between
+		 * the "no search results" case and other failures.  --JM */
 		warn(MODPREFIX "entry \"%s\" not found in map", name);
-		return NSS_STATUS_UNAVAIL;
+		return NSS_STATUS_NOTFOUND;
 	}
 
 	/* autofs doesn't support falling back to alternate records, so just
@@ -113,8 +130,21 @@
 
 	rv = ctxt->parser->parse_mount(ap, name, name_len, best_record,
 				       ctxt->parser->context);
-	free(hes_result);
-	return rv;
+
+	hesiod_free_list(ctxt->hesiod_context, hes_result);
+
+	status = pthread_mutex_unlock(&hesiod_mutex);
+	if (status)
+		fatal(status);
+
+	/*
+	 * Unavailable due to error such as module load fail 
+	 * or out of memory, etc.
+	 */
+	if (rv == 1 || rv == -1)
+		return NSS_STATUS_UNAVAIL;
+
+	return NSS_STATUS_SUCCESS;
 }
 
 /* This destroys a context for queries to this module.  It releases the parser
@@ -123,6 +153,8 @@
 {
 	struct lookup_context *ctxt = (struct lookup_context *) context;
 	int rv = close_parse(ctxt->parser);
+
+	hesiod_end(ctxt->hesiod_context);
 	free(ctxt);
 	return rv;
 }
--- autofs-5.0.0_beta3/CHANGELOG.hesiod-update	2006-05-27 03:52:25.000000000 -0400
+++ autofs-5.0.0_beta3/CHANGELOG	2006-05-27 03:54:40.000000000 -0400
@@ -4,6 +4,10 @@
 - add "_" to "." mapname translation to nis lookup module.
 - fix white space handling in replicated server selection code.
 - merge don't strip debug info macro patch (Jeff Moyer).
+- update hesiod module (Jeff Moyer).
+  - add mutex to protect against overlapping mount requests.
+  - update return from mount request to give more sensible NSS_*
+    values.
 
 23/5/2006 autofs-5.0.0_beta3
 ----------------------------
--- autofs-5.0.0_beta3/configure.hesiod-update	2006-05-22 23:28:48.000000000 -0400
+++ autofs-5.0.0_beta3/configure	2006-05-27 03:53:13.000000000 -0400
@@ -3168,9 +3168,9 @@
 if test -z "$HAVE_HESIOD"
 then
 	HAVE_HESIOD=0
-	echo "$as_me:$LINENO: checking for hes_resolve in -lhesiod" >&5
-echo $ECHO_N "checking for hes_resolve in -lhesiod... $ECHO_C" >&6
-if test "${ac_cv_lib_hesiod_hes_resolve+set}" = set; then
+	echo "$as_me:$LINENO: checking for hesiod_resolve in -lhesiod" >&5
+echo $ECHO_N "checking for hesiod_resolve in -lhesiod... $ECHO_C" >&6
+if test "${ac_cv_lib_hesiod_hesiod_resolve+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -3188,11 +3188,11 @@
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char hes_resolve ();
+char hesiod_resolve ();
 int
 main ()
 {
-hes_resolve ();
+hesiod_resolve ();
   ;
   return 0;
 }
@@ -3219,20 +3219,20 @@
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_hesiod_hes_resolve=yes
+  ac_cv_lib_hesiod_hesiod_resolve=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_hesiod_hes_resolve=no
+ac_cv_lib_hesiod_hesiod_resolve=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hes_resolve" >&5
-echo "${ECHO_T}$ac_cv_lib_hesiod_hes_resolve" >&6
-if test $ac_cv_lib_hesiod_hes_resolve = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_lib_hesiod_hesiod_resolve" >&5
+echo "${ECHO_T}$ac_cv_lib_hesiod_hesiod_resolve" >&6
+if test $ac_cv_lib_hesiod_hesiod_resolve = yes; then
   HAVE_HESIOD=1 LIBHESIOD="$LIBHESIOD -lhesiod"
 fi
 
--- autofs-5.0.0_beta3/configure.in.hesiod-update	2006-05-22 23:28:48.000000000 -0400
+++ autofs-5.0.0_beta3/configure.in	2006-05-27 03:53:13.000000000 -0400
@@ -143,7 +143,7 @@
 if test -z "$HAVE_HESIOD"
 then
 	HAVE_HESIOD=0
-	AC_CHECK_LIB(hesiod, hes_resolve, HAVE_HESIOD=1 LIBHESIOD="$LIBHESIOD -lhesiod", ,
+	AC_CHECK_LIB(hesiod, hesiod_resolve, HAVE_HESIOD=1 LIBHESIOD="$LIBHESIOD -lhesiod", ,
 		     $LIBRESOLV)
 	if test "$HAVE_HESIOD" == "1"; then
 		AC_DEFINE(WITH_HESIOD,1,


Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.89
retrieving revision 1.90
diff -u -r1.89 -r1.90
--- autofs.spec	26 May 2006 19:37:10 -0000	1.89
+++ autofs.spec	27 May 2006 07:59:47 -0000	1.90
@@ -4,23 +4,23 @@
 Summary: A tool for automatically mounting and unmounting filesystems.
 Name: autofs
 %define version 5.0.0_beta3
-%define release 2
+%define release 3
 Version: %{version}
 Release: %{release}
 Epoch: 1
 License: GPL
 Group: System Environment/Daemons
 Source: ftp://ftp.kernel.org/pub/linux/daemons/autofs/v5/autofs-%{version}.tar.bz2
-Patch1: autofs-4.1.4-hesiod-bind.patch
-Patch2: autofs-5.0.0_beta3-remove-extra-debug-print.patch
-Patch3: autofs-5.0.0_beta3-underscore-to-dot.patch
-Patch4: autofs-5.0.0_beta3-dont-probe-nfs4.patch
-Patch5: autofs-5.0.0_beta3-pgrp-pid.patch
-Patch6: autofs-5.0.0_beta3-replicated-white-space.patch
-Patch7: autofs-5.0.0_beta3-dont-strip-debug.patch
-Patch8: autofs-5.0.0_beta3-sanity-check-remove.patch
-Patch9: autofs-5.0.0_beta3-e2fsck-error-check.patch
-Patch10: autofs-5.0.0_beta3-fix-map-perms.patch
+Patch1: autofs-5.0.0_beta3-remove-extra-debug-print.patch
+Patch2: autofs-5.0.0_beta3-underscore-to-dot.patch
+Patch3: autofs-5.0.0_beta3-dont-probe-nfs4.patch
+Patch4: autofs-5.0.0_beta3-pgrp-pid.patch
+Patch5: autofs-5.0.0_beta3-replicated-white-space.patch
+Patch6: autofs-5.0.0_beta3-dont-strip-debug.patch
+Patch7: autofs-5.0.0_beta3-sanity-check-remove.patch
+Patch8: autofs-5.0.0_beta3-e2fsck-error-check.patch
+Patch9: autofs-5.0.0_beta3-fix-map-perms.patch
+Patch10: autofs-5.0.0_beta3-hesiod-update.patch
 
 Buildroot: /var/tmp/autofs-tmp
 BuildPrereq: autoconf, hesiod-devel, openldap-devel, bison, flex
@@ -125,6 +125,12 @@
 %{_libdir}/autofs/*
 
 %changelog
+* Sat May 27 2006 Ian Kent <ikent at redhat.com> - 5.0.0_beta3-3
+- update hesiod module (Jeff Moyer).
+  - add mutex to protect against overlapping mount requests.
+  - update return from mount request to give more sensible NSS_*
+    values.
+
 * Fri May 26 2006 Jeff Moyer <jmoyer at redhat.com> - 1:5.0.0_beta3-2
 - Fix the install permissions for auto.master and auto.misc.
 


--- autofs-4.1.4-hesiod-bind.patch DELETED ---




More information about the fedora-cvs-commits mailing list