#include "detection/detection_engine.h"
#include "framework/data_bus.h"
#include "log/messages.h"
+#include "managers/inspector_manager.h"
#include "utils/util.h"
#include "ftp_cmd_lookup.h"
"default client and default server configurations.\n");
return -1;
}
-#if 0
- if ( file_api->get_max_file_depth() < 0 )
- {
- // FIXIT-M need to change to IT_SERVICE and FTPTelnetChecks
- // for optimization
- }
-#endif
+
int rval;
if ((rval = CheckFTPServerConfigs(sc, config)))
return rval;
+ // Verify that FTP client and FTP data inspectors are initialized.
+ if(!snort::InspectorManager::get_inspector(FTP_CLIENT_NAME, false))
+ {
+ ParseError("ftp_server requires that %s also be configured.", FTP_CLIENT_NAME);
+ return -1;
+ }
+
+ if(!snort::InspectorManager::get_inspector(FTP_DATA_NAME, false))
+ {
+ ParseError("ftp_server requires that %s also be configured.", FTP_DATA_NAME);
+ return -1;
+ }
+
return 0;
}
struct SnortConfig;
}
+#define FTP_CLIENT_NAME "ftp_client"
+#define FTP_DATA_NAME "ftp_data"
+#define FTP_SERVER_NAME "ftp_server"
+
extern SnortProtocolId ftp_data_snort_protocol_id;
void do_detection(snort::Packet*);
SnortProtocolId ftp_data_snort_protocol_id = UNKNOWN_PROTOCOL_ID;
-#define client_key "ftp_client"
-#define server_key "ftp_server"
-
#define client_help "FTP inspector client module"
#define server_help "FTP inspector server module"
FtpClient* client = (FtpClient*)p->flow->data;
if ( !client )
{
- client = (FtpClient*)InspectorManager::get_inspector(client_key);
+ client = (FtpClient*)InspectorManager::get_inspector(FTP_CLIENT_NAME);
assert(client);
p->flow->set_data(client);
}
0,
API_RESERVED,
API_OPTIONS,
- client_key,
+ FTP_CLIENT_NAME,
client_help,
fc_mod_ctor,
mod_dtor
0,
API_RESERVED,
API_OPTIONS,
- server_key,
+ FTP_SERVER_NAME,
server_help,
fs_mod_ctor,
mod_dtor
#include "stream/stream.h"
#include "utils/util.h"
+#include "ft_main.h"
#include "ftp_module.h"
#include "ftpp_si.h"
#include "ftpdata_splitter.h"
using namespace snort;
-#define s_name "ftp_data"
-
#define s_help \
"FTP data channel handler"
class FtpDataModule : public Module
{
public:
- FtpDataModule() : Module(s_name, s_help) { }
+ FtpDataModule() : Module(FTP_DATA_NAME, s_help) { }
const PegInfo* get_pegs() const override;
PegCount* get_counts() const override;
0,
API_RESERVED,
API_OPTIONS,
- s_name,
+ FTP_DATA_NAME,
s_help,
mod_ctor,
mod_dtor
#include "log/messages.h"
+#include "ft_main.h"
#include "ftpp_si.h"
using namespace snort;
using namespace std;
-#define FTP_CLIENT "ftp_client"
-#define FTP_SERVER "ftp_server"
-
#define ftp_client_help \
"FTP client configuration module for use with ftp_server"
};
FtpClientModule::FtpClientModule() :
- Module(FTP_CLIENT, ftp_client_help, ftp_client_params)
+ Module(FTP_CLIENT_NAME, ftp_client_help, ftp_client_params)
{
conf = nullptr;
}
//-------------------------------------------------------------------------
FtpServerModule::FtpServerModule() :
- Module(FTP_SERVER, ftp_server_help, ftp_server_params)
+ Module(FTP_SERVER_NAME, ftp_server_help, ftp_server_params)
{
conf = nullptr;
}
FTP_BOUNCE_TO* FTPBounce;
int iErr;
- LogMessage("ftp_client:\n");
+ LogMessage(FTP_CLIENT_NAME ":\n");
PrintConfOpt(ClientConf->bounce, "Check for Bounce Attacks");
PrintConfOpt(ClientConf->telnet_cmds, "Check for Telnet Cmds");
return FTPP_INVALID_ARG;
}
- LogMessage("ftp_server:\n");
+ LogMessage(FTP_SERVER_NAME ":\n");
PrintConfOpt(ServerConf->telnet_cmds, "Check for Telnet Cmds");
PrintConfOpt(ServerConf->ignore_telnet_erase_cmds, "Ignore Telnet Cmd Operations");