autofs-5.0.8 - fix cache readlock not taken on lookup

From: Ian Kent <raven@themaw.net>

In modules/lookup_yp.c:check_map_indirect() there's a missing cache
readlock.
---
 CHANGELOG           |    1 +
 modules/lookup_yp.c |    6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6b92fe5..32e398f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -21,6 +21,7 @@
 - check for existing offset mount before mounting.
 - fix max() declaration.
 - fix symlink fail message in mount_bind.c.
+- fix cache readlock not taken on lookup.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
index 4d1848e..849ae44 100644
--- a/modules/lookup_yp.c
+++ b/modules/lookup_yp.c
@@ -517,9 +517,13 @@ static int check_map_indirect(struct autofs_point *ap,
 		 * If the server is down and the entry exists in the cache
 		 * and belongs to this map return success and use the entry.
 		 */
+		cache_readlock(mc);
 		exists = cache_lookup(mc, key);
-		if (exists && exists->source == source)
+		if (exists && exists->source == source) {
+			cache_unlock(mc);
 			return NSS_STATUS_SUCCESS;
+		}
+		cache_unlock(mc);
 
 		warn(ap->logopt,
 		     MODPREFIX "lookup for %s failed: %s",