From e1641d3872c48f4ec1ed11b775b5318322f2184a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 19 Dec 2025 13:57:06 +0100 Subject: [PATCH] auth: fix geoip_mmdb backend MMDB_open error handling MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit According to [MMDB_open docs], errors from `MMDB_open` should be compared to `MMDB_SUCCESS` (which is 0). All other errors are > 0, which means that existing check never detects errors, causing further queries to fail with error: ``` The MaxMind DB file is in a format this library can't handle (unknown record size or binary format version) ``` [MMDB_open docs]: https://maxmind.github.io/libmaxminddb/#mmdb_open Signed-off-by: Ensar Sarajčić --- modules/geoipbackend/geoipinterface-mmdb.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/geoipbackend/geoipinterface-mmdb.cc b/modules/geoipbackend/geoipinterface-mmdb.cc index 95f1b56daf..463b8209b8 100644 --- a/modules/geoipbackend/geoipinterface-mmdb.cc +++ b/modules/geoipbackend/geoipinterface-mmdb.cc @@ -46,7 +46,7 @@ public: else throw PDNSException(string("Unsupported mode ") + modeStr + ("for geoipbackend-mmdb")); memset(&d_s, 0, sizeof(d_s)); - if ((ec = MMDB_open(fname.c_str(), flags, &d_s)) < 0) + if ((ec = MMDB_open(fname.c_str(), flags, &d_s)) != MMDB_SUCCESS) throw PDNSException(string("Cannot open ") + fname + string(": ") + string(MMDB_strerror(ec))); d_lang = language; g_log << Logger::Debug << "Opened MMDB database " << fname << "(type: " << d_s.metadata.database_type << " version: " << d_s.metadata.binary_format_major_version << "." << d_s.metadata.binary_format_minor_version << ")" << endl; -- 2.47.3