1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 04:56:38 +02:00

Allow hostmasks to be in uplink:host

This commit is contained in:
Adam
2010-12-21 15:57:57 -05:00
parent 21125cf2cb
commit 18377ac9fd
4 changed files with 50 additions and 12 deletions
+33
View File
@@ -608,3 +608,36 @@ void DNSRequestTimeout::Tick(time_t)
delete this->request;
}
DNSRecord DNSManager::BlockingQuery(const Anope::string &mask, QueryType qt)
{
DNSRecord result(mask);
addrinfo *addrresult, hints;
result.result = mask;
result.type = qt;
int type = AF_UNSPEC;
if (qt == DNS_QUERY_A)
type = AF_INET;
else if (qt == DNS_QUERY_AAAA)
type = AF_INET6;
memset(&hints, 0, sizeof(hints));
hints.ai_family = type;
if (getaddrinfo(mask.c_str(), NULL, &hints, &addrresult) == 0)
{
sockaddrs addr;
memcpy(&addr, addrresult->ai_addr, addrresult->ai_addrlen);
try
{
result.result = addr.addr();
}
catch (const SocketException &) { }
freeaddrinfo(addrresult);
}
return result;
}