From: Fred Morcos Date: Wed, 15 May 2024 09:46:08 +0000 (+0200) Subject: Auth: Add debug logging to UeberBackend and BackendMakerClass X-Git-Tag: rec-5.1.0-beta1~43^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e69fc982ff752ee7a29537b1f560fc8ee3d18aa9;p=thirdparty%2Fpdns.git Auth: Add debug logging to UeberBackend and BackendMakerClass When trying to load backend module files. --- diff --git a/pdns/dnsbackend.cc b/pdns/dnsbackend.cc index 1aca03ce48..7abb7d47f3 100644 --- a/pdns/dnsbackend.cc +++ b/pdns/dnsbackend.cc @@ -124,14 +124,22 @@ void BackendMakerClass::load(const string& module) { bool res = false; + g_log << Logger::Debug << "BackendMakerClass: module = " << module << endl; + g_log << Logger::Debug << "BackendMakerClass: module-dir = " << arg()["module-dir"] << endl; if (module.find('.') == string::npos) { - res = UeberBackend::loadmodule(arg()["module-dir"] + "/lib" + module + "backend.so"); + auto modulePath = arg()["module-dir"] + "/lib" + module + "backend.so"; + g_log << Logger::Debug << "BackendMakerClass: Loading '" << modulePath << "'" << endl; + res = UeberBackend::loadmodule(modulePath); } - else if (module[0] == '/' || (module[0] == '.' && module[1] == '/') || (module[0] == '.' && module[1] == '.')) { // absolute or current path + else if (module[0] == '/' || (module[0] == '.' && module[1] == '/') || (module[0] == '.' && module[1] == '.')) { + // Absolute path, Current path or Parent path + g_log << Logger::Debug << "BackendMakerClass: Loading '" << module << "'" << endl; res = UeberBackend::loadmodule(module); } else { - res = UeberBackend::loadmodule(arg()["module-dir"] + "/" + module); + auto modulePath = arg()["module-dir"] + "/" + module; + g_log << Logger::Debug << "BackendMakerClass: Loading '" << modulePath << "'" << endl; + res = UeberBackend::loadmodule(modulePath); } if (!res) { diff --git a/pdns/ueberbackend.cc b/pdns/ueberbackend.cc index 1d9950fb79..e52f07efb1 100644 --- a/pdns/ueberbackend.cc +++ b/pdns/ueberbackend.cc @@ -76,24 +76,31 @@ bool UeberBackend::loadmodule(const string& name) bool UeberBackend::loadModules(const vector& modules, const string& path) { + g_log << Logger::Debug << "UeberBackend: path = " << path << endl; + for (const auto& module : modules) { bool res = false; + g_log << Logger::Debug << "UeberBackend: Attempting to load module '" << module << "'" << endl; + if (module.find('.') == string::npos) { auto fullPath = path; fullPath += "/lib"; fullPath += module; fullPath += "backend.so"; + g_log << Logger::Debug << "UeberBackend: Loading '" << fullPath << "'" << endl; res = UeberBackend::loadmodule(fullPath); } else if (module[0] == '/' || (module[0] == '.' && module[1] == '/') || (module[0] == '.' && module[1] == '.')) { - // absolute or current path + // Absolute path, Current path or Parent path + g_log << Logger::Debug << "UeberBackend: Loading '" << module << "'" << endl; res = UeberBackend::loadmodule(module); } else { auto fullPath = path; fullPath += "/"; fullPath += module; + g_log << Logger::Debug << "UeberBackend: Loading '" << fullPath << "'" << endl; res = UeberBackend::loadmodule(fullPath); }