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