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

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