diff --git a/mod_security-fix-build-with-libxml29.patch b/mod_security-fix-build-with-libxml29.patch new file mode 100644 index 0000000..f857e46 --- /dev/null +++ b/mod_security-fix-build-with-libxml29.patch @@ -0,0 +1,82 @@ +--- apache2/msc_crypt.c.orig 2012-10-18 10:42:43.381000000 +0100 ++++ apache2/msc_crypt.c 2012-10-18 10:46:52.442000000 +0100 +@@ -1079,6 +1079,70 @@ + + htmlDocContentDumpFormatOutput(output_buf, msr->crypto_html_tree, NULL, 0); + ++#ifdef LIBXML2_NEW_BUFFER ++ ++ if (output_buf->conv == NULL || (output_buf->conv && xmlOutputBufferGetSize(output_buf) == 0)) { ++ ++ if(output_buf->buffer == NULL || xmlOutputBufferGetSize(output_buf) == 0) { ++ xmlOutputBufferClose(output_buf); ++ xmlFreeDoc(msr->crypto_html_tree); ++ msr->of_stream_changed = 0; ++ return -1; ++ } ++ ++ if(msr->stream_output_data != NULL) { ++ free(msr->stream_output_data); ++ msr->stream_output_data = NULL; ++ } ++ ++ msr->stream_output_length = xmlOutputBufferGetSize(output_buf); ++ msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); ++ ++ if (msr->stream_output_data == NULL) { ++ xmlOutputBufferClose(output_buf); ++ xmlFreeDoc(msr->crypto_html_tree); ++ return -1; ++ } ++ ++ memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); ++ memcpy(msr->stream_output_data, xmlOutputBufferGetContent(output_buf), msr->stream_output_length); ++ ++ if (msr->txcfg->debuglog_level >= 4) ++ msr_log(msr, 4, "inject_encrypted_response_body: Copying XML tree from CONTENT to stream buffer [%d] bytes.", xmlOutputBufferGetSize(output_buf)); ++ ++ } else { ++ ++ if(output_buf->conv == NULL || xmlOutputBufferGetSize(output_buf) == 0) { ++ xmlOutputBufferClose(output_buf); ++ xmlFreeDoc(msr->crypto_html_tree); ++ msr->of_stream_changed = 0; ++ return -1; ++ } ++ ++ if(msr->stream_output_data != NULL) { ++ free(msr->stream_output_data); ++ msr->stream_output_data = NULL; ++ } ++ ++ msr->stream_output_length = xmlOutputBufferGetSize(output_buf); ++ msr->stream_output_data = (char *)malloc(msr->stream_output_length+1); ++ ++ if (msr->stream_output_data == NULL) { ++ xmlOutputBufferClose(output_buf); ++ xmlFreeDoc(msr->crypto_html_tree); ++ return -1; ++ } ++ ++ memset(msr->stream_output_data, 0x0, msr->stream_output_length+1); ++ memcpy(msr->stream_output_data, xmlOutputBufferGetContent(output_buf), msr->stream_output_length); ++ ++ if (msr->txcfg->debuglog_level >= 4) ++ msr_log(msr, 4, "inject_encrypted_response_body: Copying XML tree from CONV to stream buffer [%d] bytes.", xmlOutputBufferGetSize(output_buf)); ++ ++ } ++ ++#else ++ + if (output_buf->conv == NULL || (output_buf->conv && output_buf->conv->use == 0)) { + + if(output_buf->buffer == NULL || output_buf->buffer->use == 0) { +@@ -1139,6 +1203,8 @@ + + } + ++#endif ++ + xmlOutputBufferClose(output_buf); + + content_value = (char*)apr_psprintf(msr->mp, "%"APR_SIZE_T_FMT, msr->stream_output_length); diff --git a/mod_security.spec b/mod_security.spec index c0573c2..2173ad0 100644 --- a/mod_security.spec +++ b/mod_security.spec @@ -8,7 +8,7 @@ Summary: Security module for the Apache HTTP Server Name: mod_security Version: 2.7.0 -Release: 1%{?dist} +Release: 2%{?dist} License: ASL 2.0 URL: http://www.modsecurity.org/ Group: System Environment/Daemons @@ -17,6 +17,9 @@ Source1: mod_security.conf Requires: httpd httpd-mmn = %{_httpd_mmn} BuildRequires: httpd-devel libxml2-devel pcre-devel curl-devel lua-devel +# Reported to upstream +Patch0: mod_security-fix-build-with-libxml29.patch + %description ModSecurity is an open source intrusion detection and prevention engine for web applications. It operates embedded into the web server, acting @@ -32,6 +35,7 @@ This package contains the ModSecurity Audit Log Collector. %prep %setup -q -n modsecurity-apache_%{version} +%patch0 -p0 %build %configure --enable-pcre-match-limit=1000000 \ @@ -97,6 +101,9 @@ rm -rf %{buildroot} %attr(0755,root,root) %{_bindir}/mlogc-batch-load %changelog +* Thu Oct 18 2012 Athmane Madjoudj 2.7.0-2 +- Add a patch to fix failed build against libxml2 >= 2.9.0 + * Wed Oct 17 2012 Athmane Madjoudj 2.7.0-1 - Update to 2.7.0