Avoids to cleanup GeoIp on ModSecurity destructor

GeoIp is already being cleaned elsewhere.

Fix #2041
This commit is contained in:
Felipe Zimmerle
2020-11-16 11:39:26 -03:00
committed by Felipe Zimmerle
parent ab6754712c
commit 97762dc1bc
5 changed files with 19 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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