Blame SOURCES/autofs-5.1.3-make-open_lookup-error-handling-more-consistent.patch

603f99
autofs-5.1.3 - make open_lookup() error handling more consistent
603f99
603f99
From: Ian Kent <raven@themaw.net>
603f99
603f99
If the open of a lookup module fails then open_lookup() should return
603f99
an NSS status that causes the source to be skipped as it is most likely
603f99
due to the map source not being configured.
603f99
603f99
Currently open_lookup() returns NSS_STATUS_UNAVAIL for failures whereas
603f99
much of the other lookup code returns NSS_STATUS_UNKNOWN for similar
603f99
errors encountered by open_lookup().
603f99
603f99
But NSS_STATUS_UNAVAIL will result in waiting for the lookup module to
603f99
become avaiable when trying to read the master map at startup even
603f99
though it isn't likely to become available. So NSS_STATUS_UNKNOWN is
603f99
more appropriate becuase that will cause the source to be skipped and
603f99
is used for the same purpose elsewhere.
603f99
603f99
Signed-off-by: Ian Kent <raven@themaw.net>
603f99
---
603f99
 CHANGELOG       |    1 +
603f99
 daemon/module.c |   14 +++++++-------
603f99
 2 files changed, 8 insertions(+), 7 deletions(-)
603f99
603f99
--- autofs-5.0.7.orig/CHANGELOG
603f99
+++ autofs-5.0.7/CHANGELOG
603f99
@@ -259,6 +259,7 @@
603f99
 - revert fix argc off by one in mount_autofs.c.
603f99
 - only take master map mutex for master map update.
603f99
 - fix nisplus lookup init not configured check.
603f99
+- make open_lookup() error handling more consistent.
603f99
 
603f99
 25/07/2012 autofs-5.0.7
603f99
 =======================
603f99
--- autofs-5.0.7.orig/daemon/module.c
603f99
+++ autofs-5.0.7/daemon/module.c
603f99
@@ -73,7 +73,7 @@ int open_lookup(const char *name, const
603f99
 			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
603f99
 			logerr("%s%s", err_prefix, estr);
603f99
 		}
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	type = strdup(name);
603f99
@@ -83,7 +83,7 @@ int open_lookup(const char *name, const
603f99
 			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
603f99
 			logerr("%s%s", err_prefix, estr);
603f99
 		}
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	size = snprintf(fnbuf, sizeof(fnbuf),
603f99
@@ -95,7 +95,7 @@ int open_lookup(const char *name, const
603f99
 			char *estr = strerror_r(errno, buf, MAX_ERR_BUF);
603f99
 			logerr("%s%s", err_prefix, estr);
603f99
 		}
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	if (!(dh = dlopen(fnbuf, RTLD_NOW))) {
603f99
@@ -104,7 +104,7 @@ int open_lookup(const char *name, const
603f99
 			       err_prefix, name, dlerror());
603f99
 		free(mod);
603f99
 		free(type);
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	if (!(ver = (int *) dlsym(dh, "lookup_version"))
603f99
@@ -115,7 +115,7 @@ int open_lookup(const char *name, const
603f99
 		dlclose(dh);
603f99
 		free(mod);
603f99
 		free(type);
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	if (!(mod->lookup_init = (lookup_init_t) dlsym(dh, "lookup_init")) ||
603f99
@@ -129,14 +129,14 @@ int open_lookup(const char *name, const
603f99
 		dlclose(dh);
603f99
 		free(mod);
603f99
 		free(type);
603f99
-		return NSS_STATUS_UNAVAIL;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	if (mod->lookup_init(mapfmt, argc, argv, &mod->context)) {
603f99
 		dlclose(dh);
603f99
 		free(mod);
603f99
 		free(type);
603f99
-		return NSS_STATUS_NOTFOUND;
603f99
+		return NSS_STATUS_UNKNOWN;
603f99
 	}
603f99
 
603f99
 	mod->type = type;