diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-27 06:57:11 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-27 06:57:11 +0000 |
commit | 29a63023b5cbfd26be585184f70f3c6248d3768d (patch) | |
tree | 9385b6a599a0158052bbd4eb21d4e4e2d86943f7 /src/channels.cpp | |
parent | f2bf5b703f376ed2b6d9b2ab18d36da128ee17ff (diff) |
Move OnCheckBan into chanrec::IsBanned() so its always called for any attempt to check any ban
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5343 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/channels.cpp')
-rw-r--r-- | src/channels.cpp | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index 73c5746a7..8e614a8a8 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -301,17 +301,12 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo } if (Ptr->bans.size()) { - MOD_RESULT = 0; - FOREACH_RESULT_I(Instance,I_OnCheckBan,OnCheckBan(user, Ptr)); char mask[MAXBUF]; snprintf(mask, MAXBUF, "%s!%s@%s",user->nick, user->ident, user->GetIPString()); - if (!MOD_RESULT) + if (Ptr->IsBanned(user)) { - if (Ptr->IsBanned(user)) - { - user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); - return NULL; - } + user->WriteServ("474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name); + return NULL; } } } @@ -443,18 +438,22 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr,ucrec *a,userrec* u bool chanrec::IsBanned(userrec* user) { char mask[MAXBUF]; - snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString()); - for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++) + int MOD_RESULT = 0; + FOREACH_RESULT_I(Instance,I_OnCheckBan,OnCheckBan(user, Ptr)); + if (!MOD_RESULT) { - /* This allows CIDR ban matching - * - * Full masked host Full unmasked host IP with/without CIDR - */ - if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true))) + snprintf(mask, MAXBUF, "%s!%s@%s", user->nick, user->ident, user->GetIPString()); + for (BanList::iterator i = this->bans.begin(); i != this->bans.end(); i++) { - return true; + /* This allows CIDR ban matching + * + * Full masked host Full unmasked host IP with/without CIDR + */ + if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true))) + { + return true; + } } - } return false; } |