Added matching rules to audit log data. See #93.

This commit is contained in:
brectanus
2007-11-30 00:52:21 +00:00
parent 85053718d9
commit dcdce0cbc5
7 changed files with 24 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
* write to Breach Security, Inc. at support@breach.com.
*
*/
#include "re.h"
#include "msc_logging.h"
#include "httpd.h"
#include "apr_strings.h"
@@ -362,6 +363,7 @@ void sec_audit_logger(modsec_rec *msr) {
const apr_array_header_t *arr = NULL;
apr_table_entry_t *te = NULL;
char *str1 = NULL, *str2 = NULL, *text = NULL;
const msre_rule *rule = NULL;
apr_size_t nbytes, nbytes_written;
unsigned char md5hash[APR_MD5_DIGESTSIZE];
int was_limited = 0;
@@ -732,6 +734,13 @@ void sec_audit_logger(modsec_rec *msr) {
sec_auditlog_write(msr, text, strlen(text));
}
/* Matched Rules */
for(i = 0; i < msr->matched_rules->nelts; i++) {
rule = ((msre_rule **)msr->matched_rules->elts)[i];
text = apr_psprintf(msr->mp, "MatchedRule: %s\n", rule->unparsed);
sec_auditlog_write(msr, text, strlen(text));
}
/* Apache error messages */
for(i = 0; i < msr->error_messages->nelts; i++) {
error_message *em = (((error_message**)msr->error_messages->elts)[i]);