rpms/autofs/devel autofs-4.1.4-sun-parse-fixes.patch,NONE,1.1

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Wed Oct 26 19:46:12 UTC 2005


Author: jmoyer

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

Added Files:
	autofs-4.1.4-sun-parse-fixes.patch 
Log Message:
Fix a couple of bugs in the sun parser.  One disallows multiple entries of
the same name in a multimount map.  Another fix bails out when an entry of
the form "<key> /xyz".  This is invalid and should be ignored.



autofs-4.1.4-sun-parse-fixes.patch:
 parse_sun.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+)

--- NEW FILE autofs-4.1.4-sun-parse-fixes.patch ---
diff -Nurp autofs-4.1.4.orig/modules/parse_sun.c autofs-4.1.4/modules/parse_sun.c
--- autofs-4.1.4.orig/modules/parse_sun.c	2005-05-07 17:39:44.000000000 +0800
+++ autofs-4.1.4/modules/parse_sun.c	2005-05-07 17:35:27.000000000 +0800
@@ -680,6 +680,10 @@ static int sun_mount(const char *root, c
 	    "mounting root %s, mountpoint %s, what %s, fstype %s, options %s\n",
 	    root, mountpoint, what, fstype, options);
 
+	/* A malformed entry of the form key /xyz will trigger this case */
+	if (!what || *what == '\0')
+		return 1;
+
 	if (!strcmp(fstype, "nfs")) {
 		rv = mount_nfs->mount_mount(root, mountpoint, strlen(mountpoint),
 					    what, fstype, options, mount_nfs->context);
@@ -695,6 +699,18 @@ static int sun_mount(const char *root, c
 	return rv;
 }
 
+static int key_exists(struct multi_mnt *list, char *path, int pathlen)
+{
+	struct multi_mnt *mmptr = list;
+
+	while (mmptr && pathlen == strlen(mmptr->path)) {
+		if (!strncmp(mmptr->path, path, pathlen))
+			return 1;
+		mmptr = mmptr->next;
+	}
+	return 0;
+}
+
 /*
  * Build list of mounts in shortest -> longest order.
  * Pass in list head and return list head.
@@ -725,6 +741,12 @@ struct multi_mnt *multi_add_list(struct 
 		mmptr = mmptr->next;
 	}
 
+	/* if a multimount entry has duplicate keys, it is invalid */
+	if (key_exists(mmptr, path, plen)) {
+		free(new);
+		return NULL;
+	}
+
 	if (old)
 		old->next = new;
 	new->next = mmptr;




More information about the fedora-cvs-commits mailing list