Blame SOURCES/autofs-5.1.4-fix-prefix-option-handling-in-expand_entry.patch

d5dcad
autofs-5.1.4 - fix prefix option handling in expand_entry()
d5dcad
d5dcad
From: Ian Kent <raven@themaw.net>
d5dcad
d5dcad
The changes to fix the defaults handling in the amd map parser caused
d5dcad
the prefix option to not be expanded and also to not be propagated to
d5dcad
submounts in some cases.
d5dcad
d5dcad
But the prefix should be expanded in modules/parse_amd.c:expand_entry()
d5dcad
along with the reset of the amd map entry fields.
d5dcad
d5dcad
Just adding this to modules/parse_amd.c:expand_entry() (where it should
d5dcad
be) fixes the amd map entry expansion and also fixes the propagation
d5dcad
of the prefix to submounts.
d5dcad
d5dcad
Signed-off-by: Ian Kent <raven@themaw.net>
d5dcad
---
d5dcad
 CHANGELOG           |    1 +
d5dcad
 modules/parse_amd.c |   11 +++++++++++
d5dcad
 2 files changed, 12 insertions(+)
d5dcad
d5dcad
diff --git a/CHANGELOG b/CHANGELOG
d5dcad
index 13f01397..19aec2ae 100644
d5dcad
--- a/CHANGELOG
d5dcad
+++ b/CHANGELOG
d5dcad
@@ -4,6 +4,7 @@ xx/xx/2018 autofs-5.1.5
d5dcad
 - fix use after free in do_master_list_reset().
d5dcad
 - fix deadlock in dumpmaps.
d5dcad
 - dont use array for path when not necessary.
d5dcad
+- fix prefix option handling in expand_entry().
d5dcad
 
d5dcad
 19/12/2017 autofs-5.1.4
d5dcad
 - fix spec file url.
d5dcad
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
d5dcad
index 2cce5417..1a5a2960 100644
d5dcad
--- a/modules/parse_amd.c
d5dcad
+++ b/modules/parse_amd.c
d5dcad
@@ -725,6 +725,17 @@ static struct substvar *expand_entry(struct autofs_point *ap,
d5dcad
 		entry->rhost = host;
d5dcad
 	}
d5dcad
 next:
d5dcad
+	if (entry->pref) {
d5dcad
+		if (expand_selectors(ap, entry->pref, &expand, sv)) {
d5dcad
+			debug(logopt, MODPREFIX
d5dcad
+			      "pref expand(\"%s\") -> %s",
d5dcad
+			      entry->pref, expand);
d5dcad
+			free(entry->pref);
d5dcad
+			entry->pref = expand;
d5dcad
+		}
d5dcad
+		sv = macro_addvar(sv, "pref", 4, entry->pref);
d5dcad
+	}
d5dcad
+
d5dcad
 	if (entry->sublink) {
d5dcad
 		if (expand_selectors(ap, entry->sublink, &expand, sv)) {
d5dcad
 			debug(logopt, MODPREFIX