diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-03 18:27:25 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-04-03 18:27:25 +0000 |
commit | e408a82d5b8a0067e45397b563289717b94a9afb (patch) | |
tree | 5525f81ead1909276c016fdd20ad060e1bfe3fc7 | |
parent | 2257e3266906fd3ec48b9290ed00d6ef3b897482 (diff) |
Fixes to bug#37 and pre-emptive checks for security of /NAMES
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@963 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/commands.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/commands.cpp b/src/commands.cpp index f3798b364..75f0dd86d 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -474,6 +474,11 @@ void handle_topic(char **parameters, int pcnt, userrec *user) Ptr = FindChan(parameters[0]); if (Ptr) { + if (((Ptr) && (!has_channel(user,Ptr))) && (Ptr->secret)) + { + WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name); + return; + } if (Ptr->topicset) { WriteServ(user->fd,"332 %s %s :%s", user->nick, Ptr->name, Ptr->topic); @@ -498,6 +503,11 @@ void handle_topic(char **parameters, int pcnt, userrec *user) Ptr = FindChan(parameters[0]); if (Ptr) { + if ((Ptr) && (!has_channel(user,Ptr))) + { + WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, Ptr->name); + return; + } if ((Ptr->topiclock) && (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); @@ -538,7 +548,11 @@ void handle_names(char **parameters, int pcnt, userrec *user) c = FindChan(parameters[0]); if (c) { - /*WriteServ(user->fd,"353 %s = %s :%s", user->nick, c->name,*/ + if (((c) && (!has_channel(user,c))) && (c->secret)) + { + WriteServ(user->fd,"442 %s %s :You're not on that channel!",user->nick, c->name); + return; + } userlist(user,c); WriteServ(user->fd,"366 %s %s :End of /NAMES list.", user->nick, c->name); } |