X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Futils.cpp;h=4710268876879c3beb8917743ec9d307f3dd9a58;hb=4a57d129fbbe9858f2a8c4d14cef7e0d78f08329;hp=5765b87524a2f5401356c1e59a4ac52e4ebf6af0;hpb=31ec715931c72a902aeabb828a5d9a7a2563a8cc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 5765b8752..471026887 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -130,12 +130,6 @@ TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) return NULL; } -/* A convenient wrapper that returns true if a server exists */ -bool SpanningTreeUtilities::IsServer(const std::string &ServerName) -{ - return (FindServer(ServerName) != NULL); -} - SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C) { ServerInstance->Logs->Log("m_spanningtree",DEBUG,"***** Using SID for hash: %s *****", ServerInstance->Config->GetSID().c_str()); @@ -208,23 +202,6 @@ void SpanningTreeUtilities::GetListOfServersForChannel(Channel* c, TreeServerLis return; } -bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, const parameterlist ¶ms) -{ - TreeServer* omitroute = this->BestRouteTo(omit); - unsigned int items =this->TreeRoot->ChildCount(); - for (unsigned int x = 0; x < items; x++) - { - TreeServer* Route = this->TreeRoot->GetChild(x); - if ((Route) && (Route->GetSocket()) && (Route->GetName() != omit) && (omitroute != Route)) - { - TreeSocket* Sock = Route->GetSocket(); - if (Sock) - Sock->WriteLine(data); - } - } - return true; -} - bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist ¶ms, std::string omit) { TreeServer* omitroute = this->BestRouteTo(omit); @@ -337,7 +314,7 @@ void SpanningTreeUtilities::RefreshIPCache() { try { - bool cached; + bool cached = false; SecurityIPResolver* sr = new SecurityIPResolver(Creator, this, L->IPAddr, L, cached, DNS_QUERY_AAAA); ServerInstance->AddResolver(sr, cached); } @@ -374,7 +351,8 @@ void SpanningTreeUtilities::ReadConfiguration() { ConfigTag* tag = i->second; reference L = new Link(tag); - L->Name = tag->getString("name").c_str(); + std::string linkname = tag->getString("name"); + L->Name = linkname.c_str(); L->AllowMask = tag->getString("allowmask"); L->IPAddr = tag->getString("ipaddr"); L->Port = tag->getInt("port"); @@ -402,6 +380,12 @@ void SpanningTreeUtilities::ReadConfiguration() if (L->SendPass.empty()) throw ModuleException("Invalid configuration for server '"+assign(L->Name)+"', sendpass not defined"); + if ((L->SendPass.find(' ') != std::string::npos) || (L->RecvPass.find(' ') != std::string::npos)) + throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that contains a space character which is invalid"); + + if ((L->SendPass[0] == ':') || (L->RecvPass[0] == ':')) + throw ModuleException("Link block '" + assign(L->Name) + "' has a password set that begins with a colon (:) which is invalid"); + if (L->IPAddr.empty()) { L->IPAddr = "*";