summaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-04-25 04:17:21 -0400
committerAdam <Adam@anope.org>2011-04-25 04:17:21 -0400
commit4a733c93d45e0ca5d757abf826d65bc1cbaf610e (patch)
treee09f093a9926b4285ea1d33da93828ddd5b6bbcb /src/main.cpp
parent03d2378a9fc2fdc868ee4476597ec1901242a0c5 (diff)
Don't attempt to connect to the uplink if given invalid hostnames
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 3ca033507..b71a7754a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -369,6 +369,12 @@ static bool Connect()
DNSRecord req = DNSManager::BlockingQuery(uplink_server->host, uplink_server->ipv6 ? DNS_QUERY_AAAA : DNS_QUERY_A);
+ if (!req)
+ {
+ Log() << "Unable to connect to server " << servernum << " (" << uplink_server->host << ":" << uplink_server->port << "): Invalid hostname/IP";
+ continue;
+ }
+
try
{
new UplinkSocket(uplink_server->ipv6);
@@ -376,7 +382,7 @@ static bool Connect()
}
catch (const SocketException &ex)
{
- Log() << "Unable to connect to server" << servernum << " (" << uplink_server->host << ":" << uplink_server->port << "), " << ex.GetReason();
+ Log() << "Unable to connect to server " << servernum << " (" << uplink_server->host << ":" << uplink_server->port << "): " << ex.GetReason();
continue;
}