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

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