Backport fixes for #66 to 2.1.x. See #431.

This commit is contained in:
brectanus
2007-12-15 00:51:19 +00:00
parent 021191368f
commit d06aec8361
3 changed files with 21 additions and 9 deletions

View File

@@ -1,3 +1,12 @@
14 Dec 2007 - 2.1.5-rc1
-----------------------
* Stricter configuration parsing. Disruptive actions, meta actions and
phases are no longer allowed in a chained rule.
* Fixed t:escapeSeqDecode to better follow ANSI C escapes.
27 Nov 2007 - 2.1.4 27 Nov 2007 - 2.1.4
------------------- -------------------

View File

@@ -441,21 +441,18 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, const char *
if (dcfg->tmp_default_actionset == NULL) return FATAL_ERROR; if (dcfg->tmp_default_actionset == NULL) return FATAL_ERROR;
} }
/* Merge actions with the parent. */ /* Check some cases prior to merging so we know where it came from */
rule->actionset = msre_actionset_merge(modsecurity->msre, dcfg->tmp_default_actionset,
rule->actionset, 1);
if (dcfg->tmp_chain_starter != NULL) {
/* This rule is part of a chain. */
/* Check syntax for chained rules */
if ((rule->actionset != NULL) && (dcfg->tmp_chain_starter != NULL)) {
/* Must NOT specify a disruptive action. */ /* Must NOT specify a disruptive action. */
if (rule->actionset->intercept_action == NOT_SET) { if (rule->actionset->intercept_action != NOT_SET) {
return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions can only " return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions can only "
"be specified by chain starter rules."); "be specified by chain starter rules.");
} }
/* Must NOT specify a phase. */ /* Must NOT specify a phase. */
if (rule->actionset->phase == NOT_SET) { if (rule->actionset->phase != NOT_SET) {
return apr_psprintf(cmd->pool, "ModSecurity: Execution phases can only be " return apr_psprintf(cmd->pool, "ModSecurity: Execution phases can only be "
"specified by chain starter rules."); "specified by chain starter rules.");
} }
@@ -474,7 +471,13 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, const char *
return apr_psprintf(cmd->pool, "ModSecurity: The skip action can only be used " return apr_psprintf(cmd->pool, "ModSecurity: The skip action can only be used "
" by chain starter rules. "); " by chain starter rules. ");
} }
}
/* Merge actions with the parent. */
rule->actionset = msre_actionset_merge(modsecurity->msre, dcfg->tmp_default_actionset,
rule->actionset, 1);
if (dcfg->tmp_chain_starter != NULL) {
rule->chain_starter = dcfg->tmp_chain_starter; rule->chain_starter = dcfg->tmp_chain_starter;
rule->actionset->phase = rule->chain_starter->actionset->phase; rule->actionset->phase = rule->chain_starter->actionset->phase;
} }

View File

@@ -3,7 +3,7 @@
<title>ModSecurity Reference Manual</title> <title>ModSecurity Reference Manual</title>
<articleinfo> <articleinfo>
<releaseinfo>Version 2.1.4 / (November 27, 2007)</releaseinfo> <releaseinfo>Version 2.1.5-rc1 / (December 14, 2007)</releaseinfo>
<copyright> <copyright>
<year>2004-2007</year> <year>2004-2007</year>