Looks for external resources in the same path of the rule

This commit is contained in:
Felipe Zimmerle
2015-10-06 09:21:30 -03:00
parent 5cc9e94505
commit e54ef72051
17 changed files with 96 additions and 27 deletions

View File

@@ -19,12 +19,13 @@
#include "operators/operator.h"
#include "utils/https_client.h"
#include "src/utils.h"
namespace ModSecurity {
namespace operators {
bool PmFromFile::init(const char **error) {
bool PmFromFile::init(const std::string &config, const char **error) {
std::istream *iss;
if (param.compare(0, 8, "https://") == 0) {
@@ -36,7 +37,8 @@ bool PmFromFile::init(const char **error) {
}
iss = new std::stringstream(client.content);
} else {
iss = new std::ifstream(param, std::ios::in);
std::string resource = find_resource(param, config);
iss = new std::ifstream(resource, std::ios::in);
if (((std::ifstream *)iss)->is_open() == false) {
*error = std::string("Failed to open file: " + param).c_str();