autofs-5.0.3 - ignore nsswitch sources that aren't supported From: Ian Kent Allow any source name in nsswitch and ignore those we don't support. This has the side affect of also ignoring any action associated with a source that isn't supported by autofs. --- CHANGELOG | 1 + lib/nss_parse.y | 31 ++++++++++++++++--------------- lib/nss_tok.l | 22 ++++++++++++---------- 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d953d2d..268fca6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,7 @@ - fix incorrect match of map type name when included in map name. - fix incorrect pthreads condition handling for mount requests. - add check for exports automatically mounted by NFS kernel client. +- update nsswitch parser to ignore nsswitch sources that aren't supported. 14/01/2008 autofs-5.0.3 ----------------------- diff --git a/lib/nss_parse.y b/lib/nss_parse.y index 90b7d25..fa6958a 100644 --- a/lib/nss_parse.y +++ b/lib/nss_parse.y @@ -64,7 +64,6 @@ char strval[128]; %token SOURCE %token STATUS %token ACTION -%token OTHER %start file @@ -83,7 +82,9 @@ sources: nss_source nss_source: SOURCE { - if (strcmp($1, "winbind")) + if (!strcmp($1, "files") || !strcmp($1, "yp") || + !strcmp($1, "nis") || !strcmp($1, "ldap") || + !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) src = add_source(nss_list, $1); else nss_ignore($1); @@ -91,7 +92,9 @@ nss_source: SOURCE { enum nsswitch_status a; - if (strcmp($1, "winbind")) { + if (!strcmp($1, "files") || !strcmp($1, "yp") || + !strcmp($1, "nis") || !strcmp($1, "ldap") || + !strcmp($1, "nisplus") || !strcmp($1, "hesiod")) { src = add_source(nss_list, $1); for (a = 0; a < NSS_STATUS_MAX; a++) { if (act[a].action != NSS_ACTION_UNKNOWN) { @@ -101,12 +104,10 @@ nss_source: SOURCE } } else nss_ignore($1); -} | SOURCE LBRACKET status_exp_list SOURCE { nss_error($4); YYABORT; } - | SOURCE LBRACKET status_exp_list OTHER { nss_error($4); YYABORT; } - | SOURCE LBRACKET status_exp_list NL { nss_error("no closing bracket"); YYABORT; } - | SOURCE LBRACKET OTHER { nss_error($3); YYABORT; } - | SOURCE OTHER { nss_error("no opening bracket"); YYABORT; } - | error OTHER { nss_error($2); YYABORT; }; +} | SOURCE LBRACKET status_exp_list SOURCE { nss_error("missing close bracket"); YYABORT; } + | SOURCE LBRACKET status_exp_list NL { nss_error("missing close bracket"); YYABORT; } + | SOURCE LBRACKET SOURCE { nss_error($3); YYABORT; } + | error SOURCE { nss_error($2); YYABORT; }; status_exp_list: status_exp | status_exp status_exp_list @@ -117,17 +118,17 @@ status_exp: STATUS EQUAL ACTION } | BANG STATUS EQUAL ACTION { set_action(act, $2, $4, 1); -} | STATUS EQUAL OTHER {nss_error($3); YYABORT; } - | STATUS OTHER {nss_error($2); YYABORT; } - | BANG STATUS EQUAL OTHER {nss_error($4); YYABORT; } - | BANG STATUS OTHER {nss_error($3); YYABORT; } - | BANG OTHER {nss_error($2); YYABORT; }; +} | STATUS EQUAL SOURCE {nss_error($3); YYABORT; } + | STATUS SOURCE {nss_error($2); YYABORT; } + | BANG STATUS EQUAL SOURCE {nss_error($4); YYABORT; } + | BANG STATUS SOURCE {nss_error($3); YYABORT; } + | BANG SOURCE {nss_error($2); YYABORT; }; %% static int nss_ignore(const char *s) { - logmsg("ignored invalid nsswitch config near [ %s ]", s); + logmsg("ignored unsupported autofs nsswitch source \"%s\"", s); return(0); } diff --git a/lib/nss_tok.l b/lib/nss_tok.l index c435b63..1aede97 100644 --- a/lib/nss_tok.l +++ b/lib/nss_tok.l @@ -62,13 +62,13 @@ extern unsigned int nss_automount_found; %option nounput -%x AUTOMOUNT +%x AUTOMOUNT ACTIONSTR WS [[:blank:]]+ automount ([Aa][Uu][Tt][Oo][Mm][Oo][Uu][Nn][Tt]) -source files|yp|nis|nisplus|ldap|hesiod|winbind +source [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ success ([Ss][Uu][Cc][Cc][Ee][Ss][Ss]) notfound ([Nn][Oo][Tt][Ff][Oo][Uu][Nn][Dd]) @@ -82,8 +82,6 @@ return ([Rr][Ee][Tt][Uu][Rr][Nn]) action ({continue}|{return}) -other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ - %% ^{automount}: { @@ -101,6 +99,14 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ return SOURCE; } + "[" { BEGIN(ACTIONSTR); yyless(0); } + + \n { BEGIN(INITIAL); return NL; } +} + +{ + {WS} { } + {status} { strcpy(nss_lval.strval, nss_text); return STATUS; @@ -112,15 +118,11 @@ other [[:alnum:]@$%^&*()-+_":;?,<>./'{}~`]+ } "[" { return LBRACKET; } - "]" { return RBRACKET; } + "]" { BEGIN(AUTOMOUNT); return RBRACKET; } "=" { return EQUAL; } "!" { return BANG; } - {other} { - strcpy(nss_lval.strval, nss_text); - return OTHER; - } - + . { BEGIN(AUTOMOUNT); yyless(0); } \n { BEGIN(INITIAL); return NL; } }