mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
Fix compilation when YAJL is not present
This commit is contained in:
parent
9d33990550
commit
6f47462110
24
.travis.yml
24
.travis.yml
@ -1,25 +1,27 @@
|
|||||||
dist: trusty
|
dist: trusty
|
||||||
sudo: required
|
sudo: false
|
||||||
|
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libyajl-dev
|
||||||
|
- libgeoip-dev
|
||||||
|
- liblmdb-dev
|
||||||
|
|
||||||
language: cpp
|
language: cpp
|
||||||
|
|
||||||
compiler:
|
compiler:
|
||||||
# - clang
|
- clang
|
||||||
- gcc
|
- gcc
|
||||||
|
|
||||||
#before_script:
|
env:
|
||||||
# - wget http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz
|
- OPTS="--enable-parser-generation"
|
||||||
# - tar -xvzf bison-3.0.4.tar.gz
|
- OPTS="--without-curl"
|
||||||
# - cd bison-3.0.4
|
|
||||||
# - ./configure
|
|
||||||
# - make
|
|
||||||
# - make install
|
|
||||||
|
|
||||||
|
|
||||||
# Build steps
|
|
||||||
script:
|
script:
|
||||||
- ./build.sh
|
- ./build.sh
|
||||||
- ./configure --enable-parser-generation
|
- ./configure $OPTS
|
||||||
- make
|
- make
|
||||||
- make check
|
- make check
|
||||||
|
|
||||||
|
@ -13,6 +13,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WITH_YAJL
|
||||||
|
|
||||||
#include "src/request_body_processor/json.h"
|
#include "src/request_body_processor/json.h"
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
@ -273,3 +276,7 @@ JSON::~JSON() {
|
|||||||
|
|
||||||
} // namespace RequestBodyProcessor
|
} // namespace RequestBodyProcessor
|
||||||
} // namespace modsecurity
|
} // namespace modsecurity
|
||||||
|
|
||||||
|
|
||||||
|
#endif // WITH_YAJL
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WITH_YAJL
|
||||||
|
|
||||||
#include <yajl/yajl_parse.h>
|
#include <yajl/yajl_parse.h>
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -82,3 +84,5 @@ class JSON {
|
|||||||
|
|
||||||
|
|
||||||
#endif // SRC_REQUEST_BODY_PROCESSOR_JSON_H_
|
#endif // SRC_REQUEST_BODY_PROCESSOR_JSON_H_
|
||||||
|
|
||||||
|
#endif // WITH_YAJL
|
||||||
|
@ -38,7 +38,9 @@
|
|||||||
#include "modsecurity/modsecurity.h"
|
#include "modsecurity/modsecurity.h"
|
||||||
#include "src/request_body_processor/multipart.h"
|
#include "src/request_body_processor/multipart.h"
|
||||||
#include "src/request_body_processor/xml.h"
|
#include "src/request_body_processor/xml.h"
|
||||||
|
#ifdef WITH_YAJL
|
||||||
#include "src/request_body_processor/json.h"
|
#include "src/request_body_processor/json.h"
|
||||||
|
#endif
|
||||||
#include "modsecurity/audit_log.h"
|
#include "modsecurity/audit_log.h"
|
||||||
#include "src/unique_id.h"
|
#include "src/unique_id.h"
|
||||||
#include "src/utils/string.h"
|
#include "src/utils/string.h"
|
||||||
@ -122,7 +124,11 @@ Transaction::Transaction(ModSecurity *ms, Rules *rules, void *logCbData)
|
|||||||
m_collections(ms->m_global_collection, ms->m_ip_collection,
|
m_collections(ms->m_global_collection, ms->m_ip_collection,
|
||||||
ms->m_session_collection, ms->m_user_collection,
|
ms->m_session_collection, ms->m_user_collection,
|
||||||
ms->m_resource_collection),
|
ms->m_resource_collection),
|
||||||
|
#ifdef WITH_YAJL
|
||||||
m_json(new RequestBodyProcessor::JSON(this)),
|
m_json(new RequestBodyProcessor::JSON(this)),
|
||||||
|
#else
|
||||||
|
m_json(NULL),
|
||||||
|
#endif
|
||||||
m_xml(new RequestBodyProcessor::XML(this)),
|
m_xml(new RequestBodyProcessor::XML(this)),
|
||||||
TransactionAnchoredVariables(this) {
|
TransactionAnchoredVariables(this) {
|
||||||
m_id = std::to_string(this->m_timeStamp) + \
|
m_id = std::to_string(this->m_timeStamp) + \
|
||||||
@ -153,7 +159,9 @@ Transaction::~Transaction() {
|
|||||||
intervention::free(&m_it);
|
intervention::free(&m_it);
|
||||||
intervention::clean(&m_it);
|
intervention::clean(&m_it);
|
||||||
|
|
||||||
|
#ifdef WITH_YAJL
|
||||||
delete m_json;
|
delete m_json;
|
||||||
|
#endif
|
||||||
delete m_xml;
|
delete m_xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -648,6 +656,7 @@ int Transaction::processRequestBody() {
|
|||||||
m_variableReqbodyError.set("1", m_variableOffset);
|
m_variableReqbodyError.set("1", m_variableOffset);
|
||||||
m_variableReqbodyProcessorError.set("0", m_variableOffset);
|
m_variableReqbodyProcessorError.set("0", m_variableOffset);
|
||||||
}
|
}
|
||||||
|
#if WITH_YAJL
|
||||||
} else if (m_requestBodyProcessor == JSONRequestBody) {
|
} else if (m_requestBodyProcessor == JSONRequestBody) {
|
||||||
std::string error;
|
std::string error;
|
||||||
if (m_json->init() == true) {
|
if (m_json->init() == true) {
|
||||||
@ -667,6 +676,7 @@ int Transaction::processRequestBody() {
|
|||||||
m_variableReqbodyError.set("0", m_variableOffset);
|
m_variableReqbodyError.set("0", m_variableOffset);
|
||||||
m_variableReqbodyProcessorError.set("0", m_variableOffset);
|
m_variableReqbodyProcessorError.set("0", m_variableOffset);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
} else if (m_requestBodyType == MultiPartRequestBody) {
|
} else if (m_requestBodyType == MultiPartRequestBody) {
|
||||||
std::string error;
|
std::string error;
|
||||||
if (a != NULL) {
|
if (a != NULL) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user