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

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