[PATCH 05/34] autofs-5.1.2 - make lookup_nss_read_master() return nss status

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently lookup_nss_read_master() uses a boolean return but in order
for the master map retry read to function properly when trying to read
plus included maps it needs to return an NSS status instead.

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>
---
 CHANGELOG             |    1 +
 daemon/lookup.c       |   14 ++++++++++----
 modules/lookup_dir.c  |    2 +-
 modules/lookup_file.c |    2 +-
 4 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 7337ec6..408edf8 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -31,6 +31,7 @@ xx/xx/2016 autofs-5.1.3
 - dont exit on master map read fail timeout.
 - set sane default master read wait timeout.
 - don't return until after master map retry read.
+- make lookup_nss_read_master() return nss status.
 
 15/06/2016 autofs-5.1.2
 =======================
diff --git a/daemon/lookup.c b/daemon/lookup.c
index a46740e..5ff837d 100644
--- a/daemon/lookup.c
+++ b/daemon/lookup.c
@@ -175,7 +175,7 @@ int lookup_nss_read_master(struct master *master, time_t age)
 		if (result == NSS_STATUS_UNAVAIL)
 			master->read_fail = 1;
 
-		return !result;
+		return result;
 	} else {
 		char *name = master->name;
 		char *tmp;
@@ -225,7 +225,7 @@ int lookup_nss_read_master(struct master *master, time_t age)
 				if (result == NSS_STATUS_UNAVAIL)
 					master->read_fail = 1;
 
-				return !result;
+				return result;
 			}
 		}
 	}
@@ -237,7 +237,7 @@ int lookup_nss_read_master(struct master *master, time_t age)
 		if (!list_empty(&nsslist))
 			free_sources(&nsslist);
 		error(logopt, "can't to read name service switch config.");
-		return 0;
+		return NSS_STATUS_UNAVAIL;
 	}
 
 	/* First one gets it */
@@ -282,6 +282,12 @@ int lookup_nss_read_master(struct master *master, time_t age)
 			}
 		}
 
+		/* We've been instructed to move onto the next source */
+		if (result == NSS_STATUS_TRYAGAIN) {
+			result = NSS_STATUS_SUCCESS;
+			continue;
+		}
+
 		if (result == NSS_STATUS_UNKNOWN ||
 		    result == NSS_STATUS_NOTFOUND) {
 			debug(logopt, "no map - continuing to next source");
@@ -302,7 +308,7 @@ int lookup_nss_read_master(struct master *master, time_t age)
 	if (!list_empty(&nsslist))
 		free_sources(&nsslist);
 
-	return !result;
+	return result;
 }
 
 static int do_read_map(struct autofs_point *ap, struct map_source *map, time_t age)
diff --git a/modules/lookup_dir.c b/modules/lookup_dir.c
index 2880447..ab1d82f 100644
--- a/modules/lookup_dir.c
+++ b/modules/lookup_dir.c
@@ -174,7 +174,7 @@ static int include_file(struct master *master, time_t age, struct lookup_context
 	master->depth++;
 	debug(logopt, MODPREFIX "include: %s", master->name);
 	status = lookup_nss_read_master(master, age);
-	if (!status) {
+	if (status != NSS_STATUS_SUCCESS) {
 		warn(logopt,
 		     MODPREFIX
 		     "failed to read included master map %s",
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
index cb00ee5..36247c5 100644
--- a/modules/lookup_file.c
+++ b/modules/lookup_file.c
@@ -504,7 +504,7 @@ int lookup_read_master(struct master *master, time_t age, void *context)
 				master->recurse = 1;
 			master->depth++;
 			status = lookup_nss_read_master(master, age);
-			if (!status) {
+			if (status != NSS_STATUS_SUCCESS) {
 				warn(logopt,
 				     MODPREFIX
 				     "failed to read included master map %s",

--
To unsubscribe from this list: send the line "unsubscribe autofs" in



[Index of Archives]     [Linux Filesystem Development]     [Linux Ext4]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux