Blame SOURCES/autofs-5.1.8-improve-handling-of-ENOENT-in-sss-setautomntent.patch

cd8711
autofs-5.1.8 - improve handling of ENOENT in sss setautomntent()
cd8711
cd8711
From: Ian Kent <raven@themaw.net>
cd8711
cd8711
In the sss lookup module function setautomntent() a return of ENOENT
cd8711
isn't handled quite right.
cd8711
cd8711
If ENOENT (rather than EHOSTDOWN) is returned from sss setautomntent()
cd8711
we should assume the LDAP info. has been read by sss and the entry in
cd8711
fact doesn't exist.
cd8711
cd8711
Signed-off-by: Ian Kent <raven@themaw.net>
cd8711
---
cd8711
 CHANGELOG            |    1 +
cd8711
 modules/lookup_sss.c |   16 +++++++++++++++-
cd8711
 2 files changed, 16 insertions(+), 1 deletion(-)
cd8711
cd8711
--- autofs-5.1.4.orig/CHANGELOG
cd8711
+++ autofs-5.1.4/CHANGELOG
cd8711
@@ -106,6 +106,7 @@
cd8711
 - fix minus only option handling in concat_options().
cd8711
 - fix incorrect path for is_mounted() in try_remount().
cd8711
 - fail on empty replicated host name.
cd8711
+- improve handling of ENOENT in sss setautomntent().
cd8711
 
cd8711
 xx/xx/2018 autofs-5.1.5
cd8711
 - fix flag file permission.
cd8711
--- autofs-5.1.4.orig/modules/lookup_sss.c
cd8711
+++ autofs-5.1.4/modules/lookup_sss.c
cd8711
@@ -394,7 +394,17 @@ static int setautomntent(unsigned int lo
cd8711
 			if (ret != ENOENT)
cd8711
 				goto error;
cd8711
 		} else {
cd8711
-			if (ret != ENOENT && ret != EHOSTDOWN)
cd8711
+			/* If we get an ENOENT here assume it's accurrate
cd8711
+			 * and return the error.
cd8711
+			 */
cd8711
+			if (ret == ENOENT) {
cd8711
+				error(logopt, MODPREFIX
cd8711
+				      "setautomountent: entry for map %s not found",
cd8711
+				      ctxt->mapname);
cd8711
+				err = NSS_STATUS_NOTFOUND;
cd8711
+				goto free;
cd8711
+			}
cd8711
+			if (ret != EHOSTDOWN)
cd8711
 				goto error;
cd8711
 		}
cd8711
 
cd8711
@@ -410,6 +420,10 @@ static int setautomntent(unsigned int lo
cd8711
 			if (ret == EINVAL)
cd8711
 				goto free;
cd8711
 			if (ret == ENOENT) {
cd8711
+				/* Map info. not found after host became available */
cd8711
+				error(logopt, MODPREFIX
cd8711
+				      "setautomountent: entry for map %s not found",
cd8711
+				      ctxt->mapname);
cd8711
 				err = NSS_STATUS_NOTFOUND;
cd8711
 				goto free;
cd8711
 			}