Commit 575aace1 authored by Emmanuel Lepage Vallee's avatar Emmanuel Lepage Vallee Committed by Tristan Matthews

* #14304: sip: don't try and resolve hostname if it contains a period

Signed-off-by: default avatarTristan Matthews <tristan.matthews@savoirfairelinux.com>
parent 2d3d0353
......@@ -160,12 +160,17 @@ sip_utils::resolveServerDns(const std::string &server)
struct hostent *he;
std::list<std::string> ipList;
if ((he = gethostbyname(server.c_str())) == NULL)
return ipList;
struct in_addr **addr_list = (struct in_addr **) he->h_addr_list;
for (int i = 0; addr_list[i] != NULL; ++i)
ipList.push_back(inet_ntoa(*addr_list[i]));
// If hostname has a period, assume that it is an IP address and return
// as is
if (server.find(".") == std::string::npos) {
if ((he = gethostbyname(server.c_str())) == NULL)
return ipList;
struct in_addr **addr_list = (struct in_addr **) he->h_addr_list;
for (int i = 0; addr_list[i] != NULL; ++i)
ipList.push_back(inet_ntoa(*addr_list[i]));
} else {
ipList.push_back(server);
}
return ipList;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment