From c25cf927e82b31014c2d8383c41da6634408cff3 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 15 Nov 2006 17:16:54 +0000 Subject: Don't allow a non-oper to view another users modes. This slightly tweaks the rfc, because the rfc says even opers shouldnt be able to view modes but thats just a backwards pain in the neck. Also, remove the system from 1.0 whereby an oper CAN change a non-opers modes (except +o) because all this did was confuse services packages. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5748 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/mode.cpp | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/mode.cpp b/src/mode.cpp index dc4de1261..560bd8d04 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -249,11 +249,18 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec } else if (targetuser) { - /* Display user's current mode string */ - user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes()); - if (*targetuser->oper) - user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); - return; + if ((targetuser == user) || (*user->oper)) + { + /* Display user's current mode string */ + user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes()); + if (*targetuser->oper) + user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks()); + return; + } + else + { + user->WriteServ("502 %s :Can't change mode for other users", user->nick); + } } /* No such nick/channel */ @@ -340,6 +347,11 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool { type = MODETYPE_USER; mask = MASK_USER; + if ((user != targetuser) && (!ServerInstance->ULine(user->server))) + { + user->WriteServ("502 %s :Can't change mode for other users", user->nick); + return; + } } else { -- cgit v1.2.3