mirror of
https://github.com/owasp-modsecurity/ModSecurity.git
synced 2025-08-14 05:45:59 +03:00
unit-test: Fix the geoip debug code
This commit is contained in:
parent
17f88f5821
commit
8575c10781
@ -35,9 +35,13 @@ bool GeoLookup::evaluate(Assay *assay, const std::string &exp) {
|
||||
GeoIPRecord *gir;
|
||||
bool ret = true;
|
||||
|
||||
//bool ret = Utils::GeoLookup::getInstance().lookup(exp, &gir,
|
||||
// std::bind(&GeoLookup::debug, this, assay, _1, _2));
|
||||
|
||||
if (assay) {
|
||||
ret = Utils::GeoLookup::getInstance().lookup(exp, &gir,
|
||||
std::bind(&GeoLookup::debug, this, assay, _1, _2));
|
||||
} else {
|
||||
ret = Utils::GeoLookup::getInstance().lookup(exp, &gir,
|
||||
nullptr);
|
||||
}
|
||||
if (ret && gir) {
|
||||
if (gir->country_code) {
|
||||
assay->store_variable("GEO:COUNTRY_CODE", gir->country_code);
|
||||
|
@ -56,7 +56,10 @@ bool GeoLookup::setDataBase(const std::string& filePath) {
|
||||
bool GeoLookup::lookup(const std::string& target, GeoIPRecord **gir,
|
||||
std::function<bool(int, std::string)> debug) {
|
||||
if (m_gi == NULL) {
|
||||
debug(4, "GeoIP: Database is not open. Use: SecGeoLookupDb directive.");
|
||||
if (debug) {
|
||||
debug(4, "GeoIP: Database is not open. " \
|
||||
"Use: SecGeoLookupDb directive.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user