mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-01 14:15:46 +03:00
Support --enable-debug-logs=no option of configure script (#2)
* Support --enable-debug-logs=no option of configure script * Undo unintended white space changes * Undo more unintended white space changes * Address review comments - thanks Mirko * Address more review comments - thanks Mirko
This commit is contained in:
committed by
Felipe Zimmerle
parent
1d3c4c670d
commit
3a048ee2db
@@ -50,19 +50,25 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) {
|
||||
if (m_dtd == NULL) {
|
||||
std::string err = std::string("XML: Failed to load DTD: ") \
|
||||
+ m_resource;
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, err);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t->m_xml->m_data.doc == NULL) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML document tree could not "\
|
||||
"be found for DTD validation.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t->m_xml->m_data.well_formed != 1) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: DTD validation failed because " \
|
||||
"content is not well formed.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -78,7 +84,9 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) {
|
||||
|
||||
cvp = xmlNewValidCtxt();
|
||||
if (cvp == NULL) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: Failed to create a validation context.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -88,13 +96,17 @@ bool ValidateDTD::evaluate(Transaction *t, const std::string &str) {
|
||||
cvp->userData = t;
|
||||
|
||||
if (!xmlValidateDtd(cvp, t->m_xml->m_data.doc, m_dtd)) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: DTD validation failed.");
|
||||
#endif
|
||||
xmlFreeValidCtxt(cvp);
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, std::string("XML: Successfully validated " \
|
||||
"payload against DTD: ") + m_resource);
|
||||
#endif
|
||||
|
||||
xmlFreeValidCtxt(cvp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user