|
Ian Kent |
cc4062 |
autofs-5.0.5 - fix wildcard map entry match
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
From: Ian Kent <raven@themaw.net>
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
In some cases we can get a key string that includes a '*' at the start.
|
|
Ian Kent |
cc4062 |
This causes an incorrect comparison in the cache library routines and can
|
|
Ian Kent |
cc4062 |
lead to a segmentation fault.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
This patch enures that the key length is also considered when checking the
|
|
Ian Kent |
cc4062 |
wildcard key entry.
|
|
Ian Kent |
cc4062 |
---
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
CHANGELOG | 1 +
|
|
Ian Kent |
cc4062 |
daemon/lookup.c | 4 ++--
|
|
Ian Kent |
cc4062 |
lib/cache.c | 2 +-
|
|
Ian Kent |
cc4062 |
3 files changed, 4 insertions(+), 3 deletions(-)
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
--- autofs-5.0.5.orig/CHANGELOG
|
|
Ian Kent |
cc4062 |
+++ autofs-5.0.5/CHANGELOG
|
|
Ian Kent |
cc4062 |
@@ -34,6 +34,7 @@
|
|
Ian Kent |
cc4062 |
- make redhat init script more lsb compliant.
|
|
Ian Kent |
cc4062 |
- don't hold lock for simple mounts.
|
|
Ian Kent |
cc4062 |
- fix remount locking.
|
|
Ian Kent |
cc4062 |
+- fix wildcard map entry match.
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
03/09/2009 autofs-5.0.5
|
|
Ian Kent |
cc4062 |
-----------------------
|
|
Ian Kent |
cc4062 |
--- autofs-5.0.5.orig/daemon/lookup.c
|
|
Ian Kent |
cc4062 |
+++ autofs-5.0.5/daemon/lookup.c
|
|
Ian Kent |
cc4062 |
@@ -600,7 +600,7 @@ int lookup_ghost(struct autofs_point *ap
|
|
Ian Kent |
cc4062 |
cache_readlock(mc);
|
|
Ian Kent |
cc4062 |
me = cache_enumerate(mc, NULL);
|
|
Ian Kent |
cc4062 |
while (me) {
|
|
Ian Kent |
cc4062 |
- if (*me->key == '*')
|
|
Ian Kent |
cc4062 |
+ if (!strcmp(me->key, "*"))
|
|
Ian Kent |
cc4062 |
goto next;
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
if (*me->key == '/') {
|
|
Ian Kent |
cc4062 |
@@ -1035,7 +1035,7 @@ void lookup_prune_one_cache(struct autof
|
|
Ian Kent |
cc4062 |
|
|
Ian Kent |
cc4062 |
key = strdup(me->key);
|
|
Ian Kent |
cc4062 |
me = cache_enumerate(mc, me);
|
|
Ian Kent |
cc4062 |
- if (!key || *key == '*') {
|
|
Ian Kent |
cc4062 |
+ if (!key || !strcmp(key, "*")) {
|
|
Ian Kent |
cc4062 |
if (key)
|
|
Ian Kent |
cc4062 |
free(key);
|
|
Ian Kent |
cc4062 |
continue;
|
|
Ian Kent |
cc4062 |
--- autofs-5.0.5.orig/lib/cache.c
|
|
Ian Kent |
cc4062 |
+++ autofs-5.0.5/lib/cache.c
|
|
Ian Kent |
cc4062 |
@@ -719,7 +719,7 @@ int cache_update(struct mapent_cache *mc
|
|
Ian Kent |
cc4062 |
me = cache_lookup(mc, key);
|
|
Ian Kent |
cc4062 |
while (me && me->source != ms)
|
|
Ian Kent |
cc4062 |
me = cache_lookup_key_next(me);
|
|
Ian Kent |
cc4062 |
- if (!me || (*me->key == '*' && *key != '*')) {
|
|
Ian Kent |
cc4062 |
+ if (!me || (!strcmp(me->key, "*") && strcmp(key, "*"))) {
|
|
Ian Kent |
cc4062 |
ret = cache_add(mc, ms, key, mapent, age);
|
|
Ian Kent |
cc4062 |
if (!ret) {
|
|
Ian Kent |
cc4062 |
debug(logopt, "failed for %s", key);
|