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