Refactoring conditional directives for if wrappers, alternative if statements and incomplete if conditions.

This commit is contained in:
Wesley M
2015-12-08 23:26:26 -03:00
committed by Felipe Zimmerle
parent c373256d46
commit 3a7fdf8fc0
3 changed files with 27 additions and 22 deletions

View File

@@ -1086,6 +1086,7 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
{
modsec_rec *msr = NULL;
error_message_t *em = NULL;
int msr_ap_server;
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
if (info == NULL) return;
@@ -1102,15 +1103,15 @@ static void hook_error_log(const char *file, int line, int level, apr_status_t s
/* Create a context for requests we never had the chance to process */
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
if ((msr == NULL)
msr_ap_server = ((msr == NULL)
&& ((info->level & APLOG_LEVELMASK) < APLOG_DEBUG)
&& apr_table_get(info->r->subprocess_env, "UNIQUE_ID"))
&& apr_table_get(info->r->subprocess_env, "UNIQUE_ID"));
#else
if ((msr == NULL)
msr_ap_server = ((msr == NULL)
&& ((level & APLOG_LEVELMASK) < APLOG_DEBUG)
&& apr_table_get(r->subprocess_env, "UNIQUE_ID"))
&& apr_table_get(r->subprocess_env, "UNIQUE_ID"));
#endif
{
if (msr_ap_server) {
#if AP_SERVER_MAJORVERSION_NUMBER > 1 && AP_SERVER_MINORVERSION_NUMBER > 2
msr = create_tx_context((request_rec *)info->r);
#else
@@ -1484,7 +1485,7 @@ static int hook_connection_early(conn_rec *conn)
conn_read_state_suspicious_list, client_ip, NULL, &error_msg) <= 0))
{
if (conn_limits_filter_state == MODSEC_DETECTION_ONLY)
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL,
"ModSecurity: Too many threads [%ld] of %ld allowed " \
"in READ state from %s - There is a suspission list " \
"but that IP is not part of it, access granted",