Blame SOURCES/autofs-5.1.4-dont-allow-trailing-slash-in-master-map-mount-points.patch

aea863
autofs-5.1.4 - dont allow trailing slash in master map mount points
aea863
aea863
From: Ian Kent <raven@themaw.net>
aea863
aea863
If a master map mount point path has a trailing '/' this can cause
aea863
problems so remove them at parse time.
aea863
aea863
Signed-off-by: Ian Kent <raven@themaw.net>
aea863
---
aea863
 CHANGELOG          |    1 +
aea863
 lib/master_parse.y |    5 +++++
aea863
 2 files changed, 6 insertions(+)
aea863
aea863
diff --git a/CHANGELOG b/CHANGELOG
aea863
index 1e5ec15b..a7bb89dc 100644
aea863
--- a/CHANGELOG
aea863
+++ b/CHANGELOG
aea863
@@ -12,6 +12,7 @@ xx/xx/2018 autofs-5.1.5
aea863
 - use_hostname_for_mounts shouldn't prevent selection among replicas.
aea863
 - fix monotonic_elapsed.
aea863
 - Makefiles.rules: remove 'samples' from SUBDIRS.
aea863
+- dont allow trailing slash in master map mount points.
aea863
 
aea863
 19/12/2017 autofs-5.1.4
aea863
 - fix spec file url.
aea863
diff --git a/lib/master_parse.y b/lib/master_parse.y
aea863
index 42e03c2d..761ade9b 100644
aea863
--- a/lib/master_parse.y
aea863
+++ b/lib/master_parse.y
aea863
@@ -749,6 +749,7 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
aea863
 	struct map_source *source;
aea863
 	unsigned int logopt = logging;
aea863
 	unsigned int m_logopt = master->logopt;
aea863
+	size_t mp_len;
aea863
 	int ret;
aea863
 
aea863
 	local_init_vars();
aea863
@@ -763,6 +764,10 @@ int master_parse_entry(const char *buffer, unsigned int default_timeout, unsigne
aea863
 		return 0;
aea863
 	}
aea863
 
aea863
+	mp_len = strlen(path);
aea863
+	while (mp_len && path[--mp_len] == '/')
aea863
+		path[mp_len] = 0;
aea863
+
aea863
 	nc = master->nc;
aea863
 
aea863
 	/* Add null map entries to the null map cache */