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

49 lines
1.4 KiB
Diff

autofs-5.1.4 - dont allow trailing slash in master map mount points
From: Ian Kent <raven@themaw.net>
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@themaw.net>
---
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 */