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

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