mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Added XML warn/error output to debug log. See #519.
This commit is contained in:
@@ -891,6 +891,12 @@ static int msre_op_validateDTD_execute(modsec_rec *msr, msre_rule *rule, msre_va
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send validator errors/warnings to msr_log */
|
||||
/* NOTE: No xmlDtdSetValidErrors()? */
|
||||
cvp->error = (xmlSchemaValidityErrorFunc)msr_log_error;
|
||||
cvp->warning = (xmlSchemaValidityErrorFunc)msr_log_warn;
|
||||
cvp->userData = msr;
|
||||
|
||||
if (!xmlValidateDtd(cvp, msr->xml->doc, dtd)) {
|
||||
*error_msg = "XML: DTD validation failed.";
|
||||
xmlFreeValidCtxt(cvp);
|
||||
@@ -935,6 +941,9 @@ static int msre_op_validateSchema_execute(modsec_rec *msr, msre_rule *rule, msre
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send parser errors/warnings to msr_log */
|
||||
xmlSchemaSetParserErrors(parserCtx, (xmlSchemaValidityErrorFunc)msr_log_error, (xmlSchemaValidityWarningFunc)msr_log_warn, msr);
|
||||
|
||||
schema = xmlSchemaParse(parserCtx);
|
||||
if (schema == NULL) {
|
||||
*error_msg = apr_psprintf(msr->mp, "XML: Failed to load Schema: %s", rule->op_param);
|
||||
@@ -950,6 +959,9 @@ static int msre_op_validateSchema_execute(modsec_rec *msr, msre_rule *rule, msre
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Send validator errors/warnings to msr_log */
|
||||
xmlSchemaSetValidErrors(validCtx, (xmlSchemaValidityErrorFunc)msr_log_error, (xmlSchemaValidityWarningFunc)msr_log_warn, msr);
|
||||
|
||||
rc = xmlSchemaValidateDoc(validCtx, msr->xml->doc);
|
||||
if (rc != 0) {
|
||||
*error_msg = "XML: Schema validation failed.";
|
||||
|
Reference in New Issue
Block a user