]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/extra/m_ssl_gnutls.cpp
Fix spacing in calls to LogManager::Log.
[user/henk/code/inspircd.git] / src / modules / extra / m_ssl_gnutls.cpp
index b42853912ad6310ae82a37bf1a297cbfba09601f..5ae530608d494819c13fb7963569cfba952343f6 100644 (file)
@@ -233,7 +233,7 @@ class ModuleSSLGnuTLS : public Module
                dh_alloc = false;
        }
 
-       void init()
+       void init() CXX11_OVERRIDE
        {
                // Needs the flag as it ignores a plain /rehash
                OnModuleRehash(NULL,"ssl");
@@ -250,7 +250,7 @@ class ModuleSSLGnuTLS : public Module
                ServerInstance->Modules->AddService(starttls);
        }
 
-       void OnRehash(User* user)
+       void OnRehash(User* user) CXX11_OVERRIDE
        {
                sslports.clear();
 
@@ -290,7 +290,7 @@ class ModuleSSLGnuTLS : public Module
                }
        }
 
-       void OnModuleRehash(User* user, const std::string &param)
+       void OnModuleRehash(User* user, const std::string &param) CXX11_OVERRIDE
        {
                if(param != "ssl")
                        return;
@@ -350,13 +350,13 @@ class ModuleSSLGnuTLS : public Module
                ret = gnutls_certificate_allocate_credentials(&x509_cred);
                cred_alloc = (ret >= 0);
                if (!cred_alloc)
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEBUG, "m_ssl_gnutls.so: Failed to allocate certificate credentials: %s", gnutls_strerror(ret));
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEBUG, "m_ssl_gnutls.so: Failed to allocate certificate credentials: %s", gnutls_strerror(ret));
 
                if((ret =gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEBUG, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret));
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEBUG, "m_ssl_gnutls.so: Failed to set X.509 trust file '%s': %s", cafile.c_str(), gnutls_strerror(ret));
 
                if((ret = gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM)) < 0)
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEBUG, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret));
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEBUG, "m_ssl_gnutls.so: Failed to set X.509 CRL file '%s': %s", crlfile.c_str(), gnutls_strerror(ret));
 
                FileReader reader;
 
@@ -405,13 +405,13 @@ class ModuleSSLGnuTLS : public Module
                if ((ret = gnutls_priority_init(&priority, priocstr, &prioerror)) < 0)
                {
                        // gnutls did not understand the user supplied string, log and fall back to the default priorities
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: Failed to set priorities to \"%s\": %s Syntax error at position %u, falling back to default (NORMAL)", priorities.c_str(), gnutls_strerror(ret), (unsigned int) (prioerror - priocstr));
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEFAULT, "m_ssl_gnutls.so: Failed to set priorities to \"%s\": %s Syntax error at position %u, falling back to default (NORMAL)", priorities.c_str(), gnutls_strerror(ret), (unsigned int) (prioerror - priocstr));
                        gnutls_priority_init(&priority, "NORMAL", NULL);
                }
 
                #else
                if (priorities != "NORMAL")
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: You've set <gnutls:priority> to a value other than the default, but this is only supported with GnuTLS v2.1.7 or newer. Your GnuTLS version is older than that so the option will have no effect.");
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEFAULT, "m_ssl_gnutls.so: You've set <gnutls:priority> to a value other than the default, but this is only supported with GnuTLS v2.1.7 or newer. Your GnuTLS version is older than that so the option will have no effect.");
                #endif
 
                #if(GNUTLS_VERSION_MAJOR < 2 || ( GNUTLS_VERSION_MAJOR == 2 && GNUTLS_VERSION_MINOR < 12 ) )
@@ -461,7 +461,7 @@ class ModuleSSLGnuTLS : public Module
                int ret;
 
                if((ret = gnutls_dh_params_generate2(dh_params, dh_bits)) < 0)
-                       ServerInstance->Logs->Log("m_ssl_gnutls",LOG_DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret));
+                       ServerInstance->Logs->Log("m_ssl_gnutls", LOG_DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits): %s", dh_bits, gnutls_strerror(ret));
        }
 
        ~ModuleSSLGnuTLS()
@@ -484,7 +484,7 @@ class ModuleSSLGnuTLS : public Module
                ServerInstance->GenRandom = &ServerInstance->HandleGenRandom;
        }
 
-       void OnCleanup(int target_type, void* item)
+       void OnCleanup(int target_type, void* item) CXX11_OVERRIDE
        {
                if(target_type == TYPE_USER)
                {
@@ -499,12 +499,12 @@ class ModuleSSLGnuTLS : public Module
                }
        }
 
-       Version GetVersion()
+       Version GetVersion() CXX11_OVERRIDE
        {
                return Version("Provides SSL support for clients", VF_VENDOR);
        }
 
-       void On005Numeric(std::map<std::string, std::string>& tokens)
+       void On005Numeric(std::map<std::string, std::string>& tokens) CXX11_OVERRIDE
        {
                if (!sslports.empty())
                        tokens["SSL"] = sslports;
@@ -512,7 +512,7 @@ class ModuleSSLGnuTLS : public Module
                        tokens["STARTTLS"];
        }
 
-       void OnHookIO(StreamSocket* user, ListenSocket* lsb)
+       void OnHookIO(StreamSocket* user, ListenSocket* lsb) CXX11_OVERRIDE
        {
                if (!user->GetIOHook() && lsb->bind_tag->getString("ssl") == "gnutls")
                {
@@ -521,7 +521,7 @@ class ModuleSSLGnuTLS : public Module
                }
        }
 
-       void OnRequest(Request& request)
+       void OnRequest(Request& request) CXX11_OVERRIDE
        {
                if (strcmp("GET_SSL_CERT", request.id) == 0)
                {
@@ -554,7 +554,7 @@ class ModuleSSLGnuTLS : public Module
                Handshake(session, user);
        }
 
-       void OnStreamSocketAccept(StreamSocket* user, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server)
+       void OnStreamSocketAccept(StreamSocket* user, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server) CXX11_OVERRIDE
        {
                issl_session* session = &sessions[user->GetFd()];
 
@@ -565,17 +565,17 @@ class ModuleSSLGnuTLS : public Module
                InitSession(user, true);
        }
 
-       void OnStreamSocketConnect(StreamSocket* user)
+       void OnStreamSocketConnect(StreamSocket* user) CXX11_OVERRIDE
        {
                InitSession(user, false);
        }
 
-       void OnStreamSocketClose(StreamSocket* user)
+       void OnStreamSocketClose(StreamSocket* user) CXX11_OVERRIDE
        {
                CloseSession(&sessions[user->GetFd()]);
        }
 
-       int OnStreamSocketRead(StreamSocket* user, std::string& recvq)
+       int OnStreamSocketRead(StreamSocket* user, std::string& recvq) CXX11_OVERRIDE
        {
                issl_session* session = &sessions[user->GetFd()];
 
@@ -633,7 +633,7 @@ class ModuleSSLGnuTLS : public Module
                return 0;
        }
 
-       int OnStreamSocketWrite(StreamSocket* user, std::string& sendq)
+       int OnStreamSocketWrite(StreamSocket* user, std::string& sendq) CXX11_OVERRIDE
        {
                issl_session* session = &sessions[user->GetFd()];
 
@@ -732,7 +732,7 @@ class ModuleSSLGnuTLS : public Module
                }
        }
 
-       void OnUserConnect(LocalUser* user)
+       void OnUserConnect(LocalUser* user) CXX11_OVERRIDE
        {
                if (user->eh.GetIOHook() == this)
                {
@@ -846,7 +846,7 @@ class ModuleSSLGnuTLS : public Module
                }
                else
                {
-                       certinfo->fingerprint = irc::hex(digest, digest_size);
+                       certinfo->fingerprint = BinToHex(digest, digest_size);
                }
 
                /* Beware here we do not check for errors.
@@ -860,7 +860,7 @@ info_done_dealloc:
                gnutls_x509_crt_deinit(cert);
        }
 
-       void OnEvent(Event& ev)
+       void OnEvent(Event& ev) CXX11_OVERRIDE
        {
                if (starttls.enabled)
                        capHandler.HandleEvent(ev);