Blame SOURCES/autofs-5.1.1-fix-return-handling-in-sss-lookup-module.patch

304803
autofs-5.1.1 - fix return handling in sss lookup module
304803
304803
From: Ian Kent <raven@themaw.net>
304803
304803
In the sss lookup module some of the calls don't distinguish between
304803
no entry found and service unavailable.
304803
304803
If service unavailable gets returned from a master map read it results
304803
in autofs not updating the mounts. A notfound return doesn't because it
304803
indicates the map doesn't exist so updating the mounts isn't a problem
304803
as it can be when the source is unavailable.
304803
304803
Signed-off-by: Ian Kent <raven@themaw.net>
304803
---
304803
 CHANGELOG            |    1 +
304803
 modules/lookup_sss.c |   24 +++++++++++++++++-------
304803
 2 files changed, 18 insertions(+), 7 deletions(-)
304803
304803
--- autofs-5.0.7.orig/CHANGELOG
304803
+++ autofs-5.0.7/CHANGELOG
304803
@@ -171,6 +171,7 @@
304803
 - fix mount as you go offset selection.
304803
 - init qdn before use in get_query_dn().
304803
 - fix left mount count return from umount_multi_triggers().
304803
+- fix return handling in sss lookup module.
304803
 
304803
 25/07/2012 autofs-5.0.7
304803
 =======================
304803
--- autofs-5.0.7.orig/modules/lookup_sss.c
304803
+++ autofs-5.0.7/modules/lookup_sss.c
304803
@@ -148,9 +148,8 @@ static int setautomntent(unsigned int lo
304803
 		error(logopt, MODPREFIX "setautomntent: %s", estr);
304803
 		if (*sss_ctxt)
304803
 			free(*sss_ctxt);
304803
-		return 0;
304803
 	}
304803
-	return 1;
304803
+	return ret;
304803
 }
304803
 
304803
 static int endautomntent(unsigned int logopt,
304803
@@ -161,9 +160,8 @@ static int endautomntent(unsigned int lo
304803
 		char buf[MAX_ERR_BUF];
304803
 		char *estr = strerror_r(ret, buf, MAX_ERR_BUF);
304803
 		error(logopt, MODPREFIX "endautomntent: %s", estr);
304803
-		return 0;
304803
 	}
304803
-	return 1;
304803
+	return ret;
304803
 }
304803
 
304803
 int lookup_read_master(struct master *master, time_t age, void *context)
304803
@@ -180,8 +178,12 @@ int lookup_read_master(struct master *ma
304803
 	char *value = NULL;
304803
 	int count, ret;
304803
 
304803
-	if (!setautomntent(logopt, ctxt, ctxt->mapname, &sss_ctxt))
304803
+	ret = setautomntent(logopt, ctxt, ctxt->mapname, &sss_ctxt);
304803
+	if (ret) {
304803
+		if (ret == ENOENT)
304803
+			return NSS_STATUS_NOTFOUND;
304803
 		return NSS_STATUS_UNAVAIL;
304803
+	}
304803
 
304803
 	count = 0;
304803
 	while (1) {
304803
@@ -280,8 +282,12 @@ int lookup_read_map(struct autofs_point
304803
 		return NSS_STATUS_SUCCESS;
304803
 	}
304803
 
304803
-	if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
304803
+	ret = setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt);
304803
+	if (ret) {
304803
+		if (ret == ENOENT)
304803
+			return NSS_STATUS_NOTFOUND;
304803
 		return NSS_STATUS_UNAVAIL;
304803
+	}
304803
 
304803
 	count = 0;
304803
 	while (1) {
304803
@@ -386,8 +392,12 @@ static int lookup_one(struct autofs_poin
304803
 
304803
 	mc = source->mc;
304803
 
304803
-	if (!setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt))
304803
+	ret = setautomntent(ap->logopt, ctxt, ctxt->mapname, &sss_ctxt);
304803
+	if (ret) {
304803
+		if (ret == ENOENT)
304803
+			return NSS_STATUS_NOTFOUND;
304803
 		return NSS_STATUS_UNAVAIL;
304803
+	}
304803
 
304803
 	ret = ctxt->getautomntbyname_r(qKey, &value, sss_ctxt);
304803
 	if (ret && ret != ENOENT) {