autofs-5.1.6 - make lookup_file.c nss map read status return handling consistent From: Ian Kent The nss map read status return used in modules/lookup_file.c should be consistent with what's used in daemon/lookup.c. The return NSS_STATUS_UNAVAIL is supposed to be used by functions in daemon/lookup.c to indicate a recoverable access failure of some sort such as network not yet avialable. But these type of failures with file based maps aren't normally recoverable. Return NSS_STATUS_UNKNOWN in these cases to avoid automount unnessarily invoking retry logic. Also check plus included master map returns for NSS_STATUS_UNAVAIL explicity and only set the read fail flag in that case. Signed-off-by: Ian Kent --- CHANGELOG | 1 + modules/lookup_file.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index ae8d2d3d..439ab210 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -73,6 +73,7 @@ xx/xx/2020 autofs-5.1.7 - check defaults_read_config() return. - move AUTOFS_LIB to end of build rule lines. - make autofs.a a shared library. +- make lookup_file.c nss map read status return handling consistent. 07/10/2019 autofs-5.1.6 - support strictexpire mount option. diff --git a/modules/lookup_file.c b/modules/lookup_file.c index 6986830b..f46a04f0 100644 --- a/modules/lookup_file.c +++ b/modules/lookup_file.c @@ -459,7 +459,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) if (master->depth > MAX_INCLUDE_DEPTH) { error(logopt, MODPREFIX "maximum include depth exceeded %s", master->name); - return NSS_STATUS_UNAVAIL; + return NSS_STATUS_UNKNOWN; } f = open_fopen_r(ctxt->mapname); @@ -469,7 +469,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) error(logopt, MODPREFIX "could not open master map file %s", ctxt->mapname); - return NSS_STATUS_UNAVAIL; + return NSS_STATUS_UNKNOWN; } while(1) { @@ -509,7 +509,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) MODPREFIX "failed to read included master map %s", master->name); - if (status != NSS_STATUS_NOTFOUND) { + if (status == NSS_STATUS_UNAVAIL) { /* * If we're starting up we need the whole * master map initially, so tell the upper @@ -529,7 +529,7 @@ int lookup_read_master(struct master *master, time_t age, void *context) error(logopt, MODPREFIX "could not malloc parse buffer"); fclose(f); - return NSS_STATUS_UNAVAIL; + return NSS_STATUS_UNKNOWN; } memset(buffer, 0, blen); @@ -712,7 +712,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) if (source->depth > MAX_INCLUDE_DEPTH) { error(ap->logopt, "maximum include depth exceeded %s", ctxt->mapname); - return NSS_STATUS_UNAVAIL; + return NSS_STATUS_UNKNOWN; } f = open_fopen_r(ctxt->mapname); @@ -721,7 +721,7 @@ int lookup_read_map(struct autofs_point *ap, time_t age, void *context) return NSS_STATUS_NOTFOUND; error(ap->logopt, MODPREFIX "could not open map file %s", ctxt->mapname); - return NSS_STATUS_UNAVAIL; + return NSS_STATUS_UNKNOWN; } while(1) {