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

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