summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-18 21:23:00 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-18 21:23:00 +0000
commit8cb1935360087b4e38802b837981e5f41e9b87d7 (patch)
tree687d0c37e28a12d9052828e77fe0a8a5c08a8e11 /src/modules/m_spanningtree
parent46e56dedd37abe33af4e8b970d5b83729dc1ef05 (diff)
Allow SASL messages to be targeted at the services server
<sasl target="services.example.net"> will avoid broadcasting all authentication messages across the network, which improves security. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12494 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r--src/modules/m_spanningtree/protocolinterface.cpp9
-rw-r--r--src/modules/m_spanningtree/protocolinterface.h2
-rw-r--r--src/modules/m_spanningtree/utils.cpp12
-rw-r--r--src/modules/m_spanningtree/utils.h12
4 files changed, 20 insertions, 15 deletions
diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp
index 843361e9e..7434400a0 100644
--- a/src/modules/m_spanningtree/protocolinterface.cpp
+++ b/src/modules/m_spanningtree/protocolinterface.cpp
@@ -26,9 +26,14 @@ void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
}
}
-void SpanningTreeProtocolInterface::SendEncapsulatedData(parameterlist &encap)
+bool SpanningTreeProtocolInterface::SendEncapsulatedData(const parameterlist &encap)
{
- Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
+ if (encap[0].find('*') != std::string::npos)
+ {
+ Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
+ return true;
+ }
+ return Utils->DoOneToOne(ServerInstance->Config->GetSID(), "ENCAP", encap, encap[0]);
}
void SpanningTreeProtocolInterface::SendMetaData(Extensible* target, const std::string &key, const std::string &data)
diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h
index 9ba9f2d2f..762946901 100644
--- a/src/modules/m_spanningtree/protocolinterface.h
+++ b/src/modules/m_spanningtree/protocolinterface.h
@@ -13,7 +13,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface
SpanningTreeProtocolInterface(ModuleSpanningTree* mod, SpanningTreeUtilities* util) : Utils(util), Module(mod) { }
virtual ~SpanningTreeProtocolInterface() { }
- virtual void SendEncapsulatedData(parameterlist &encap);
+ virtual bool SendEncapsulatedData(const parameterlist &encap);
virtual void SendMetaData(Extensible* target, const std::string &key, const std::string &data);
virtual void SendTopic(Channel* channel, std::string &topic);
virtual void SendMode(const std::string &target, const parameterlist &modedata, const std::vector<TranslateType> &types);
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 81fb0ecde..2271bf374 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -199,7 +199,7 @@ 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, parameterlist &params)
+bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, const parameterlist &params)
{
TreeServer* omitroute = this->BestRouteTo(omit);
unsigned int items =this->TreeRoot->ChildCount();
@@ -216,7 +216,7 @@ bool SpanningTreeUtilities::DoOneToAllButSenderRaw(const std::string &data, cons
return true;
}
-bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, parameterlist &params, std::string omit)
+bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, std::string omit)
{
TreeServer* omitroute = this->BestRouteTo(omit);
std::string FullLine = ":" + prefix + " " + command;
@@ -243,7 +243,7 @@ bool SpanningTreeUtilities::DoOneToAllButSender(const std::string &prefix, const
return true;
}
-bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::string &command, parameterlist &params)
+bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params)
{
std::string FullLine = ":" + prefix + " " + command;
unsigned int words = params.size();
@@ -265,21 +265,21 @@ bool SpanningTreeUtilities::DoOneToMany(const std::string &prefix, const std::st
return true;
}
-bool SpanningTreeUtilities::DoOneToMany(const char* prefix, const char* command, parameterlist &params)
+bool SpanningTreeUtilities::DoOneToMany(const char* prefix, const char* command, const parameterlist &params)
{
std::string spfx = prefix;
std::string scmd = command;
return this->DoOneToMany(spfx, scmd, params);
}
-bool SpanningTreeUtilities::DoOneToAllButSender(const char* prefix, const char* command, parameterlist &params, std::string omit)
+bool SpanningTreeUtilities::DoOneToAllButSender(const char* prefix, const char* command, const parameterlist &params, std::string omit)
{
std::string spfx = prefix;
std::string scmd = command;
return this->DoOneToAllButSender(spfx, scmd, params, omit);
}
-bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, parameterlist &params, std::string target)
+bool SpanningTreeUtilities::DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, std::string target)
{
TreeServer* Route = this->BestRouteTo(target);
if (Route)
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index eb0df03ff..2e527ae12 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -124,27 +124,27 @@ class SpanningTreeUtilities : public classbase
/** Send a message from this server to one other local or remote
*/
- bool DoOneToOne(const std::string &prefix, const std::string &command, parameterlist &params, std::string target);
+ bool DoOneToOne(const std::string &prefix, const std::string &command, const parameterlist &params, std::string target);
/** Send a message from this server to all but one other, local or remote
*/
- bool DoOneToAllButSender(const std::string &prefix, const std::string &command, parameterlist &params, std::string omit);
+ bool DoOneToAllButSender(const std::string &prefix, const std::string &command, const parameterlist &params, std::string omit);
/** Send a message from this server to all but one other, local or remote
*/
- bool DoOneToAllButSender(const char* prefix, const char* command, parameterlist &params, std::string omit);
+ bool DoOneToAllButSender(const char* prefix, const char* command, const parameterlist &params, std::string omit);
/** Send a message from this server to all others
*/
- bool DoOneToMany(const std::string &prefix, const std::string &command, parameterlist &params);
+ bool DoOneToMany(const std::string &prefix, const std::string &command, const parameterlist &params);
/** Send a message from this server to all others
*/
- bool DoOneToMany(const char* prefix, const char* command, parameterlist &params);
+ bool DoOneToMany(const char* prefix, const char* command, const parameterlist &params);
/** Send a message from this server to all others, without doing any processing on the command (e.g. send it as-is with colons and all)
*/
- bool DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, parameterlist &params);
+ bool DoOneToAllButSenderRaw(const std::string &data, const std::string &omit, const std::string &prefix, const irc::string &command, const parameterlist &params);
/** Read the spanningtree module's tags from the config file
*/