Backend error: Out of range exception


Aug 10 12:17:53 localhost pdns_server[302931]: Backend reported permanent error which prevented lookup (Out of range exception parsing hostmaster.example.com. 202208101 28800 7200 604800 86400), aborting
Aug 10 12:17:53 localhost pdns_server[302931]: Backend error: Out of range exception parsing hostmaster.example.com. 202208101 28800 7200 604800 86400

SOAの書式がどうも間違っているらしい? ソースを確認してみる。

dnsbackend.ccにエラーの出力箇所があった。やっぱりSOAのパースをする場所っぽい。

void fillSOAData(const string &content, SOAData &data)
{
  vector<string>parts;
  parts.reserve(7);
  stringtok(parts, content);

  try {
    data.nameserver = DNSName(parts.at(0));
    data.hostmaster = DNSName(parts.at(1));
    pdns::checked_stoi_into(data.serial, parts.at(2));
    pdns::checked_stoi_into(data.refresh, parts.at(3));
    pdns::checked_stoi_into(data.retry, parts.at(4));
    pdns::checked_stoi_into(data.expire, parts.at(5));
    pdns::checked_stoi_into(data.minimum, parts.at(6));
  }
  catch(const std::out_of_range& oor) {
    throw PDNSException("Out of range exception parsing '" + content + "'");
  }
}

どうも7個のフィールドがあるらしい。しかしSOAレコードを見ると

hostmaster.example.com. 202208101 28800 7200 604800 86400

6個しかないので、確かにパースでエラーが出そう。

試しにDBに下記の値をつっこんでみた。

ns.example.com hostmaster.example.com. 202208101 28800 7200 604800 86400
# ※この時はドメインが1つしかなかったので下記としたが、複数ある場合全て書き換わるので注意
sqlute3> UPDATE records SET content = 'ns.example.com hostmaster.example.com. 202208101 28800 7200 604800 86400' where type='SOA';

書き換えた所正常に動作するようになった。