summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-09 14:46:39 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-04-09 14:46:39 +0000
commit663a113180ceeab1fe5e86412de3c2afc1e23d4f (patch)
tree404f47ab2eab7e02d1a0f5d2181ef927edbd48a9 /src/modules/m_spanningtree
parentbe36d92f3dcb0ac3772daebff43a5ecfe0a2d364 (diff)
Test code that pretends to send a hashed value if its got a challenge - don't use this, it wont connect
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6768 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/handshaketimer.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket.h5
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp14
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp2
4 files changed, 18 insertions, 7 deletions
diff --git a/src/modules/m_spanningtree/handshaketimer.cpp b/src/modules/m_spanningtree/handshaketimer.cpp
index 57a7eeced..e57141a7c 100644
--- a/src/modules/m_spanningtree/handshaketimer.cpp
+++ b/src/modules/m_spanningtree/handshaketimer.cpp
@@ -45,7 +45,7 @@ void HandshakeTimer::Tick(time_t TIME)
{
sock->SendCapabilities();
if (sock->GetLinkState() == CONNECTING)
- sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+lnk->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
+ sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+sock->MakePass(lnk->SendPass)+" 0 :"+this->Instance->Config->ServerDesc);
}
else
{
@@ -54,7 +54,7 @@ void HandshakeTimer::Tick(time_t TIME)
InspSocketAttachCertRequest(sock, (Module*)Utils->Creator, sock->GetHook()).Send();
sock->SendCapabilities();
if (sock->GetLinkState() == CONNECTING)
- sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+lnk->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
+ sock->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+sock->MakePass(lnk->SendPass)+" 0 :"+this->Instance->Config->ServerDesc);
}
else
{
diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h
index 2fd18b35a..82a066be6 100644
--- a/src/modules/m_spanningtree/treesocket.h
+++ b/src/modules/m_spanningtree/treesocket.h
@@ -149,6 +149,11 @@ class TreeSocket : public InspSocket
*/
std::string RandString(unsigned int length);
+ /** Construct a password, optionally hashed with the other side's
+ * challenge string
+ */
+ std::string MakePass(const std::string &password);
+
/** When an outbound connection finishes connecting, we receive
* this event, and must send our SERVER string to the other
* side. If the other side is happy, as outlined in the server
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp
index fdf88f071..8ccd83b3a 100644
--- a/src/modules/m_spanningtree/treesocket1.cpp
+++ b/src/modules/m_spanningtree/treesocket1.cpp
@@ -121,6 +121,15 @@ void TreeSocket::SetTheirChallenge(const std::string &c)
this->theirchallenge = c;
}
+std::string TreeSocket::MakePass(const std::string &password)
+{
+ if ((this->GetOurChallenge() != "") && (this->GetTheirChallenge() != ""))
+ {
+ return password + ":" + this->GetTheirChallenge();
+ }
+ return password;
+}
+
/** When an outbound connection finishes connecting, we receive
* this event, and must send our SERVER string to the other
* side. If the other side is happy, as outlined in the server
@@ -145,10 +154,7 @@ bool TreeSocket::OnConnected()
else
this->SendCapabilities();
/* found who we're supposed to be connecting to, send the neccessary gubbins. */
- /*if (Hook)*/
- Instance->Timers->AddTimer(new HandshakeTimer(Instance, this, &(*x), this->Utils));
- /*else
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+x->SendPass+" 0 :"+this->Instance->Config->ServerDesc);*/
+ Instance->Timers->AddTimer(new HandshakeTimer(Instance, this, &(*x), this->Utils));
return true;
}
}
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index da456603f..1e915cddc 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -902,7 +902,7 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> &params)
this->InboundDescription = description;
// this is good. Send our details: Our server name and description and hopcount of 0,
// along with the sendpass from this block.
- this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+x->SendPass+" 0 :"+this->Instance->Config->ServerDesc);
+ this->WriteLine(std::string("SERVER ")+this->Instance->Config->ServerName+" "+this->MakePass(x->SendPass)+" 0 :"+this->Instance->Config->ServerDesc);
// move to the next state, we are now waiting for THEM.
this->LinkState = WAIT_AUTH_2;
return true;