Fix a parsing bug in the rules that would ignore the very first rule. See #23.

This commit is contained in:
Sam Hocevar 2021-03-02 15:25:34 +01:00
parent af88e6fd4f
commit d4e0a60119
2 changed files with 2 additions and 2 deletions

View File

@ -474,7 +474,7 @@ YY_ACTION(void) yy_1_auth_rule(yycontext *yy, char *yytext, int yyleng)
} }
allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule; allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule;
if (seTotal > 0) { if (seTotal > 0) {
if (seInfo[seTotal - 1].rulesStart == 0) { if (seInfo[seTotal - 1].rulesStart == 0 && seInfo[seTotal - 1].rulesCount == 0) {
seInfo[seTotal - 1].rulesStart = allRulesCount; seInfo[seTotal - 1].rulesStart = allRulesCount;
} }
++seInfo[seTotal - 1].rulesCount; ++seInfo[seTotal - 1].rulesCount;

View File

@ -98,7 +98,7 @@ auth-rule = auth-key - < pattern >
} }
allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule; allRules[allRulesCount].type = yy->isAuthAllow ? allowRule : denyRule;
if (seTotal > 0) { if (seTotal > 0) {
if (seInfo[seTotal - 1].rulesStart == 0) { if (seInfo[seTotal - 1].rulesStart == 0 && seInfo[seTotal - 1].rulesCount == 0) {
seInfo[seTotal - 1].rulesStart = allRulesCount; seInfo[seTotal - 1].rulesStart = allRulesCount;
} }
++seInfo[seTotal - 1].rulesCount; ++seInfo[seTotal - 1].rulesCount;