summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-20 16:29:40 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-20 16:29:40 +0200
commit0e98ca83b5ed6a0f8ed5ec3a6ea80014cb6dea6c (patch)
tree28c5e3b32e6b7edd9208e6815af890932d0ee3ee /src
parent1442193c79016ea60a8a6e7df66f758040b77c76 (diff)
Reject nickname case changes too when enforcing <security:restrictbannedusers>
Diffstat (limited to 'src')
-rw-r--r--src/users.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 8b34cfe8d..87e40a53e 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -628,6 +628,21 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts)
// If a module denied the change, abort now
if (MOD_RESULT == MOD_RES_DENY)
return false;
+
+ // Disallow the nick change if <security:restrictbannedusers> is on and there is a ban matching this user in
+ // one of the channels they are on
+ if (ServerInstance->Config->RestrictBannedUsers)
+ {
+ for (UCListIter i = this->chans.begin(); i != this->chans.end(); ++i)
+ {
+ Channel* chan = (*i)->chan;
+ if (chan->GetPrefixValue(this) < VOICE_VALUE && chan->IsBanned(this))
+ {
+ this->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
+ return false;
+ }
+ }
+ }
}
if (assign(newnick) == assign(nick))
@@ -661,19 +676,6 @@ bool User::ChangeNick(const std::string& newnick, bool force, time_t newts)
this->WriteNumeric(ERR_ERRONEUSNICKNAME, "%s :Invalid nickname: %s", newnick.c_str(), mq->reason.c_str());
return false;
}
-
- if (ServerInstance->Config->RestrictBannedUsers)
- {
- for (UCListIter i = this->chans.begin(); i != this->chans.end(); i++)
- {
- Channel* chan = (*i)->chan;
- if (chan->GetPrefixValue(this) < VOICE_VALUE && chan->IsBanned(this))
- {
- this->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
- return false;
- }
- }
- }
}
/*