This makes sure the domain id in struct DomainInfo always gets set to
something (i.e. UnknownDomainID when the backend can't figure out a
meaningful value).
Fixes: #551
void Bind2Backend::loadConfig(string* status) // NOLINT(readability-function-cognitive-complexity) 13379 https://github.com/PowerDNS/pdns/issues/13379 Habbie: zone2sql.cc, bindbackend2.cc: reduce complexity
{
- static int domain_id = 1;
+ static domainid_t domain_id = 1;
if (!getArg("config").empty()) {
BindParser BP;
if (result.count("PdnsDomainId") && !result["PdnsDomainId"].empty())
info.id = static_cast<domainid_t>(std::stoll(result["PdnsDomainId"][0]));
else
- info.id = 0;
+ info.id = UnknownDomainID;
info.serial = sd.serial;
info.zone = domain;
void parseDomainInfo(const domaininfo_result_t& row, DomainInfo& di)
{
+ di.id = UnknownDomainID;
for (const auto& item : row) {
if (item.first == "account")
di.account = boost::get<string>(item.second);
if (!getAuth(domain, &sd))
return false;
+ di.id = sd.domain_id;
di.zone = domain;
di.backend = this;
di.serial = sd.serial;