mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +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,7 +50,9 @@ bool ValidateSchema::evaluate(Transaction *t,
|
||||
if (m_err.empty() == false) {
|
||||
err << m_err;
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, err.str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -73,7 +75,9 @@ bool ValidateSchema::evaluate(Transaction *t,
|
||||
if (m_err.empty() == false) {
|
||||
err << " " << m_err;
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, err.str());
|
||||
#endif
|
||||
xmlSchemaFreeParserCtxt(m_parserCtx);
|
||||
return true;
|
||||
}
|
||||
@@ -84,7 +88,9 @@ bool ValidateSchema::evaluate(Transaction *t,
|
||||
if (m_err.empty() == false) {
|
||||
err << " " << m_err;
|
||||
}
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, err.str());
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -94,36 +100,46 @@ bool ValidateSchema::evaluate(Transaction *t,
|
||||
(xmlSchemaValidityWarningFunc)warn_runtime, t);
|
||||
|
||||
if (t->m_xml->m_data.doc == NULL) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML document tree could not be found for " \
|
||||
"schema validation.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t->m_xml->m_data.well_formed != 1) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: Schema validation failed because " \
|
||||
"content is not well formed.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Make sure there were no other generic processing errors */
|
||||
/*
|
||||
if (msr->msc_reqbody_error) {
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: Schema validation could not proceed due to previous"
|
||||
" processing errors.");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
rc = xmlSchemaValidateDoc(m_validCtx, t->m_xml->m_data.doc);
|
||||
if (rc != 0) {
|
||||
t->debug(4, "XML: Schema validation failed.");
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: Schema validation failed.");
|
||||
#endif
|
||||
xmlSchemaFree(m_schema);
|
||||
xmlSchemaFreeParserCtxt(m_parserCtx);
|
||||
return true; /* No match. */
|
||||
}
|
||||
|
||||
#ifndef NO_LOGS
|
||||
t->debug(4, "XML: Successfully validated payload against " \
|
||||
"Schema: " + m_resource);
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user