|
Ian Kent |
9ef58b |
autofs-5.0.4 - always read file maps key lookup fixes
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
Since we always read file maps at start we need to ensure that
|
|
Ian Kent |
9ef58b |
we return a not found if the key isn't found in the cache. Also,
|
|
Ian Kent |
9ef58b |
if we're looking through a "multi" map we can't use the cache
|
|
Ian Kent |
9ef58b |
lookup optimisation because, in this case, there is a single map
|
|
Ian Kent |
9ef58b |
source shared by the "multi" maps so we may not get correct results
|
|
Ian Kent |
9ef58b |
from the lookup if a map later in the search has been modified.
|
|
Ian Kent |
9ef58b |
---
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
CHANGELOG | 1 +
|
|
Ian Kent |
9ef58b |
modules/lookup_file.c | 17 +++++++++++------
|
|
Ian Kent |
9ef58b |
2 files changed, 12 insertions(+), 6 deletions(-)
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
diff --git a/CHANGELOG b/CHANGELOG
|
|
Ian Kent |
9ef58b |
index 972ef63..5000f0c 100644
|
|
Ian Kent |
9ef58b |
--- a/CHANGELOG
|
|
Ian Kent |
9ef58b |
+++ b/CHANGELOG
|
|
Ian Kent |
9ef58b |
@@ -48,6 +48,7 @@
|
|
Ian Kent |
9ef58b |
- improve manual umount recovery.
|
|
Ian Kent |
9ef58b |
- dont fail on ipv6 address when adding host.
|
|
Ian Kent |
9ef58b |
- always read file maps multi map fix.
|
|
Ian Kent |
9ef58b |
+- always read file maps key lookup fixes.
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
4/11/2008 autofs-5.0.4
|
|
Ian Kent |
9ef58b |
-----------------------
|
|
Ian Kent |
9ef58b |
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
|
|
Ian Kent |
9ef58b |
index bd30bc5..a4ca39d 100644
|
|
Ian Kent |
9ef58b |
--- a/modules/lookup_file.c
|
|
Ian Kent |
9ef58b |
+++ b/modules/lookup_file.c
|
|
Ian Kent |
9ef58b |
@@ -1003,13 +1003,15 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
|
|
Ian Kent |
9ef58b |
* If any map instances are present for this source
|
|
Ian Kent |
9ef58b |
* then either we have plus included entries or we
|
|
Ian Kent |
9ef58b |
* are looking through the list of nsswitch sources.
|
|
Ian Kent |
9ef58b |
- * In either case we cannot avoid reading through the
|
|
Ian Kent |
9ef58b |
- * map because we must preserve the key order over
|
|
Ian Kent |
9ef58b |
- * multiple sources. But also, we can't know, at this
|
|
Ian Kent |
9ef58b |
- * point, if a source instance has been changed since
|
|
Ian Kent |
9ef58b |
- * the last time we checked it.
|
|
Ian Kent |
9ef58b |
+ * In either case, or if it's a "multi" source, we
|
|
Ian Kent |
9ef58b |
+ * cannot avoid reading through the map because we
|
|
Ian Kent |
9ef58b |
+ * must preserve the key order over multiple sources
|
|
Ian Kent |
9ef58b |
+ * or maps. But also, we can't know, at this point,
|
|
Ian Kent |
9ef58b |
+ * if a source instance has been changed since the
|
|
Ian Kent |
9ef58b |
+ * last time we checked it.
|
|
Ian Kent |
9ef58b |
*/
|
|
Ian Kent |
9ef58b |
- if (!source->instance)
|
|
Ian Kent |
9ef58b |
+ if (!source->instance &&
|
|
Ian Kent |
9ef58b |
+ source->type && strcmp(source->type, "multi"))
|
|
Ian Kent |
9ef58b |
goto do_cache_lookup;
|
|
Ian Kent |
9ef58b |
} else
|
|
Ian Kent |
9ef58b |
source->stale = 1;
|
|
Ian Kent |
9ef58b |
@@ -1055,6 +1057,9 @@ do_cache_lookup:
|
|
Ian Kent |
9ef58b |
}
|
|
Ian Kent |
9ef58b |
cache_unlock(mc);
|
|
Ian Kent |
9ef58b |
|
|
Ian Kent |
9ef58b |
+ if (!me)
|
|
Ian Kent |
9ef58b |
+ return NSS_STATUS_NOTFOUND;
|
|
Ian Kent |
9ef58b |
+
|
|
Ian Kent |
9ef58b |
if (!mapent)
|
|
Ian Kent |
9ef58b |
return NSS_STATUS_TRYAGAIN;
|
|
Ian Kent |
9ef58b |
|