1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 01UPSTREAM_autofs-5.0.3-nss-source-any.patch
3
## DP: Supplied by upstream.
8
autofs-5.0.3 - ignore nsswitch sources that aren't supported
10
From: Ian Kent <raven@themaw.net>
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.
18
lib/nss_parse.y | 31 ++++++++++++++++---------------
19
lib/nss_tok.l | 22 ++++++++++++----------
20
3 files changed, 29 insertions(+), 25 deletions(-)
23
diff --git a/CHANGELOG b/CHANGELOG
24
index d953d2d..268fca6 100644
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.
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
39
@@ -64,7 +64,6 @@ char strval[128];
40
%token <strval> SOURCE
41
%token <strval> STATUS
42
%token <strval> ACTION
43
-%token <strval> OTHER
47
@@ -83,7 +82,9 @@ sources: nss_source
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);
58
@@ -91,7 +92,9 @@ nss_source: SOURCE
60
enum nsswitch_status a;
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
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; };
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
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; };
103
static int nss_ignore(const char *s)
105
- logmsg("ignored invalid nsswitch config near [ %s ]", s);
106
+ logmsg("ignored unsupported autofs nsswitch source \"%s\"", s);
110
diff --git a/lib/nss_tok.l b/lib/nss_tok.l
111
index c435b63..1aede97 100644
114
@@ -62,13 +62,13 @@ extern unsigned int nss_automount_found;
119
+%x AUTOMOUNT ACTIONSTR
123
automount ([Aa][Uu][Tt][Oo][Mm][Oo][Uu][Nn][Tt])
125
-source files|yp|nis|nisplus|ldap|hesiod|winbind
126
+source [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
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])
132
action ({continue}|{return})
134
-other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
139
@@ -101,6 +99,14 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
143
+ "[" { BEGIN(ACTIONSTR); yyless(0); }
145
+ \n { BEGIN(INITIAL); return NL; }
152
strcpy(nss_lval.strval, nss_text);
154
@@ -112,15 +118,11 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+
157
"[" { return LBRACKET; }
158
- "]" { return RBRACKET; }
159
+ "]" { BEGIN(AUTOMOUNT); return RBRACKET; }
160
"=" { return EQUAL; }
164
- strcpy(nss_lval.strval, nss_text);
168
+ . { BEGIN(AUTOMOUNT); yyless(0); }
169
\n { BEGIN(INITIAL); return NL; }