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