summaryrefslogtreecommitdiff
path: root/src/dns.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-03 04:08:20 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-03 04:08:20 +0000
commit8ed74be517990d100bdfe237a002d5115ea85a5e (patch)
treeb9d50cac1077d59fb06cc9b164572573ad393e7a /src/dns.cpp
parentde25d946733f774e3a5b53a58438a9c92af0acbe (diff)
Fix crash due to null address in DNS
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11797 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/dns.cpp')
-rw-r--r--src/dns.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/dns.cpp b/src/dns.cpp
index 2e016f58e..e4d0b73fb 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -216,14 +216,6 @@ int DNSRequest::SendRequests(const DNSHeader *header, const int length, QueryTyp
DNS::EmptyHeader(payload,header,length);
- if (this->dnsobj->myserver.sa.sa_family == AF_INET6)
- {
- dnsobj->myserver.in6.sin6_port = htons(DNS::QUERY_PORT);
- }
- else
- {
- dnsobj->myserver.in4.sin_port = htons(DNS::QUERY_PORT);
- }
if (ServerInstance->SE->SendTo(dnsobj, payload, length + 12, 0, &(dnsobj->myserver.sa), sa_size(dnsobj->myserver)) != length+12)
return -1;
@@ -311,7 +303,7 @@ void DNS::Rehash()
this->cache = new dnscache();
}
- irc::sockets::aptosa(ServerInstance->Config->DNSServer, 0, &myserver);
+ irc::sockets::aptosa(ServerInstance->Config->DNSServer, DNS::QUERY_PORT, &myserver);
/* Initialize mastersocket */
int s = irc::sockets::OpenTCPSocket(ServerInstance->Config->DNSServer, SOCK_DGRAM);
@@ -565,10 +557,7 @@ DNSResult DNS::GetResult()
*
* -- Thanks jilles for pointing this one out.
*/
- irc::sockets::sockaddrs expect_src;
- irc::sockets::aptosa(ServerInstance->Config->DNSServer, DNS::QUERY_PORT, &expect_src);
-
- if (memcmp(&from, &expect_src, sizeof(irc::sockets::sockaddrs)))
+ if (memcmp(&from, &myserver, sizeof(irc::sockets::sockaddrs)))
{
return DNSResult(-1,"",0,"");
}