]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/main.cpp
Add sanity checks to the ssl modules so that theres no possibility of an out of range...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / main.cpp
index 6d71fc872d8f691a63b9050d2f78c1779de3748b..fdd57c4ef09a8fcbad280fb0dd925b11a53f3c6b 100644 (file)
@@ -480,7 +480,7 @@ void ModuleSpanningTree::DoPingChecks(time_t curtime)
                        {
                                if (serv->AnsweredLastPing())
                                {
-                                       sock->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" PING "+serv->GetName());
+                                       sock->WriteLine(std::string(":")+ServerInstance->Config->GetSID()+" PING "+serv->GetID());
                                        serv->SetNextPingTime(curtime + Utils->PingFreq);
                                        serv->LastPing = curtime;
                                        timeval t;
@@ -679,18 +679,18 @@ int ModuleSpanningTree::HandleConnect(const char** parameters, int pcnt, userrec
                        TreeServer* CheckDupe = Utils->FindServer(x->Name.c_str());
                        if (!CheckDupe)
                        {
-                               RemoteMessage(user, "*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",user->nick,x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
+                               RemoteMessage(user, "*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
                                ConnectServer(&(*x));
                                return 1;
                        }
                        else
                        {
-                               RemoteMessage(user, "*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",user->nick,x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str());
+                               RemoteMessage(user, "*** CONNECT: Server \002%s\002 already exists on the network and is connected via \002%s\002",x->Name.c_str(),CheckDupe->GetParent()->GetName().c_str());
                                return 1;
                        }
                }
        }
-       RemoteMessage(user, "NOTICE %s :*** CONNECT: No server matching \002%s\002 could be found in the config file.",user->nick,parameters[0]);
+       RemoteMessage(user, "*** CONNECT: No server matching \002%s\002 could be found in the config file.",parameters[0]);
        return 1;
 }
 
@@ -822,6 +822,10 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const char**
                int n_translate = thiscmd->translation.size();
                TranslateType translate_to;
 
+               /* To make sure that parameters with spaces, or empty
+                * parameters, etc, are always sent properly, *always*
+                * prefix the last parameter with a :. This also removes
+                * an extra strchr() */
                for (int j = 0; j < pcnt; j++)
                {
                        std::string target;
@@ -837,8 +841,8 @@ void ModuleSpanningTree::OnPostCommand(const std::string &command, const char**
 
                        ServerInstance->Log(DEBUG,"TRANSLATION: %s - type is %d", parameters[j], translate_to);
                        ServerInstance->Parser->TranslateUIDs(translate_to, parameters[j], target);
-
-                       if (strchr(parameters[j],' '))
+                       
+                       if (j == (pcnt - 1))
                                params.push_back(":" + target);
                        else
                                params.push_back(target);