Fix compilation issue while xml is disabled

This commit is contained in:
Felipe Zimmerle
2018-02-21 16:15:05 -03:00
parent ff782ddfa4
commit ac100785d1
9 changed files with 54 additions and 6 deletions

View File

@@ -24,7 +24,7 @@
namespace modsecurity {
namespace operators {
#ifdef WITH_LIBXML2
bool ValidateDTD::init(const std::string &file, std::string *error) {
std::string err;
m_resource = utils::find_resource(m_param, file, &err);
@@ -112,7 +112,7 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) {
return false;
}
#endif
} // namespace operators
} // namespace modsecurity

View File

@@ -19,9 +19,10 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifdef WITH_LIBXML2
#include <libxml/xmlschemas.h>
#include <libxml/xpath.h>
#endif
#include <string>
#include <memory>
#include <utility>
@@ -37,6 +38,7 @@ class ValidateDTD : public Operator {
/** @ingroup ModSecurity_Operator */
explicit ValidateDTD(std::unique_ptr<RunTimeString> param)
: Operator("ValidateDTD", std::move(param)) { }
#ifdef WITH_LIBXML2
~ValidateDTD() {
if (m_dtd != NULL) {
xmlFreeDtd(m_dtd);
@@ -92,6 +94,7 @@ class ValidateDTD : public Operator {
private:
std::string m_resource;
xmlDtdPtr m_dtd;
#endif
};
} // namespace operators

View File

@@ -25,6 +25,8 @@
namespace modsecurity {
namespace operators {
#ifdef WITH_LIBXML2
bool ValidateSchema::init(const std::string &file, std::string *error) {
std::string err;
m_resource = utils::find_resource(m_param, file, &err);
@@ -146,6 +148,7 @@ bool ValidateSchema::evaluate(Transaction *t,
return false;
}
#endif
} // namespace operators
} // namespace modsecurity

View File

@@ -19,9 +19,10 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#ifdef WITH_LIBXML2
#include <libxml/xmlschemas.h>
#include <libxml/xpath.h>
#endif
#include <string>
#include <memory>
#include <utility>
@@ -35,6 +36,10 @@ namespace operators {
class ValidateSchema : public Operator {
public:
/** @ingroup ModSecurity_Operator */
#ifndef WITH_LIBXML2
explicit ValidateSchema(std::unique_ptr<RunTimeString> param)
: Operator("ValidateSchema", std::move(param)) { }
#else
explicit ValidateSchema(std::unique_ptr<RunTimeString> param)
: Operator("ValidateSchema", std::move(param)),
m_parserCtx(NULL),
@@ -133,6 +138,7 @@ class ValidateSchema : public Operator {
xmlSchemaPtr m_schema;
std::string m_resource;
std::string m_err;
#endif
};
} // namespace operators