summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-15 17:16:54 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-11-15 17:16:54 +0000
commitc25cf927e82b31014c2d8383c41da6634408cff3 (patch)
treec1c671af3dea74f2ab2acd2da9ce70ec6187a0c1 /src/mode.cpp
parentaca1075bd9f04dc599a1a5a5687aa87184baeae4 (diff)
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
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp22
1 files 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
{