summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-12 17:01:36 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2008-04-12 17:01:36 +0000
commit27e2941ec9a9a7609749b7310a787548ddf716a5 (patch)
tree7fa8ff67bb3afb4644728a3f6ad1fdf817e3da03
parent597ecea91e69f96869127ba1023c3d689c4c216c (diff)
Fixes for bug #515, update existing in-use connect tags on the fly in rehash
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9471 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/users.h6
-rw-r--r--src/configreader.cpp19
2 files changed, 25 insertions, 0 deletions
diff --git a/include/users.h b/include/users.h
index 4b16c09be..229edcfa2 100644
--- a/include/users.h
+++ b/include/users.h
@@ -239,6 +239,12 @@ public:
this->limit = llimit;
}
+ void Update(const std::string &n, const std::string &hst)
+ {
+ name = n;
+ host = hst;
+ }
+
/** Reference counter. Contains an int as to how many users are connected to this class. :)
* This will be 0 if no users are connected. If a <connect> is removed from the config, and there
* are 0 users on it - it will go away in RAM. :)
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 35a208be9..42294412b 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -559,6 +559,15 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
{
if (*allow)
{
+ /* Find existing class by mask, the mask should be unique */
+ for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item)
+ {
+ if ((*item)->GetHost() == allow)
+ {
+ (*item)->Update(timeout, flood, allow, pingfreq, password, threshold, sendq, recvq, localmax, globalmax, maxchans, port, limit);
+ return true;
+ }
+ }
ConnectClass* cc = new ConnectClass(name, timeout, flood, allow, pingfreq, password, hashtype, threshold, sendq, recvq, localmax, globalmax, maxchans);
cc->limit = limit;
cc->SetPort(port);
@@ -566,6 +575,16 @@ bool DoConnect(ServerConfig* conf, const char*, char**, ValueList &values, int*)
}
else
{
+ /* Find existing class by mask, the mask should be unique */
+ for (ClassVector::iterator item = conf->Classes.begin(); item != conf->Classes.end(); ++item)
+ {
+ if ((*item)->GetHost() == deny)
+ {
+ (*item)->Update(name, deny);
+ (*item)->SetPort(port);
+ return true;
+ }
+ }
ConnectClass* cc = new ConnectClass(name, deny);
cc->SetPort(port);
conf->Classes.push_back(cc);