~ubuntu-branches/ubuntu/precise/autofs5/precise

« back to all changes in this revision

Viewing changes to debian/patches/autofs-5.0.5-fix-wildcard-map-entry-match.patch

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-07-03 14:35:46 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20110703143546-nej26krjij0rf792
Tags: 5.0.6-0ubuntu1
* New upstream release:
  - Dropped upstream patches 
  - Refreshed debian/patches/17ld.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
autofs-5.0.5 - fix wildcard map entry match
2
 
 
3
 
From: Ian Kent <raven@themaw.net>
4
 
 
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.
8
 
 
9
 
This patch enures that the key length is also considered when checking the
10
 
wildcard key entry.
11
 
---
12
 
 
13
 
 CHANGELOG       |    1 +
14
 
 daemon/lookup.c |    4 ++--
15
 
 lib/cache.c     |    2 +-
16
 
 3 files changed, 4 insertions(+), 3 deletions(-)
17
 
 
18
 
 
19
 
diff --git a/CHANGELOG b/CHANGELOG
20
 
index 6ef2d5a..76207c8 100644
21
 
--- a/CHANGELOG
22
 
+++ b/CHANGELOG
23
 
@@ -35,6 +35,7 @@
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.
28
 
 
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
33
 
--- a/daemon/lookup.c
34
 
+++ b/daemon/lookup.c
35
 
@@ -600,7 +600,7 @@ int lookup_ghost(struct autofs_point *ap, const char *root)
36
 
                cache_readlock(mc);
37
 
                me = cache_enumerate(mc, NULL);
38
 
                while (me) {
39
 
-                       if (*me->key == '*')
40
 
+                       if (!strcmp(me->key, "*"))
41
 
                                goto next;
42
 
 
43
 
                        if (*me->key == '/') {
44
 
@@ -1035,7 +1035,7 @@ void lookup_prune_one_cache(struct autofs_point *ap, struct mapent_cache *mc, ti
45
 
 
46
 
                key = strdup(me->key);
47
 
                me = cache_enumerate(mc, me);
48
 
-               if (!key || *key == '*') {
49
 
+               if (!key || !strcmp(key, "*")) {
50
 
                        if (key)
51
 
                                free(key);
52
 
                        continue;
53
 
diff --git a/lib/cache.c b/lib/cache.c
54
 
index cd62ac2..440b3e8 100644
55
 
--- a/lib/cache.c
56
 
+++ b/lib/cache.c
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);
64
 
                if (!ret) {
65
 
                        debug(logopt, "failed for %s", key);