summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 03:21:22 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-04-29 03:21:22 +0000
commit8bcd42704bb3c5361a9d3eacb0c793102d4f826a (patch)
tree0e738a28db9c8169cc7d5f28315337787f191cfb
parent3df81381bcfee4531599ddb417a31e7efca2528e (diff)
Normalize IPv6 addresses when producing SSL port list, fixes bug #853
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11337 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp9
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp9
2 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 1372fb2df..1b9139867 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -160,6 +160,15 @@ class ModuleSSLGnuTLS : public Module
std::string port = Conf->ReadValue("bind", "port", index);
std::string addr = Conf->ReadValue("bind", "address", index);
+ if (!addr.empty())
+ {
+ // normalize address, important for IPv6
+ int portint = 0;
+ irc::sockets::sockaddrs bin;
+ if (irc::sockets::aptosa(addr.c_str(), portint, &bin))
+ irc::sockets::satoap(addr, portint, &bin);
+ }
+
irc::portparser portrange(port, false);
long portno = -1;
while ((portno = portrange.GetToken()))
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index 7295274e8..b9e23ba0b 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -182,6 +182,15 @@ class ModuleSSLOpenSSL : public Module
std::string port = Conf.ReadValue("bind", "port", index);
std::string addr = Conf.ReadValue("bind", "address", index);
+ if (!addr.empty())
+ {
+ // normalize address, important for IPv6
+ int portint = 0;
+ irc::sockets::sockaddrs bin;
+ if (irc::sockets::aptosa(addr.c_str(), portint, &bin))
+ irc::sockets::satoap(addr, portint, &bin);
+ }
+
irc::portparser portrange(port, false);
long portno = -1;
while ((portno = portrange.GetToken()))