mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-30 03:34:29 +03:00
parser: Loads content straight from buffer.
This commit is contained in:
18
src/rules.cc
18
src/rules.cc
@@ -111,25 +111,17 @@ int Rules::loadRemote(char *key, char *uri) {
|
||||
|
||||
|
||||
int Rules::load(const char *plain_rules) {
|
||||
bool ret = true;
|
||||
/**
|
||||
* @todo rgg. we should make the parser work out of the buffer.
|
||||
*
|
||||
*/
|
||||
std::ofstream myfile;
|
||||
myfile.open("/tmp/modsec_ugly_hack.txt");
|
||||
myfile << plain_rules;
|
||||
myfile.close();
|
||||
|
||||
Driver *driver = new Driver();
|
||||
if (driver->parse("/tmp/modsec_ugly_hack.txt")) {
|
||||
ret = false;
|
||||
|
||||
if (driver->parse(plain_rules) == false) {
|
||||
parserError << driver->parserError.rdbuf();
|
||||
return false;
|
||||
}
|
||||
|
||||
this->merge(driver);
|
||||
delete driver;
|
||||
|
||||
return ret;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user