diff options
author | Adam <Adam@anope.org> | 2012-11-30 20:49:59 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-11-30 20:49:59 -0500 |
commit | 705d1efeabd39812ad6699c39e6f252aa2fadcc9 (patch) | |
tree | 3675758c0c69d42bd2f437ebf19d15ee3a1d133a /src | |
parent | c0f60d56a1a5fdc5632ba2d2c81304d02beef1e3 (diff) |
Allow services to return more than one NS record
Diffstat (limited to 'src')
-rw-r--r-- | src/config.cpp | 2 | ||||
-rw-r--r-- | src/dns.cpp | 15 |
2 files changed, 12 insertions, 5 deletions
diff --git a/src/config.cpp b/src/config.cpp index 339a946f5..8969569fd 100644 --- a/src/config.cpp +++ b/src/config.cpp @@ -1267,7 +1267,7 @@ ConfigItems::ConfigItems(ServerConfig *conf) {"dns", "ip", "0.0.0.0", new ValueContainerString(&conf->DNSIP), DT_STRING, NoValidation}, {"dns", "port", "53", new ValueContainerInt(&conf->DNSPort), DT_INTEGER, NoValidation}, {"dns", "admin", "admin@example.com", new ValueContainerString(&conf->DNSSOAAdmin), DT_STRING, NoValidation}, - {"dns", "primary_nameserver", "ns1.example.com", new ValueContainerString(&conf->DNSSOANS), DT_STRING, NoValidation}, + {"dns", "nameservers", "ns1.example.com", new ValueContainerString(&conf->DNSSOANS), DT_STRING, NoValidation}, {"dns", "refresh", "3600", new ValueContainerUInt(&conf->DNSSOARefresh), DT_UINTEGER, NoValidation}, {"chanserv", "name", "", new ValueContainerString(&conf->ChanServ), DT_STRING, NoValidation}, {"chanserv", "defaults", "keeptopic secure securefounder signkick", new ValueContainerString(&CSDefaults), DT_STRING, ValidateChanServ}, diff --git a/src/dns.cpp b/src/dns.cpp index e75f98449..ccb919a31 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -468,7 +468,9 @@ unsigned short Packet::Pack(unsigned char *output, unsigned short output_size) unsigned short packet_pos_save = pos; pos += 2; - this->PackName(output, output_size, pos, Config->DNSSOANS); + std::vector<Anope::string> nameservers; + spacesepstream(Config->DNSSOANS).GetTokens(nameservers); + this->PackName(output, output_size, pos, !nameservers.empty() ? nameservers[0] : ""); this->PackName(output, output_size, pos, Config->DNSSOAAdmin.replace_all_cs('@', '.')); if (pos + 20 >= output_size) @@ -730,9 +732,14 @@ bool Manager::HandlePacket(ReplySocket *s, const unsigned char *const packet_buf if (q.type == QUERY_AXFR) { - ResourceRecord rr2(q.name, QUERY_NS); - rr2.rdata = Config->DNSSOANS; - packet->answers.push_back(rr2); + Anope::string token; + spacesepstream sep(Config->DNSSOANS); + while (sep.GetToken(token)) + { + ResourceRecord rr2(q.name, QUERY_NS); + rr2.rdata = token; + packet->answers.push_back(rr2); + } } break; } |