summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9a70712)
raw | patch | inline | side by side (parent: 9a70712)
author | Sebastian Harl <sh@tokkee.org> | |
Sun, 19 Oct 2014 15:24:50 +0000 (17:24 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sun, 19 Oct 2014 15:24:50 +0000 (17:24 +0200) |
That is, don't accept anything besides the string "attribute". Previously,
<anything>[<string>] was accepted as an attribute value.
<anything>[<string>] was accepted as an attribute value.
src/frontend/grammar.y | patch | blob | history | |
t/unit/frontend/parser_test.c | patch | blob | history |
diff --git a/src/frontend/grammar.y b/src/frontend/grammar.y
index cc0d5b94d475d6ccce027aab7e3601e957ecdc1a..78b45d295a1585fe93dfa9e1bb0e9b3bdd504879 100644 (file)
--- a/src/frontend/grammar.y
+++ b/src/frontend/grammar.y
|
IDENTIFIER '[' STRING ']'
{
+ if (strcasecmp($1, "attribute")) {
+ char errmsg[strlen($1) + strlen($3) + 32];
+ snprintf(errmsg, sizeof(errmsg),
+ YY_("unknown value %s[%s]"), $1, $3);
+ sdb_fe_yyerror(&yylloc, scanner, errmsg);
+ free($1); $1 = NULL;
+ free($3); $3 = NULL;
+ YYABORT;
+ }
$$ = sdb_store_expr_attrvalue($3);
free($1); $1 = NULL;
free($3); $3 = NULL;
index 8898e8b082852b5212fe307e76ece7a538dc251b..134b50cc54cb5c499d878210ca66013274faa287 100644 (file)
{ "LOOKUP hosts MATCHING "
"attribute['foo'] = "
"1.23 + 'foo'", -1, -1, 0 },
+ { "LOOKUP hosts MATCHING "
+ "attr['foo'] = 1.23", -1, -1, 0 },
+ { "LOOKUP hosts MATCHING "
+ "attr['foo'] IS NULL", -1, -1, 0 },
/* comments */
{ "/* some comment */", -1, 0, 0 },