~ubuntu-branches/ubuntu/raring/autofs5/raring

« back to all changes in this revision

Viewing changes to debian/patches/01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch

  • Committer: Bazaar Package Importer
  • Author(s): Jan Christoph Nordholz
  • Date: 2008-06-12 22:24:27 UTC
  • Revision ID: james.westby@ubuntu.com-20080612222427-835z4g5518ex9wic
Tags: 5.0.3-2
* Update upstream patchset (2008/06/12) - five new patches.
* Bump Standards version to 3.8.0, debhelper to v7.
* Link ldap module against kerberos. Closes: #485470.
* /dev/urandom is sufficiently random for our purpose - use it
  instead of /dev/random, which might block. Closes: #481257.
* Add watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh /usr/share/dpatch/dpatch-run
 
2
## 01UPSTREAM_autofs-5.0.3-lookup-next-soucre-stale-entry.patch
 
3
## DP: Supplied by upstream.
 
4
 
 
5
@DPATCH@
 
6
 
 
7
 
 
8
autofs-5.0.3 - multi-map doesn't pickup NIS updates automatically
 
9
 
 
10
From: Ian Kent <raven@themaw.net>
 
11
 
 
12
In a multi-map configuration, autofs doesn't pick up NIS updates
 
13
automatically. This is caused by the lookup not checking alternate
 
14
sources for the given key (or wildcard) when doing a key lookup.
 
15
---
 
16
 
 
17
 CHANGELOG                |    1 +
 
18
 lib/cache.c              |    2 ++
 
19
 modules/lookup_file.c    |   11 ++++++++---
 
20
 modules/lookup_ldap.c    |   11 ++++++++---
 
21
 modules/lookup_nisplus.c |   11 ++++++++---
 
22
 modules/lookup_yp.c      |   11 ++++++++---
 
23
 6 files changed, 35 insertions(+), 12 deletions(-)
 
24
 
 
25
 
 
26
diff --git a/CHANGELOG b/CHANGELOG
 
27
index 268fca6..3ed84d3 100644
 
28
--- a/CHANGELOG
 
29
+++ b/CHANGELOG
 
30
@@ -16,6 +16,7 @@
 
31
 - fix incorrect pthreads condition handling for mount requests.
 
32
 - add check for exports automatically mounted by NFS kernel client.
 
33
 - update nsswitch parser to ignore nsswitch sources that aren't supported.
 
34
+- check for map key in (possible) alternate map sources when doing lookup.
 
35
  
 
36
 14/01/2008 autofs-5.0.3
 
37
 -----------------------
 
38
diff --git a/lib/cache.c b/lib/cache.c
 
39
index 55586a3..d5abab0 100644
 
40
--- a/lib/cache.c
 
41
+++ b/lib/cache.c
 
42
@@ -700,6 +700,8 @@ int cache_update(struct mapent_cache *mc, struct map_source *ms, const char *key
 
43
        int ret = CHE_OK;
 
44
 
 
45
        me = cache_lookup(mc, key);
 
46
+       while (me && me->source != ms)
 
47
+               me = cache_lookup_key_next(me);
 
48
        if (!me || (*me->key == '*' && *key != '*')) {
 
49
                ret = cache_add(mc, ms, key, mapent, age);
 
50
                if (!ret) {
 
51
diff --git a/modules/lookup_file.c b/modules/lookup_file.c
 
52
index 466690a..894f6fd 100644
 
53
--- a/modules/lookup_file.c
 
54
+++ b/modules/lookup_file.c
 
55
@@ -1116,9 +1116,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 
56
 
 
57
        cache_readlock(mc);
 
58
        me = cache_lookup(mc, key);
 
59
-       /* Stale mapent => check for wildcard */
 
60
-       if (me && !me->mapent)
 
61
-               me = cache_lookup_distinct(mc, "*");
 
62
+       /* Stale mapent => check for entry in alternate source or wildcard */
 
63
+       if (me && !me->mapent) {
 
64
+               while ((me = cache_lookup_key_next(me)))
 
65
+                       if (me->source == source)
 
66
+                               break;
 
67
+               if (!me)
 
68
+                       me = cache_lookup_distinct(mc, "*");
 
69
+       }
 
70
        if (me && (me->source == source || *me->key == '/')) {
 
71
                pthread_cleanup_push(cache_lock_cleanup, mc);
 
72
                mapent_len = strlen(me->mapent);
 
73
diff --git a/modules/lookup_ldap.c b/modules/lookup_ldap.c
 
74
index ded26f7..5cc2148 100644
 
75
--- a/modules/lookup_ldap.c
 
76
+++ b/modules/lookup_ldap.c
 
77
@@ -2596,9 +2596,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 
78
 
 
79
        cache_readlock(mc);
 
80
        me = cache_lookup(mc, key);
 
81
-       /* Stale mapent => check for wildcard */
 
82
-       if (me && !me->mapent)
 
83
-               me = cache_lookup_distinct(mc, "*");
 
84
+       /* Stale mapent => check for entry in alternate source or wildcard */
 
85
+       if (me && !me->mapent) {
 
86
+               while ((me = cache_lookup_key_next(me)))
 
87
+                       if (me->source == source)
 
88
+                               break;
 
89
+               if (!me)
 
90
+                       me = cache_lookup_distinct(mc, "*");
 
91
+       }
 
92
        if (me && (me->source == source || *me->key == '/')) {
 
93
                mapent_len = strlen(me->mapent);
 
94
                mapent = alloca(mapent_len + 1);
 
95
diff --git a/modules/lookup_nisplus.c b/modules/lookup_nisplus.c
 
96
index 628ffcf..3c19fd3 100644
 
97
--- a/modules/lookup_nisplus.c
 
98
+++ b/modules/lookup_nisplus.c
 
99
@@ -530,9 +530,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 
100
 
 
101
        cache_readlock(mc);
 
102
        me = cache_lookup(mc, key);
 
103
-       /* Stale mapent => check for wildcard */
 
104
-       if (me && !me->mapent)
 
105
-               me = cache_lookup_distinct(mc, "*");
 
106
+       /* Stale mapent => check for entry in alternate source or wildcard */
 
107
+       if (me && !me->mapent) {
 
108
+               while ((me = cache_lookup_key_next(me)))
 
109
+                       if (me->source == source)
 
110
+                               break;
 
111
+               if (!me)
 
112
+                       me = cache_lookup_distinct(mc, "*");
 
113
+       }
 
114
        if (me && (me->source == source || *me->key == '/')) {
 
115
                mapent_len = strlen(me->mapent);
 
116
                mapent = alloca(mapent_len + 1);
 
117
diff --git a/modules/lookup_yp.c b/modules/lookup_yp.c
 
118
index 0fc84f8..14f981c 100644
 
119
--- a/modules/lookup_yp.c
 
120
+++ b/modules/lookup_yp.c
 
121
@@ -636,9 +636,14 @@ int lookup_mount(struct autofs_point *ap, const char *name, int name_len, void *
 
122
 
 
123
        cache_readlock(mc);
 
124
        me = cache_lookup(mc, key);
 
125
-       /* Stale mapent => check for wildcard */
 
126
-       if (me && !me->mapent)
 
127
-               me = cache_lookup_distinct(mc, "*");
 
128
+       /* Stale mapent => check for entry in alternate source or wildcard */
 
129
+       if (me && !me->mapent) {
 
130
+               while ((me = cache_lookup_key_next(me)))
 
131
+                       if (me->source == source)
 
132
+                               break;
 
133
+               if (!me)
 
134
+                       me = cache_lookup_distinct(mc, "*");
 
135
+       }
 
136
        if (me && (me->source == source || *me->key == '/')) {
 
137
                mapent_len = strlen(me->mapent);
 
138
                mapent = alloca(mapent_len + 1);