if (!IS_LOCAL(this))
return NULL;
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Setting connect class for UID %s", this->uuid);
+
if (!explicit_name.empty())
{
for (ClassVector::iterator i = ServerInstance->Config->Classes.begin(); i != ServerInstance->Config->Classes.end(); i++)
if (explicit_name == c->GetName())
{
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Explicitly set to %s", explicit_name.c_str());
found = c;
}
}
{
ConnectClass* c = *i;
+ if (c->GetType() == CC_ALLOW)
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "ALLOW %s %d %s", c->GetHost().c_str(), c->GetPort(), c->GetName().c_str());
+ }
+ else
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "DENY %s %d %s", c->GetHost().c_str(), c->GetPort(), c->GetName().c_str());
+ }
+
+ /* if it's disabled, we can't match this one. */
+ if (c->GetDisabled())
+ {
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Class disabled");
+ continue;
+ }
+
/* check if host matches.. */
- if (((!match(this->GetIPString(),c->GetHost().c_str(),true)) && (!match(this->host,c->GetHost().c_str()))))
+ if (((!match(this->GetIPString(),c->GetHost(),true)) && (!match(this->host,c->GetHost()))))
{
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "No host match (for %s)", c->GetHost().c_str());
continue;
}
*/
if (c->limit && (c->RefCount + 1 >= c->limit))
{
- ServerInstance->Logs->Log("USERS", DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit);
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "OOPS: Connect class limit (%lu) hit, denying", c->limit);
continue;
}
- /* if it's disabled, we can't match this one. */
- if (c->GetDisabled())
- continue;
-
/* if it requires a port ... */
if (c->GetPort())
{
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Requires port (%d)", c->GetPort());
+
/* and our port doesn't match, fail. */
if (this->GetPort() != c->GetPort())
{
+ ServerInstance->Logs->Log("CONNECTCLASS", DEBUG, "Port match failed (%d)", this->GetPort());
continue;
}
}
- /* we match this class, BUT! we must keep checking in case a further class is type deny and also matches us. */
+ /* we stop at the first class that meets ALL critera. */
found = c;
+ break;
}
}