summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-01-13 10:43:05 +0100
committerAlexander Barton <alex@barton.de>2012-01-13 10:50:00 +0100
commitd4d8102fc99a57e2b1f6604f8a5956c33e88bf2c (patch)
treef55321d7f0cbb1c74e184bd709ffb1e1f572cb53
parent77f68b4fd140404848e203a6634ecd472294723f (diff)
downloadngircd-d4d8102fc99a57e2b1f6604f8a5956c33e88bf2c.tar.gz
ngircd-d4d8102fc99a57e2b1f6604f8a5956c33e88bf2c.zip
Don't stop join handling on faulty channel, skip it (part #2)
Commit 565523cb allowed processing of further channel names given to the
JOIN command when a single name was invalid.

After this patch, the JOIN command handler continues to process channel
name lists even after errors like "channel is full", "too many channels",
and the like and generates appropriate error messages for all the
channels given by the client.
-rw-r--r--src/ngircd/irc-channel.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 196b5477..77deed7a 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -364,7 +364,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 			 /* channel must be created, but forbidden by config */
 			IRC_WriteStrClient(Client, ERR_BANNEDFROMCHAN_MSG,
 					   Client_ID(Client), channame);
-			break;
+			goto join_next;
 		}
 
 		/* Local client? */
@@ -377,15 +377,19 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 
 			/* Test if the user has reached the channel limit */
 			if ((Conf_MaxJoins > 0) &&
-			    (Channel_CountForUser(Client) >= Conf_MaxJoins))
-				return IRC_WriteStrClient(Client,
+			    (Channel_CountForUser(Client) >= Conf_MaxJoins)) {
+				if (!IRC_WriteStrClient(Client,
 						ERR_TOOMANYCHANNELS_MSG,
-						Client_ID(Client), channame);
+						Client_ID(Client), channame))
+					return DISCONNECTED;
+				goto join_next;
+			}
+
 			if (chan) {
 				/* Already existing channel: check if the
 				 * client is allowed to join */
 				if (!join_allowed(Client, chan, channame, key))
-					break;
+					goto join_next;
 			} else {
 				/* New channel: first user will become channel
 				 * operator unless this is a modeless channel */