commit edceb48269a925b61187ae30ce4f863598c2034b
Author: Ian Kent <ikent@redhat.com>
Date:   Fri May 25 10:00:09 2012 +0800

    autofs-5.0.6 - duplicate parent options for included maps
    
    Included maps should inherite mount options from their parent mount.

Index: autofs-5.0.5/modules/lookup_file.c
===================================================================
--- autofs-5.0.5.orig/modules/lookup_file.c
+++ autofs-5.0.5/modules/lookup_file.c
@@ -41,9 +41,10 @@ typedef enum {
 typedef enum { got_nothing, got_star, got_real, got_plus } FOUND_STATE;
 typedef enum { esc_none, esc_char, esc_val, esc_all } ESCAPES;
 
-
 struct lookup_context {
 	const char *mapname;
+	int opts_argc;
+	const char **opts_argv;
 	struct parse_mod *parse;
 };
 
@@ -88,8 +89,20 @@ int lookup_init(const char *mapfmt, int
 	if (!mapfmt)
 		mapfmt = MAPFMT_DEFAULT;
 
-	ctxt->parse = open_parse(mapfmt, MODPREFIX, argc - 1, argv + 1);
+	argc--;
+	argv++;
+
+	ctxt->opts_argv = copy_argv(argc, (const char **) argv);
+	if (ctxt->opts_argv == NULL) {
+		free(ctxt);
+		warn(LOGOPT_NONE, MODPREFIX "failed to duplicate options");
+		return 1;
+	}
+	ctxt->opts_argc = argc;
+
+	ctxt->parse = open_parse(mapfmt, MODPREFIX, argc, argv);
 	if (!ctxt->parse) {
+		free_argv(ctxt->opts_argc, ctxt->opts_argv);
 		free(ctxt);
 		logmsg(MODPREFIX "failed to open parse context");
 		return 1;
@@ -512,12 +525,15 @@ static int check_self_include(const char
 }
 
 static struct map_source *
-prepare_plus_include(struct autofs_point *ap, time_t age, char *key, unsigned int inc)
+prepare_plus_include(struct autofs_point *ap,
+		     time_t age, char *key, unsigned int inc,
+		     struct lookup_context *ctxt)
 {
 	struct map_source *current;
 	struct map_source *source;
 	struct map_type_info *info;
 	const char *argv[2];
+	char **tmp_argv, **tmp_opts;
 	int argc;
 	char *buf;
 
@@ -551,9 +567,35 @@ prepare_plus_include(struct autofs_point
 	argv[0] = info->map;
 	argv[1] = NULL;
 
+	tmp_argv = (char **) copy_argv(argc, argv);
+	if (!tmp_argv) {
+		error(ap->logopt, MODPREFIX "failed to allocate args vector");
+		free_map_type_info(info);
+		free(buf);
+		return NULL;
+	}
+
+	tmp_opts = (char **) copy_argv(ctxt->opts_argc, ctxt->opts_argv);
+	if (!tmp_opts) {
+		error(ap->logopt, MODPREFIX "failed to allocate options args vector");
+		free_argv(argc, (const char **) tmp_argv);
+		free_map_type_info(info);
+		free(buf);
+		return NULL;
+	}
+
+	tmp_argv = append_argv(argc, tmp_argv, ctxt->opts_argc, tmp_opts);
+	if (!tmp_argv) {
+		error(ap->logopt, MODPREFIX "failed to append options vector");
+		free_map_type_info(info);
+		free(buf);
+		return NULL;
+	}
+	argc += ctxt->opts_argc;
+
 	source = master_find_source_instance(current,
 					     info->type, info->format,
-					     argc, argv);
+					     argc, (const char **) tmp_argv);
 	if (source) {
 		/*
 		 * Make sure included map age is in sync with its owner
@@ -563,15 +605,17 @@ prepare_plus_include(struct autofs_point
 		source->stale = 1;
 	} else {
 		source = master_add_source_instance(current,
-						    info->type, info->format,
-						    age, argc, argv);
+						    info->type, info->format, age,
+						    argc, (const char **) tmp_argv);
 		if (!source) {
+			free_argv(argc, (const char **) tmp_argv);
 			free_map_type_info(info);
 			free(buf);
 			error(ap->logopt, "failed to add included map instance");
 			return NULL;
 		}
 	}
+	free_argv(argc, (const char **) tmp_argv);
 
 	source->depth = current->depth + 1;
 	if (inc)
@@ -645,7 +689,7 @@ int lookup_read_map(struct autofs_point
 			master_source_current_wait(ap->entry);
 			ap->entry->current = source;
 
-			inc_source = prepare_plus_include(ap, age, key, inc);
+			inc_source = prepare_plus_include(ap, age, key, inc, ctxt);
 			if (!inc_source) {
 				debug(ap->logopt,
 				      "failed to select included map %s", key);
@@ -729,7 +773,7 @@ static int lookup_one(struct autofs_poin
 				master_source_current_wait(ap->entry);
 				ap->entry->current = source;
 
-				inc_source = prepare_plus_include(ap, age, mkey, inc);
+				inc_source = prepare_plus_include(ap, age, mkey, inc, ctxt);
 				if (!inc_source) {
 					debug(ap->logopt,
 					      MODPREFIX
@@ -1096,6 +1140,7 @@ int lookup_done(void *context)
 {
 	struct lookup_context *ctxt = (struct lookup_context *) context;
 	int rv = close_parse(ctxt->parse);
+	free_argv(ctxt->opts_argc, ctxt->opts_argv);
 	free(ctxt);
 	return rv;
 }
Index: autofs-5.0.5/CHANGELOG
===================================================================
--- autofs-5.0.5.orig/CHANGELOG
+++ autofs-5.0.5/CHANGELOG
@@ -68,6 +68,7 @@
 - fix map source check in file lookup.
 - check scandir() return value.
 - fix sasl bind host name selection.
+- duplicate parent options for included maps.
 
 03/09/2009 autofs-5.0.5
 -----------------------
