Description:
Fix SF bug #
2328334: Allow users to join channels with names that are
exactly CHANNELLEN bytes long.
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1906
c9e4aea6-c8fd-4c43-8297-
357d70d61c8c
+2009-02-08 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/channel.c (clean_channelname): Delete this function; it is
+ no longer used, and had the same length-off-by-one bug.
+
+ * ircd/m_join.c (m_join): Use > instead of >= with CHANNELLEN.
+
+ * tests/ircd.conf: Set CHANNELLEN to make it easier to test this.
+
+ * tests/bug-2328334.cmd: New file for regression testing.
+
2009-02-08 Michael Poole <mdpoole@troilus.org>
* include/numeric.h (ERR_INVALIDKEY): Define new numeric.
send_reply(cptr, RPL_ENDOFBANLIST, chptr->chname);
}
-/** Remove bells and commas from channel name
- *
- * @param cn Channel name to clean, modified in place.
- */
-void clean_channelname(char *cn)
-{
- int i;
-
- for (i = 0; cn[i]; i++) {
- if (i >= IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN))
- || !IsChannelChar(cn[i])) {
- cn[i] = '\0';
- return;
- }
- if (IsChannelLower(cn[i])) {
- cn[i] = ToLower(cn[i]);
-#ifndef FIXME
- /*
- * Remove for .08+
- * toupper(0xd0)
- */
- if ((unsigned char)(cn[i]) == 0xd0)
- cn[i] = (char) 0xf0;
-#endif
- }
- }
-}
-
/** Get a channel block, creating if necessary.
* Get Channel block for chname (and allocate a new channel
* block, if it didn't exists before).
if (!(chptr = FindChannel(name))) {
if (((name[0] == '&') && !feature_bool(FEAT_LOCAL_CHANNELS))
- || strlen(name) >= IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN))) {
+ || strlen(name) > IRCD_MIN(CHANNELLEN, feature_int(FEAT_CHANNELLEN))) {
send_reply(sptr, ERR_NOSUCHCHANNEL, name);
continue;
}
--- /dev/null
+define srv1 localhost:7601
+define srv1-name irc.example.net
+define cl1-nick Op3rm4n
+define channel1 #1234567890123456789012345678901234567890123456789
+define channel2 #12345678901234567890123456789012345678901234567890
+
+
+# Connect a client and try to join the two channels.
+# The second channel's name is one character too long, and should be truncated.
+connect cl1 %cl1-nick% oper %srv1% :Some Channel Operator
+:cl1 join %channel1%
+:cl1 join %channel2%
+:cl1 expect %srv1-name% 403 %channel2% :No such channel
+# Force cl1 to do something else so the expect is checked.
+:cl1 part %channel1%
Features {
"HUB" = "TRUE";
"CONFIG_OPERCMDS" = "TRUE";
+ "CHANNELLEN" = "50";
};