summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-03 19:21:54 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-04-03 19:21:54 +0000
commitd5e5aa15cfebe233bf68312b5fbe30bb7b4b9336 (patch)
treebe1adc33f5da91f4348292df32aa592bfad431a0
parentadac447f46b50e2d5d4a43f2f1697ad2ccda788d (diff)
Fixes to crash when setting the key of a channel youre not a member of
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@965 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/mode.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index 22e9816b3..21817f283 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -1277,26 +1277,30 @@ void handle_mode(char **parameters, int pcnt, userrec *user)
}
}
- int MOD_RESULT = 0;
- FOREACH_RESULT(OnAccessCheck(user,NULL,Ptr,AC_GENERAL_MODE));
-
- if (MOD_RESULT == ACR_DENY)
- return;
- if (MOD_RESULT == ACR_DEFAULT)
- {
- if ((cstatus(user,Ptr) < STATUS_HOP) && (Ptr))
- {
- WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, Ptr->name);
- return;
- }
- }
if ((Ptr) && (!has_channel(user,Ptr)))
{
WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name);
return;
}
- process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,false);
+ if (Ptr)
+ {
+ int MOD_RESULT = 0;
+ FOREACH_RESULT(OnAccessCheck(user,NULL,Ptr,AC_GENERAL_MODE));
+
+ if (MOD_RESULT == ACR_DENY)
+ return;
+ if (MOD_RESULT == ACR_DEFAULT)
+ {
+ if (cstatus(user,Ptr) < STATUS_HOP)
+ {
+ WriteServ(user->fd,"482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, Ptr->name);
+ return;
+ }
+ }
+
+ process_modes(parameters,user,Ptr,cstatus(user,Ptr),pcnt,false,false,false);
+ }
}
else
{