From 8bcd42704bb3c5361a9d3eacb0c793102d4f826a Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 29 Apr 2009 03:21:22 +0000 Subject: 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 --- src/modules/extra/m_ssl_gnutls.cpp | 9 +++++++++ src/modules/extra/m_ssl_openssl.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) (limited to 'src/modules/extra') 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())) -- cgit v1.2.3