]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Export the GetCiphersuite() method from the SSL modules
authorAttila Molnar <attilamolnar@hush.com>
Thu, 28 Apr 2016 15:06:16 +0000 (17:06 +0200)
committerAttila Molnar <attilamolnar@hush.com>
Thu, 28 Apr 2016 15:06:16 +0000 (17:06 +0200)
include/modules/ssl.h
src/modules/extra/m_ssl_gnutls.cpp
src/modules/extra/m_ssl_openssl.cpp

index adc78e324fab0bd577cac6e288fcbcbd1ae1cce1..9cc504128daae20a0daee6b4ea0c2880d8ccaa67 100644 (file)
@@ -198,6 +198,12 @@ class SSLIOHook : public IOHook
                        return cert->GetFingerprint();
                return "";
        }
+
+       /**
+        * Get the ciphersuite negotiated with the peer
+        * @param out String where the ciphersuite string will be appended to
+        */
+       virtual void GetCiphersuite(std::string& out) const = 0;
 };
 
 /** Helper functions for obtaining SSL client certificates and key fingerprints
index 6a653ddedd60f6f2dbb94e95be4097d4be8f7f94..69aedf03d5704e58bf1afdcfb2d1fa6307f68a13 100644 (file)
@@ -1164,8 +1164,10 @@ info_done_dealloc:
                }
        }
 
-       void GetCiphersuite(std::string& out) const
+       void GetCiphersuite(std::string& out) const CXX11_OVERRIDE
        {
+               if (!IsHandshakeDone())
+                       return;
                out.append(UnknownIfNULL(gnutls_protocol_get_name(gnutls_protocol_get_version(sess)))).push_back('-');
                out.append(UnknownIfNULL(gnutls_kx_get_name(gnutls_kx_get(sess)))).push_back('-');
                out.append(UnknownIfNULL(gnutls_cipher_get_name(gnutls_cipher_get(sess)))).push_back('-');
index c9ae14e11bad0b31547494d3b19cd9d3a052d199..ed66291f4c4679861f85b244222faf98bdf7b8a4 100644 (file)
@@ -735,8 +735,10 @@ class OpenSSLIOHook : public SSLIOHook
                }
        }
 
-       void GetCiphersuite(std::string& out) const
+       void GetCiphersuite(std::string& out) const CXX11_OVERRIDE
        {
+               if (!IsHandshakeDone())
+                       return;
                out.append(SSL_get_version(sess)).push_back('-');
                out.append(SSL_get_cipher(sess));
        }