From: Daniel De Graaf Date: Thu, 5 Aug 2010 01:27:21 +0000 (-0400) Subject: Prevent kicking people you do not have permission to deprivilege X-Git-Tag: v2.0.23~857 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=460453230db00a2e779259c94be1bedc57c43aec;p=user%2Fhenk%2Fcode%2Finspircd.git Prevent kicking people you do not have permission to deprivilege --- diff --git a/src/channels.cpp b/src/channels.cpp index 0ad99fb94..01450ce61 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -526,10 +526,13 @@ void Channel::KickUser(User *src, User *user, const char* reason) if (res == MOD_RES_PASSTHRU) { int them = this->GetPrefixValue(src); - int us = this->GetPrefixValue(user); - if ((them < HALFOP_VALUE) || (them < us)) + char us = GetPrefixChar(user)[0]; + ModeHandler* mh = ServerInstance->Modes->FindMode(us, MODETYPE_CHANNEL); + int min = mh ? mh->GetLevelRequired() : HALFOP_VALUE; + if (them < HALFOP_VALUE || them < min) { - src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",src->nick.c_str(), this->name.c_str(), them >= HALFOP_VALUE ? "" : "half-"); + src->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", + src->nick.c_str(), this->name.c_str(), min > HALFOP_VALUE ? "" : "half-"); return; } }