about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2008-07-22 13:18:19 +0200
committerAlexander Barton <alex@barton.de>2008-07-22 13:18:19 +0200
commit258143897ca1a4cbc8b97c9691a0cf83b963705a (patch)
tree0c97939edff3fc060ef84d9c6419025dc9f24902
parent477f2fd9e719d757ff3d6f3515f845c37e13e354 (diff)
downloadngircd-258143897ca1a4cbc8b97c9691a0cf83b963705a.tar.gz
ngircd-258143897ca1a4cbc8b97c9691a0cf83b963705a.zip
Return 461 (syntax error) on "JOIN :" and "PART :"
Up to this patch ngIRCd did not return any result (GIT master) or a badly
formated 403 (":irc.server 403 test  :No such channel" [note the two
spaces!], branch-0-12-x) on the above commands, this patch changes the
behaviour to reflect ircd 2.11 which returns 461 in both cases.
-rw-r--r--src/ngircd/irc-channel.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 030961f0..f64570ad 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -214,6 +214,11 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 	channame = Req->argv[0];
 	channame = strtok_r(channame, ",", &lastchan);
 
+	/* Make sure that "channame" is not the empty string ("JOIN :") */
+	if (! channame)
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
+
 	while (channame) {
 		flags = NULL;
 
@@ -318,6 +323,12 @@ IRC_PART(CLIENT * Client, REQUEST * Req)
 
 	/* Loop over all the given channel names */
 	chan = strtok(Req->argv[0], ",");
+
+	/* Make sure that "chan" is not the empty string ("PART :") */
+	if (! chan)
+		return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
+					  Client_ID(Client), Req->command);
+
 	while (chan) {
 		Channel_Part(target, Client, chan,
 			     Req->argc > 1 ? Req->argv[1] : Client_ID(target));