Sophie

Sophie

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

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

autofs-5.0.1 - mapent becomes negative during lookup

From: Ian Kent <raven@themaw.net>

During a mount request it is possible for a mapent to become negative
between the time it is checked on entry and when we fetch the mount
location information. This is because we drop the cache lock after
the initial check and take it back again before getting the location
information.
---

 modules/lookup_file.c    |    2 +-
 modules/lookup_ldap.c    |    2 +-
 modules/lookup_nisplus.c |    2 +-
 modules/lookup_yp.c      |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)


--- autofs-5.0.1.orig/modules/lookup_file.c
+++ autofs-5.0.1/modules/lookup_file.c
@@ -1125,7 +1125,7 @@ do_cache_lookup:
 		if (!me)
 			me = cache_lookup_distinct(mc, "*");
 	}
-	if (me && (me->source == source || *me->key == '/')) {
+	if (me && me->mapent && (me->source == source || *me->key == '/')) {
 		pthread_cleanup_push(cache_lock_cleanup, mc);
 		mapent_len = strlen(me->mapent);
 		mapent = alloca(mapent_len + 1);
--- autofs-5.0.1.orig/modules/lookup_ldap.c
+++ autofs-5.0.1/modules/lookup_ldap.c
@@ -2707,7 +2707,7 @@ int lookup_mount(struct autofs_point *ap
 		if (!me)
 			me = cache_lookup_distinct(mc, "*");
 	}
-	if (me && (me->source == source || *me->key == '/')) {
+	if (me && me->mapent && (me->source == source || *me->key == '/')) {
 		mapent_len = strlen(me->mapent);
 		mapent = alloca(mapent_len + 1);
 		strcpy(mapent, me->mapent);
--- autofs-5.0.1.orig/modules/lookup_nisplus.c
+++ autofs-5.0.1/modules/lookup_nisplus.c
@@ -560,7 +560,7 @@ int lookup_mount(struct autofs_point *ap
 		if (!me)
 			me = cache_lookup_distinct(mc, "*");
 	}
-	if (me && (me->source == source || *me->key == '/')) {
+	if (me && me->mapent && (me->source == source || *me->key == '/')) {
 		mapent_len = strlen(me->mapent);
 		mapent = alloca(mapent_len + 1);
 		strcpy(mapent, me->mapent);
--- autofs-5.0.1.orig/modules/lookup_yp.c
+++ autofs-5.0.1/modules/lookup_yp.c
@@ -670,7 +670,7 @@ int lookup_mount(struct autofs_point *ap
 		if (!me)
 			me = cache_lookup_distinct(mc, "*");
 	}
-	if (me && (me->source == source || *me->key == '/')) {
+	if (me && me->mapent && (me->source == source || *me->key == '/')) {
 		mapent_len = strlen(me->mapent);
 		mapent = alloca(mapent_len + 1);
 		strcpy(mapent, me->mapent);