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