summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-22 13:11:27 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-12-22 13:11:27 +0000
commit5b889dc2478831e40767a71a6c8970e5e03938f9 (patch)
treea25833ffee07f539cb81be42ebfe06a809128926
parent21afd6048de9d68a55700d70d1647e5ee2eacf7e (diff)
Allowed capab unencrypted in an encrypted connection
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2635 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/modules/m_spanningtree.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index ffc3befa4..57872b65d 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -1230,8 +1230,8 @@ class TreeSocket : public InspSocket
char out[1024];
char result[1024];
log(DEBUG,"Original string '%s'",ret.c_str());
- /* ERROR is still allowed unencryped */
- if (ret.substr(0,7) != "ERROR :")
+ /* ERROR + CAPAB is still allowed unencryped */
+ if ((ret.substr(0,7) != "ERROR :") && (ret.substr(0,6) != "CAPAB "))
{
int nbytes = from64tobits(out, ret.c_str(), 1024);
log(DEBUG,"m_spanningtree: decrypt %d bytes",nbytes);
@@ -1256,8 +1256,8 @@ class TreeSocket : public InspSocket
if (this->ctx)
{
log(DEBUG,"AES context");
- char result[1024];
- char result64[1024];
+ char result[10240];
+ char result64[10240];
if (this->keylength)
{
while (line.length() % this->keylength != 0)
@@ -1266,10 +1266,13 @@ class TreeSocket : public InspSocket
line = line + "\7";
}
}
- ctx->Encrypt(line.c_str(), result, line.length(),0);
+ unsigned int ll = line.length();
+ log(DEBUG,"Plaintext line with padding = %d chars",ll);
+ ctx->Encrypt(line.c_str(), result, ll, 0);
+ log(DEBUG,"Encrypted.");
to64frombits((unsigned char*)result64,
(unsigned char*)result,
- line.length());
+ ll);
line = result64;
log(DEBUG,"Encrypted: %s",line.c_str());
//int from64tobits(char *out, const char *in, int maxlen);