summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-16 21:36:07 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2008-01-16 21:36:07 +0000
commitb979bc46743bcb180af93f34b4bb337edce67b7d (patch)
tree2b419ca64151c0d1887eb77e89a0deee3c134f95 /src/modules
parentc28e8dc34a04c1c91b268687e9e0b4146d7c3c3a (diff)
Validate <server:id> on startup if provided, thx Brain
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8721 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp6
-rw-r--r--src/modules/m_spanningtree/utils.cpp12
-rw-r--r--src/modules/m_spanningtree/utils.h5
3 files changed, 4 insertions, 19 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 8f0ee0f17..e5d25dc50 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -818,7 +818,7 @@ bool TreeSocket::RemoteServer(const std::string &prefix, std::deque<std::string>
this->SendError("Protocol error - Introduced remote server from unknown server "+prefix);
return false;
}
- if (!Utils->IsSID(sid))
+ if (!this->Instance->IsSID(sid))
{
this->SendError("Invalid format server ID: "+sid+"!");
return false;
@@ -897,7 +897,7 @@ bool TreeSocket::Outbound_Reply_Server(std::deque<std::string> &params)
return false;
}
- if (!Utils->IsSID(sid))
+ if (!this->Instance->IsSID(sid))
{
this->SendError("Invalid format server ID: "+sid+"!");
return false;
@@ -974,7 +974,7 @@ bool TreeSocket::Inbound_Server(std::deque<std::string> &params)
return false;
}
- if (!Utils->IsSID(sid))
+ if (!this->Instance->IsSID(sid))
{
this->SendError("Invalid format server ID: "+sid+"!");
return false;
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 32580cd97..4e0193727 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -29,16 +29,6 @@
/* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
-bool SpanningTreeUtilities::IsSID(const std::string &str)
-{
- /* Returns true if the string given is exactly 3 characters long,
- * starts with a digit, and the other two characters are A-Z or digits
- */
- return ((str.length() == 3) && isdigit(str[0]) &&
- ((str[1] >= 'A' && str[1] <= 'Z') || isdigit(str[1])) &&
- ((str[2] >= 'A' && str[2] <= 'Z') || isdigit(str[2])));
-}
-
/** Yay for fast searches!
* This is hundreds of times faster than recursion
* or even scanning a linked list, especially when
@@ -47,7 +37,7 @@ bool SpanningTreeUtilities::IsSID(const std::string &str)
*/
TreeServer* SpanningTreeUtilities::FindServer(const std::string &ServerName)
{
- if (IsSID(ServerName))
+ if (this->ServerInstance->IsSID(ServerName))
return this->FindServerID(ServerName);
server_hash::iterator iter = serverlist.find(ServerName.c_str());
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index 6fb8b3e6e..f79b5280e 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -190,11 +190,6 @@ class SpanningTreeUtilities
void AddBurstingServer(const std::string &ServerName, TreeSocket* s);
void DelBurstingServer(TreeSocket* s);
-
- /** Return true if str looks like a server ID
- * @param string to check against
- */
- bool IsSID(const std::string &str);
};
#endif