diff options
-rw-r--r-- | include/users.h | 4 | ||||
-rw-r--r-- | src/configreader.cpp | 6 | ||||
-rw-r--r-- | src/users.cpp | 13 |
3 files changed, 15 insertions, 8 deletions
diff --git a/include/users.h b/include/users.h index da68bfd78..c7ed73264 100644 --- a/include/users.h +++ b/include/users.h @@ -25,7 +25,9 @@ enum ClassTypes { /** connect:allow */ CC_ALLOW = 0, /** connect:deny */ - CC_DENY = 1 + CC_DENY = 1, + /** named connect block (for opers, etc) */ + CC_NAMED = 2 }; /** RFC1459 channel modes diff --git a/src/configreader.cpp b/src/configreader.cpp index 04763cbab..bbf3adf59 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -261,7 +261,7 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) for(ClassVector::iterator i = current->Classes.begin(); i != current->Classes.end(); ++i) { ConnectClass* c = *i; - std::string typeMask = (c->type == CC_ALLOW) ? "a" : "d"; + std::string typeMask = (c->type == CC_ALLOW) ? "a" : (c->type == CC_DENY) ? "d" : "n"; typeMask += c->host; oldBlocksByMask[typeMask] = c; } @@ -335,7 +335,9 @@ void ServerConfig::CrossCheckConnectBlocks(ServerConfig* current) } else { - throw CoreException("Connect class must have an allow or deny mask at " + tag->getTagLocation()); + type = CC_NAMED; + mask = name; + typeMask = 'n' + mask; } ClassMap::iterator dupMask = newBlocksByMask.find(typeMask); if (dupMask != newBlocksByMask.end()) diff --git a/src/users.cpp b/src/users.cpp index 8456703cc..c390e3471 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -621,10 +621,7 @@ void User::Oper(OperInfo* info) l->ChangeDisplayedHost(vhost.c_str()); std::string opClass = oper->getConfig("class"); if (!opClass.empty()) - { l->SetClass(opClass); - l->CheckClass(); - } } ServerInstance->SNO->WriteToSnoMask('o',"%s (%s@%s) is now an IRC operator of type %s (using oper '%s')", @@ -817,8 +814,10 @@ void LocalUser::FullConnect() return; } } + CheckClass(); + CheckLines(); - if (this->CheckLines()) + if (quitting) return; this->WriteServ("NOTICE Auth :Welcome to \002%s\002!",ServerInstance->Config->Network.c_str()); @@ -1606,10 +1605,14 @@ void LocalUser::SetClass(const std::string &explicit_name) { ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "ALLOW %s %d %s", c->host.c_str(), c->GetPort(), c->GetName().c_str()); } - else + else if (c->type == CC_DENY) { ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "DENY %s %d %s", c->GetHost().c_str(), c->GetPort(), c->GetName().c_str()); } + else + { + continue; + } /* check if host matches.. */ if (c->GetHost().length() && !InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) && |