You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

62 lines
2.1 KiB

autofs-5.0.9 - amd lookup use config map_type if type is not given
From: Ian Kent <raven@themaw.net>
If the map type isn't given in the map defaults or the map location
the attempt to set it from the configuration.
A NULL map type is valid and means use the nss source list to find
the source of the map.
This approach may not always give the best result. For example, when
a map type specified in the master map submounts will not inherit
it and will instead use a configured global type instead. Second,
if we want to use nss to find a map source a global map type can't
be defined or it will override the nss source search.
---
modules/parse_amd.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/modules/parse_amd.c b/modules/parse_amd.c
index e27a195..bf673b3 100644
--- a/modules/parse_amd.c
+++ b/modules/parse_amd.c
@@ -1339,12 +1339,21 @@ struct amd_entry *make_default_entry(struct autofs_point *ap,
char *defaults = "opts:=rw,defaults";
struct amd_entry *defaults_entry;
struct list_head dflts;
+ char *map_type;
INIT_LIST_HEAD(&dflts);
if (amd_parse_list(ap, defaults, &dflts, &sv))
return NULL;
defaults_entry = list_entry(dflts.next, struct amd_entry, list);
list_del_init(&defaults_entry->list);
+ /*
+ * If map type isn't given try to inherit from
+ * parent. A NULL map type is valid and means
+ * use configured nss sources.
+ */
+ map_type = conf_amd_get_map_type(ap->path);
+ if (map_type)
+ defaults_entry->map_type = strdup(map_type);
/* The list should now be empty .... */
free_amd_entry_list(&dflts);
return defaults_entry;
@@ -1458,6 +1467,16 @@ static struct amd_entry *get_defaults_entry(struct autofs_point *ap,
if (amd_parse_list(ap, expand, &dflts, &sv))
goto out;
entry = select_default_entry(ap, &dflts, sv);
+ if (!entry->map_type) {
+ /*
+ * If map type isn't given try to inherit from
+ * parent. A NULL map type is valid and means
+ * use configured nss sources.
+ */
+ char *map_type = conf_amd_get_map_type(ap->path);
+ if (map_type)
+ entry->map_type = strdup(map_type);
+ }
free(expand);
}