File autofs-5.1.0-dont-add-wildcard-to-negative-cache.patch of Package autofs.3485

From: Ian Kent <ikent@redhat.com>
Date: Wed, 19 Nov 2014 08:32:32 +0800
Subject: [PATCH] autofs-5.1.0 - dont add wildcard to negative cache

If the wilcard is added to the negative cache it prevents any
further matching of the wildcard for the given map.
---
 daemon/lookup.c | 4 ++++
 lib/cache.c     | 4 ++++
 3 files changed, 9 insertions(+)

diff --git a/daemon/lookup.c b/daemon/lookup.c
index 6444fa5b57bd..62071df0a463 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -1057,6 +1057,10 @@ static void update_negative_cache(struct autofs_point *ap, struct map_source *so
 	if (source && source->depth)
 		return;
 
+	/* Don't update the wildcard */
+	if (strlen(name) == 1 && *name == '*')
+		return;
+
 	/* Have we recorded the lookup fail for negative caching? */
 	me = lookup_source_mapent(ap, name, LKP_DISTINCT);
 	if (me)
diff --git a/lib/cache.c b/lib/cache.c
index 4bab5a3d18ec..a2465755a0ff 100644
--- a/lib/cache.c
+++ b/lib/cache.c
@@ -762,6 +762,10 @@ void cache_update_negative(struct mapent_cache *mc,
 	struct mapent *me;
 	int rv = CHE_OK;
 
+	/* Don't update the wildcard */
+	if (strlen(key) == 1 && *key == '*')
+		return;
+
 	me = cache_lookup_distinct(mc, key);
 	if (me)
 		rv = cache_push_mapent(me, NULL);
-- 
2.7.4