mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-09-29 11:16:33 +03:00
Refectoring on the DebugLog mechanism
The DebugLog implementation was modified to use shared memory to keep the information about the opened files and file handles. The modification was necessary to avoid race-conditions. This commit also closes the issue SpiderLabs/ModSecurity-nginx#17
This commit is contained in:
@@ -42,7 +42,7 @@ class DebugLog {
|
||||
bool isLogFileSet();
|
||||
bool isLogLevelSet();
|
||||
void setDebugLogLevel(int level);
|
||||
void setDebugLogFile(const std::string &fileName);
|
||||
void setDebugLogFile(const std::string &fileName, std::string *error);
|
||||
const std::string& getDebugLogFile();
|
||||
int getDebugLogLevel();
|
||||
|
||||
|
@@ -330,10 +330,23 @@ class RulesProperties {
|
||||
|
||||
if (from->m_debugLog && to->m_debugLog &&
|
||||
from->m_debugLog->isLogFileSet()) {
|
||||
std::string error;
|
||||
to->m_debugLog->setDebugLogFile(
|
||||
from->m_debugLog->getDebugLogFile());
|
||||
from->m_debugLog->getDebugLogFile(),
|
||||
&error);
|
||||
if (error.size() > 0) {
|
||||
*err << error;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (from->m_debugLog && to->m_debugLog &&
|
||||
from->m_debugLog->isLogLevelSet()) {
|
||||
to->m_debugLog->setDebugLogLevel(
|
||||
from->m_debugLog->getDebugLogLevel());
|
||||
}
|
||||
|
||||
|
||||
return amount_of_rules;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user