diff --git a/CHANGES b/CHANGES index 56b21bb49f..54d5a5db68 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,8 @@ +2.4-276 | 2016-02-10 21:29:33 -0800 + + * Allow IRC commands to not have parameters. (Mark Taylor) + 2.4-272 | 2016-02-08 14:27:58 -0800 * fix memory leaks in find_all() and IRC analyzer. (Dirk Leinenbach) diff --git a/VERSION b/VERSION index cdd47a2522..834f974518 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.4-272 +2.4-276 diff --git a/src/analyzer/protocol/irc/IRC.cc b/src/analyzer/protocol/irc/IRC.cc index d1ee6dc468..0a32588783 100644 --- a/src/analyzer/protocol/irc/IRC.cc +++ b/src/analyzer/protocol/irc/IRC.cc @@ -55,7 +55,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) return; } - string myline = string((const char*) line); + string myline = string((const char*) line, length); // Check for prefix. string prefix = ""; @@ -106,28 +106,29 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig) } else { // get command - - // special case that has no arguments - if ( myline == "STARTTLS" ) - return; - unsigned int pos = myline.find(' '); + // Not all commands require parameters if ( pos > (unsigned int) length ) - { - Weird("irc_invalid_line"); - return; - } + pos = (unsigned int) length; command = myline.substr(0, pos); for ( unsigned int i = 0; i < command.size(); ++i ) command[i] = toupper(command[i]); + // Adjust for the no-parameter case + if ( pos == (unsigned int) length ) + pos--; + myline = myline.substr(pos + 1); } // Extract parameters. string params = myline; + // special case + if ( command == "STARTTLS" ) + return; + // Check for Server2Server - connections with ZIP enabled. if ( orig && orig_status == WAIT_FOR_REGISTRATION ) { diff --git a/testing/btest/Baseline/scripts.base.protocols.irc.events/out b/testing/btest/Baseline/scripts.base.protocols.irc.events/out index e0aa3da2f8..8ec1e7f95d 100644 --- a/testing/btest/Baseline/scripts.base.protocols.irc.events/out +++ b/testing/btest/Baseline/scripts.base.protocols.irc.events/out @@ -11,6 +11,7 @@ thenagualII!~affreujoj@THENAGUAL.users.undernet.org -> #easymovies: \x0304,00DVD -> ladyvampress: list -> #easymovies: @ladyvampress gordon1`^!~allu0002@gordon2411.users.undernet.org -> #easymovies: \x0308\x02File Server Online\x02 \x0303Triggers:\xab\x0308\x0308/ctcp gordon1`^ /ctcp gordon1`^ /CTCP gordon1`^ Movies Galore\x0303\xbb Sends:\xab\x03081/30\x0303\xbb Queues:\xab\x03080/30\x0303\xbb Accessed:\xab\x03082556 times\x0303\xbb Online:\xab\x03080/4\x0303\xbb RCPS:\xab\x0308193.8 Kbs by MadDingo\x0303\xbb Served:\xab\x03081.14TB in 1118 files\x0303\xbb Current BW:\xab\x030818.7 Kbs\x0303\xbb AQT:\xab\x0308No Wait\x0303\xbb \x0f\x0303\x97\x0314I\x0303-\x0315n\x0303-\x0315v\x0303-\x0300i\x0303-\x0300s\x0303-\x0315i\x0303-\x0315o\x0303-\x0314n\x0303\x97\x0f +quit: () thenagualII!~affreujoj@THENAGUAL.users.undernet.org -> #easymovies: \x02TDCC Server Online\x02 Desc:\xc2\xabjet li fong sai yuk 2 vostfr\xc2\xbb Trigger:\xc2\xabtrigger1\xc2\xbb Size:\xc2\xab699MB\xc2\xbb Sends:\xc2\xab0/2\xc2\xbb Queues:\xc2\xab0/10\xc2\xbb Record CPS:\xc2\xab0 cps by n/a\xc2\xbb Downloads:\xc2\xab0\xc2\xbb \x0f\x97I-n-v-i-s-i-o-n\x97 thenagualII!~affreujoj@THENAGUAL.users.undernet.org -> #easymovies: \x02TDCC Server Online\x02 Desc:\xc2\xabarturo.brachetti.l.homme.aux.mille.songes.avi\xc2\xbb Trigger:\xc2\xabtriggerII\xc2\xbb Size:\xc2\xab698MB\xc2\xbb Sends:\xc2\xab0/2\xc2\xbb Queues:\xc2\xab0/10\xc2\xbb Record CPS:\xc2\xab0 cps by n/a\xc2\xbb Downloads:\xc2\xab0\xc2\xbb \x0f\x97I-n-v-i-s-i-o-n\x97 thenagualII!~affreujoj@THENAGUAL.users.undernet.org -> #easymovies: \x02TDCC Server Online\x02 Desc:\xc2\xabnational geographic les hackers.avi\xc2\xbb Trigger:\xc2\xab!tdcc-3\xc2\xbb Size:\xc2\xab693MB\xc2\xbb Sends:\xc2\xab0/2\xc2\xbb Queues:\xc2\xab0/10\xc2\xbb Record CPS:\xc2\xab0 cps by n/a\xc2\xbb Downloads:\xc2\xab0\xc2\xbb \x0f\x97I-n-v-i-s-i-o-n\x97 @@ -24,6 +25,7 @@ thenagualII!~affreujoj@THENAGUAL.users.undernet.org -> #easymovies: \x0304,00DVD -> ladyvampress: list -> #easymovies: @ladyvampress gordon1`^!~allu0002@gordon2411.users.undernet.org -> #easymovies: \x0308\x02File Server Online\x02 \x0303Triggers:\xab\x0308\x0308/ctcp gordon1`^ /ctcp gordon1`^ /CTCP gordon1`^ Movies Galore\x0303\xbb Sends:\xab\x03081/30\x0303\xbb Queues:\xab\x03080/30\x0303\xbb Accessed:\xab\x03082556 times\x0303\xbb Online:\xab\x03080/4\x0303\xbb RCPS:\xab\x0308193.8 Kbs by MadDingo\x0303\xbb Served:\xab\x03081.14TB in 1118 files\x0303\xbb Current BW:\xab\x030818.7 Kbs\x0303\xbb AQT:\xab\x0308No Wait\x0303\xbb \x0f\x0303\x97\x0314I\x0303-\x0315n\x0303-\x0315v\x0303-\x0300i\x0303-\x0300s\x0303-\x0315i\x0303-\x0315o\x0303-\x0314n\x0303\x97\x0f +quit: () -> #brotest: test quit: (quitting) quit: brotest (Client Quit)