Blob Blame History Raw
autofs-5.1.4 - fix prefix option handling in expand_entry()

From: Ian Kent <raven@themaw.net>

The changes to fix the defaults handling in the amd map parser caused
the prefix option to not be expanded and also to not be propagated to
submounts in some cases.

But the prefix should be expanded in modules/parse_amd.c:expand_entry()
along with the reset of the amd map entry fields.

Just adding this to modules/parse_amd.c:expand_entry() (where it should
be) fixes the amd map entry expansion and also fixes the propagation
of the prefix to submounts.

Signed-off-by: Ian Kent <raven@themaw.net>
---
 CHANGELOG           |    1 +
 modules/parse_amd.c |   11 +++++++++++
 2 files changed, 12 insertions(+)

--- autofs-5.0.7.orig/CHANGELOG
+++ autofs-5.0.7/CHANGELOG
@@ -292,6 +292,7 @@
 - fix use after free in do_master_list_reset().
 - fix deadlock in dumpmaps.
 - dont use array for path when not necessary.
+- fix prefix option handling in expand_entry().
 
 25/07/2012 autofs-5.0.7
 =======================
--- autofs-5.0.7.orig/modules/parse_amd.c
+++ autofs-5.0.7/modules/parse_amd.c
@@ -727,6 +727,17 @@ static struct substvar *expand_entry(str
 		entry->rhost = host;
 	}
 next:
+	if (entry->pref) {
+		if (expand_selectors(ap, entry->pref, &expand, sv)) {
+			debug(logopt, MODPREFIX
+			      "pref expand(\"%s\") -> %s",
+			      entry->pref, expand);
+			free(entry->pref);
+			entry->pref = expand;
+		}
+		sv = macro_addvar(sv, "pref", 4, entry->pref);
+	}
+
 	if (entry->sublink) {
 		if (expand_selectors(ap, entry->sublink, &expand, sv)) {
 			debug(logopt, MODPREFIX