1
0
mirror of https://github.com/anope/anope.git synced 2026-07-04 20:33:12 +02:00

Allow services to return more than one NS record

This commit is contained in:
Adam
2012-11-30 20:49:59 -05:00
parent c0f60d56a1
commit 705d1efeab
3 changed files with 14 additions and 7 deletions
+2 -2
View File
@@ -1072,8 +1072,8 @@ dns
* SOA record information.
*/
admin = "admin@example.com"
/* This should be the name of the public facing nameserver serving the records */
primary_nameserver = "ns1.example.com"
/* This should be the names of the public facing nameserver serving the records */
nameservers = "ns1.example.com ns2.example.com"
/* The time slave servers are allowed to cache. This should be reasonably low
* if you want your records to be updated without much delay.
*/
+1 -1
View File
@@ -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},
+11 -4
View File
@@ -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;
}