1
autofs-5.0.5 - fix wildcard map entry match
3
From: Ian Kent <raven@themaw.net>
5
In some cases we can get a key string that includes a '*' at the start.
6
This causes an incorrect comparison in the cache library routines and can
7
lead to a segmentation fault.
9
This patch enures that the key length is also considered when checking the
14
daemon/lookup.c | 4 ++--
16
3 files changed, 4 insertions(+), 3 deletions(-)
19
diff --git a/CHANGELOG b/CHANGELOG
20
index 6ef2d5a..76207c8 100644
24
- make redhat init script more lsb compliant.
25
- don't hold lock for simple mounts.
26
- fix remount locking.
27
+- fix wildcard map entry match.
29
03/09/2009 autofs-5.0.5
30
-----------------------
31
diff --git a/daemon/lookup.c b/daemon/lookup.c
32
index 8537861..ec979c9 100644
35
@@ -600,7 +600,7 @@ int lookup_ghost(struct autofs_point *ap, const char *root)
37
me = cache_enumerate(mc, NULL);
39
- if (*me->key == '*')
40
+ if (!strcmp(me->key, "*"))
43
if (*me->key == '/') {
44
@@ -1035,7 +1035,7 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
46
key = strdup(me->key);
47
me = cache_enumerate(mc, me);
48
- if (!key || *key == '*') {
49
+ if (!key || !strcmp(key, "*")) {
53
diff --git a/lib/cache.c b/lib/cache.c
54
index cd62ac2..440b3e8 100644
57
@@ -719,7 +719,7 @@ int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key
58
me = cache_lookup(mc, key);
59
while (me && me->source != ms)
60
me = cache_lookup_key_next(me);
61
- if (!me || (*me->key == '*' && *key != '*')) {
62
+ if (!me || (!strcmp(me->key, "*") && strcmp(key, "*"))) {
63
ret = cache_add(mc, ms, key, mapent, age);
65
debug(logopt, "failed for %s", key);