Handle actionset being NULL. See #66 and #429.

This commit is contained in:
brectanus 2007-12-15 00:42:39 +00:00
parent 05c8ccd07e
commit 32100608e5

View File

@ -557,13 +557,13 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, const char *
/* Check some cases prior to merging so we know where it came from */
/* Must NOT specify a disruptive action in logging phase. */
if (rule->actionset->phase == PHASE_LOGGING && (rule->actionset->intercept_action != ACTION_ALLOW && rule->actionset->intercept_action != ACTION_NONE)) {
if ((rule->actionset != NULL) && (rule->actionset->phase == PHASE_LOGGING) && (rule->actionset->intercept_action != ACTION_ALLOW && rule->actionset->intercept_action != ACTION_NONE)) {
return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions "
"cannot be specified in the logging phase. %d", rule->actionset->intercept_action);
}
/* Check syntax for chained rules */
if (dcfg->tmp_chain_starter != NULL) {
if ((rule->actionset != NULL) && (dcfg->tmp_chain_starter != NULL)) {
/* Must NOT specify a disruptive action. */
if (rule->actionset->intercept_action != NOT_SET) {
return apr_psprintf(cmd->pool, "ModSecurity: Disruptive actions can only "
@ -591,9 +591,6 @@ 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 "
" by chain starter rules. ");
}
rule->chain_starter = dcfg->tmp_chain_starter;
rule->actionset->phase = rule->chain_starter->actionset->phase;
}
/* Merge actions with the parent.
@ -603,6 +600,11 @@ static const char *add_rule(cmd_parms *cmd, directory_config *dcfg, const char *
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->actionset->phase = rule->chain_starter->actionset->phase;
}
if (rule->actionset->is_chained != 1) {
/* If this rule is part of the chain but does
* not want more rules to follow in the chain