Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 130701790bf2d95e902edf16031ff596 > files > 69

autofs-5.0.1-0.rc2.164.el5_8.src.rpm

autofs-5.0.3 - fix multi source messages

From: Ian Kent <raven@themaw.net>

There are incorrect "key not found" messages seen for master map
entries that have multiple sources (direct mounts).

For example, for the direct mount entries:

/-    auto.one
/-    auto.two

if a mount lookup is done and is not found in auto.one we see a
not found message even though it may be found in auto.two.

This patch moves the "key not found" reporting out to the higher
level lookup and reports status at the end of the lookup.
---

 daemon/lookup.c          |    3 +++
 modules/lookup_file.c    |   11 ++---------
 modules/lookup_ldap.c    |   10 ++--------
 modules/lookup_nisplus.c |   12 +++---------
 modules/lookup_program.c |    2 +-
 modules/lookup_yp.c      |   10 ++--------
 6 files changed, 13 insertions(+), 35 deletions(-)


--- autofs-5.0.1.orig/daemon/lookup.c
+++ autofs-5.0.1/daemon/lookup.c
@@ -909,6 +909,9 @@ int lookup_nss_mount(struct autofs_point
 	send_map_update_request(ap);
 	pthread_cleanup_pop(1);
 
+	if (result == NSS_STATUS_NOTFOUND)
+		error(ap->logopt, "key \"%s\" not found in map.", name);
+
 	return !result;
 }
 
--- autofs-5.0.1.orig/modules/lookup_file.c
+++ autofs-5.0.1/modules/lookup_file.c
@@ -1078,7 +1078,7 @@ int lookup_mount(struct autofs_point *ap
 	me = cache_lookup_distinct(mc, key);
 	if (me && me->status >= time(NULL)) {
 		cache_unlock(mc);
-		return NSS_STATUS_NOTFOUND;
+		return NSS_STATUS_UNAVAIL;
 	}
 	cache_unlock(mc);
 
@@ -1109,11 +1109,6 @@ int lookup_mount(struct autofs_point *ap
 		if (status) {
 			if (status == NSS_STATUS_COMPLETED)
 				return NSS_STATUS_SUCCESS;
-
-			error(ap->logopt,
-			      MODPREFIX "key \"%s\" not found in map",
-			      name);
-
 			return NSS_STATUS_NOTFOUND;
 		}
 	}
@@ -1158,9 +1153,7 @@ int lookup_mount(struct autofs_point *ap
 			}
 			cache_unlock(mc);
 		}
-	} else
-		error(ap->logopt,
-		      MODPREFIX "key \"%s\" not found in map.", name);
+	}
 
 	if (ret)
 		return NSS_STATUS_TRYAGAIN;
--- autofs-5.0.1.orig/modules/lookup_ldap.c
+++ autofs-5.0.1/modules/lookup_ldap.c
@@ -2535,12 +2535,8 @@ int lookup_mount(struct autofs_point *ap
 
 		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
 		free(lkp_key);
-		if (status) {
-			error(ap->logopt,
-			      MODPREFIX "key \"%s\" not found in map",
-			      name);
+		if (status)
 			return status;
-		}
 	}
 
 	cache_readlock(mc);
@@ -2582,9 +2578,7 @@ int lookup_mount(struct autofs_point *ap
 			}
 			cache_unlock(mc);
 		}
-	} else
-		error(ap->logopt,
-		      MODPREFIX "key \"%s\" not found in map", name);
+	}
 
 	if (ret)
 		return NSS_STATUS_TRYAGAIN;
--- autofs-5.0.1.orig/modules/lookup_nisplus.c
+++ autofs-5.0.1/modules/lookup_nisplus.c
@@ -524,12 +524,8 @@ int lookup_mount(struct autofs_point *ap
 		ap->entry->current = source;
 
 		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
-		if (status) {
-			error(ap->logopt,
-			      MODPREFIX "key \"%s\" not found in map",
-			      name);
+		if (status)
 			return status;
-		}
 	}
 
 	cache_readlock(mc);
@@ -570,12 +566,10 @@ int lookup_mount(struct autofs_point *ap
 			}
 			cache_unlock(mc);
 		}
-	} else
-		error(ap->logopt,
-		      MODPREFIX "key \"%s\" not found in map", name);
+	}
 
 	if (ret)
-		return NSS_STATUS_NOTFOUND;
+		return NSS_STATUS_TRYAGAIN;
 
 	return NSS_STATUS_SUCCESS;
 }
--- autofs-5.0.1.orig/modules/lookup_program.c
+++ autofs-5.0.1/modules/lookup_program.c
@@ -390,7 +390,7 @@ out_free:
 			me->status = now + ap->negative_timeout;
 		}
 		cache_unlock(mc);
-		return NSS_STATUS_UNAVAIL;
+		return NSS_STATUS_TRYAGAIN;
 	}
 
 	return NSS_STATUS_SUCCESS;
--- autofs-5.0.1.orig/modules/lookup_yp.c
+++ autofs-5.0.1/modules/lookup_yp.c
@@ -634,12 +634,8 @@ int lookup_mount(struct autofs_point *ap
 
 		status = check_map_indirect(ap, lkp_key, strlen(lkp_key), ctxt);
 		free(lkp_key);
-		if (status) {
-			error(ap->logopt,
-			      MODPREFIX "key \"%s\" not found in map",
-			      name);
+		if (status)
 			return status;
-		}
 	}
 
 	cache_readlock(mc);
@@ -680,9 +676,7 @@ int lookup_mount(struct autofs_point *ap
 			}
 			cache_unlock(mc);
 		}
-	 } else
-		error(ap->logopt,
-		      MODPREFIX "key \"%s\" not found in map", name);
+	 }
 
 	if (ret)
 		return NSS_STATUS_TRYAGAIN;