rpms/autofs/devel autofs-4.1.4-check-is-multi.patch, NONE, 1.1 autofs-4.1.4-check-nsswitch-submount.patch, 1.1, 1.2 autofs-4.1.4-non-replicated-ping.patch, 1.1, 1.2 autofs.spec, 1.59, 1.60

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Thu Apr 14 02:31:05 UTC 2005


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

Modified Files:
	autofs-4.1.4-check-nsswitch-submount.patch 
	autofs-4.1.4-non-replicated-ping.patch autofs.spec 
Added Files:
	autofs-4.1.4-check-is-multi.patch 
Log Message:
- Finish up with the merge breakage.
- Temporary fix for the multimount detection code.  It seems half-baked.



autofs-4.1.4-check-is-multi.patch:
 parse_sun.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

--- NEW FILE autofs-4.1.4-check-is-multi.patch ---
--- autofs-4.1.4/modules/parse_sun.c.orig	2005-04-13 22:15:02.734715312 -0400
+++ autofs-4.1.4/modules/parse_sun.c	2005-04-13 22:16:08.570706720 -0400
@@ -766,7 +766,6 @@ static int check_is_multi(const char *ma
 {
 	const char *p = (char *) mapent;
 	int multi = 0;
-	int first_chunk = 0;
 
 	while (*p) {
 		p = skipspace(p);
@@ -779,11 +778,9 @@ static int check_is_multi(const char *ma
 		 * path that begins with '/' indicates a mutil-mount
 		 * entry.
 		 */
-		if (first_chunk) {
-			if (*p == '/' || *p == '-') {
-				multi = 1;
-				break;
-			}
+		if (*p == '/' || *p == '-') {
+			multi = 1;
+			break;
 		}
 
 		while (*p == '-') {
@@ -796,7 +793,6 @@ static int check_is_multi(const char *ma
 		 * after which it's a multi mount.
 		 */
 		p += chunklen(p, check_colon(p));
-		first_chunk++;
 	}
 
 	return multi;

autofs-4.1.4-check-nsswitch-submount.patch:
 include/automount.h |    8 ++
 lib/Makefile        |    4 -
 lib/nsswitch.c      |  154 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 modules/Makefile    |    4 +
 modules/parse_sun.c |   32 +++++-----
 5 files changed, 183 insertions(+), 19 deletions(-)

Index: autofs-4.1.4-check-nsswitch-submount.patch
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs-4.1.4-check-nsswitch-submount.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- autofs-4.1.4-check-nsswitch-submount.patch	13 Apr 2005 23:34:44 -0000	1.1
+++ autofs-4.1.4-check-nsswitch-submount.patch	14 Apr 2005 02:30:56 -0000	1.2
@@ -1,5 +1,5 @@
---- autofs-4.1.4/include/automount.h.orig	2005-01-26 08:03:02.000000000 -0500
-+++ autofs-4.1.4/include/automount.h	2005-04-13 18:56:37.189633272 -0400
+--- autofs-4.1.4/include/automount.h.orig	2005-04-13 20:54:52.749944144 -0400
++++ autofs-4.1.4/include/automount.h	2005-04-13 20:56:21.850398816 -0400
 @@ -282,6 +282,14 @@ int is_mounted(const char *table, const 
  int has_fstab_option(const char *path, const char *opt);
  int allow_owner_mount(const char *);
@@ -15,8 +15,165 @@
  /* log notification */
  extern int do_verbose;
  extern int do_debug;
---- autofs-4.1.4/lib/Makefile.orig	2005-01-09 04:16:43.000000000 -0500
-+++ autofs-4.1.4/lib/Makefile	2005-04-13 18:57:32.186272512 -0400
+--- autofs-4.1.4/lib/nsswitch.c.orig	2005-04-13 20:54:25.405101192 -0400
++++ autofs-4.1.4/lib/nsswitch.c	2005-04-13 20:54:07.827773352 -0400
+@@ -0,0 +1,154 @@
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#include <syslog.h>
++#include <ctype.h>
++#include <sys/types.h>
++#include <sys/stat.h>
++#include <unistd.h>
++#include <rpcsvc/ypclnt.h>
++#include <netdb.h>
++#include "automount.h"
++
++#define MODPREFIX "nsswitch: "
++
++/*
++ * Function which takes in a partial map name (ie. auto.misc), parses the
++ * nsswitch.conf file and returns a valid map name (ie. yp:auto.misc or
++ * file:/etc/auto.misc
++ */
++char *get_nsswitch_map(const char *loc)
++{
++	char buf[1024];
++	char *ordering;
++	const char *automount_str = "automount:";
++	char *comment = NULL;
++	FILE *nsswitch;
++	int found_automount = 0;
++	char *retval = NULL;
++	int retsize = 0;
++
++	debug(MODPREFIX "called nsswitch with: '%s'", loc);
++	nsswitch = fopen(_PATH_NSSWITCH_CONF, "r");
++	if (!nsswitch) {
++		error(MODPREFIX "Unable to open %s", _PATH_NSSWITCH_CONF);
++		return NULL;
++	}
++
++	while ((ordering = fgets((char *)buf, sizeof(buf), nsswitch))) {
++		if ((comment = strchr(ordering,'#')))
++			*comment = '\0';
++		while (isspace(*ordering)) ordering++;
++		if (!strncmp(ordering, automount_str, sizeof(automount_str))) {
++			ordering += strlen(automount_str);
++			found_automount = 1;
++			break;
++		}
++	}
++
++	fclose(nsswitch);
++
++	if (!found_automount)
++		return NULL;
++
++	while (*ordering != '\0') {
++		while (isspace(*ordering)) ordering++;
++		if (!strncmp(ordering, "files", 5)) {
++			switch (isfilemap(loc)) {
++				case MAPTYPE_FILE:
++					retsize = strlen(loc) + 11;
++					retval = malloc(retsize);
++					if (!retval)
++						return NULL;
++					snprintf(retval, retsize,
++							"file:/etc/%s", loc);
++					return retval;
++				case MAPTYPE_PROGRAM:
++					retsize = strlen(loc) + 14;
++					retval = malloc(retsize);
++					if (!retval)
++						return NULL;
++					snprintf(retval, retsize,
++							"program:/etc/%s", loc);
++					return retval;
++				default: // filemap doesn't exist
++					break;
++			}
++
++		} else if ((!strncmp(ordering, "yp", 2) ||
++					!strncmp(ordering,"nis", 3)) &&
++				isypmap(loc)) {
++			retsize = strlen(loc) + 4;
++			retval = malloc(retsize);
++			snprintf(retval, retsize, "yp:%s", loc);
++			return retval;
++		}
++		while (!isspace(*ordering) && (*ordering != '\0')) ordering++;
++	}
++	error(MODPREFIX "couldn't find map");
++	return retval;
++}
++
++/*
++ * Function takes in a filename and tests if it exists in "/etc/"
++ * Returns: MAPTYPE_FILE if it is not executable, MAPTYPE_PROGRAM if it
++ * is executable and 0 if it doesn't exists or has incorrect permissions.
++ */
++
++int isfilemap(const char *loc)
++{
++	struct stat st;
++	int ret = 0;	
++	char *realfilemap;
++
++	realfilemap = malloc(strlen(loc) + 6); /* '/etc/' + '\0' */
++	if (!realfilemap) {
++		crit(MODPREFIX "malloc failed.");
++		return 0;
++	}
++
++	snprintf(realfilemap, strlen(loc) + 6, "/etc/%s", loc);
++
++	ret = stat(realfilemap, &st);
++	free (realfilemap);
++
++	if (!ret) {
++		if (st.st_uid != 0) {
++			error(MODPREFIX "file /etc/%s exists but is not"
++					" owned by root.", loc);
++			return 0;
++		} else if (st.st_mode & S_IRUSR) {
++			if (st.st_mode & S_IXUSR) 
++				return MAPTYPE_PROGRAM;
++			else
++				return MAPTYPE_FILE;
++		}
++	}
++	return 0;
++}
++
++/*
++ * Function takes in a yp map name and returns
++ * 1 if it exists or 0 if it doesn't.
++ *
++ * Some of this code borrowed from ypcat
++ */
++
++int isypmap(const char *loc)
++{
++	int err;
++	char *domainname;
++	int order;
++
++	if ((err = yp_get_default_domain(&domainname)) != YPERR_SUCCESS) {
++		error (MODPREFIX "unable to get default yp domain");
++		return 0;
++	}
++	if ((err = yp_order(domainname, loc, &order)) != YPERR_SUCCESS) {
++		error (MODPREFIX "unable to find map, %s in domain, %s",
++				loc, domainname);
++		return 0;
++	}
++
++	return 1;
++}
+--- autofs-4.1.4/lib/Makefile.orig	2005-04-13 20:55:00.260802320 -0400
++++ autofs-4.1.4/lib/Makefile	2005-04-13 20:56:21.850398816 -0400
 @@ -9,10 +9,10 @@ include ../Makefile.rules
  RPCGEN = /usr/bin/rpcgen
  RANLIB = /usr/bin/ranlib
@@ -30,18 +187,8 @@
  
  LIB = autofs.a
  
---- autofs-4.1.4/modules/Makefile.orig	2005-04-13 18:56:21.753979848 -0400
-+++ autofs-4.1.4/modules/Makefile	2005-04-13 18:56:37.191632968 -0400
-@@ -86,3 +86,7 @@ lookup_ldap.so: lookup_ldap.c
- 	$(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
- 		lookup_ldap.c $(AUTOFS_LIB) $(LIBLDAP)
- 	$(STRIP) lookup_ldap.so
-+
-+parse_sun.so: parse_sun.c
-+	$(CC) $(SOLDFLAGS) $(CFLAGS) -o parse_sun.so parse_sun.c $(AUTOFS_LIB) $(LIBNSL)
-+	$(STRIP) parse_sun.so
---- autofs-4.1.4/modules/parse_sun.c.orig	2005-04-05 08:42:42.000000000 -0400
-+++ autofs-4.1.4/modules/parse_sun.c	2005-04-13 18:59:46.410867272 -0400
+--- autofs-4.1.4/modules/parse_sun.c.orig	2005-04-13 20:55:18.508028320 -0400
++++ autofs-4.1.4/modules/parse_sun.c	2005-04-13 20:56:21.852398512 -0400
 @@ -566,6 +566,8 @@ static int sun_mount(const char *root, c
  	int rv;
  	char *mountpoint;
@@ -90,21 +237,13 @@
  	} else {
  		what = alloca(loclen + 1);
  		memcpy(what, loc, loclen);
---- autofs-4.1.4/samples/rc.autofs.in.orig	2005-04-13 18:55:18.406610112 -0400
-+++ autofs-4.1.4/samples/rc.autofs.in	2005-04-13 18:55:18.411609352 -0400
-@@ -284,9 +284,13 @@ function getmounts()
- 		fi
- 		# Dont even deal with conflicts between --ghost and [no]browse
- 		# Its just insane to configure things like that.
--		if echo "$options" | grep -qE -- '\B-browse\b' ;
-+		if echo "$options" | grep -q 'browse' ;
- 		then
--		    startupoptions="$startupoptions --ghost"
-+		    if echo "$options" | grep -qE -- '[ 	]+-browse' ||
-+		       echo "$options" | grep -q -- ',browse' ;
-+		    then
-+			startupoptions="$startupoptions --ghost"
-+		    fi
- 		fi
- 		# Check for verbose
- 		if echo "$daemonoptions $options" | \
+--- autofs-4.1.4/modules/Makefile.orig	2005-04-13 20:55:31.997977536 -0400
++++ autofs-4.1.4/modules/Makefile	2005-04-13 20:56:21.851398664 -0400
+@@ -86,3 +86,7 @@ lookup_ldap.so: lookup_ldap.c
+ 	$(CC) $(SOLDFLAGS) $(CFLAGS) $(LDAP_FLAGS) -o lookup_ldap.so \
+ 		lookup_ldap.c $(AUTOFS_LIB) $(LIBLDAP)
+ 	$(STRIP) lookup_ldap.so
++
++parse_sun.so: parse_sun.c
++	$(CC) $(SOLDFLAGS) $(CFLAGS) -o parse_sun.so parse_sun.c $(AUTOFS_LIB) $(LIBNSL)
++	$(STRIP) parse_sun.so

autofs-4.1.4-non-replicated-ping.patch:
 mount_nfs.c |  129 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 99 insertions(+), 30 deletions(-)

Index: autofs-4.1.4-non-replicated-ping.patch
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs-4.1.4-non-replicated-ping.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- autofs-4.1.4-non-replicated-ping.patch	13 Apr 2005 23:34:44 -0000	1.1
+++ autofs-4.1.4-non-replicated-ping.patch	14 Apr 2005 02:30:56 -0000	1.2
@@ -1,5 +1,5 @@
---- autofs-4.1.4/modules/mount_nfs.c.orig	2005-04-13 18:38:08.851126336 -0400
-+++ autofs-4.1.4/modules/mount_nfs.c	2005-04-13 18:38:53.034409456 -0400
+--- autofs-4.1.4/modules/mount_nfs.c.orig	2005-04-13 20:31:24.639009544 -0400
++++ autofs-4.1.4/modules/mount_nfs.c	2005-04-13 20:31:40.727563712 -0400
 @@ -31,6 +31,7 @@
  #include <netinet/in.h>
  #include <linux/nfs.h>
@@ -8,7 +8,7 @@
  
  #define MODULE_MOUNT
  #include "automount.h"
-@@ -105,28 +106,72 @@ int is_local_addr(const char *host, cons
+@@ -105,28 +106,116 @@ int is_local_addr(const char *host, cons
  	
  	return 1;
  }
@@ -22,6 +22,50 @@
 +	return !strchr(what, ',') && (strchr(what, ':') == strrchr(what, ':'));
 +}
 +
++/*
++ *  Check to see if the 'host:path' or 'host' is on the local machine
++ *  Returns < 0 if there is a host lookup problem, otherwise returns 0
++ *  if it's not a local mount, and returns > 0 if it is a local mount.
++ */
++int is_local_mount(const char *hostpath)
++{
++	struct hostent *he;
++	char **haddr;
++	char *delim;
++	char *hostname;
++	int hostnamelen;
++	int local = 0;
++
++	debug(MODPREFIX "is_local_mount: %s", hostpath);
++	delim = strpbrk(hostpath,":");
++
++	if (delim) 
++		hostnamelen = delim - hostpath; 
++	else 
++		hostnamelen = strlen(hostpath);
++
++	hostname = malloc(hostnamelen+1);
++	strncpy(hostname,hostpath,hostnamelen);
++	hostname[hostnamelen] = '\0';
++	he = gethostbyname(hostname);
++	if (!he) {
++		error(MODPREFIX "host %s: lookup failure", hostname);
++		return -1;
++	}
++
++	for (haddr = he->h_addr_list; *haddr; haddr++) {
++		local = is_local_addr(hostname, *haddr, he->h_length);
++		if (local < 0) 
++			return local;
++ 		if (local) {
++			debug(MODPREFIX "host %s: is localhost",
++					hostname);
++			return local;
++		}
++	}
++	return 0;
++}
++
  /*
   * Given a mount string, return (in the same string) the
 - * best mount to use based on weight/locality/rpctime
@@ -84,7 +128,7 @@
  	while (p && *p) {
  		char *next;
  		unsigned int ping_stat = 0;
-@@ -171,37 +216,17 @@ int get_best_mount(char *what, const cha
+@@ -171,37 +260,17 @@ int get_best_mount(char *what, const cha
  		/* p points to a server, "next is our next parse point */
  		if (!skiplocal) {
  			/* Check if it's localhost */
@@ -126,7 +170,7 @@
  		}
  
  		/* ping each (or the) entry to see if it's alive. */
-@@ -256,7 +281,7 @@ int get_best_mount(char *what, const cha
+@@ -256,7 +325,7 @@ int get_best_mount(char *what, const cha
  	 */
  	if (!local && winner_weight == INT_MAX) {
  		/* We had more than one contender and none responded in time */
@@ -135,7 +179,7 @@
  			/* We've already tried a longer timeout */
  			if (!longtimeout) {
  				/* Reset string and try again */
-@@ -267,7 +292,7 @@ int get_best_mount(char *what, const cha
+@@ -267,7 +336,7 @@ int get_best_mount(char *what, const cha
  				      "retrying with longer timeout",
  				      original);
  
@@ -144,7 +188,7 @@
  			}
  		}
  	}
-@@ -395,7 +420,7 @@ int mount_mount(const char *root, const 
+@@ -395,7 +464,7 @@ int mount_mount(const char *root, const 
  		/* No colon, take this as a bind (local) entry */
  		local = 1;
  	} else if (!nosymlink) {


Index: autofs.spec
===================================================================
RCS file: /cvs/dist/rpms/autofs/devel/autofs.spec,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- autofs.spec	14 Apr 2005 00:23:30 -0000	1.59
+++ autofs.spec	14 Apr 2005 02:30:56 -0000	1.60
@@ -4,7 +4,7 @@
 Summary: A tool for automatically mounting and unmounting filesystems.
 Name: autofs
 %define version 4.1.4
-%define release 3
+%define release 4
 Version: %{version}
 Release: %{release}
 Epoch: 1
@@ -19,6 +19,7 @@
 Patch6: autofs-4.1.4-non-replicated-ping.patch
 Patch7: autofs-4.1.4-check-nsswitch-submount.patch
 Patch8: autofs-4.1.3-alt-master-ldap.patch
+Patch9: autofs-4.1.4-check-is-multi.patch
 
 Buildroot: /var/tmp/autofs-tmp
 BuildPrereq: autoconf, hesiod-devel, openldap-devel, perl
@@ -64,6 +65,9 @@
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 %build
 #CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=/usr --libdir=%{_libdir}
@@ -117,6 +121,10 @@
 %{_libdir}/autofs/*
 
 %changelog
+* Wed Apr 13 2005 Jeff Moyer <jmoyer at redhat.com> - 1:4.1.4-4
+- Finish up with the merge breakage.
+- Temporary fix for the multimount detection code.  It seems half-baked.
+
 * Wed Apr 13 2005 Jeff Moyer <jmoyer at redhat.com> - 1:4.1.4-3
 - Fix up the one-auto-master patch.  My "improvements" had side-effects.
 




More information about the fedora-cvs-commits mailing list