diff --git a/CHANGELOG b/CHANGELOG index 2e0b5fe..227cf02 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -8,6 +8,8 @@ - remove unused option UNDERSCORETODOT from default config files. - make default installed master map for /net use "-hosts" instead of auto.net. +- fix included map recursive map key lookup. + - and fix the recursive map key lookup for browsable map case. 1/9/2006 autofs-5.0.1 rc2 ------------------------- diff --git a/daemon/lookup.c b/daemon/lookup.c index dacb678..978f276 100644 --- a/daemon/lookup.c +++ b/daemon/lookup.c @@ -300,9 +300,14 @@ static int read_file_source_instance(str format = map->format; - instance = master_add_source_instance(map, type, format, age); - if (!instance) - return NSS_STATUS_UNAVAIL; + instance = master_find_source_instance(map, type, format, 0, NULL); + if (!instance) { + instance = master_add_source_instance(map, type, format, age); + if (!instance) + return NSS_STATUS_UNAVAIL; + instance->recurse = map->recurse; + instance->depth = map->depth; + } return do_read_map(ap, instance, age); } @@ -314,9 +319,14 @@ static int read_source_instance(struct a format = map->format; - instance = master_add_source_instance(map, type, format, age); - if (!instance) - return NSS_STATUS_UNAVAIL; + instance = master_find_source_instance(map, type, format, 0, NULL); + if (!instance) { + instance = master_add_source_instance(map, type, format, age); + if (!instance) + return NSS_STATUS_UNAVAIL; + instance->recurse = map->recurse; + instance->depth = map->depth; + } return do_read_map(ap, instance, age); } @@ -368,6 +378,8 @@ static enum nsswitch_status read_map_sou tmap.lookup = map->lookup; tmap.mc = map->mc; tmap.instance = map->instance; + tmap.recurse = map->recurse; + tmap.depth = map->depth; tmap.argc = 0; tmap.argv = NULL; @@ -633,9 +645,14 @@ static int lookup_name_file_source_insta format = map->format; - instance = master_add_source_instance(map, type, format, age); - if (!instance) - return NSS_STATUS_NOTFOUND; + instance = master_find_source_instance(map, type, format, 0, NULL); + if (!instance) { + instance = master_add_source_instance(map, type, format, age); + if (!instance) + return NSS_STATUS_NOTFOUND; + instance->recurse = map->recurse; + instance->depth = map->depth; + } return do_lookup_mount(ap, instance, name, name_len); } @@ -649,8 +666,13 @@ static int lookup_name_source_instance(s format = map->format; instance = master_find_source_instance(map, type, format, 0, NULL); - if (!instance) + if (!instance) { instance = master_add_source_instance(map, type, format, age); + if (!instance) + return NSS_STATUS_NOTFOUND; + instance->recurse = map->recurse; + instance->depth = map->depth; + } return do_lookup_mount(ap, instance, name, name_len); } @@ -692,6 +714,8 @@ static enum nsswitch_status lookup_map_n tmap.format = map->format; tmap.mc = map->mc; tmap.instance = map->instance; + tmap.recurse = map->recurse; + tmap.depth = map->depth; tmap.argc = 0; tmap.argv = NULL; diff --git a/modules/lookup_file.c b/modules/lookup_file.c index c20c976..645925d 100644 --- a/modules/lookup_file.c +++ b/modules/lookup_file.c @@ -469,6 +469,17 @@ static int check_self_include(const char { char *m_key, *m_base, *i_key, *i_base; + /* + * If we are including a file map then check the + * full path of the map. + */ + if (*(key + 1) == '/') { + if (!strcmp(key + 1, ctxt->mapname)) + return 1; + else + return 0; + } + i_key = strdup(key + 1); if (!i_key) return 0; @@ -746,7 +757,7 @@ static int lookup_one(struct autofs_poin int status; debug(ap->logopt, - MODPREFIX "lookup included map %s", key); + MODPREFIX "lookup included map %s", mkey); inc = check_self_include(mkey, ctxt);