autofs-5.0.8 - fix fix map source with type lookup

From: Ian Kent <raven@themaw.net>

The recent change to make autofs look in the defined map directory
for map source file (or nss source files) when the map doesn't start
with a "/" broke the internal hosts map (thanks for alerting me to
this Leonardo).
---
 CHANGELOG       |    1 +
 daemon/lookup.c |   10 ++++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index ffcb39d..ee64f0d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -38,6 +38,7 @@
 - simple coverity fixes.
 - fix fix options compare.
 - use open(2) instead of access(2) to trigger dependent mounts.
+- fix fix map source with type lookup.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index 31479f7..d6d9af9 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -418,8 +418,11 @@ static int lookup_map_read_map(struct autofs_point *ap,
 {
 	char *path;
 
-	if (!map->argv[0])
+	if (!map->argv[0]) {
+		if (!strcmp(map->type, "hosts"))
+			return do_read_map(ap, map, age);
 		return NSS_STATUS_UNKNOWN;
+	}
 
 	/*
 	 * This is only called when map->type != NULL.
@@ -809,8 +812,11 @@ static int do_name_lookup_mount(struct autofs_point *ap,
 {
 	char *path;
 
-	if (!map->argv[0])
+	if (!map->argv[0]) {
+		if (!strcmp(map->type, "hosts"))
+			return do_lookup_mount(ap, map, name, name_len);
 		return NSS_STATUS_UNKNOWN;
+	}
 
 	/*
 	 * This is only called when map->type != NULL.
