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

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