Merge in SNORT/snort3 from ~ABHPAL/snort3:ftp_no_encrypt to master
Squashed commit of the following:
commit
a32b054c106c71b116ef7c7ec279ad877cadce6a
Author: Abhijit Pal(abhpal) <abhpal@cisco.com>
Date: Tue Jun 7 10:48:05 2022 +0530
ftp_telnet: correct the implementation for check_encrypted and encrypted_data config, handle form-feed as non-encrypted traffic
bool FtpServerModule::set(const char*, Value& v, SnortConfig*)
{
if ( v.is("check_encrypted") )
- conf->detect_encrypted = v.get_bool();
+ conf->check_encrypted_data = v.get_bool();
else if ( v.is("chk_str_fmt") )
add_commands(v, CMD_CHECK);
add_commands(v, CMD_ENCR);
else if ( v.is("encrypted_traffic") )
- conf->check_encrypted_data = v.get_bool();
+ conf->detect_encrypted = v.get_bool();
else if ( v.is("file_get_cmds") )
add_commands(v, CMD_XFER|CMD_GET);
*
*/
#define NUL 0x00
+#define FF 0x0c
#define CR 0x0d
#define LF 0x0a
#define SP 0x20
while ((read_ptr < end) &&
(*read_ptr != SP) &&
+ (*read_ptr != FF) &&
(*read_ptr != CR) &&
(*read_ptr != LF) && /* Check for LF when there wasn't a CR,
* protocol violation, but accepted by
{
if (!isalpha((int)(*ptr)))
{
- if (!isascii((int)(*ptr)) || !isprint((int)(*ptr)))
+ if (!isascii((int)(*ptr)) || (!isprint((int)(*ptr)) && (!isspace((int)(*ptr)))))
{
encrypted = 1;
}
{
if (!isdigit((int)(*ptr)))
{
- if (!isascii((int)(*ptr)) || !isprint((int)(*ptr)))
+ if (!isascii((int)(*ptr)) || (!isprint((int)(*ptr)) && (!isspace((int)(*ptr)))))
{
encrypted = 1;
}
if (read_ptr < end)
{
- if (*read_ptr == SP)
+ if ((*read_ptr == SP) || (*read_ptr == FF))
{
space = 1;
}
conf->ayt_threshold = v.get_int32();
else if ( v.is("check_encrypted") )
- conf->detect_encrypted = v.get_bool();
+ conf->check_encrypted_data = v.get_bool();
else if ( v.is("encrypted_traffic") )
- conf->check_encrypted_data = v.get_bool();
+ conf->detect_encrypted = v.get_bool();
else if ( v.is("normalize") )
conf->normalize = v.get_bool();