BUG/MEDIUM: config: reject anything but "if" or "unless" after a use-backend rule
Adrian Fitzpatrick reported that since commit f51658d ("MEDIUM: config:
relax use_backend check to make the condition optional"), typos like "of"
instead of "if" on use_backend rules are not properly detected. The reason
is that the parser only checks for "if" or "unless" otherwise it considers
there's no keyword, making the rule inconditional.
This patch fixes it. It may reveal some rare config bugs for some people,
but will not affect valid configurations.
This fix must be backported to 1.7, 1.6 and 1.5.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index bafd051..5486960 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -3776,6 +3776,12 @@
err_code |= warnif_cond_conflicts(cond, SMP_VAL_FE_SET_BCK, file, linenum);
}
+ else if (*args[2]) {
+ Alert("parsing [%s:%d] : unexpected keyword '%s' after switching rule, only 'if' and 'unless' are allowed.\n",
+ file, linenum, args[2]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
rule = calloc(1, sizeof(*rule));
if (!rule) {