Adds verbose message when a resource is not found.

Fix #1309
This commit is contained in:
Felipe Zimmerle
2017-05-02 13:38:41 -03:00
parent 77a658c7cd
commit c97db2f361
10 changed files with 906 additions and 831 deletions

View File

@@ -38,11 +38,12 @@ bool PmFromFile::init(const std::string &config, std::string *error) {
}
iss = new std::stringstream(client.content);
} else {
std::string resource = utils::find_resource(m_param, config);
std::string err;
std::string resource = utils::find_resource(m_param, config, &err);
iss = new std::ifstream(resource, std::ios::in);
if (((std::ifstream *)iss)->is_open() == false) {
error->assign("Failed to open file: " + m_param);
error->assign("Failed to open file: " + m_param + ". " + err);
delete iss;
return false;
}

View File

@@ -26,9 +26,10 @@ namespace operators {
bool ValidateDTD::init(const std::string &file, std::string *error) {
m_resource = utils::find_resource(m_param, file);
std::string err;
m_resource = utils::find_resource(m_param, file, &err);
if (m_resource == "") {
error->assign("XML: File not found: " + m_param + ".");
error->assign("XML: File not found: " + m_param + ". " + err);
return false;
}

View File

@@ -26,9 +26,10 @@ namespace modsecurity {
namespace operators {
bool ValidateSchema::init(const std::string &file, std::string *error) {
m_resource = utils::find_resource(m_param, file);
std::string err;
m_resource = utils::find_resource(m_param, file, &err);
if (m_resource == "") {
error->assign("XML: File not found: " + m_param + ".");
error->assign("XML: File not found: " + m_param + ". " + err);
return false;
}