int iServerSip;
int iServerDip;
int http_id_found = 0;
- SfIp sip;
- SfIp dip;
-
- //structure copy
- sip = SiInput->sip;
- dip = SiInput->dip;
ServerConfDip = ServerConfSip = GlobalConf;
//-------------------------------------------------------------------------
// FIXIT-L eliminate this arbitrary limit on rule text size
-const unsigned window_bits = -9;
+const int window_bits = -9;
const unsigned max_rule = 128000;
static uint8_t so_buf[max_rule];
AppIdModuleConfig::~AppIdModuleConfig()
{
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
snort_free((void*)conf_file);
#endif
snort_free((void*)app_detector_dir);
globfree(&globs);
}
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
void AppIdConfig::configure_analysis_networks(char* toklist[], uint32_t flag)
{
int zone;
map_app_names_to_snort_ids();
AppIdUtils::init_netmasks(app_id_netmasks);
app_info_mgr.init_appid_info_table(mod_config);
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
load_analysis_config(mod_config->conf_file, 0, mod_config->instance_id);
#endif
read_port_detectors(ODP_PORT_DETECTORS);
AppIdModuleConfig();
~AppIdModuleConfig();
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
const char* conf_file = nullptr;
#endif
bool stats_logging_enabled = false;
static const Parameter s_params[] =
{
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
{ "conf", Parameter::PT_STRING, nullptr, nullptr,
"RNA configuration file" }, // FIXIT-L eliminate reference to "RNA"
#endif
bool AppIdModule::set(const char*, Value& v, SnortConfig*)
{
-#if USE_RNA_CONFIG
+#ifdef USE_RNA_CONFIG
if ( v.is("conf") )
config->conf_file = snort_strdup(v.get_string());
else
else
{
if (cooked_client)
- snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_cl_%u",app_id);
+ snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_cl_%d",app_id);
else
- snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_%u",app_id);
+ snprintf(tmpBuff, MAX_EVENT_APPNAME_LEN, "_err_%d",app_id);
tmpBuff[MAX_EVENT_APPNAME_LEN - 1] = 0;
app_name = tmpBuff;
unsigned host_reporting, AppIdSession*);
};
-class DnsTcpServiceDetector : public ServiceDetector, DnsValidator
+class DnsTcpServiceDetector : public ServiceDetector, public DnsValidator
{
public:
DnsTcpServiceDetector(ServiceDiscovery*);
int validate(AppIdDiscoveryArgs&) override;
};
-class DnsUdpServiceDetector : public ServiceDetector, DnsValidator
+class DnsUdpServiceDetector : public ServiceDetector, public DnsValidator
{
public:
DnsUdpServiceDetector(ServiceDiscovery*);
static const uint8_t APP_SMTP_THUNDERBIRD_SHORT[] = "Thunderbird/";
static THREAD_LOCAL SmtpClientDetector* smtp_client_detector = nullptr;
-static THREAD_LOCAL SmtpServiceDetector* smtp_service_detector = nullptr;
SmtpClientDetector::SmtpClientDetector(ClientDiscovery* cdm)
{
{ SMTPS_DEPRECATED_PORT, IpProtocol::TCP, false }
};
- smtp_service_detector = this;
handler->register_detector(name, this, proto);
}
&& (proto == IpProtocol::UDP) && !asd->tried_reverse_service )
{
asd->tried_reverse_service = true;
- ServiceDiscoveryState* sds = AppIdServiceState::get(p->ptrs.ip_api.get_src(),
+ ServiceDiscoveryState* rsds = AppIdServiceState::get(p->ptrs.ip_api.get_src(),
proto, p->ptrs.sp, asd->is_decrypted());
- if ( sds && sds->service )
- asd->service_candidates.push_back(sds->service);
+ if ( rsds && rsds->service )
+ asd->service_candidates.push_back(rsds->service);
else if ( udp_reversed_services[p->ptrs.sp].size() )
{
asd->service_candidates.insert(asd->service_candidates.end(),
ipstr[0] = 0;
sfip_ntop(ip, ipstr, sizeof(ipstr));
- ErrorMessage("Failed to remove from hash: %s:%u:%u\n", ipstr, (unsigned)proto, port);
+ ErrorMessage("Failed to remove from hash: %s:%u:%hu\n", ipstr, (unsigned)proto, port);
}
}
formatter->register_section(m->get_name());
- for (auto const& i : peg_map)
- formatter->register_field(m->get_pegs()[i].name, &(m->get_counts()[i]));
+ for (auto const& peg : peg_map)
+ formatter->register_field(m->get_pegs()[peg].name, &(m->get_counts()[peg]));
}
formatter->finalize_fields();
}
else if (HttpTestManager::use_test_output())
{
printf("Scan from flow data %" PRIu64
- " direction %d length %u client port %u server port %u\n", session_data->seq_num,
+ " direction %d length %u client port %hu server port %hu\n", session_data->seq_num,
source_id, length, flow->client_port, flow->server_port);
fflush(stdout);
if (HttpTestManager::get_show_scan())
{
char* space;
char* version;
- int length;
SIPMethodNode* method;
/*Process request*/
space = (char*)memchr(buff, ' ', end - buff);
if (space == NULL)
return false;
- length = space - buff;
msg->method = (char*)buff;
- msg->methodLen = length;
+ msg->methodLen = space - buff;
DebugFormat(DEBUG_SIP, "method: %.*s\n", msg->methodLen, msg->method);
method = SIP_FindMethod (config->methods, msg->method, msg->methodLen);
*/
SfIpRet SfCidr::contains(const SfIp* ip) const
{
- unsigned int mask, temp, i;
+ uint16_t i;
const uint32_t* pn, * pi;
/* SFIP_CONTAINS is returned here due to how sfvar_ip_in
return SFIP_NOT_CONTAINS;
}
- mask = 32 - (bits - 32 * i);
+ unsigned int mask = 32 - (bits - 32 * i);
if (mask == 32)
return SFIP_CONTAINS;
/* At this point, there are some number of remaining bits to check.
* Mask the bits we don't care about off of "ip" so we can compare
* the ints directly */
- temp = ntohl(*pi);
+ unsigned int temp = ntohl(*pi);
temp = (temp >> mask) << mask;
/* If pn was setup correctly through this library, there is no need to
assert(sizeof(IcmpStats)/sizeof(PegCount) == sizeof(IcmpStatTypes)/sizeof(CountType));
static const IcmpStatTypes icmp_stat_types;
- static const CountType* const count_types = (const CountType* const)&icmp_stat_types;
+ static const CountType* const count_types = (const CountType*)&icmp_stat_types;
sum_stats_helper(accumulate_now_stats, count_types);
}
assert(sizeof(IpStats)/sizeof(PegCount) == sizeof(IpStatTypes)/sizeof(CountType));
static const IpStatTypes ip_stat_types;
- static const CountType* const count_types = (const CountType* const)&ip_stat_types;
+ static const CountType* const count_types = (const CountType*)&ip_stat_types;
sum_stats_helper(accumulate_now_stats, count_types);
}
{
tcpStats.internalEvents++;
SnortEventqAdd(GENERATOR_INTERNAL, eventSid);
- DebugFormat(DEBUG_STREAM, "Stream raised internal event %d\n", eventSid);
+ DebugFormat(DEBUG_STREAM, "Stream raised internal event %u\n", eventSid);
}
}
assert(sizeof(TcpStats)/sizeof(PegCount) == sizeof(TcpStatTypes)/sizeof(CountType));
static const TcpStatTypes tcp_stat_types;
- static const CountType* const count_types = (const CountType* const)&tcp_stat_types;
+ static const CountType* const count_types = (const CountType*)&tcp_stat_types;
sum_stats_helper(accumulate_now_stats, count_types);
}
{
if ( !bytes || !seglist.next )
{
- DebugFormat(DEBUG_STREAM_STATE, "bailing: no bytes: %d or empty seglist: %p\n",
+ DebugFormat(DEBUG_STREAM_STATE, "bailing: no bytes: %u or empty seglist: %p\n",
bytes, (void*)seglist.next);
return 0;
}