[PATCH 14/20] autofs-5.1.4 - dont allow trailing slash in master map mount points

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If a master map mount point path has a trailing '/' this can cause
problems so remove them at parse time.

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
---
 CHANGELOG          |    1 +
 lib/master_parse.y |    5 +++++
 2 files changed, 6 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 1e5ec15b..a7bb89dc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ xx/xx/2018 autofs-5.1.5
 - use_hostname_for_mounts shouldn't prevent selection among replicas.
 - fix monotonic_elapsed.
 - Makefiles.rules: remove 'samples' from SUBDIRS.
+- dont allow trailing slash in master map mount points.
 
 19/12/2017 autofs-5.1.4
 - fix spec file url.
diff --git a/lib/master_parse.y b/lib/master_parse.y
index 42e03c2d..761ade9b 100644
--- a/lib/master_parse.y
+++ b/lib/master_parse.y
@@ -749,6 +749,7 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
 	struct map_source *source;
 	unsigned int logopt = logging;
 	unsigned int m_logopt = master->logopt;
+	size_t mp_len;
 	int ret;
 
 	local_init_vars();
@@ -763,6 +764,10 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
 		return 0;
 	}
 
+	mp_len = strlen(path);
+	while (mp_len && path[--mp_len] == '/')
+		path[mp_len] = 0;
+
 	nc = master->nc;
 
 	/* Add null map entries to the null map cache */

--
To unsubscribe from this list: send the line "unsubscribe autofs" in



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux