3737/**
3838 * \brief Regex for parsing our keyword options
3939 */
40- #define PARSE_REGEX "^\\s*(stor|retr|nlst)\\s*$"
40+ #define PARSE_REGEX "^\\s*(stor|retr|nlst|list|mlsd )\\s*$"
4141static DetectParseRegex parse_regex ;
4242
4343/* Prototypes of functions registered in DetectFtpdataRegister below */
@@ -147,6 +147,10 @@ static DetectFtpdataData *DetectFtpdataParse(const char *ftpcommandstr)
147147 ftpcommandd -> command = FTP_COMMAND_RETR ;
148148 } else if (!strcmp (arg1 , "nlst" )) {
149149 ftpcommandd -> command = FTP_COMMAND_NLST ;
150+ } else if (!strcmp (arg1 , "list" )) {
151+ ftpcommandd -> command = FTP_COMMAND_LIST ;
152+ } else if (!strcmp (arg1 , "mlsd" )) {
153+ ftpcommandd -> command = FTP_COMMAND_MLSD ;
150154 } else {
151155 SCLogError ("Invalid command value" );
152156 goto error ;
@@ -213,6 +217,16 @@ static int DetectFtpdataParseTest01(void)
213217 FAIL_IF_NULL (ftpcommandd );
214218 FAIL_IF (!(ftpcommandd -> command == FTP_COMMAND_STOR ));
215219 DetectFtpdataFree (NULL , ftpcommandd );
220+
221+ ftpcommandd = DetectFtpdataParse ("list" );
222+ FAIL_IF_NULL (ftpcommandd );
223+ FAIL_IF (!(ftpcommandd -> command == FTP_COMMAND_LIST ));
224+ DetectFtpdataFree (NULL , ftpcommandd );
225+
226+ ftpcommandd = DetectFtpdataParse ("mlsd" );
227+ FAIL_IF_NULL (ftpcommandd );
228+ FAIL_IF (!(ftpcommandd -> command == FTP_COMMAND_MLSD ));
229+ DetectFtpdataFree (NULL , ftpcommandd );
216230 PASS ;
217231}
218232
@@ -225,7 +239,14 @@ static int DetectFtpdataSignatureTest01(void)
225239 FAIL_IF_NULL (sig );
226240 sig = DetectEngineAppendSig (de_ctx , "alert ip any any -> any any (ftpdata_command:retr; sid:2; rev:1;)" );
227241 FAIL_IF_NULL (sig );
228- sig = DetectEngineAppendSig (de_ctx , "alert ip any any -> any any (ftpdata_command:xxx; sid:3; rev:1;)" );
242+ sig = DetectEngineAppendSig (
243+ de_ctx , "alert ip any any -> any any (ftpdata_command:list; sid:3; rev:1;)" );
244+ FAIL_IF_NULL (sig );
245+ sig = DetectEngineAppendSig (
246+ de_ctx , "alert ip any any -> any any (ftpdata_command:mlsd; sid:4; rev:1;)" );
247+ FAIL_IF_NULL (sig );
248+ sig = DetectEngineAppendSig (
249+ de_ctx , "alert ip any any -> any any (ftpdata_command:xxx; sid:5; rev:1;)" );
229250 FAIL_IF_NOT_NULL (sig );
230251
231252 DetectEngineCtxFree (de_ctx );
0 commit comments