summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/configreader.cpp3
-rw-r--r--src/modules.cpp1
-rw-r--r--src/stats.cpp5
-rw-r--r--src/users.cpp44
4 files changed, 22 insertions, 31 deletions
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 183e78a12..b34c3ecca 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -361,8 +361,6 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
me->name = name;
- tag->readString("password", me->pass);
- tag->readString("hash", me->hash);
me->registration_timeout = tag->getInt("timeout", me->registration_timeout);
me->pingtime = tag->getInt("pingfreq", me->pingtime);
std::string sendq;
@@ -384,7 +382,6 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current)
me->fakelag = tag->getBool("fakelag", me->fakelag);
me->maxlocal = tag->getInt("localmax", me->maxlocal);
me->maxglobal = tag->getInt("globalmax", me->maxglobal);
- me->port = tag->getInt("port", me->port);
me->maxchans = tag->getInt("maxchans", me->maxchans);
me->limit = tag->getInt("limit", me->limit);
diff --git a/src/modules.cpp b/src/modules.cpp
index 9186e38be..558923332 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -155,6 +155,7 @@ ModResult Module::OnUserList(User*, Channel*) { return MOD_RES_PASSTHRU; }
ModResult Module::OnWhoisLine(User*, User*, int&, std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnBuildNeighborList(User*, UserChanList&, std::map<User*,bool>&) { }
void Module::OnGarbageCollect() { }
+ModResult Module::OnSetConnectClass(LocalUser* user, ConnectClass* myclass) { return MOD_RES_PASSTHRU; }
void Module::OnText(User*, void*, int, const std::string&, char, CUList&) { }
void Module::OnRunTestSuite() { }
void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) { }
diff --git a/src/stats.cpp b/src/stats.cpp
index df41d26da..fb4e5e7a5 100644
--- a/src/stats.cpp
+++ b/src/stats.cpp
@@ -80,10 +80,7 @@ void InspIRCd::DoStats(char statschar, User* user, string_list &results)
else
res << c->host;
- if (c->port)
- res << ' ' << c->port << ' ';
- else
- res << " * ";
+ res << ' ' << c->config->getString("port", "*") << ' ';
res << c->GetRecvqMax() << ' ' << c->GetSendqSoftMax() << ' ' << c->GetSendqHardMax()
<< ' ' << c->GetCommandRate() << ' ' << c->GetPenaltyThreshold();
diff --git a/src/users.cpp b/src/users.cpp
index 2cc26c158..1392af075 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -806,9 +806,9 @@ void LocalUser::FullConnect()
/* Check the password, if one is required by the user's connect class.
* This CANNOT be in CheckClass(), because that is called prior to PASS as well!
*/
- if (!MyClass->pass.empty())
+ if (!MyClass->config->getString("pass").empty())
{
- if (ServerInstance->PassCompare(this, MyClass->pass.c_str(), password.c_str(), MyClass->hash.c_str()))
+ if (ServerInstance->PassCompare(this, MyClass->config->getString("pass"), password, MyClass->config->getString("hash")))
{
ServerInstance->Users->QuitUser(this, "Invalid password");
return;
@@ -1603,18 +1603,19 @@ void LocalUser::SetClass(const std::string &explicit_name)
{
ConnectClass* c = *i;
- if (c->type == CC_ALLOW)
- {
- ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "ALLOW %s %d %s", c->host.c_str(), c->GetPort(), c->GetName().c_str());
- }
- else if (c->type == CC_DENY)
+ ModResult MOD_RESULT;
+ FIRST_MOD_RESULT(OnSetConnectClass, MOD_RESULT, (this,c));
+ if (MOD_RESULT == MOD_RES_DENY)
+ continue;
+ if (MOD_RESULT == MOD_RES_ALLOW)
{
- ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "DENY %s %d %s", c->GetHost().c_str(), c->GetPort(), c->GetName().c_str());
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Class forced by module to %s", c->GetName().c_str());
+ found = c;
+ break;
}
- else
- {
+
+ if (c->type == CC_NAMED)
continue;
- }
/* check if host matches.. */
if (c->GetHost().length() && !InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) &&
@@ -1635,16 +1636,14 @@ void LocalUser::SetClass(const std::string &explicit_name)
}
/* if it requires a port ... */
- if (c->GetPort())
+ int port = c->config->getInt("port");
+ if (port)
{
- ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Requires port (%d)", c->GetPort());
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Requires port (%d)", port);
/* and our port doesn't match, fail. */
- if (this->GetServerPort() != c->GetPort())
- {
- ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Port match failed (%d)", this->GetServerPort());
+ if (this->GetServerPort() != port)
continue;
- }
}
/* we stop at the first class that meets ALL critera. */
@@ -1705,19 +1704,18 @@ const std::string& FakeUser::GetFullRealHost()
ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask)
: config(tag), type(t), fakelag(true), name("unnamed"), registration_timeout(0), host(mask),
- pingtime(0), pass(""), hash(""), softsendqmax(0), hardsendqmax(0), recvqmax(0),
- penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxchans(0), port(0), limit(0)
+ pingtime(0), softsendqmax(0), hardsendqmax(0), recvqmax(0),
+ penaltythreshold(0), commandrate(0), maxlocal(0), maxglobal(0), maxchans(0), limit(0)
{
}
ConnectClass::ConnectClass(ConfigTag* tag, char t, const std::string& mask, const ConnectClass& parent)
: config(tag), type(t), fakelag(parent.fakelag), name("unnamed"),
registration_timeout(parent.registration_timeout), host(mask), pingtime(parent.pingtime),
- pass(parent.pass), hash(parent.hash), softsendqmax(parent.softsendqmax),
- hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax),
+ softsendqmax(parent.softsendqmax), hardsendqmax(parent.hardsendqmax), recvqmax(parent.recvqmax),
penaltythreshold(parent.penaltythreshold), commandrate(parent.commandrate),
maxlocal(parent.maxlocal), maxglobal(parent.maxglobal), maxchans(parent.maxchans),
- port(parent.port), limit(parent.limit)
+ limit(parent.limit)
{
}
@@ -1727,8 +1725,6 @@ void ConnectClass::Update(const ConnectClass* src)
registration_timeout = src->registration_timeout;
host = src->host;
pingtime = src->pingtime;
- pass = src->pass;
- hash = src->hash;
softsendqmax = src->softsendqmax;
hardsendqmax = src->hardsendqmax;
recvqmax = src->recvqmax;