From: Miod Vallat Date: Mon, 13 Jul 2026 14:44:15 +0000 (+0200) Subject: Pay more attention to boost::variant types. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=16e71caed2923b270ad98aced1a5facb65b8c5a0;p=thirdparty%2Fpdns.git Pay more attention to boost::variant types. This allows record contents made of digits only to be correctly handled as strings. Fixes: #10657 Signed-off-by: Miod Vallat --- diff --git a/modules/lua2backend/lua2api2.cc b/modules/lua2backend/lua2api2.cc index 27915b6a51..ffe0621973 100644 --- a/modules/lua2backend/lua2api2.cc +++ b/modules/lua2backend/lua2api2.cc @@ -123,12 +123,9 @@ void Lua2BackendAPIv2::parseLookup(const lookup_result_t& result) if (item.second.which() == 3) { rec.qname = DNSName(boost::get(item.second)); } - else if (item.second.which() == 2) { + else { // assuming item.second.which() == 2 here rec.qname = boost::get(item.second); } - else { - throw PDNSException("Unsupported value for name"); - } } else if (item.first == "domain_id") { rec.domain_id = boost::get(item.second); @@ -143,7 +140,12 @@ void Lua2BackendAPIv2::parseLookup(const lookup_result_t& result) rec.ttl = boost::get(item.second); } else if (item.first == "content") { - rec.setContent(boost::get(item.second)); + if (item.second.which() == 1) { + rec.setContent(std::to_string(boost::get(item.second))); + } + else { // assuming item.second.which() == 3 here + rec.setContent(boost::get(item.second)); + } } else if (item.first == "scopeMask") { rec.scopeMask = boost::get(item.second); @@ -264,7 +266,12 @@ void Lua2BackendAPIv2::parseDomainInfo(const domaininfo_result_t& row, DomainInf for (const auto& item : row) { try { if (item.first == "account") { - info.account = boost::get(item.second); + if (item.second.which() == 1) { // should the account name be all-digits... + info.account = std::to_string(boost::get(item.second)); + } + else { // assuming item.second.which() == 2 here + info.account = boost::get(item.second); + } } else if (item.first == "last_check") { info.last_check = static_cast(boost::get(item.second));