From 385a2828e87897bd611bd2a519727ef88dc6d632 Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Wed, 26 Mar 2014 18:21:42 -0700 Subject: [PATCH] Code cosmetics: Reduces the amounts of warning. Removes the warnings by adding missing headers and removed unused variables. --- apache2/msc_crypt.c | 2 +- apache2/msc_json.h | 3 +++ apache2/msc_status_engine.c | 1 - apache2/re_operators.c | 1 - apache2/re_variables.c | 1 - nginx/modsecurity/config | 8 ++++---- standalone/api.c | 12 ++++++++---- 7 files changed, 16 insertions(+), 12 deletions(-) diff --git a/apache2/msc_crypt.c b/apache2/msc_crypt.c index c1c9c4c2..e059b751 100644 --- a/apache2/msc_crypt.c +++ b/apache2/msc_crypt.c @@ -67,7 +67,7 @@ char *normalize_path(modsec_rec *msr, char *input) { if(uri->path) { char *Uri = NULL; int bytes = 0; - int i; + /*int i;*/ char *relative_link = NULL; char *filename = NULL; char *relative_path = NULL; diff --git a/apache2/msc_json.h b/apache2/msc_json.h index 91c887b3..02326ec0 100644 --- a/apache2/msc_json.h +++ b/apache2/msc_json.h @@ -53,5 +53,8 @@ int DSOLOCAL json_complete(modsec_rec *msr, char **error_msg); apr_status_t DSOLOCAL json_cleanup(modsec_rec *msr); +int DSOLOCAL json_process_chunk(modsec_rec *msr, const char *buf, + unsigned int size, char **error_msg); + #endif #endif diff --git a/apache2/msc_status_engine.c b/apache2/msc_status_engine.c index b9068cc7..62d10de0 100644 --- a/apache2/msc_status_engine.c +++ b/apache2/msc_status_engine.c @@ -227,7 +227,6 @@ int DSOLOCAL msc_status_engine_mac_address (unsigned char *mac) PIP_ADAPTER_INFO pAdapterInfo; PIP_ADAPTER_INFO pAdapter = NULL; DWORD dwRetVal = 0; - UINT i; ULONG ulOutBufLen = sizeof (IP_ADAPTER_INFO); pAdapterInfo = (IP_ADAPTER_INFO *)malloc(sizeof (IP_ADAPTER_INFO)); diff --git a/apache2/re_operators.c b/apache2/re_operators.c index 1dcd76db..d58b05c2 100644 --- a/apache2/re_operators.c +++ b/apache2/re_operators.c @@ -2053,7 +2053,6 @@ static int msre_op_detectXSS_execute(modsec_rec *msr, msre_rule *rule, msre_var char **error_msg) { int is_xss; - int capture; is_xss = libinjection_xss(var->value, var->value_len); diff --git a/apache2/re_variables.c b/apache2/re_variables.c index d67b7f6b..ebccf9eb 100644 --- a/apache2/re_variables.c +++ b/apache2/re_variables.c @@ -1993,7 +1993,6 @@ static int var_full_request_generate(modsec_rec *msr, msre_var *var, failed_fill_buffer: failed_not_enough_mem: failed_measure_buffer: -no_buffer: return 0; } diff --git a/nginx/modsecurity/config b/nginx/modsecurity/config index 8d7ce34a..fe8471ba 100644 --- a/nginx/modsecurity/config +++ b/nginx/modsecurity/config @@ -1,7 +1,5 @@ #!/bin/sh -# This file should be auto-generated whenever modsecurity is configured as standalone. - CFLAGS="$CFLAGS \ -I/usr/include/apr-1.0 \ -I/usr/include/apr-1.0 -I/usr/include \ @@ -9,7 +7,8 @@ CFLAGS="$CFLAGS \ -I/usr/include/libxml2 \ -DWITH_LUA -I/usr/include/lua5.1 \ -DWITH_PCRE_STUDY -DMODSEC_PCRE_MATCH_LIMIT=1500 -DMODSEC_PCRE_MATCH_LIMIT_RECURSION=1500 -DREQUEST_EARLY \ - " + \ + -DWITH_YAJL -I/usr/include/yajl " CORE_LIBS="$CORE_LIBS \ @@ -20,7 +19,8 @@ CORE_LIBS="$CORE_LIBS \ -lxml2 \ -llua5.1 \ -lpcre \ - -L/usr/lib -lcap" + -L/usr/lib -lcap \ + -lyajl " ngx_addon_name=ngx_http_modsecurity diff --git a/standalone/api.c b/standalone/api.c index 88d56f7d..55055609 100644 --- a/standalone/api.c +++ b/standalone/api.c @@ -40,6 +40,10 @@ #include "api.h" +#ifdef WIN32 +#include "msc_status_engine.h" +#endif + extern void *modsecLogObj; extern void (*modsecLogHook)(void *obj, int level, char *str); extern int (*modsecDropAction)(request_rec *r); @@ -75,6 +79,7 @@ DECLARE_HOOK(void,insert_filter,(request_rec *r)) DECLARE_HOOK(void,insert_error_filter,(request_rec *r)) char *sa_name = "standalone"; +const char *sa_name_argv[] = { "standalone", NULL }; server_rec *server; apr_pool_t *pool = NULL; @@ -135,7 +140,7 @@ server_rec *modsecInit() { server->port = 80; server->process = apr_palloc(pool, sizeof(process_rec)); server->process->argc = 1; - server->process->argv = &sa_name; + server->process->argv = sa_name_argv; server->process->pconf = pool; server->process->pool = pool; server->process->short_name = sa_name; @@ -223,7 +228,6 @@ apr_status_t ap_http_in_filter(ap_filter_t *f, apr_bucket_brigade *bb_out, } apr_status_t ap_http_out_filter(ap_filter_t *f, apr_bucket_brigade *b) { - apr_status_t rc; apr_bucket_brigade *bb_out = (apr_bucket_brigade *)f->ctx; APR_BRIGADE_CONCAT(bb_out, b); @@ -662,9 +666,9 @@ int modsecFinishRequest(request_rec *r) { // destroy only the connection pool int modsecFinishConnection(conn_rec *c) { - apr_pool_destroy(c->pool); + return 0; } @@ -713,4 +717,4 @@ void modsecStatusEngineCall() "SecStatusEngine to On.\n"); } } -#endif \ No newline at end of file +#endif