Blame SOURCES/autofs-5.1.7-fix-mount_fullpath.patch

beb904
autofs-5.1.7 - fix mount_fullpath()
beb904
beb904
From: Ian Kent <raven@themaw.net>
beb904
beb904
mount_fullpath() incorrecly fills fullpath with the contents of root
beb904
when name[0] == '/'. The cases root[last] == '/' and name[0] == '/'
beb904
need to be handled seperately.
beb904
beb904
Signed-off-by: Ian Kent <raven@themaw.net>
beb904
---
beb904
 CHANGELOG           |    1 +
beb904
 lib/mounts.c        |    4 +++-
beb904
 modules/parse_amd.c |    6 ++++--
beb904
 3 files changed, 8 insertions(+), 3 deletions(-)
beb904
beb904
--- autofs-5.1.4.orig/CHANGELOG
beb904
+++ autofs-5.1.4/CHANGELOG
beb904
@@ -36,6 +36,7 @@
beb904
 - add tree_mapent_add_node().
beb904
 - add tree_mapent_delete_offsets().
beb904
 - add tree_mapent_traverse_subtree().
beb904
+- fix mount_fullpath().
beb904
 
beb904
 xx/xx/2018 autofs-5.1.5
beb904
 - fix flag file permission.
beb904
--- autofs-5.1.4.orig/lib/mounts.c
beb904
+++ autofs-5.1.4/lib/mounts.c
beb904
@@ -371,8 +371,10 @@ int mount_fullpath(char *fullpath, size_
beb904
 	/* Root offset of multi-mount or direct or offset mount.
beb904
 	 * Direct or offset mount, name (or root) is absolute path.
beb904
 	 */
beb904
-	if (root[last] == '/' || *name == '/')
beb904
+	if (root[last] == '/')
beb904
 		len = snprintf(fullpath, max_len, "%s", root);
beb904
+	else if (*name == '/')
beb904
+		len = snprintf(fullpath, max_len, "%s", name);
beb904
 	else
beb904
 		len = snprintf(fullpath, max_len, "%s/%s", root, name);
beb904
 
beb904
--- autofs-5.1.4.orig/modules/parse_amd.c
beb904
+++ autofs-5.1.4/modules/parse_amd.c
beb904
@@ -1177,7 +1177,8 @@ static int do_generic_mount(struct autof
beb904
 		 * the automount filesystem.
beb904
 		 */
beb904
 		if (!is_mounted(entry->fs, MNTS_REAL)) {
beb904
-			ret = do_mount(ap, entry->fs, "/", 1,
beb904
+			ret = do_mount(ap, entry->fs,
beb904
+				       entry->fs, strlen(entry->fs),
beb904
 				       target, entry->type, opts);
beb904
 			if (ret)
beb904
 				goto out;
beb904
@@ -1227,7 +1228,8 @@ static int do_nfs_mount(struct autofs_po
beb904
 					     mount_nfs->context);
beb904
 	} else {
beb904
 		if (!is_mounted(entry->fs, MNTS_REAL)) {
beb904
-			ret = mount_nfs->mount_mount(ap, entry->fs, "/", 1,
beb904
+			ret = mount_nfs->mount_mount(ap, entry->fs,
beb904
+						entry->fs, strlen(entry->fs),
beb904
 						target, entry->type, opts,
beb904
 						mount_nfs->context);
beb904
 			if (ret)