mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2026-01-16 08:27:10 +03:00
Avoids to cleanup GeoIp on ModSecurity destructor
GeoIp is already being cleaned elsewhere. Fix #2041
This commit is contained in:
committed by
Felipe Zimmerle
parent
ab6754712c
commit
97762dc1bc
@@ -95,9 +95,6 @@ ModSecurity::~ModSecurity() {
|
||||
#ifdef MSC_WITH_CURL
|
||||
curl_global_cleanup();
|
||||
#endif
|
||||
#ifdef WITH_GEOIP
|
||||
Utils::GeoLookup::getInstance().cleanUp();
|
||||
#endif
|
||||
#ifdef WITH_LIBXML2
|
||||
xmlCleanupParser();
|
||||
#endif
|
||||
|
||||
@@ -63,22 +63,26 @@ bool GeoLookup::setDataBase(const std::string& filePath,
|
||||
std::string intGeo;
|
||||
#endif
|
||||
|
||||
if (m_version != NOT_LOADED) {
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
#ifdef WITH_MAXMIND
|
||||
int status = MMDB_open(filePath.c_str(), MMDB_MODE_MMAP, &mmdb);
|
||||
if (status != MMDB_SUCCESS) {
|
||||
intMax.assign("libMaxMind: Can't open: " + std::string(MMDB_strerror(status)) + ".");
|
||||
} else {
|
||||
if (status == MMDB_SUCCESS) {
|
||||
m_version = VERSION_MAXMIND;
|
||||
} else {
|
||||
intMax.assign("libMaxMind: Can't open: " + std::string(MMDB_strerror(status)) + ".");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WITH_GEOIP
|
||||
if (m_version == NOT_LOADED) {
|
||||
m_gi = GeoIP_open(filePath.c_str(), GEOIP_MEMORY_CACHE);
|
||||
if (m_gi == NULL) {
|
||||
intGeo.append("GeoIP: Can't open: " + filePath + ".");
|
||||
} else {
|
||||
if (m_gi) {
|
||||
m_version = VERSION_GEOIP;
|
||||
} else {
|
||||
intGeo.append("GeoIP: Can't open: " + filePath + ".");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -55,13 +55,16 @@ class GeoLookup {
|
||||
private:
|
||||
GeoLookup() :
|
||||
m_version(NOT_LOADED)
|
||||
#if WITH_MAXMIND
|
||||
,mmdb()
|
||||
#endif
|
||||
#if WITH_GEOIP
|
||||
,m_gi(NULL)
|
||||
#endif
|
||||
{ }
|
||||
~GeoLookup();
|
||||
GeoLookup(GeoLookup const&);
|
||||
void operator=(GeoLookup const&);
|
||||
GeoLookup(GeoLookup const&) = delete;
|
||||
void operator=(GeoLookup const&) = delete;
|
||||
|
||||
GeoLookupVersion m_version;
|
||||
#if WITH_MAXMIND
|
||||
|
||||
Reference in New Issue
Block a user