Blame SOURCES/autofs-5.1.2-make-lookup_nss_read_master-return-nss-status.patch

306fa1
autofs-5.1.2 - make lookup_nss_read_master() return nss status
306fa1
306fa1
From: Ian Kent <raven@themaw.net>
306fa1
306fa1
Currently lookup_nss_read_master() uses a boolean return but in order
306fa1
for the master map retry read to function properly when trying to read
306fa1
plus included maps it needs to return an NSS status instead.
306fa1
306fa1
Signed-off-by: Ian Kent <raven@themaw.net>
306fa1
---
306fa1
 CHANGELOG             |    1 +
306fa1
 daemon/lookup.c       |   14 ++++++++++----
306fa1
 modules/lookup_dir.c  |    2 +-
306fa1
 modules/lookup_file.c |    2 +-
306fa1
 4 files changed, 13 insertions(+), 6 deletions(-)
306fa1
306fa1
--- autofs-5.0.7.orig/CHANGELOG
306fa1
+++ autofs-5.0.7/CHANGELOG
306fa1
@@ -212,6 +212,7 @@
306fa1
 - dont exit on master map read fail timeout.
306fa1
 - set sane default master read wait timeout.
306fa1
 - don't return until after master map retry read.
306fa1
+- make lookup_nss_read_master() return nss status.
306fa1
 
306fa1
 25/07/2012 autofs-5.0.7
306fa1
 =======================
306fa1
--- autofs-5.0.7.orig/daemon/lookup.c
306fa1
+++ autofs-5.0.7/daemon/lookup.c
306fa1
@@ -175,7 +175,7 @@ int lookup_nss_read_master(struct master
306fa1
 		if (result == NSS_STATUS_UNAVAIL)
306fa1
 			master->read_fail = 1;
306fa1
 
306fa1
-		return !result;
306fa1
+		return result;
306fa1
 	} else {
306fa1
 		char *name = master->name;
306fa1
 		char *tmp;
306fa1
@@ -225,7 +225,7 @@ int lookup_nss_read_master(struct master
306fa1
 				if (result == NSS_STATUS_UNAVAIL)
306fa1
 					master->read_fail = 1;
306fa1
 
306fa1
-				return !result;
306fa1
+				return result;
306fa1
 			}
306fa1
 		}
306fa1
 	}
306fa1
@@ -237,7 +237,7 @@ int lookup_nss_read_master(struct master
306fa1
 		if (!list_empty(&nsslist))
306fa1
 			free_sources(&nsslist);
306fa1
 		error(logopt, "can't to read name service switch config.");
306fa1
-		return 0;
306fa1
+		return NSS_STATUS_UNAVAIL;
306fa1
 	}
306fa1
 
306fa1
 	/* First one gets it */
306fa1
@@ -282,6 +282,12 @@ int lookup_nss_read_master(struct master
306fa1
 			}
306fa1
 		}
306fa1
 
306fa1
+		/* We've been instructed to move onto the next source */
306fa1
+		if (result == NSS_STATUS_TRYAGAIN) {
306fa1
+			result = NSS_STATUS_SUCCESS;
306fa1
+			continue;
306fa1
+		}
306fa1
+
306fa1
 		if (result == NSS_STATUS_UNKNOWN ||
306fa1
 		    result == NSS_STATUS_NOTFOUND) {
306fa1
 			debug(logopt, "no map - continuing to next source");
306fa1
@@ -302,7 +308,7 @@ int lookup_nss_read_master(struct master
306fa1
 	if (!list_empty(&nsslist))
306fa1
 		free_sources(&nsslist);
306fa1
 
306fa1
-	return !result;
306fa1
+	return result;
306fa1
 }
306fa1
 
306fa1
 static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t age)
306fa1
--- autofs-5.0.7.orig/modules/lookup_dir.c
306fa1
+++ autofs-5.0.7/modules/lookup_dir.c
306fa1
@@ -154,7 +154,7 @@ static int include_file(struct master *m
306fa1
 	master->depth++;
306fa1
 	debug(logopt, MODPREFIX "include: %s", master->name);
306fa1
 	status = lookup_nss_read_master(master, age);
306fa1
-	if (!status) {
306fa1
+	if (status != NSS_STATUS_SUCCESS) {
306fa1
 		warn(logopt,
306fa1
 		     MODPREFIX
306fa1
 		     "failed to read included master map %s",
306fa1
--- autofs-5.0.7.orig/modules/lookup_file.c
306fa1
+++ autofs-5.0.7/modules/lookup_file.c
306fa1
@@ -503,7 +503,7 @@ int lookup_read_master(struct master *ma
306fa1
 				master->recurse = 1;
306fa1
 			master->depth++;
306fa1
 			status = lookup_nss_read_master(master, age);
306fa1
-			if (!status) {
306fa1
+			if (status != NSS_STATUS_SUCCESS) {
306fa1
 				warn(logopt,
306fa1
 				     MODPREFIX
306fa1
 				     "failed to read included master map %s",