spp_ftptelnet.c (snort-2.9.16.1) | : | spp_ftptelnet.c (snort-2.9.17) | ||
---|---|---|---|---|
skipping to change at line 107 | skipping to change at line 107 | |||
* External Global Variables | * External Global Variables | |||
* Variables that we need from Snort to log errors correctly and such. | * Variables that we need from Snort to log errors correctly and such. | |||
*/ | */ | |||
#ifdef PERF_PROFILING | #ifdef PERF_PROFILING | |||
PreprocStats ftpPerfStats; | PreprocStats ftpPerfStats; | |||
PreprocStats telnetPerfStats; | PreprocStats telnetPerfStats; | |||
#ifdef TARGET_BASED | #ifdef TARGET_BASED | |||
PreprocStats ftpdataPerfStats; | PreprocStats ftpdataPerfStats; | |||
#endif | #endif | |||
#endif | #endif | |||
FTPTelnet_Stats ftp_telnet_stats; | ||||
/* | /* | |||
* Global Variables | * Global Variables | |||
* This is the only way to work with Snort preprocessors because | * This is the only way to work with Snort preprocessors because | |||
* the user configuration must be kept between the Init function | * the user configuration must be kept between the Init function | |||
* the actual preprocessor. There is no interaction between the | * the actual preprocessor. There is no interaction between the | |||
* two except through global variable usage. | * two except through global variable usage. | |||
*/ | */ | |||
tSfPolicyUserContextId ftp_telnet_config = NULL; | tSfPolicyUserContextId ftp_telnet_config = NULL; | |||
FTPTELNET_GLOBAL_CONF *ftp_telnet_eval_config = NULL; | FTPTELNET_GLOBAL_CONF *ftp_telnet_eval_config = NULL; | |||
#ifdef TARGET_BASED | #ifdef TARGET_BASED | |||
int16_t ftp_app_id = 0; | int16_t ftp_app_id = 0; | |||
int16_t ftp_data_app_id = 0; | int16_t ftp_data_app_id = 0; | |||
int16_t telnet_app_id = 0; | int16_t telnet_app_id = 0; | |||
#endif | #endif | |||
/* static function prototypes */ | /* static function prototypes */ | |||
static void FTPTelnetReset(int, void *); | static void FTPTelnetReset(int, void *); | |||
static void FTPTelnetResetStats(int, void *); | static void FTPTelnetResetStats(int, void *); | |||
static void FTPTelnetStats(int); | ||||
#ifdef SNORT_RELOAD | #ifdef SNORT_RELOAD | |||
static void FtpTelnetReloadGlobal(struct _SnortConfig *, char *, void **); | static void FtpTelnetReloadGlobal(struct _SnortConfig *, char *, void **); | |||
static void FtpTelnetReload(struct _SnortConfig *, char *, void **); | static void FtpTelnetReload(struct _SnortConfig *, char *, void **); | |||
static int FtpTelnetReloadVerify(struct _SnortConfig *, void *); | static int FtpTelnetReloadVerify(struct _SnortConfig *, void *); | |||
static void * FtpTelnetReloadSwap(struct _SnortConfig *, void *); | static void * FtpTelnetReloadSwap(struct _SnortConfig *, void *); | |||
static void FtpTelnetReloadSwapFree(void *); | static void FtpTelnetReloadSwapFree(void *); | |||
#endif | #endif | |||
extern char *maxToken; | extern char *maxToken; | |||
skipping to change at line 284 | skipping to change at line 286 | |||
if (ftp_telnet_config == NULL) | if (ftp_telnet_config == NULL) | |||
{ | { | |||
DynamicPreprocessorFatalMessage("No memory to allocate " | DynamicPreprocessorFatalMessage("No memory to allocate " | |||
"FTP/Telnet configuration.\n"); | "FTP/Telnet configuration.\n"); | |||
} | } | |||
_dpd.addPreprocExit(FTPTelnetCleanExit, NULL, PRIORITY_APPLICATION, PP_F TPTELNET); | _dpd.addPreprocExit(FTPTelnetCleanExit, NULL, PRIORITY_APPLICATION, PP_F TPTELNET); | |||
_dpd.addPreprocReset(FTPTelnetReset, NULL, PRIORITY_APPLICATION, PP_FTPT ELNET); | _dpd.addPreprocReset(FTPTelnetReset, NULL, PRIORITY_APPLICATION, PP_FTPT ELNET); | |||
_dpd.addPreprocResetStats(FTPTelnetResetStats, NULL, PRIORITY_APPLICATIO N, PP_FTPTELNET); | _dpd.addPreprocResetStats(FTPTelnetResetStats, NULL, PRIORITY_APPLICATIO N, PP_FTPTELNET); | |||
_dpd.addPreprocConfCheck(sc, FTPConfigCheck); | _dpd.addPreprocConfCheck(sc, FTPConfigCheck); | |||
_dpd.registerPreprocStats("ftp_telnet", FTPTelnetStats); | ||||
#ifdef PERF_PROFILING | #ifdef PERF_PROFILING | |||
_dpd.addPreprocProfileFunc("ftptelnet_ftp", (void*)&ftpPerfStats, 0, _dp d.totalPerfStats, NULL); | _dpd.addPreprocProfileFunc("ftptelnet_ftp", (void*)&ftpPerfStats, 0, _dp d.totalPerfStats, NULL); | |||
_dpd.addPreprocProfileFunc("ftptelnet_telnet", (void*)&telnetPerfStats, 0, _dpd.totalPerfStats, NULL); | _dpd.addPreprocProfileFunc("ftptelnet_telnet", (void*)&telnetPerfStats, 0, _dpd.totalPerfStats, NULL); | |||
#ifdef TARGET_BASED | ||||
_dpd.addPreprocProfileFunc("ftptelnet_ftpdata", (void*)&ftpdataPerfStats , 0, _dpd.totalPerfStats, NULL); | _dpd.addPreprocProfileFunc("ftptelnet_ftpdata", (void*)&ftpdataPerfStats , 0, _dpd.totalPerfStats, NULL); | |||
#endif | #endif | |||
#endif | ||||
#ifdef TARGET_BASED | #ifdef TARGET_BASED | |||
if (_dpd.streamAPI != NULL) | if (_dpd.streamAPI != NULL) | |||
{ | { | |||
/* Find and store the application ID for FTP & Telnet */ | /* Find and store the application ID for FTP & Telnet */ | |||
ftp_app_id = _dpd.addProtocolReference("ftp"); | ftp_app_id = _dpd.addProtocolReference("ftp"); | |||
ftp_data_app_id = _dpd.addProtocolReference("ftp-data"); | ftp_data_app_id = _dpd.addProtocolReference("ftp-data"); | |||
telnet_app_id = _dpd.addProtocolReference("telnet"); | telnet_app_id = _dpd.addProtocolReference("telnet"); | |||
} | } | |||
skipping to change at line 489 | skipping to change at line 494 | |||
static void FTPTelnetReset(int signal, void *data) | static void FTPTelnetReset(int signal, void *data) | |||
{ | { | |||
return; | return; | |||
} | } | |||
static void FTPTelnetResetStats(int signal, void *data) | static void FTPTelnetResetStats(int signal, void *data) | |||
{ | { | |||
return; | return; | |||
} | } | |||
static void FTPTelnetStats(int exiting) | ||||
{ | ||||
_dpd.logMsg("FTPTelnet Preprocessor Statistics\n"); | ||||
_dpd.logMsg(" Current active FTP sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.ftp_sessions); | ||||
_dpd.logMsg(" Max concurrent FTP sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.max_ftp_sessions); | ||||
_dpd.logMsg(" Total FTP Data sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.ftp_data_sessions); | ||||
_dpd.logMsg(" Max concurrent FTP Data sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.max_ftp_data_sessions); | ||||
_dpd.logMsg(" Current active Telnet sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.telnet_sessions); | ||||
_dpd.logMsg(" Max concurrent Telnet sessions : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.max_telnet_sessions); | ||||
_dpd.logMsg(" Current ftp_telnet session non-mempool memory : " STDu64 "\n" | ||||
, | ||||
ftp_telnet_stats.heap_memory); | ||||
} | ||||
#ifdef SNORT_RELOAD | #ifdef SNORT_RELOAD | |||
static void _FtpTelnetReload(struct _SnortConfig *sc, tSfPolicyUserContextId ftp _telnet_swap_config, char *args) | static void _FtpTelnetReload(struct _SnortConfig *sc, tSfPolicyUserContextId ftp _telnet_swap_config, char *args) | |||
{ | { | |||
char *pcToken; | char *pcToken; | |||
char ErrorString[ERRSTRLEN]; | char ErrorString[ERRSTRLEN]; | |||
int iErrStrLen = ERRSTRLEN; | int iErrStrLen = ERRSTRLEN; | |||
int iRet = 0; | int iRet = 0; | |||
tSfPolicyId policy_id = _dpd.getParserPolicy(sc); | tSfPolicyId policy_id = _dpd.getParserPolicy(sc); | |||
FTPTELNET_GLOBAL_CONF *pPolicyConfig = NULL; | FTPTELNET_GLOBAL_CONF *pPolicyConfig = NULL; | |||
End of changes. 6 change blocks. | ||||
0 lines changed or deleted | 31 lines changed or added |