|
Ian Kent |
cc58c1 |
autofs-5.0.6 - duplicate parent options for included maps
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
From: Ian Kent <ikent@redhat.com>
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
Included maps should inherite mount options from their parent mount.
|
|
Ian Kent |
cc58c1 |
---
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
CHANGELOG | 1
|
|
Ian Kent |
cc58c1 |
modules/lookup_file.c | 61 +++++++++++++++++++++++++++++++++++++++++++-------
|
|
Ian Kent |
cc58c1 |
2 files changed, 54 insertions(+), 8 deletions(-)
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
--- autofs-5.0.6.orig/CHANGELOG
|
|
Ian Kent |
cc58c1 |
+++ autofs-5.0.6/CHANGELOG
|
|
Ian Kent |
cc58c1 |
@@ -43,6 +43,7 @@
|
|
Ian Kent |
cc58c1 |
- fix initialization in rpc create_client().
|
|
Ian Kent |
cc58c1 |
- fix libtirpc name clash.
|
|
Ian Kent |
cc58c1 |
- report map not read when debug logging.
|
|
Ian Kent |
cc58c1 |
+- duplicate parent options for included maps.
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
28/06/2011 autofs-5.0.6
|
|
Ian Kent |
cc58c1 |
-----------------------
|
|
Ian Kent |
cc58c1 |
--- autofs-5.0.6.orig/modules/lookup_file.c
|
|
Ian Kent |
cc58c1 |
+++ autofs-5.0.6/modules/lookup_file.c
|
|
Ian Kent |
cc58c1 |
@@ -41,9 +41,10 @@ typedef enum {
|
|
Ian Kent |
cc58c1 |
typedef enum { got_nothing, got_star, got_real, got_plus } FOUND_STATE;
|
|
Ian Kent |
cc58c1 |
typedef enum { esc_none, esc_char, esc_val, esc_all } ESCAPES;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
-
|
|
Ian Kent |
cc58c1 |
struct lookup_context {
|
|
Ian Kent |
cc58c1 |
const char *mapname;
|
|
Ian Kent |
cc58c1 |
+ int opts_argc;
|
|
Ian Kent |
cc58c1 |
+ const char **opts_argv;
|
|
Ian Kent |
cc58c1 |
struct parse_mod *parse;
|
|
Ian Kent |
cc58c1 |
};
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
@@ -88,8 +89,20 @@ int lookup_init(const char *mapfmt, int
|
|
Ian Kent |
cc58c1 |
if (!mapfmt)
|
|
Ian Kent |
cc58c1 |
mapfmt = MAPFMT_DEFAULT;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
- ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);
|
|
Ian Kent |
cc58c1 |
+ argc--;
|
|
Ian Kent |
cc58c1 |
+ argv++;
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
+ ctxt->opts_argv = copy_argv(argc, (const char **) argv);
|
|
Ian Kent |
cc58c1 |
+ if (ctxt->opts_argv == NULL) {
|
|
Ian Kent |
cc58c1 |
+ free(ctxt);
|
|
Ian Kent |
cc58c1 |
+ warn(LOGOPT_NONE, MODPREFIX "failed to duplicate options");
|
|
Ian Kent |
cc58c1 |
+ return 1;
|
|
Ian Kent |
cc58c1 |
+ }
|
|
Ian Kent |
cc58c1 |
+ ctxt->opts_argc = argc;
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
+ ctxt->parse = open_parse(mapfmt, MODPREFIX, argc, argv);
|
|
Ian Kent |
cc58c1 |
if (!ctxt->parse) {
|
|
Ian Kent |
cc58c1 |
+ free_argv(ctxt->opts_argc, ctxt->opts_argv);
|
|
Ian Kent |
cc58c1 |
free(ctxt);
|
|
Ian Kent |
cc58c1 |
logmsg(MODPREFIX "failed to open parse context");
|
|
Ian Kent |
cc58c1 |
return 1;
|
|
Ian Kent |
cc58c1 |
@@ -512,12 +525,15 @@ static int check_self_include(const char
|
|
Ian Kent |
cc58c1 |
}
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
static struct map_source *
|
|
Ian Kent |
cc58c1 |
-prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned int inc)
|
|
Ian Kent |
cc58c1 |
+prepare_plus_include(struct autofs_point *ap,
|
|
Ian Kent |
cc58c1 |
+ time_t age, char *key, unsigned int inc,
|
|
Ian Kent |
cc58c1 |
+ struct lookup_context *ctxt)
|
|
Ian Kent |
cc58c1 |
{
|
|
Ian Kent |
cc58c1 |
struct map_source *current;
|
|
Ian Kent |
cc58c1 |
struct map_source *source;
|
|
Ian Kent |
cc58c1 |
struct map_type_info *info;
|
|
Ian Kent |
cc58c1 |
const char *argv[2];
|
|
Ian Kent |
cc58c1 |
+ char **tmp_argv, **tmp_opts;
|
|
Ian Kent |
cc58c1 |
int argc;
|
|
Ian Kent |
cc58c1 |
char *buf;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
@@ -551,9 +567,35 @@ prepare_plus_include(struct autofs_point
|
|
Ian Kent |
cc58c1 |
argv[0] = info->map;
|
|
Ian Kent |
cc58c1 |
argv[1] = NULL;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
+ tmp_argv = (char **) copy_argv(argc, argv);
|
|
Ian Kent |
cc58c1 |
+ if (!tmp_argv) {
|
|
Ian Kent |
cc58c1 |
+ error(ap->logopt, MODPREFIX "failed to allocate args vector");
|
|
Ian Kent |
cc58c1 |
+ free_map_type_info(info);
|
|
Ian Kent |
cc58c1 |
+ free(buf);
|
|
Ian Kent |
cc58c1 |
+ return NULL;
|
|
Ian Kent |
cc58c1 |
+ }
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
+ tmp_opts = (char **) copy_argv(ctxt->opts_argc, ctxt->opts_argv);
|
|
Ian Kent |
cc58c1 |
+ if (!tmp_opts) {
|
|
Ian Kent |
cc58c1 |
+ error(ap->logopt, MODPREFIX "failed to allocate options args vector");
|
|
Ian Kent |
cc58c1 |
+ free_argv(argc, (const char **) tmp_argv);
|
|
Ian Kent |
cc58c1 |
+ free_map_type_info(info);
|
|
Ian Kent |
cc58c1 |
+ free(buf);
|
|
Ian Kent |
cc58c1 |
+ return NULL;
|
|
Ian Kent |
cc58c1 |
+ }
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
+ tmp_argv = append_argv(argc, tmp_argv, ctxt->opts_argc, tmp_opts);
|
|
Ian Kent |
cc58c1 |
+ if (!tmp_argv) {
|
|
Ian Kent |
cc58c1 |
+ error(ap->logopt, MODPREFIX "failed to append options vector");
|
|
Ian Kent |
cc58c1 |
+ free_map_type_info(info);
|
|
Ian Kent |
cc58c1 |
+ free(buf);
|
|
Ian Kent |
cc58c1 |
+ return NULL;
|
|
Ian Kent |
cc58c1 |
+ }
|
|
Ian Kent |
cc58c1 |
+ argc += ctxt->opts_argc;
|
|
Ian Kent |
cc58c1 |
+
|
|
Ian Kent |
cc58c1 |
source = master_find_source_instance(current,
|
|
Ian Kent |
cc58c1 |
info->type, info->format,
|
|
Ian Kent |
cc58c1 |
- argc, argv);
|
|
Ian Kent |
cc58c1 |
+ argc, (const char **) tmp_argv);
|
|
Ian Kent |
cc58c1 |
if (source) {
|
|
Ian Kent |
cc58c1 |
/*
|
|
Ian Kent |
cc58c1 |
* Make sure included map age is in sync with its owner
|
|
Ian Kent |
cc58c1 |
@@ -563,15 +605,17 @@ prepare_plus_include(struct autofs_point
|
|
Ian Kent |
cc58c1 |
source->stale = 1;
|
|
Ian Kent |
cc58c1 |
} else {
|
|
Ian Kent |
cc58c1 |
source = master_add_source_instance(current,
|
|
Ian Kent |
cc58c1 |
- info->type, info->format,
|
|
Ian Kent |
cc58c1 |
- age, argc, argv);
|
|
Ian Kent |
cc58c1 |
+ info->type, info->format, age,
|
|
Ian Kent |
cc58c1 |
+ argc, (const char **) tmp_argv);
|
|
Ian Kent |
cc58c1 |
if (!source) {
|
|
Ian Kent |
cc58c1 |
+ free_argv(argc, (const char **) tmp_argv);
|
|
Ian Kent |
cc58c1 |
free_map_type_info(info);
|
|
Ian Kent |
cc58c1 |
free(buf);
|
|
Ian Kent |
cc58c1 |
error(ap->logopt, "failed to add included map instance");
|
|
Ian Kent |
cc58c1 |
return NULL;
|
|
Ian Kent |
cc58c1 |
}
|
|
Ian Kent |
cc58c1 |
}
|
|
Ian Kent |
cc58c1 |
+ free_argv(argc, (const char **) tmp_argv);
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
source->depth = current->depth + 1;
|
|
Ian Kent |
cc58c1 |
if (inc)
|
|
Ian Kent |
cc58c1 |
@@ -645,7 +689,7 @@ int lookup_read_map(struct autofs_point
|
|
Ian Kent |
cc58c1 |
master_source_current_wait(ap->entry);
|
|
Ian Kent |
cc58c1 |
ap->entry->current = source;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
- inc_source = prepare_plus_include(ap, age, key, inc);
|
|
Ian Kent |
cc58c1 |
+ inc_source = prepare_plus_include(ap, age, key, inc, ctxt);
|
|
Ian Kent |
cc58c1 |
if (!inc_source) {
|
|
Ian Kent |
cc58c1 |
debug(ap->logopt,
|
|
Ian Kent |
cc58c1 |
"failed to select included map %s", key);
|
|
Ian Kent |
cc58c1 |
@@ -729,7 +773,7 @@ static int lookup_one(struct autofs_poin
|
|
Ian Kent |
cc58c1 |
master_source_current_wait(ap->entry);
|
|
Ian Kent |
cc58c1 |
ap->entry->current = source;
|
|
Ian Kent |
cc58c1 |
|
|
Ian Kent |
cc58c1 |
- inc_source = prepare_plus_include(ap, age, mkey, inc);
|
|
Ian Kent |
cc58c1 |
+ inc_source = prepare_plus_include(ap, age, mkey, inc, ctxt);
|
|
Ian Kent |
cc58c1 |
if (!inc_source) {
|
|
Ian Kent |
cc58c1 |
debug(ap->logopt,
|
|
Ian Kent |
cc58c1 |
MODPREFIX
|
|
Ian Kent |
cc58c1 |
@@ -1096,6 +1140,7 @@ int lookup_done(void *context)
|
|
Ian Kent |
cc58c1 |
{
|
|
Ian Kent |
cc58c1 |
struct lookup_context *ctxt = (struct lookup_context *) context;
|
|
Ian Kent |
cc58c1 |
int rv = close_parse(ctxt->parse);
|
|
Ian Kent |
cc58c1 |
+ free_argv(ctxt->opts_argc, ctxt->opts_argv);
|
|
Ian Kent |
cc58c1 |
free(ctxt);
|
|
Ian Kent |
cc58c1 |
return rv;
|
|
Ian Kent |
cc58c1 |
}
|