Brandon Beresini sent me a patch yesterday adding tests for JOIN under various circumstances, which I believe he worked on with Bryan Caldwell and Ali Shemiran. I made a few modifications; the result is below.
We couldn't seem to come up with a good way to elicit a proper ERR_BANNEDFROMCHAN reply because, while the configuration file can specify channel modes, it apparently can't pass the required parameter to the +b mode in order to effect a ban. Any proposals?
Also in the process of investigating this we discovered some rather unusual behavior. A user who has already joined a channel and tries to join the channel again will normally receive no reply---this is how other IRC daemons behave as well. However, if a ban is in effect for that user, the user receives an ERR_BANNEDFROMCHAN reply even though the user is already in the channel---other servers don't do this:
join #chan :nick!~user@csegrad.ucsd.edu JOIN :#chan :irc.bit.netz 353 nick = #chan :@nick :irc.bit.netz 366 nick #chan :End of NAMES list join #chan mode #chan +b nick :nick!~user@csegrad.ucsd.edu MODE #chan +b nick!*@* join #chan :irc.bit.netz 474 nick #chan :Cannot join channel (+b)
This might qualify as a bug. Thoughts?
Dana
diff --git a/src/testsuite/Makefile.am b/src/testsuite/Makefile.am index bc8df84..b382a01 100644 --- a/src/testsuite/Makefile.am +++ b/src/testsuite/Makefile.am @@ -20,8 +20,8 @@ EXTRA_DIST = \ README functions.inc getpid.sh \ start-server.sh stop-server.sh tests.sh stress-server.sh \ test-loop.sh wait-tests.sh \ - channel-test.e connect-test.e check-idle.e misc-test.e mode-test.e \ - opless-channel-test.e \ + channel-test.e connect-test.e check-idle.e join-test.e \ + misc-test.e mode-test.e opless-channel-test.e \ who-test.e stress-A.e stress-B.e \ ngircd-test.conf
@@ -48,6 +48,10 @@ channel-test: tests.sh rm -f channel-test ln -s $(srcdir)/tests.sh channel-test
+join-test: tests.sh + rm -f join-test + ln -s $(srcdir)/tests.sh join-test + opless-channel-test: tests.sh rm -f opless-channel-test ln -s $(srcdir)/tests.sh opless-channel-test @@ -67,10 +71,11 @@ mode-test: tests.sh TESTS = start-server.sh \ connect-test \ channel-test \ + join-test \ misc-test \ mode-test \ - who-test \ opless-channel-test \ + who-test \ stress-server.sh \ stop-server.sh
diff --git a/src/testsuite/join-test.e b/src/testsuite/join-test.e new file mode 100644 index 0000000..41a5168 --- /dev/null +++ b/src/testsuite/join-test.e @@ -0,0 +1,68 @@ +spawn telnet localhost 6789 +expect { + timeout { exit 1 } + "Connected" +} + +send "nick nick\r" +send "user user . . :User\r" +expect { + timeout { exit 1 } + "376" +} + +send "JOIN\r" +expect { + timeout { exit 1} + "461" +} + +send "JOIN #InviteChannel\r" +expect { + timeout { exit 1 } + "473" +} + +send "JOIN #FullKeyed\r" +expect { + timeout { exit 1 } + "475" +} + +send "JOIN #FullKeyed WrongKey\r" +expect { + timeout { exit 1 } + "475" +} + +send "JOIN #FullKeyed Secret\r" +expect { + timeout { exit 1 } + "471" +} + +send "JOIN #TopicChannel\r" +expect { + timeout { exit 1 } + "@* JOIN :#TopicChannel" +} +expect { + timeout { exit 1 } + "332" +} + +send "JOIN 0\r" +send "JOIN #1,#2,#3,#4\r" +send "JOIN #5\r" +expect { + timeout { exit 1 } + "405" +} + +send "quit\r" +expect { + timeout { exit 1 } + "Connection closed" +} + +# -eof- diff --git a/src/testsuite/ngircd-test.conf b/src/testsuite/ngircd-test.conf index 0bec96d..eeace76 100644 --- a/src/testsuite/ngircd-test.conf +++ b/src/testsuite/ngircd-test.conf @@ -8,9 +8,25 @@ AdminEMail = admin@irc.server MaxConnectionsIP = 0 OperCanUseMode = yes + MaxJoins = 4
[Operator] Name = TestOp Password = 123
+[CHANNEL] + Name = #InviteChannel + Modes = i + +[CHANNEL] + Name = #FullKeyed + Modes = lk + MaxUsers = 0 + Key = Secret + +[CHANNEL] + Name = #TopicChannel + Modes = t + Topic = the topic + # -eof-
Dana Dahlstrom dana+ngIRCd@cs.ucsd.edu wrote:
Brandon Beresini sent me a patch yesterday adding tests for JOIN under various circumstances, which I believe he worked on with Bryan Caldwell and Ali Shemiran. I made a few modifications; the result is below.
Also applied to my tree, thanks.
We couldn't seem to come up with a good way to elicit a proper ERR_BANNEDFROMCHAN reply because, while the configuration file can specify channel modes, it apparently can't pass the required parameter to the +b mode in order to effect a ban. Any proposals?
Thats bug 55: http://arthur.barton.de/cgi-bin/bugzilla/show_bug.cgi?id=55
Also in the process of investigating this we discovered some rather unusual behavior. A user who has already joined a channel and tries to join the channel again will normally receive no reply---this is how other IRC daemons behave as well. However, if a ban is in effect for that user, the user receives an ERR_BANNEDFROMCHAN reply even though the user is already in the channel---other servers don't do this:
[..]
Not sure. Depends on how intrusive the change is (i have not looked at this closely). Right now ban/invite lists are checked before Channel_Join() gets called (which detects the 'already joined' case).