diff --git a/apache2/Makefile b/apache2/Makefile index a48efd7b..6b95ac17 100644 --- a/apache2/Makefile +++ b/apache2/Makefile @@ -39,13 +39,12 @@ APACHECTL = apachectl INCLUDES = -I /usr/include/libxml2 -I /usr/include/lua5.1 # INCLUDES = -I /usr/include/libxml2 -I /path/to/httpd-x.y/srclib/pcre -DEFS = -DWITH_LIBXML2 -DWITH_LUA +DEFS = -DWITH_LUA # DEFS = -DWITH_ICONV -# -# DEFS = -DWITH_LIBXML2 -DPERFORMANCE_MEASUREMENT -# DEFS = -DWITH_LIBXML2 -DNO_MODSEC_API -# DEFS = -DWITH_LIBXML2 -DDEBUG_CONF -# DEFS = -DWITH_LIBXML2 -DCACHE_DEBUG +# DEFS = -DPERFORMANCE_MEASUREMENT +# DEFS = -DNO_MODSEC_API +# DEFS = -DDEBUG_CONF +# DEFS = -DCACHE_DEBUG # LIBS = -Lmy/lib/dir -lmylib CFLAGS = -O2 -g -Wuninitialized -Wall -Wmissing-prototypes -Wshadow -Wunused-variable -Wunused-value -Wchar-subscripts -Wsign-compare diff --git a/apache2/Makefile.win b/apache2/Makefile.win index 96284cd7..baae09f7 100644 --- a/apache2/Makefile.win +++ b/apache2/Makefile.win @@ -4,7 +4,6 @@ BASE = "C:/Program Files/Apache Group/Apache2/" CC = cl -# Add -DWITH_LIBXML2 below if you want to link against libxml2 DEFS = /nologo /Od /LD /W3 -DWIN32 -DWINNT DLL = mod_security2.dll diff --git a/apache2/modsecurity.c b/apache2/modsecurity.c index e3b694a5..95f2c7c8 100644 --- a/apache2/modsecurity.c +++ b/apache2/modsecurity.c @@ -163,10 +163,8 @@ static apr_status_t modsecurity_tx_cleanup(void *data) { /* Multipart processor cleanup. */ if (msr->mpd != NULL) multipart_cleanup(msr); - #ifdef WITH_LIBXML2 /* XML processor cleanup. */ if (msr->xml != NULL) xml_cleanup(msr); - #endif // TODO: Why do we ignore return code here? modsecurity_request_body_clear(msr, &my_error_msg); diff --git a/apache2/modsecurity.h b/apache2/modsecurity.h index 586e2f27..7824df34 100644 --- a/apache2/modsecurity.h +++ b/apache2/modsecurity.h @@ -41,9 +41,7 @@ typedef struct msc_string msc_string; #include "msc_multipart.h" #include "msc_pcre.h" #include "msc_util.h" -#ifdef WITH_LIBXML2 #include "msc_xml.h" -#endif #include "msc_geo.h" #include "re.h" @@ -320,9 +318,7 @@ struct modsec_rec { multipart_data *mpd; /* MULTIPART processor data structure */ - #ifdef WITH_LIBXML2 xml_data *xml; /* XML processor data structure */ - #endif /* audit logging */ char *new_auditlog_boundary; diff --git a/apache2/msc_reqbody.c b/apache2/msc_reqbody.c index 1f3126f6..b0d4e459 100644 --- a/apache2/msc_reqbody.c +++ b/apache2/msc_reqbody.c @@ -78,7 +78,6 @@ apr_status_t modsecurity_request_body_start(modsec_rec *msr, char **error_msg) { msr_log(msr, 2, "Multipart parser init failed: %s", my_error_msg); } } - #ifdef WITH_LIBXML2 else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { if (xml_init(msr, &my_error_msg) < 0) { @@ -88,7 +87,6 @@ apr_status_t modsecurity_request_body_start(modsec_rec *msr, char **error_msg) { msr_log(msr, 2, "Multipart parser init failed: %s", my_error_msg); } } - #endif else if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { /* Do nothing, URLENCODED processor does not support streaming yet. */ @@ -274,7 +272,6 @@ apr_status_t modsecurity_request_body_store(modsec_rec *msr, msr_log(msr, 2, "Request body processor error: %s", my_error_msg); } } - #ifdef WITH_LIBXML2 else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { /* Increase per-request data length counter. */ @@ -288,7 +285,6 @@ apr_status_t modsecurity_request_body_store(modsec_rec *msr, msr_log(msr, 2, "Request body processor error: %s", my_error_msg); } } - #endif else if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { /* Increase per-request data length counter. */ @@ -437,7 +433,6 @@ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) { if (strcmp(msr->msc_reqbody_processor, "URLENCODED") == 0) { return modsecurity_request_body_end_urlencoded(msr, error_msg); } - #ifdef WITH_LIBXML2 else if (strcmp(msr->msc_reqbody_processor, "XML") == 0) { if (xml_complete(msr, &my_error_msg) < 0) { @@ -447,7 +442,6 @@ apr_status_t modsecurity_request_body_end(modsec_rec *msr, char **error_msg) { return -1; } } - #endif } /* Note the request body no files length. */ diff --git a/apache2/msc_xml.c b/apache2/msc_xml.c index 7f642dec..4bbdc7b6 100644 --- a/apache2/msc_xml.c +++ b/apache2/msc_xml.c @@ -8,8 +8,6 @@ * write to Breach Security, Inc. at support@breach.com. * */ -#ifdef WITH_LIBXML2 - #include "msc_xml.h" @@ -131,5 +129,3 @@ apr_status_t xml_cleanup(modsec_rec *msr) { return 1; } - -#endif diff --git a/apache2/re_operators.c b/apache2/re_operators.c index 1872fd80..e9e30c0f 100644 --- a/apache2/re_operators.c +++ b/apache2/re_operators.c @@ -818,8 +818,6 @@ static int msre_op_m_execute(modsec_rec *msr, msre_rule *rule, msre_var *var, ch return 1; } -#ifdef WITH_LIBXML2 - /* validateDTD */ static int msre_op_validateDTD_init(msre_rule *rule, char **error_msg) { @@ -1100,8 +1098,6 @@ static int msre_op_verifyCC_execute(modsec_rec *msr, msre_rule *rule, msre_var * } -#endif - /** * Perform geograpical lookups on an IP/Host. */ @@ -1833,8 +1829,6 @@ void msre_engine_register_default_operators(msre_engine *engine) { msre_op_m_execute ); - #ifdef WITH_LIBXML2 - /* validateDTD */ msre_engine_op_register(engine, "validateDTD", @@ -1849,8 +1843,6 @@ void msre_engine_register_default_operators(msre_engine *engine) { msre_op_validateSchema_execute ); - #endif - /* verifyCC */ msre_engine_op_register(engine, "verifyCC", diff --git a/apache2/re_variables.c b/apache2/re_variables.c index 0ccfb4fd..5d449f20 100644 --- a/apache2/re_variables.c +++ b/apache2/re_variables.c @@ -15,9 +15,7 @@ #include "re.h" #include "msc_util.h" -#ifdef WITH_LIBXML2 #include "libxml/xpathInternals.h" -#endif /** * Generates a variable from a string and a length. @@ -513,8 +511,6 @@ static int var_reqbody_processor_error_msg_generate(modsec_rec *msr, msre_var *v return 1; } -#ifdef WITH_LIBXML2 - /* XML */ static char *var_xml_validate(msre_ruleset *ruleset, msre_var *var) { @@ -630,7 +626,6 @@ static int var_xml_generate(modsec_rec *msr, msre_var *var, msre_rule *rule, return count; } -#endif /* WEBSERVER_ERROR_LOG */ @@ -3097,7 +3092,6 @@ void msre_engine_register_default_variables(msre_engine *engine) { PHASE_REQUEST_HEADERS ); - #ifdef WITH_LIBXML2 /* XML */ msre_engine_variable_register(engine, "XML", @@ -3108,5 +3102,4 @@ void msre_engine_register_default_variables(msre_engine *engine) { VAR_CACHE, PHASE_REQUEST_BODY ); - #endif } diff --git a/doc/modsecurity2-apache-reference.xml b/doc/modsecurity2-apache-reference.xml index 07e00ff3..e4e3c5c9 100644 --- a/doc/modsecurity2-apache-reference.xml +++ b/doc/modsecurity2-apache-reference.xml @@ -339,7 +339,7 @@ - (Optional) Add one line to your configuration to load libxml2: + Add one line to your configuration to load libxml2: LoadFile /usr/lib/libxml2.so @@ -5269,4 +5269,4 @@ SecRule REQUEST_METHOD "!@within %{tx.allowed_methods}" t:l - \ No newline at end of file +