From: Michael Poole Date: Mon, 9 Feb 2009 03:39:42 +0000 (+0000) Subject: Author: Michael Poole X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=53db8a34fb699436ab64a51fe5ac88e88e8c1bec Author: Michael Poole 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 --- diff --git a/ChangeLog b/ChangeLog index d74896c..eb128f3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-02-08 Michael Poole + + * 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 * include/numeric.h (ERR_INVALIDKEY): Define new numeric. diff --git a/ircd/channel.c b/ircd/channel.c index 04d28a2..46fb060 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -1224,34 +1224,6 @@ static void send_ban_list(struct Client* cptr, struct Channel* chptr) 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). diff --git a/ircd/m_join.c b/ircd/m_join.c index 26d9c2d..e004966 100644 --- a/ircd/m_join.c +++ b/ircd/m_join.c @@ -158,7 +158,7 @@ int m_join(struct Client *cptr, struct Client *sptr, int parc, char *parv[]) 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; } diff --git a/tests/bug-2328334.cmd b/tests/bug-2328334.cmd new file mode 100644 index 0000000..18500af --- /dev/null +++ b/tests/bug-2328334.cmd @@ -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% diff --git a/tests/ircd.conf b/tests/ircd.conf index 3f6b529..e58c936 100644 --- a/tests/ircd.conf +++ b/tests/ircd.conf @@ -38,4 +38,5 @@ IAuth { program = "../tests/iauth-test"; }; Features { "HUB" = "TRUE"; "CONFIG_OPERCMDS" = "TRUE"; + "CHANNELLEN" = "50"; };