summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-09 05:54:43 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2010-02-09 05:54:43 +0000
commit7f722fa65680487ab018a65469d27ce43335b67d (patch)
tree08ddda21559530db51fa0ad89de401ae6f3bd1cc /src
parent4aeda51771f6fcc2b0d548fa33394af59038aedd (diff)
Move password checking into connect class search
This makes it possible to have a passworded connect class that is open to any host without denying users that do not use the password. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12411 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_halfvoice.cpp2
-rw-r--r--src/users.cpp30
2 files changed, 15 insertions, 17 deletions
diff --git a/src/modules/m_halfvoice.cpp b/src/modules/m_halfvoice.cpp
index 93aa3c182..c961d7c88 100644
--- a/src/modules/m_halfvoice.cpp
+++ b/src/modules/m_halfvoice.cpp
@@ -33,7 +33,7 @@ class HalfVoiceMode : public ModeHandler
unsigned int GetPrefixRank()
{
- return STATUS_VALUE;
+ return HALFVOICE_VALUE;
}
void RemoveMode(Channel* channel, irc::modestacker* stack)
diff --git a/src/users.cpp b/src/users.cpp
index 62bf0f543..1a9c2da18 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -801,19 +801,7 @@ void LocalUser::FullConnect()
* may put the user into a totally seperate class with different restrictions! so we *must* check again.
* Don't remove this! -- w00t
*/
- this->SetClass();
-
- /* 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->config->getString("pass").empty())
- {
- if (ServerInstance->PassCompare(this, MyClass->config->getString("pass"), password, MyClass->config->getString("hash")))
- {
- ServerInstance->Users->QuitUser(this, "Invalid password");
- return;
- }
- }
+ SetClass();
CheckClass();
CheckLines();
@@ -1602,6 +1590,7 @@ void LocalUser::SetClass(const std::string &explicit_name)
for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
{
ConnectClass* c = *i;
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Checking %s", c->GetName().c_str());
ModResult MOD_RESULT;
FIRST_MOD_RESULT(OnSetConnectClass, MOD_RESULT, (this,c));
@@ -1617,6 +1606,10 @@ void LocalUser::SetClass(const std::string &explicit_name)
if (c->type == CC_NAMED)
continue;
+ bool regdone = (registered != REG_NONE);
+ if (c->config->getBool("registered", regdone) != regdone)
+ continue;
+
/* check if host matches.. */
if (c->GetHost().length() && !InspIRCd::MatchCIDR(this->GetIPString(), c->GetHost(), NULL) &&
!InspIRCd::MatchCIDR(this->host, c->GetHost(), NULL))
@@ -1646,9 +1639,14 @@ void LocalUser::SetClass(const std::string &explicit_name)
continue;
}
- bool regdone = (registered != REG_NONE);
- if (c->config->getBool("registered", regdone) != regdone)
- continue;
+ if (!c->config->getString("pass").empty())
+ {
+ if (ServerInstance->PassCompare(this, c->config->getString("pass"), password, c->config->getString("hash")))
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Bad password, skipping");
+ continue;
+ }
+ }
/* we stop at the first class that meets ALL critera. */
found = c;