summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/inspsocket.cpp2
-rw-r--r--src/modules/extra/m_ssl_gnutls.cpp11
-rw-r--r--src/modules/extra/m_ssl_openssl.cpp13
-rw-r--r--src/modules/extra/m_ziplink.cpp20
-rw-r--r--src/modules/m_spanningtree.cpp3
5 files changed, 42 insertions, 7 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index fc0f7537a..6987d5ccd 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -505,7 +505,7 @@ bool InspSocket::Poll()
if (!this->Instance->SE->AddFd(this))
return false;
}
- if (this->IsIOHooked)
+ if (Instance->Config->GetIOHook(this))
{
try
{
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp
index 4a604ba9a..46c65efd4 100644
--- a/src/modules/extra/m_ssl_gnutls.cpp
+++ b/src/modules/extra/m_ssl_gnutls.cpp
@@ -267,7 +267,16 @@ class ModuleSSLGnuTLS : public Module
}
else if (strcmp("IS_HOOK", request->GetId()) == 0)
{
- return ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ char* ret = "OK";
+ try
+ {
+ ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ }
+ catch (ModuleException &e)
+ {
+ return NULL;
+ }
+ return ret;
}
else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
{
diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp
index ed3d60b34..3aa1baea0 100644
--- a/src/modules/extra/m_ssl_openssl.cpp
+++ b/src/modules/extra/m_ssl_openssl.cpp
@@ -302,8 +302,17 @@ class ModuleSSLOpenSSL : public Module
}
else if (strcmp("IS_HOOK", request->GetId()) == 0)
{
- ServerInstance->Log(DEBUG, "Hooking socket %08x", ISR->Sock);
- return ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ char* ret = "OK";
+ try
+ {
+ ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ }
+ catch (ModuleException &e)
+ {
+ return NULL;
+ }
+
+ return ret;
}
else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
{
diff --git a/src/modules/extra/m_ziplink.cpp b/src/modules/extra/m_ziplink.cpp
index 0647517c2..32f4cca77 100644
--- a/src/modules/extra/m_ziplink.cpp
+++ b/src/modules/extra/m_ziplink.cpp
@@ -148,7 +148,6 @@ class izip_session : public classbase
z_stream c_stream; /* compression stream */
z_stream d_stream; /* decompress stream */
izip_status status;
- int need_bytes;
int fd;
CountedBuffer* inbuf;
};
@@ -196,7 +195,16 @@ class ModuleZLib : public Module
}
else if (strcmp("IS_HOOK", request->GetId()) == 0)
{
- return ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ char* ret = "OK";
+ try
+ {
+ ret = ServerInstance->Config->AddIOHook((Module*)this, (InspSocket*)ISR->Sock) ? (char*)"OK" : NULL;
+ }
+ catch (ModuleException& e)
+ {
+ return NULL;
+ }
+ return ret;
}
else if (strcmp("IS_UNHOOK", request->GetId()) == 0)
{
@@ -255,6 +263,7 @@ class ModuleZLib : public Module
session->status = IZIP_OPEN;
session->inbuf = new CountedBuffer();
+ ServerInstance->Log(DEBUG,"session->inbuf ALLOC = %d, %08x", fd, session->inbuf);
session->c_stream.zalloc = (alloc_func)0;
session->c_stream.zfree = (free_func)0;
@@ -263,7 +272,6 @@ class ModuleZLib : public Module
session->d_stream.zalloc = (alloc_func)0;
session->d_stream.zfree = (free_func)0;
session->d_stream.opaque = (voidpf)0;
-
}
virtual void OnRawSocketConnect(int fd)
@@ -289,6 +297,8 @@ class ModuleZLib : public Module
if (readresult > 0)
{
+ ServerInstance->Log(DEBUG,"session->inbuf PTR = %d, %08x", fd, session->inbuf);
+
session->inbuf->AddData(compr, readresult);
int size = session->inbuf->GetFrame(compr, CHUNK);
@@ -315,6 +325,8 @@ class ModuleZLib : public Module
total_in_uncompressed += session->d_stream.total_out;
buffer[session->d_stream.total_out] = 0;
+
+ ServerInstance->Log(DEBUG,"Decompressed %d bytes", session->d_stream.total_out);
}
}
return (readresult > 0);
@@ -322,6 +334,8 @@ class ModuleZLib : public Module
virtual int OnRawSocketWrite(int fd, const char* buffer, int count)
{
+ ServerInstance->Log(DEBUG,"Compressing %d bytes", count);
+
izip_session* session = &sessions[fd];
int ocount = count;
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index ef7e17820..9345b5463 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -700,6 +700,9 @@ class TreeSocket : public InspSocket
{
myhost = ServerName;
this->LinkState = CONNECTING;
+
+ if (Hook)
+ InspSocketHookRequest(this, (Module*)Utils->Creator, Hook).Send();
}
/** When a listening socket gives us a new file descriptor,