Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 15

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.1 - always read file maps key lookup fixes

From: Ian Kent <raven@themaw.net>

Since we always read file maps at start we need to ensure that
we return a not found if the key isn't found in the cache. Also,
if we're looking through a "multi" map we can't use the cache
lookup optimisation because, in this case, there is a single map
source shared by the "multi" maps so we may not get correct results
from the lookup if a map later in the search has been modified.
---

 modules/lookup_file.c |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)


--- autofs-5.0.1.orig/modules/lookup_file.c
+++ autofs-5.0.1/modules/lookup_file.c
@@ -1079,13 +1079,15 @@ int lookup_mount(struct autofs_point *ap
 			 * If any map instances are present for this source
 			 * then either we have plus included entries or we
 			 * are looking through the list of nsswitch sources.
-			 * In either case we cannot avoid reading through the
-			 * map because we must preserve the key order over
-			 * multiple sources. But also, we can't know, at this
-			 * point, if a source instance has been changed since
-			 * the last time we checked it.
+			 * In either case, or if it's a "multi" source, we
+			 * cannot avoid reading through the map because we
+			 * must preserve the key order over multiple sources
+			 * or maps. But also, we can't know, at this point,
+			 * if a source instance has been changed since the
+			 * last time we checked it.
 			 */
-			if (!source->instance)
+			if (!source->instance &&
+			    source->type && strcmp(source->type, "multi"))
 				goto do_cache_lookup;
 		} else
 			source->stale = 1;
@@ -1132,6 +1134,9 @@ do_cache_lookup:
 	}
 	cache_unlock(mc);
 
+	if (!me)
+		return NSS_STATUS_NOTFOUND;
+
 	if (mapent) {
 		master_source_current_wait(ap->entry);
 		ap->entry->current = source;