MODSEC-336

This commit is contained in:
brenosilva 2012-10-05 18:03:58 +00:00
parent 9661ac4de7
commit 10e2eec5bb
5 changed files with 9 additions and 9 deletions

View File

@ -328,7 +328,7 @@ void msr_log_warn(modsec_rec *msr, const char *text, ...) {
/** /**
* Converts an Apache error log message into one line of text. * Converts an Apache error log message into one line of text.
*/ */
char *format_error_log_message(apr_pool_t *mp, error_message *em) { char *format_error_log_message(apr_pool_t *mp, error_message_t *em) {
char *s_file = "", *s_line = "", *s_level = ""; char *s_file = "", *s_line = "", *s_level = "";
char *s_status = "", *s_message = ""; char *s_status = "", *s_message = "";
char *msg = NULL; char *msg = NULL;

View File

@ -457,7 +457,7 @@ static modsec_rec *create_tx_context(request_rec *r) {
} }
/* Populate tx fields */ /* Populate tx fields */
msr->error_messages = apr_array_make(msr->mp, 5, sizeof(error_message *)); msr->error_messages = apr_array_make(msr->mp, 5, sizeof(error_message_t *));
msr->alerts = apr_array_make(msr->mp, 5, sizeof(char *)); msr->alerts = apr_array_make(msr->mp, 5, sizeof(char *));
msr->server_software = real_server_signature; msr->server_software = real_server_signature;
@ -964,7 +964,7 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
#endif #endif
{ {
modsec_rec *msr = NULL; modsec_rec *msr = NULL;
error_message *em = NULL; error_message_t *em = NULL;
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
if (info == NULL) return; if (info == NULL) return;
@ -1007,7 +1007,7 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
if (msr == NULL) return; if (msr == NULL) return;
/* Store the error message for later */ /* Store the error message for later */
em = (error_message *)apr_pcalloc(msr->mp, sizeof(error_message)); em = (error_message_t *)apr_pcalloc(msr->mp, sizeof(error_message_t));
if (em == NULL) return; if (em == NULL) return;
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2 #if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
@ -1035,7 +1035,7 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
} }
} }
*(const error_message **)apr_array_push(msr->error_messages) = em; *(const error_message_t **)apr_array_push(msr->error_messages) = em;
} }

View File

@ -26,7 +26,7 @@ typedef struct rule_exception rule_exception;
typedef struct rule_exception encryption_method; typedef struct rule_exception encryption_method;
typedef struct modsec_rec modsec_rec; typedef struct modsec_rec modsec_rec;
typedef struct directory_config directory_config; typedef struct directory_config directory_config;
typedef struct error_message error_message; typedef struct error_message_t error_message_t;
typedef struct msc_engine msc_engine; typedef struct msc_engine msc_engine;
typedef struct msc_data_chunk msc_data_chunk; typedef struct msc_data_chunk msc_data_chunk;
typedef struct msc_arg msc_arg; typedef struct msc_arg msc_arg;
@ -590,7 +590,7 @@ struct directory_config {
int crypto_hash_framesrc_pm; int crypto_hash_framesrc_pm;
}; };
struct error_message { struct error_message_t {
const char *file; const char *file;
int line; int line;
int level; int level;

View File

@ -930,7 +930,7 @@ void sec_audit_logger(modsec_rec *msr) {
/* Apache error messages */ /* Apache error messages */
for(i = 0; i < msr->error_messages->nelts; i++) { for(i = 0; i < msr->error_messages->nelts; i++) {
error_message *em = (((error_message**)msr->error_messages->elts)[i]); error_message_t *em = (((error_message_t **)msr->error_messages->elts)[i]);
text = apr_psprintf(msr->mp, "Apache-Error: %s\n", text = apr_psprintf(msr->mp, "Apache-Error: %s\n",
format_error_log_message(msr->mp, em)); format_error_log_message(msr->mp, em));
sec_auditlog_write(msr, text, strlen(text)); sec_auditlog_write(msr, text, strlen(text));

View File

@ -670,7 +670,7 @@ static int var_webserver_error_log_generate(modsec_rec *msr, msre_var *var, msre
int i, count = 0; int i, count = 0;
for(i = 0; i < msr->error_messages->nelts; i++) { for(i = 0; i < msr->error_messages->nelts; i++) {
error_message *em = (((error_message**)msr->error_messages->elts)[i]); error_message_t *em = (((error_message_t **)msr->error_messages->elts)[i]);
char *fem = NULL; char *fem = NULL;
fem = format_error_log_message(mptmp, em); fem = format_error_log_message(mptmp, em);