mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 19:47:47 +03:00
@@ -59,21 +59,26 @@ double cpu_seconds(void) {
|
||||
|
||||
|
||||
std::string find_resource(const std::string& resource,
|
||||
const std::string& config) {
|
||||
const std::string& config, std::string *err) {
|
||||
std::ifstream *iss;
|
||||
|
||||
err->assign("Looking at: ");
|
||||
// Trying absolute or relative to the current dir.
|
||||
iss = new std::ifstream(resource, std::ios::in);
|
||||
if (iss->is_open()) {
|
||||
iss->close();
|
||||
delete iss;
|
||||
return resource;
|
||||
} else {
|
||||
err->append("'" + resource + "', ");
|
||||
}
|
||||
delete iss;
|
||||
|
||||
// What about `*' ?
|
||||
if (utils::expandEnv(resource, 0).size() > 1) {
|
||||
return resource;
|
||||
} else {
|
||||
err->append("'" + resource + "', ");
|
||||
}
|
||||
|
||||
// Trying the same path of the configuration file.
|
||||
@@ -83,12 +88,16 @@ std::string find_resource(const std::string& resource,
|
||||
iss->close();
|
||||
delete iss;
|
||||
return f;
|
||||
} else {
|
||||
err->append("'" + f + "', ");
|
||||
}
|
||||
delete iss;
|
||||
|
||||
// What about `*' ?
|
||||
if (utils::expandEnv(f, 0).size() > 1) {
|
||||
return f;
|
||||
} else {
|
||||
err->append("'" + f + "'.");
|
||||
}
|
||||
|
||||
return std::string("");
|
||||
|
@@ -29,7 +29,8 @@ namespace utils {
|
||||
|
||||
|
||||
double cpu_seconds(void);
|
||||
std::string find_resource(const std::string& file, const std::string& param);
|
||||
std::string find_resource(const std::string& file, const std::string& param,
|
||||
std::string *err);
|
||||
std::string get_path(const std::string& file);
|
||||
std::list<std::string> expandEnv(const std::string& var, int flags);
|
||||
bool createDir(std::string dir, int mode, std::string *error);
|
||||
|
Reference in New Issue
Block a user