summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/users.h4
-rw-r--r--src/configreader.cpp6
-rw-r--r--src/dns.cpp15
-rw-r--r--src/inspsocket.cpp4
-rw-r--r--src/listensocket.cpp4
-rw-r--r--src/socket.cpp5
-rw-r--r--src/users.cpp8
7 files changed, 7 insertions, 39 deletions
diff --git a/include/users.h b/include/users.h
index 7e05c9f2a..6f656a51b 100644
--- a/include/users.h
+++ b/include/users.h
@@ -444,10 +444,6 @@ class CoreExport User : public StreamSocket
* @return The port number of this user.
*/
int GetServerPort();
- /**
- * @return The server IP address
- */
- std::string GetServerIP();
/** Get client IP string from sockaddr, using static internal buffer
* @return The IP string
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 21e4c2321..05171ea60 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -2102,9 +2102,3 @@ void ConfigReaderThread::Finish()
delete this->Config;
}
}
-
-template<>
-void ValueContainer<char[MAXBUF]>::Set(ServerConfig* conf, ValueItem const& item)
-{
- strlcpy(conf->*vptr, item.GetString(), MAXBUF);
-}
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,"");
}
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index ebf6e3b9d..60c69559d 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -46,7 +46,7 @@ void BufferedSocket::DoConnect(const std::string &ipaddr, int aport, unsigned lo
BufferedSocketError BufferedSocket::BeginConnect(const std::string &ipaddr, int aport, unsigned long maxtime, const std::string &connectbindip)
{
irc::sockets::sockaddrs addr, bind;
- if (!irc::sockets::aptosa(ipaddr.c_str(), aport, &addr))
+ if (!irc::sockets::aptosa(ipaddr, aport, &addr))
{
ServerInstance->Logs->Log("SOCKET", DEBUG, "BUG: Hostname passed to BufferedSocket, rather than an IP address!");
return I_ERR_CONNECT;
@@ -55,7 +55,7 @@ BufferedSocketError BufferedSocket::BeginConnect(const std::string &ipaddr, int
bind.sa.sa_family = 0;
if (!connectbindip.empty())
{
- if (!irc::sockets::aptosa(connectbindip.c_str(), 0, &bind))
+ if (!irc::sockets::aptosa(connectbindip, 0, &bind))
{
return I_ERR_BIND;
}
diff --git a/src/listensocket.cpp b/src/listensocket.cpp
index a8c713959..c6b91a4f6 100644
--- a/src/listensocket.cpp
+++ b/src/listensocket.cpp
@@ -26,7 +26,7 @@ ListenSocketBase::ListenSocketBase(int port, const std::string &addr) : desc("pl
irc::sockets::sockaddrs bind_to;
// canonicalize address if it is defined
- if (!irc::sockets::aptosa(addr.c_str(), port, &bind_to))
+ if (!irc::sockets::aptosa(addr, port, &bind_to))
{
// malformed address
bind_addr = addr;
@@ -39,7 +39,7 @@ ListenSocketBase::ListenSocketBase(int port, const std::string &addr) : desc("pl
irc::sockets::satoap(&bind_to, bind_addr, bind_port);
bind_desc = irc::sockets::satouser(&bind_to);
- this->fd = irc::sockets::OpenTCPSocket(bind_addr.c_str());
+ this->fd = irc::sockets::OpenTCPSocket(bind_addr);
}
if (this->fd > -1)
diff --git a/src/socket.cpp b/src/socket.cpp
index 00be4250b..9ec6c9982 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -27,10 +27,7 @@ bool InspIRCd::BindSocket(int sockfd, int port, const char* addr, bool dolisten)
sockaddrs servaddr;
int ret;
- if (*addr == '*' || *addr == '\0')
- addr = NULL;
-
- if (port == -1 && !addr)
+ if ((*addr == '*' || *addr == '\0') && port == -1)
{
/* Port -1: Means UDP IPV4 port binding - Special case
* used by DNS engine.
diff --git a/src/users.cpp b/src/users.cpp
index 33931fd45..c3f1f3ae5 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -1049,14 +1049,6 @@ const char* User::GetCIDRMask(int range)
return ""; // unused, but oh well
}
-std::string User::GetServerIP()
-{
- int port;
- std::string ip;
- irc::sockets::satoap(&server_sa, ip, port);
- return ip;
-}
-
const char* User::GetIPString()
{
int port;