Ian Kent d25689
autofs-5.1.4 - fix prefix option handling in expand_entry()
Ian Kent d25689
Ian Kent d25689
From: Ian Kent <raven@themaw.net>
Ian Kent d25689
Ian Kent d25689
The changes to fix the defaults handling in the amd map parser caused
Ian Kent d25689
the prefix option to not be expanded and also to not be propagated to
Ian Kent d25689
submounts in some cases.
Ian Kent d25689
Ian Kent d25689
But the prefix should be expanded in modules/parse_amd.c:expand_entry()
Ian Kent d25689
along with the reset of the amd map entry fields.
Ian Kent d25689
Ian Kent d25689
Just adding this to modules/parse_amd.c:expand_entry() (where it should
Ian Kent d25689
be) fixes the amd map entry expansion and also fixes the propagation
Ian Kent d25689
of the prefix to submounts.
Ian Kent d25689
Ian Kent d25689
Signed-off-by: Ian Kent <raven@themaw.net>
Ian Kent d25689
---
Ian Kent d25689
 CHANGELOG           |    1 +
Ian Kent d25689
 modules/parse_amd.c |   11 +++++++++++
Ian Kent d25689
 2 files changed, 12 insertions(+)
Ian Kent d25689
Ian Kent d25689
--- autofs-5.1.4.orig/CHANGELOG
Ian Kent d25689
+++ autofs-5.1.4/CHANGELOG
Ian Kent d25689
@@ -64,6 +64,7 @@
Ian Kent d25689
 - workaround getaddrinfo(3) ai_canonname bug
Ian Kent d25689
 - fix deadlock in dumpmaps.
Ian Kent d25689
 - dont use array for path when not necessary.
Ian Kent d25689
+- fix prefix option handling in expand_entry().
Ian Kent d25689
 
Ian Kent d25689
 24/05/2017 autofs-5.1.3
Ian Kent d25689
 =======================
Ian Kent d25689
--- autofs-5.1.4.orig/modules/parse_amd.c
Ian Kent d25689
+++ autofs-5.1.4/modules/parse_amd.c
Ian Kent d25689
@@ -725,6 +725,17 @@ static struct substvar *expand_entry(str
Ian Kent d25689
 		entry->rhost = host;
Ian Kent d25689
 	}
Ian Kent d25689
 next:
Ian Kent d25689
+	if (entry->pref) {
Ian Kent d25689
+		if (expand_selectors(ap, entry->pref, &expand, sv)) {
Ian Kent d25689
+			debug(logopt, MODPREFIX
Ian Kent d25689
+			      "pref expand(\"%s\") -> %s",
Ian Kent d25689
+			      entry->pref, expand);
Ian Kent d25689
+			free(entry->pref);
Ian Kent d25689
+			entry->pref = expand;
Ian Kent d25689
+		}
Ian Kent d25689
+		sv = macro_addvar(sv, "pref", 4, entry->pref);
Ian Kent d25689
+	}
Ian Kent d25689
+
Ian Kent d25689
 	if (entry->sublink) {
Ian Kent d25689
 		if (expand_selectors(ap, entry->sublink, &expand, sv)) {
Ian Kent d25689
 			debug(logopt, MODPREFIX