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

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