Added missing log level checks before logging.

This commit is contained in:
ivanr 2009-12-07 17:27:39 +00:00
parent 7916942fe3
commit 23c3237d1c

View File

@ -132,10 +132,12 @@ static int msre_op_rx_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, c
if (msr->txcfg->debuglog_level >= 6) {
int capcount = 0;
rc = msc_fullinfo(regex, PCRE_INFO_CAPTURECOUNT, &capcount);
if (msr->txcfg->debuglog_level >= 6) {
if ((capture == 0) && (capcount > 0)) {
msr_log(msr, 6, "Ignoring regex captures since \"capture\" action is not enabled.");
}
}
}
/* We always use capture so that ovector can be used as working space
* and no memory has to be allocated for any backreferences.
@ -918,7 +920,9 @@ static int msre_op_validateDTD_execute(modsec_rec *msr, msre_rule *rule, msre_va
return 1; /* No match. */
}
if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "XML: Successfully validated payload against DTD: %s", rule->op_param);
}
xmlFreeValidCtxt(cvp);
xmlFreeDtd(dtd);
@ -998,7 +1002,9 @@ static int msre_op_validateSchema_execute(modsec_rec *msr, msre_rule *rule, msre
return 1; /* No match. */
}
if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "XML: Successfully validated payload against Schema: %s", rule->op_param);
}
xmlSchemaFree(schema);
xmlSchemaFreeValidCtxt(validCtx);
@ -1349,7 +1355,9 @@ static int msre_op_rbl_execute(modsec_rec *msr, msre_rule *rule, msre_var *var,
return 1; /* Match. */
}
if (msr->txcfg->debuglog_level >= 5) {
msr_log(msr, 5, "RBL lookup of %s failed at %s.", log_escape_nq(msr->mp, name_to_check), var->name);
}
/* No match. */
return 0;
@ -1409,7 +1417,9 @@ static int msre_op_inspectFile_execute(modsec_rec *msr, msre_rule *rule, msre_va
const char *approver_script = rule->op_param;
const char *target_file = apr_pstrmemdup(msr->mp, var->value, var->value_len);
if (msr->txcfg->debuglog_level >= 4) {
msr_log(msr, 4, "Executing %s to inspect %s.", approver_script, target_file);
}
argv[0] = approver_script;
argv[1] = target_file;