Revision: 1906
          
http://undernet-ircu.svn.sourceforge.net/undernet-ircu/?rev=1906&view=rev
Author:   entrope
Date:     2009-02-09 03:39:42 +0000 (Mon, 09 Feb 2009)

Log Message:
-----------
Author: Michael Poole <[email protected]>
Description:

Fix SF bug #2328334: Allow users to join channels with names that are
exactly CHANNELLEN bytes long.

Modified Paths:
--------------
    ircu2/branches/u2_10_12_branch/ChangeLog
    ircu2/branches/u2_10_12_branch/ircd/channel.c
    ircu2/branches/u2_10_12_branch/ircd/m_join.c
    ircu2/branches/u2_10_12_branch/tests/ircd.conf

Added Paths:
-----------
    ircu2/branches/u2_10_12_branch/tests/bug-2328334.cmd

Modified: ircu2/branches/u2_10_12_branch/ChangeLog
===================================================================
--- ircu2/branches/u2_10_12_branch/ChangeLog    2009-02-09 01:30:13 UTC (rev 
1905)
+++ ircu2/branches/u2_10_12_branch/ChangeLog    2009-02-09 03:39:42 UTC (rev 
1906)
@@ -1,5 +1,16 @@
 2009-02-08  Michael Poole <[email protected]>
 
+       * 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 <[email protected]>
+
        * include/numeric.h (ERR_INVALIDKEY): Define new numeric.
 
        * ircd/s_err.c (ERR_INVALIDKEY): Give it a text string.

Modified: ircu2/branches/u2_10_12_branch/ircd/channel.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/channel.c       2009-02-09 01:30:13 UTC 
(rev 1905)
+++ ircu2/branches/u2_10_12_branch/ircd/channel.c       2009-02-09 03:39:42 UTC 
(rev 1906)
@@ -1224,34 +1224,6 @@
   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).

Modified: ircu2/branches/u2_10_12_branch/ircd/m_join.c
===================================================================
--- ircu2/branches/u2_10_12_branch/ircd/m_join.c        2009-02-09 01:30:13 UTC 
(rev 1905)
+++ ircu2/branches/u2_10_12_branch/ircd/m_join.c        2009-02-09 03:39:42 UTC 
(rev 1906)
@@ -158,7 +158,7 @@
 
     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;
       }

Added: ircu2/branches/u2_10_12_branch/tests/bug-2328334.cmd
===================================================================
--- ircu2/branches/u2_10_12_branch/tests/bug-2328334.cmd                        
        (rev 0)
+++ ircu2/branches/u2_10_12_branch/tests/bug-2328334.cmd        2009-02-09 
03:39:42 UTC (rev 1906)
@@ -0,0 +1,15 @@
+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%

Modified: ircu2/branches/u2_10_12_branch/tests/ircd.conf
===================================================================
--- ircu2/branches/u2_10_12_branch/tests/ircd.conf      2009-02-09 01:30:13 UTC 
(rev 1905)
+++ ircu2/branches/u2_10_12_branch/tests/ircd.conf      2009-02-09 03:39:42 UTC 
(rev 1906)
@@ -38,4 +38,5 @@
 Features {
         "HUB" = "TRUE";
         "CONFIG_OPERCMDS" = "TRUE";
+        "CHANNELLEN" = "50";
 };


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to