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

« back to all changes in this revision

Viewing changes to debian/patches/01UPSTREAM_autofs-5.0.3-nss-source-any.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-nss-source-any.patch
 
3
## DP: Supplied by upstream.
 
4
 
 
5
@DPATCH@
 
6
 
 
7
 
 
8
autofs-5.0.3 - ignore nsswitch sources that aren't supported
 
9
 
 
10
From: Ian Kent <raven@themaw.net>
 
11
 
 
12
Allow any source name in nsswitch and ignore those we don't support.
 
13
This has the side affect of also ignoring any action associated with
 
14
a source that isn't supported by autofs.
 
15
---
 
16
 
 
17
 CHANGELOG       |    1 +
 
18
 lib/nss_parse.y |   31 ++++++++++++++++---------------
 
19
 lib/nss_tok.l   |   22 ++++++++++++----------
 
20
 3 files changed, 29 insertions(+), 25 deletions(-)
 
21
 
 
22
 
 
23
diff --git a/CHANGELOG b/CHANGELOG
 
24
index d953d2d..268fca6 100644
 
25
--- a/CHANGELOG
 
26
+++ b/CHANGELOG
 
27
@@ -15,6 +15,7 @@
 
28
 - fix incorrect match of map type name when included in map name.
 
29
 - fix incorrect pthreads condition handling for mount requests.
 
30
 - add check for exports automatically mounted by NFS kernel client.
 
31
+- update nsswitch parser to ignore nsswitch sources that aren't supported.
 
32
  
 
33
 14/01/2008 autofs-5.0.3
 
34
 -----------------------
 
35
diff --git a/lib/nss_parse.y b/lib/nss_parse.y
 
36
index 90b7d25..fa6958a 100644
 
37
--- a/lib/nss_parse.y
 
38
+++ b/lib/nss_parse.y
 
39
@@ -64,7 +64,6 @@ char strval[128];
 
40
 %token <strval> SOURCE
 
41
 %token <strval> STATUS
 
42
 %token <strval> ACTION
 
43
-%token <strval> OTHER
 
44
 
 
45
 %start file
 
46
 
 
47
@@ -83,7 +82,9 @@ sources: nss_source
 
48
 
 
49
 nss_source: SOURCE
 
50
 {
 
51
-       if (strcmp($1, "winbind"))
 
52
+       if (!strcmp($1, "files") || !strcmp($1, "yp") ||
 
53
+           !strcmp($1, "nis") || !strcmp($1, "ldap") ||
 
54
+           !strcmp($1, "nisplus") || !strcmp($1, "hesiod"))
 
55
                src = add_source(nss_list, $1);
 
56
        else
 
57
                nss_ignore($1);
 
58
@@ -91,7 +92,9 @@ nss_source: SOURCE
 
59
 {
 
60
        enum nsswitch_status a;
 
61
 
 
62
-       if (strcmp($1, "winbind")) {
 
63
+       if (!strcmp($1, "files") || !strcmp($1, "yp") ||
 
64
+           !strcmp($1, "nis") || !strcmp($1, "ldap") ||
 
65
+           !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) {
 
66
                src = add_source(nss_list, $1);
 
67
                for (a = 0; a < NSS_STATUS_MAX; a++) {
 
68
                        if (act[a].action != NSS_ACTION_UNKNOWN) {
 
69
@@ -101,12 +104,10 @@ nss_source: SOURCE
 
70
                }
 
71
        } else
 
72
                nss_ignore($1);
 
73
-} | SOURCE LBRACKET status_exp_list SOURCE { nss_error($4); YYABORT; }
 
74
-  | SOURCE LBRACKET status_exp_list OTHER { nss_error($4); YYABORT; }
 
75
-  | SOURCE LBRACKET status_exp_list NL { nss_error("no closing bracket"); YYABORT; }
 
76
-  | SOURCE LBRACKET OTHER { nss_error($3); YYABORT; }
 
77
-  | SOURCE OTHER { nss_error("no opening bracket"); YYABORT; }
 
78
-  | error OTHER { nss_error($2); YYABORT; };
 
79
+} | SOURCE LBRACKET status_exp_list SOURCE { nss_error("missing close bracket"); YYABORT; }
 
80
+  | SOURCE LBRACKET status_exp_list NL { nss_error("missing close bracket"); YYABORT; }
 
81
+  | SOURCE LBRACKET SOURCE { nss_error($3); YYABORT; }
 
82
+  | error SOURCE { nss_error($2); YYABORT; };
 
83
 
 
84
 status_exp_list: status_exp
 
85
                | status_exp status_exp_list
 
86
@@ -117,17 +118,17 @@ status_exp: STATUS EQUAL ACTION
 
87
 } | BANG STATUS EQUAL ACTION
 
88
 {
 
89
        set_action(act, $2, $4, 1);
 
90
-} | STATUS EQUAL OTHER {nss_error($3); YYABORT; }
 
91
-  | STATUS OTHER {nss_error($2); YYABORT; }
 
92
-  | BANG STATUS EQUAL OTHER {nss_error($4); YYABORT; }
 
93
-  | BANG STATUS OTHER {nss_error($3); YYABORT; }
 
94
-  | BANG OTHER {nss_error($2); YYABORT; };
 
95
+} | STATUS EQUAL SOURCE {nss_error($3); YYABORT; }
 
96
+  | STATUS SOURCE {nss_error($2); YYABORT; }
 
97
+  | BANG STATUS EQUAL SOURCE {nss_error($4); YYABORT; }
 
98
+  | BANG STATUS SOURCE {nss_error($3); YYABORT; }
 
99
+  | BANG SOURCE {nss_error($2); YYABORT; };
 
100
 
 
101
 %%
 
102
 
 
103
 static int nss_ignore(const char *s)
 
104
 {
 
105
-       logmsg("ignored invalid nsswitch config near [ %s ]", s);
 
106
+       logmsg("ignored unsupported autofs nsswitch source \"%s\"", s);
 
107
        return(0);
 
108
 }
 
109
 
 
110
diff --git a/lib/nss_tok.l b/lib/nss_tok.l
 
111
index c435b63..1aede97 100644
 
112
--- a/lib/nss_tok.l
 
113
+++ b/lib/nss_tok.l
 
114
@@ -62,13 +62,13 @@ extern unsigned int nss_automount_found;
 
115
 
 
116
 %option nounput
 
117
 
 
118
-%x AUTOMOUNT
 
119
+%x AUTOMOUNT ACTIONSTR
 
120
 
 
121
 WS             [[:blank:]]+
 
122
 
 
123
 automount      ([Aa][Uu][Tt][Oo][Mm][Oo][Uu][Nn][Tt])
 
124
 
 
125
-source         files|yp|nis|nisplus|ldap|hesiod|winbind
 
126
+source         [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
 
127
 
 
128
 success                ([Ss][Uu][Cc][Cc][Ee][Ss][Ss])
 
129
 notfound       ([Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd])
 
130
@@ -82,8 +82,6 @@ return                ([Rr][Ee][Tt][Uu][Rr][Nn])
 
131
 
 
132
 action         ({continue}|{return})
 
133
 
 
134
-other          [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
 
135
-
 
136
 %%
 
137
 
 
138
 ^{automount}: {
 
139
@@ -101,6 +99,14 @@ other               [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
 
140
                return SOURCE;
 
141
        }
 
142
 
 
143
+       "["     { BEGIN(ACTIONSTR); yyless(0); }
 
144
+
 
145
+       \n      { BEGIN(INITIAL); return NL; }
 
146
+}
 
147
+
 
148
+<ACTIONSTR>{
 
149
+       {WS}    { }
 
150
+
 
151
        {status} {
 
152
                strcpy(nss_lval.strval, nss_text);
 
153
                return STATUS;
 
154
@@ -112,15 +118,11 @@ other             [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
 
155
        }
 
156
 
 
157
        "["     { return LBRACKET; }
 
158
-       "]"     { return RBRACKET; }
 
159
+       "]"     { BEGIN(AUTOMOUNT); return RBRACKET; }
 
160
        "="     { return EQUAL; }
 
161
        "!"     { return BANG; }
 
162
 
 
163
-       {other} {
 
164
-               strcpy(nss_lval.strval, nss_text);
 
165
-               return OTHER;
 
166
-       }
 
167
-
 
168
+       .       { BEGIN(AUTOMOUNT); yyless(0); }
 
169
        \n      { BEGIN(INITIAL); return NL; }
 
170
 }
 
171