summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_ssl_gnutls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra/m_ssl_gnutls.cpp')
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp72
1 files changed, 36 insertions, 36 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index fd18f51f1..b33213c14 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -79,11 +79,11 @@ class ModuleSSLGnuTLS : public Module
gnutls_global_init(); // This must be called once in the program
if(gnutls_certificate_allocate_credentials(&x509_cred) != 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials");
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to allocate certificate credentials");
// Guessing return meaning
if(gnutls_dh_params_init(&dh_params) < 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters");
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to initialise DH parameters");
// Needs the flag as it ignores a plain /rehash
OnRehash("ssl");
@@ -118,11 +118,11 @@ class ModuleSSLGnuTLS : public Module
// We keep a record of which ports we're listening on with SSL
listenports.push_back(port);
- log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port);
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Enabling SSL for port %d", port);
}
else
{
- log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port);
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: FAILED to enable SSL on port %d, maybe you have another ssl or similar module loaded?", port);
}
}
}
@@ -167,14 +167,14 @@ class ModuleSSLGnuTLS : public Module
keyfile = confdir + keyfile;
if(gnutls_certificate_set_x509_trust_file(x509_cred, cafile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file: %s", cafile.c_str());
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 trust file: %s", cafile.c_str());
if(gnutls_certificate_set_x509_crl_file (x509_cred, crlfile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file: %s", crlfile.c_str());
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 CRL file: %s", crlfile.c_str());
// Guessing on the return value of this, manual doesn't say :|
if(gnutls_certificate_set_x509_key_file (x509_cred, certfile.c_str(), keyfile.c_str(), GNUTLS_X509_FMT_PEM) < 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files: %s and %s", certfile.c_str(), keyfile.c_str());
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to set X.509 certificate and key files: %s and %s", certfile.c_str(), keyfile.c_str());
// This may be on a large (once a day or week) timer eventually.
GenerateDHParams();
@@ -190,7 +190,7 @@ class ModuleSSLGnuTLS : public Module
// security requirements.
if(gnutls_dh_params_generate2(dh_params, dh_bits) < 0)
- log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits)", dh_bits);
+ ServerInstance->Log(DEFAULT, "m_ssl_gnutls.so: Failed to generate DH parameters (%d bits)", dh_bits);
}
virtual ~ModuleSSLGnuTLS()
@@ -211,7 +211,7 @@ class ModuleSSLGnuTLS : public Module
{
// User is using SSL, they're a local user, and they're using one of *our* SSL ports.
// Potentially there could be multiple SSL modules loaded at once on different ports.
- log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Adding user %s to cull list", user->nick);
culllist->AddItem(user, "SSL module unloading");
}
}
@@ -223,7 +223,7 @@ class ModuleSSLGnuTLS : public Module
{
// We're being unloaded, kill all the users added to the cull list in OnCleanup
int numusers = culllist->Apply();
- log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Killed %d users for unload of GnuTLS SSL module", numusers);
for(unsigned int i = 0; i < listenports.size(); i++)
ServerInstance->Config->DelIOHook(listenports[i]);
@@ -271,7 +271,7 @@ class ModuleSSLGnuTLS : public Module
virtual void OnRawSocketClose(int fd)
{
- log(DEBUG, "OnRawSocketClose: %d", fd);
+ ServerInstance->Log(DEBUG, "OnRawSocketClose: %d", fd);
CloseSession(&sessions[fd]);
}
@@ -281,13 +281,13 @@ class ModuleSSLGnuTLS : public Module
if(!session->sess)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: No session to read from");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: No session to read from");
readresult = 0;
CloseSession(session);
return 1;
}
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead(%d, buffer, %u, %d)", fd, count, readresult);
if(session->status == ISSL_HANDSHAKING_READ)
{
@@ -296,18 +296,18 @@ class ModuleSSLGnuTLS : public Module
if(Handshake(session))
{
// Handshake successfully resumed.
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: successfully resumed handshake");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: successfully resumed handshake");
}
else
{
// Couldn't resume handshake.
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: failed to resume handshake");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: failed to resume handshake");
return -1;
}
}
else if(session->status == ISSL_HANDSHAKING_WRITE)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: handshake wants to write data but we are currently reading");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: handshake wants to write data but we are currently reading");
return -1;
}
@@ -317,14 +317,14 @@ class ModuleSSLGnuTLS : public Module
{
// Is this right? Not sure if the unencrypted data is garaunteed to be the same length.
// Read into the inbuffer, offset from the beginning by the amount of data we have that insp hasn't taken yet.
- log(DEBUG, "m_ssl_gnutls.so: gnutls_record_recv(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: gnutls_record_recv(sess, inbuf+%d, %d-%d)", session->inbufoffset, inbufsize, session->inbufoffset);
int ret = gnutls_record_recv(session->sess, session->inbuf + session->inbufoffset, inbufsize - session->inbufoffset);
if(ret == 0)
{
// Client closed connection.
- log(DEBUG, "m_ssl_gnutls.so: Client closed the connection");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Client closed the connection");
readresult = 0;
CloseSession(session);
return 1;
@@ -333,12 +333,12 @@ class ModuleSSLGnuTLS : public Module
{
if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Not all SSL data read: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Not all SSL data read: %s", gnutls_strerror(ret));
return -1;
}
else
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Error reading SSL data: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Error reading SSL data: %s", gnutls_strerror(ret));
readresult = 0;
CloseSession(session);
}
@@ -351,7 +351,7 @@ class ModuleSSLGnuTLS : public Module
unsigned int length = ret + session->inbufoffset;
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Read %d bytes, now have %d waiting to be passed up", ret, length);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: Read %d bytes, now have %d waiting to be passed up", ret, length);
if(count <= length)
{
@@ -376,7 +376,7 @@ class ModuleSSLGnuTLS : public Module
}
else if(session->status == ISSL_CLOSING)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: session closing...");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketRead: session closing...");
readresult = 0;
}
@@ -390,7 +390,7 @@ class ModuleSSLGnuTLS : public Module
if(!session->sess)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: No session to write to");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: No session to write to");
CloseSession(session);
return 1;
}
@@ -402,20 +402,20 @@ class ModuleSSLGnuTLS : public Module
if(Handshake(session))
{
// Handshake successfully resumed.
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: successfully resumed handshake");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: successfully resumed handshake");
}
else
{
// Couldn't resume handshake.
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: failed to resume handshake");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: failed to resume handshake");
}
}
else if(session->status == ISSL_HANDSHAKING_READ)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: handshake wants to read data but we are currently writing");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: handshake wants to read data but we are currently writing");
}
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Adding %d bytes to the outgoing buffer", count);
session->outbuf.append(sendbuffer, count);
sendbuffer = session->outbuf.c_str();
count = session->outbuf.size();
@@ -426,30 +426,30 @@ class ModuleSSLGnuTLS : public Module
if(ret == 0)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Client closed the connection");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Client closed the connection");
CloseSession(session);
}
else if(ret < 0)
{
if(ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Not all SSL data written: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Not all SSL data written: %s", gnutls_strerror(ret));
}
else
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Error writing SSL data: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Error writing SSL data: %s", gnutls_strerror(ret));
CloseSession(session);
}
}
else
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Successfully wrote %d bytes", ret);
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: Successfully wrote %d bytes", ret);
session->outbuf = session->outbuf.substr(ret);
}
}
else if(session->status == ISSL_CLOSING)
{
- log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: session closing...");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: OnRawSocketWrite: session closing...");
}
return 1;
@@ -508,13 +508,13 @@ class ModuleSSLGnuTLS : public Module
{
// gnutls_handshake() wants to read() again.
session->status = ISSL_HANDSHAKING_READ;
- log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (reading) later, error string: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (reading) later, error string: %s", gnutls_strerror(ret));
}
else
{
// gnutls_handshake() wants to write() again.
session->status = ISSL_HANDSHAKING_WRITE;
- log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (writing) later, error string: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake needs resuming (writing) later, error string: %s", gnutls_strerror(ret));
MakePollWrite(session);
}
}
@@ -522,7 +522,7 @@ class ModuleSSLGnuTLS : public Module
{
// Handshake failed.
CloseSession(session);
- log(DEBUG, "m_ssl_gnutls.so: Handshake failed, error string: %s", gnutls_strerror(ret));
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake failed, error string: %s", gnutls_strerror(ret));
session->status = ISSL_CLOSING;
}
@@ -531,7 +531,7 @@ class ModuleSSLGnuTLS : public Module
else
{
// Handshake complete.
- log(DEBUG, "m_ssl_gnutls.so: Handshake completed");
+ ServerInstance->Log(DEBUG, "m_ssl_gnutls.so: Handshake completed");
// This will do for setting the ssl flag...it could be done earlier if it's needed. But this seems neater.
userrec* extendme = ServerInstance->FindDescriptor(session->fd);