]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Test code that pretends to send a hashed value if its got a challenge - don't use...
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 9 Apr 2007 14:46:39 +0000 (14:46 +0000)
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>
Mon, 9 Apr 2007 14:46:39 +0000 (14:46 +0000)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6768 e03df62e-2008-0410-955e-edbf42e46eb7

src/modules/m_spanningtree/handshaketimer.cpp
src/modules/m_spanningtree/treesocket.h
src/modules/m_spanningtree/treesocket1.cpp
src/modules/m_spanningtree/treesocket2.cpp

index 57a7eecedd5458c98afe196f108d6dfdff10a377..e57141a7c2be25e4c9ad25188c61bc6b9a14a2e7 100644 (file)
@@ -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
                        {
index 2fd18b35a6c270b10563a81524fff6c8e1e5e7ea..82a066be6ebd4df8c8e7c013789ef171effc10ba 100644 (file)
@@ -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
index fdf88f071fac7465a01f23e0d6e79b3ed24a2171..8ccd83b3a24f4bcce2450d5aa4f612bfd74ad8d2 100644 (file)
@@ -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;
                        }
                }
index da456603fa5c78a9a3ae6b1e8a89eb9383ca8d64..1e915cddcdb9376784c835b2259b750c70917074 100644 (file)
@@ -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;