X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmode.cpp;h=e562a8551a39013f0becb0169b1a92bc68e53222;hb=1ff26bac16487869af7a5e4ebfa1219096c9327b;hp=83aff70cf56400a4e64d29d89dc26cc196f65948;hpb=57608fe351cff19679b1d78fb5cbfb7cad89dfc1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/mode.cpp b/src/mode.cpp index 83aff70cf..e562a8551 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -577,14 +577,23 @@ void ModeParser::Process(const char* const* parameters, int pcnt, User *user, bo /* It's an oper only mode, check if theyre an oper. If they arent, * eat any parameter that came with the mode, and continue to next */ - if ((IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!user->HasModePermission(modehandlers[handler_id]->GetModeChar(), type))) + if (adding && (IS_LOCAL(user)) && (modehandlers[handler_id]->NeedsOper()) && (!user->HasModePermission(modehandlers[handler_id]->GetModeChar(), type))) { - user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to %sset %s mode %c", - user->nick, - user->oper, - adding ? "" : "un", - type == MODETYPE_CHANNEL ? "channel" : "user", - modehandlers[handler_id]->GetModeChar()); + if (IS_OPER(user)) + { + user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c", + user->nick, + user->oper, + type == MODETYPE_CHANNEL ? "channel" : "user", + modehandlers[handler_id]->GetModeChar()); + } + else + { + user->WriteNumeric(481, "%s :Permission Denied - Only operators may set %s mode %c", + user->nick, + type == MODETYPE_CHANNEL ? "channel" : "user", + modehandlers[handler_id]->GetModeChar()); + } continue; } @@ -705,12 +714,12 @@ void ModeParser::CleanMask(std::string &mask) std::string::size_type pos_of_pling = mask.find_first_of('!'); std::string::size_type pos_of_at = mask.find_first_of('@'); std::string::size_type pos_of_dot = mask.find_first_of('.'); - std::string::size_type pos_of_colon = mask.find_first_of(':'); /* Because ipv6 addresses are colon delimited */ + std::string::size_type pos_of_colons = mask.find("::"); /* Because ipv6 addresses are colon delimited -- double so it treats extban as nick */ if ((pos_of_pling == std::string::npos) && (pos_of_at == std::string::npos)) { - /* Just a nick, or just a host */ - if ((pos_of_dot == std::string::npos) && (pos_of_colon == std::string::npos)) + /* Just a nick, or just a host - or clearly ipv6 (starting with :) */ + if ((pos_of_dot == std::string::npos) && (pos_of_colons == std::string::npos) && mask[0] != ':') { /* It has no '.' in it, it must be a nick. */ mask.append("!*@*");