Blame SOURCES/autofs-5.1.3-remove-expand_selectors-call-on-amd-parser-entry.patch

cef8f8
autofs-5.1.3 - remove expand_selectors() call on amd parser entry
cef8f8
cef8f8
From: Ian Kent <raven@themaw.net>
cef8f8
cef8f8
Macro expansion within the amd parser has to be done during the mount
cef8f8
attempt loop, after any defaults are setup and also after any defaults
cef8f8
overrides from the map entry itself.
cef8f8
cef8f8
Signed-off-by: Ian Kent <raven@themaw.net>
cef8f8
---
cef8f8
 CHANGELOG           |    1 +
cef8f8
 modules/parse_amd.c |   22 ++++++----------------
cef8f8
 2 files changed, 7 insertions(+), 16 deletions(-)
cef8f8
cef8f8
--- autofs-5.0.7.orig/CHANGELOG
cef8f8
+++ autofs-5.0.7/CHANGELOG
cef8f8
@@ -271,6 +271,7 @@
cef8f8
 - fix typo in amd_parse.c.
cef8f8
 - add missing MODPREFIX to logging in amd parser.
cef8f8
 - fix symlink false negative in umount_multi().
cef8f8
+- remove expand_selectors() on amd parser entry.
cef8f8
 
cef8f8
 25/07/2012 autofs-5.0.7
cef8f8
 =======================
cef8f8
--- autofs-5.0.7.orig/modules/parse_amd.c
cef8f8
+++ autofs-5.0.7/modules/parse_amd.c
cef8f8
@@ -1846,7 +1846,6 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 	struct amd_entry *defaults_entry;
cef8f8
 	struct amd_entry *cur_defaults;
cef8f8
 	char *defaults;
cef8f8
-	char *pmapent;
cef8f8
 	int len, rv = 1;
cef8f8
 	int cur_state;
cef8f8
 	int ret;
cef8f8
@@ -1871,17 +1870,8 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 		return 1;
cef8f8
 	}
cef8f8
 
cef8f8
-	len = expand_selectors(ap, mapent, &pmapent, sv);
cef8f8
-	if (!len) {
cef8f8
-		macro_free_table(sv);
cef8f8
-		pthread_setcancelstate(cur_state, NULL);
cef8f8
-		return 1;
cef8f8
-	}
cef8f8
-
cef8f8
 	pthread_setcancelstate(cur_state, NULL);
cef8f8
 
cef8f8
-	debug(ap->logopt, MODPREFIX "expanded mapent: %s", pmapent);
cef8f8
-
cef8f8
 	defaults = conf_amd_get_map_defaults(ap->path);
cef8f8
 	if (defaults) {
cef8f8
 		debug(ap->logopt, MODPREFIX
cef8f8
@@ -1903,7 +1893,6 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 		error(ap->logopt, MODPREFIX "failed to get a defaults entry");
cef8f8
 		if (defaults)
cef8f8
 			free(defaults);
cef8f8
-		free(pmapent);
cef8f8
 		macro_free_table(sv);
cef8f8
 		return 1;
cef8f8
 	}
cef8f8
@@ -1912,16 +1901,13 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 
cef8f8
 	INIT_LIST_HEAD(&entries);
cef8f8
 
cef8f8
-	ret = amd_parse_list(ap, pmapent, &entries, &sv;;
cef8f8
+	ret = amd_parse_list(ap, mapent, &entries, &sv;;
cef8f8
 	if (ret) {
cef8f8
 		error(ap->logopt,
cef8f8
-		      MODPREFIX "failed to parse entry: %s", pmapent);
cef8f8
-		free(pmapent);
cef8f8
+		      MODPREFIX "failed to parse entry: %s", mapent);
cef8f8
 		goto done;
cef8f8
 	}
cef8f8
 
cef8f8
-	free(pmapent);
cef8f8
-
cef8f8
 	if (list_empty(&entries)) {
cef8f8
 		error(ap->logopt, MODPREFIX "no location found after parse");
cef8f8
 		goto done;
cef8f8
@@ -1958,6 +1944,9 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 			continue;
cef8f8
 		}
cef8f8
 
cef8f8
+		debug(ap->logopt, "expand defaults entry");
cef8f8
+		sv = expand_entry(ap, cur_defaults, flags, sv);
cef8f8
+
cef8f8
 		if (this->flags & AMD_ENTRY_CUT && at_least_one) {
cef8f8
 			info(ap->logopt, MODPREFIX
cef8f8
 			     "at least one entry tried before cut selector, "
cef8f8
@@ -1970,6 +1959,7 @@ int parse_mount(struct autofs_point *ap,
cef8f8
 
cef8f8
 		at_least_one = 1;
cef8f8
 
cef8f8
+		debug(ap->logopt, "expand mount entry");
cef8f8
 		update_with_defaults(cur_defaults, this, sv);
cef8f8
 		sv = expand_entry(ap, this, flags, sv);
cef8f8
 		sv = merge_entry_options(ap, this, sv);