mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +00:00
analyzer: Replace nulls with nullptr
This commit is contained in:
parent
cb01e098df
commit
6897912909
54 changed files with 305 additions and 307 deletions
|
@ -124,11 +124,11 @@ void Analyzer::CtorInit(const Tag& arg_tag, Connection* arg_conn)
|
||||||
skip = false;
|
skip = false;
|
||||||
finished = false;
|
finished = false;
|
||||||
removing = false;
|
removing = false;
|
||||||
parent = 0;
|
parent = nullptr;
|
||||||
orig_supporters = 0;
|
orig_supporters = nullptr;
|
||||||
resp_supporters = 0;
|
resp_supporters = nullptr;
|
||||||
signature = 0;
|
signature = nullptr;
|
||||||
output_handler = 0;
|
output_handler = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analyzer::~Analyzer()
|
Analyzer::~Analyzer()
|
||||||
|
@ -138,7 +138,7 @@ Analyzer::~Analyzer()
|
||||||
LOOP_OVER_CHILDREN(i)
|
LOOP_OVER_CHILDREN(i)
|
||||||
delete *i;
|
delete *i;
|
||||||
|
|
||||||
SupportAnalyzer* next = 0;
|
SupportAnalyzer* next = nullptr;
|
||||||
|
|
||||||
for ( SupportAnalyzer* a = orig_supporters; a; a = next )
|
for ( SupportAnalyzer* a = orig_supporters; a; a = next )
|
||||||
{
|
{
|
||||||
|
@ -501,7 +501,7 @@ Analyzer* Analyzer::FindChild(ID arg_id)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analyzer* Analyzer::FindChild(Tag arg_tag)
|
Analyzer* Analyzer::FindChild(Tag arg_tag)
|
||||||
|
@ -523,13 +523,13 @@ Analyzer* Analyzer::FindChild(Tag arg_tag)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analyzer* Analyzer::FindChild(const char* name)
|
Analyzer* Analyzer::FindChild(const char* name)
|
||||||
{
|
{
|
||||||
Tag tag = analyzer_mgr->GetComponentTag(name);
|
Tag tag = analyzer_mgr->GetComponentTag(name);
|
||||||
return tag ? FindChild(tag) : 0;
|
return tag ? FindChild(tag) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Analyzer::DeleteChild(analyzer_list::iterator i)
|
void Analyzer::DeleteChild(analyzer_list::iterator i)
|
||||||
|
@ -570,7 +570,7 @@ void Analyzer::AddSupportAnalyzer(SupportAnalyzer* analyzer)
|
||||||
analyzer->IsOrig() ? &orig_supporters : &resp_supporters;
|
analyzer->IsOrig() ? &orig_supporters : &resp_supporters;
|
||||||
|
|
||||||
// Find end of the list.
|
// Find end of the list.
|
||||||
SupportAnalyzer* prev = 0;
|
SupportAnalyzer* prev = nullptr;
|
||||||
SupportAnalyzer* s;
|
SupportAnalyzer* s;
|
||||||
for ( s = *head; s; prev = s, s = s->sibling )
|
for ( s = *head; s; prev = s, s = s->sibling )
|
||||||
;
|
;
|
||||||
|
@ -621,7 +621,7 @@ SupportAnalyzer* Analyzer::FirstSupportAnalyzer(bool orig)
|
||||||
SupportAnalyzer* sa = orig ? orig_supporters : resp_supporters;
|
SupportAnalyzer* sa = orig ? orig_supporters : resp_supporters;
|
||||||
|
|
||||||
if ( ! sa )
|
if ( ! sa )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! sa->Removing() )
|
if ( ! sa->Removing() )
|
||||||
return sa;
|
return sa;
|
||||||
|
@ -922,7 +922,7 @@ void TransportLayerAnalyzer::SetContentsFile(unsigned int /* direction */,
|
||||||
BroFile* TransportLayerAnalyzer::GetContentsFile(unsigned int /* direction */) const
|
BroFile* TransportLayerAnalyzer::GetContentsFile(unsigned int /* direction */) const
|
||||||
{
|
{
|
||||||
reporter->Error("analyzer type does not support writing to a contents file");
|
reporter->Error("analyzer type does not support writing to a contents file");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransportLayerAnalyzer::PacketContents(const u_char* data, int len)
|
void TransportLayerAnalyzer::PacketContents(const u_char* data, int len)
|
||||||
|
|
|
@ -152,7 +152,7 @@ public:
|
||||||
* @param caplen The packet's capture length, if available.
|
* @param caplen The packet's capture length, if available.
|
||||||
*/
|
*/
|
||||||
void NextPacket(int len, const u_char* data, bool is_orig,
|
void NextPacket(int len, const u_char* data, bool is_orig,
|
||||||
uint64_t seq = -1, const IP_Hdr* ip = 0, int caplen = 0);
|
uint64_t seq = -1, const IP_Hdr* ip = nullptr, int caplen = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Passes stream input to the analyzer for processing. The analyzer
|
* Passes stream input to the analyzer for processing. The analyzer
|
||||||
|
@ -528,7 +528,7 @@ public:
|
||||||
* @param len If \a data is given, the length of it.
|
* @param len If \a data is given, the length of it.
|
||||||
*/
|
*/
|
||||||
virtual void ProtocolViolation(const char* reason,
|
virtual void ProtocolViolation(const char* reason,
|
||||||
const char* data = 0, int len = 0);
|
const char* data = nullptr, int len = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if ProtocolConfirmation() has been called at least
|
* Returns true if ProtocolConfirmation() has been called at least
|
||||||
|
@ -558,13 +558,13 @@ public:
|
||||||
* Convenience function that forwards directly to the corresponding
|
* Convenience function that forwards directly to the corresponding
|
||||||
* Connection::Event().
|
* Connection::Event().
|
||||||
*/
|
*/
|
||||||
void Event(EventHandlerPtr f, const char* name = 0);
|
void Event(EventHandlerPtr f, const char* name = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function that forwards directly to the corresponding
|
* Convenience function that forwards directly to the corresponding
|
||||||
* Connection::Event().
|
* Connection::Event().
|
||||||
*/
|
*/
|
||||||
void Event(EventHandlerPtr f, Val* v1, Val* v2 = 0);
|
void Event(EventHandlerPtr f, Val* v1, Val* v2 = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience function that forwards directly to
|
* Convenience function that forwards directly to
|
||||||
|
@ -796,7 +796,7 @@ public:
|
||||||
* connection originator side, and otherwise for the responder side.
|
* connection originator side, and otherwise for the responder side.
|
||||||
*/
|
*/
|
||||||
SupportAnalyzer(const char* name, Connection* conn, bool arg_orig)
|
SupportAnalyzer(const char* name, Connection* conn, bool arg_orig)
|
||||||
: Analyzer(name, conn) { orig = arg_orig; sibling = 0; }
|
: Analyzer(name, conn) { orig = arg_orig; sibling = nullptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor.
|
* Destructor.
|
||||||
|
@ -879,7 +879,7 @@ public:
|
||||||
* @param conn The connection the analyzer is associated with.
|
* @param conn The connection the analyzer is associated with.
|
||||||
*/
|
*/
|
||||||
TransportLayerAnalyzer(const char* name, Connection* conn)
|
TransportLayerAnalyzer(const char* name, Connection* conn)
|
||||||
: Analyzer(name, conn) { pia = 0; }
|
: Analyzer(name, conn) { pia = nullptr; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overridden from parent class.
|
* Overridden from parent class.
|
||||||
|
|
|
@ -292,17 +292,17 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
||||||
if ( ! c )
|
if ( ! c )
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("request to instantiate unknown analyzer");
|
reporter->InternalWarning("request to instantiate unknown analyzer");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! c->Enabled() )
|
if ( ! c->Enabled() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ! c->Factory() )
|
if ( ! c->Factory() )
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("analyzer %s cannot be instantiated dynamically",
|
reporter->InternalWarning("analyzer %s cannot be instantiated dynamically",
|
||||||
GetComponentName(tag).c_str());
|
GetComponentName(tag).c_str());
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analyzer* a = c->Factory()(conn);
|
Analyzer* a = c->Factory()(conn);
|
||||||
|
@ -310,7 +310,7 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
||||||
if ( ! a )
|
if ( ! a )
|
||||||
{
|
{
|
||||||
reporter->InternalWarning("analyzer instantiation failed");
|
reporter->InternalWarning("analyzer instantiation failed");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
a->SetAnalyzerTag(tag);
|
a->SetAnalyzerTag(tag);
|
||||||
|
@ -321,12 +321,12 @@ Analyzer* Manager::InstantiateAnalyzer(const Tag& tag, Connection* conn)
|
||||||
Analyzer* Manager::InstantiateAnalyzer(const char* name, Connection* conn)
|
Analyzer* Manager::InstantiateAnalyzer(const char* name, Connection* conn)
|
||||||
{
|
{
|
||||||
Tag tag = GetComponentTag(name);
|
Tag tag = GetComponentTag(name);
|
||||||
return tag ? InstantiateAnalyzer(tag, conn) : 0;
|
return tag ? InstantiateAnalyzer(tag, conn) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool add_if_not_found)
|
Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool add_if_not_found)
|
||||||
{
|
{
|
||||||
analyzer_map_by_port* m = 0;
|
analyzer_map_by_port* m = nullptr;
|
||||||
|
|
||||||
switch ( proto ) {
|
switch ( proto ) {
|
||||||
case TRANSPORT_TCP:
|
case TRANSPORT_TCP:
|
||||||
|
@ -339,7 +339,7 @@ Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool
|
||||||
|
|
||||||
default:
|
default:
|
||||||
reporter->InternalWarning("unsupported transport protocol in analyzer::Manager::LookupPort");
|
reporter->InternalWarning("unsupported transport protocol in analyzer::Manager::LookupPort");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzer_map_by_port::const_iterator i = m->find(port);
|
analyzer_map_by_port::const_iterator i = m->find(port);
|
||||||
|
@ -348,7 +348,7 @@ Manager::tag_set* Manager::LookupPort(TransportProto proto, uint32_t port, bool
|
||||||
return i->second;
|
return i->second;
|
||||||
|
|
||||||
if ( ! add_if_not_found )
|
if ( ! add_if_not_found )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
tag_set* l = new tag_set;
|
tag_set* l = new tag_set;
|
||||||
m->insert(std::make_pair(port, l));
|
m->insert(std::make_pair(port, l));
|
||||||
|
@ -362,11 +362,11 @@ Manager::tag_set* Manager::LookupPort(PortVal* val, bool add_if_not_found)
|
||||||
|
|
||||||
bool Manager::BuildInitialAnalyzerTree(Connection* conn)
|
bool Manager::BuildInitialAnalyzerTree(Connection* conn)
|
||||||
{
|
{
|
||||||
tcp::TCP_Analyzer* tcp = 0;
|
tcp::TCP_Analyzer* tcp = nullptr;
|
||||||
udp::UDP_Analyzer* udp = 0;
|
udp::UDP_Analyzer* udp = nullptr;
|
||||||
icmp::ICMP_Analyzer* icmp = 0;
|
icmp::ICMP_Analyzer* icmp = nullptr;
|
||||||
TransportLayerAnalyzer* root = 0;
|
TransportLayerAnalyzer* root = nullptr;
|
||||||
pia::PIA* pia = 0;
|
pia::PIA* pia = nullptr;
|
||||||
bool check_port = false;
|
bool check_port = false;
|
||||||
|
|
||||||
switch ( conn->ConnTransport() ) {
|
switch ( conn->ConnTransport() ) {
|
||||||
|
@ -628,7 +628,7 @@ bool Manager::ApplyScheduledAnalyzers(Connection* conn, bool init, TransportLaye
|
||||||
|
|
||||||
EnumVal* tag = it->AsEnumVal();
|
EnumVal* tag = it->AsEnumVal();
|
||||||
Ref(tag);
|
Ref(tag);
|
||||||
conn->Event(scheduled_analyzer_applied, 0, tag);
|
conn->Event(scheduled_analyzer_applied, nullptr, tag);
|
||||||
|
|
||||||
DBG_ANALYZER_ARGS(conn, "activated %s analyzer as scheduled",
|
DBG_ANALYZER_ARGS(conn, "activated %s analyzer as scheduled",
|
||||||
analyzer_mgr->GetComponentName(*it).c_str());
|
analyzer_mgr->GetComponentName(*it).c_str());
|
||||||
|
|
|
@ -311,7 +311,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return True if at least one scheduled analyzer was found.
|
* @return True if at least one scheduled analyzer was found.
|
||||||
*/
|
*/
|
||||||
bool ApplyScheduledAnalyzers(Connection* conn, bool init_and_event = true, TransportLayerAnalyzer* parent = 0);
|
bool ApplyScheduledAnalyzers(Connection* conn, bool init_and_event = true, TransportLayerAnalyzer* parent = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schedules a particular analyzer for an upcoming connection. Once
|
* Schedules a particular analyzer for an upcoming connection. Once
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
using namespace analyzer::bittorrent;
|
using namespace analyzer::bittorrent;
|
||||||
|
|
||||||
static TableType* bt_tracker_headers = 0;
|
static TableType* bt_tracker_headers = nullptr;
|
||||||
static RecordType* bittorrent_peer;
|
static RecordType* bittorrent_peer;
|
||||||
static TableType* bittorrent_peer_set;
|
static TableType* bittorrent_peer_set;
|
||||||
static RecordType* bittorrent_benc_value;
|
static RecordType* bittorrent_benc_value;
|
||||||
|
@ -44,7 +44,7 @@ BitTorrentTracker_Analyzer::BitTorrentTracker_Analyzer(Connection* c)
|
||||||
req_buf[sizeof(req_buf) - 1] = 0;
|
req_buf[sizeof(req_buf) - 1] = 0;
|
||||||
req_buf_pos = req_buf;
|
req_buf_pos = req_buf;
|
||||||
req_buf_len = 0;
|
req_buf_len = 0;
|
||||||
req_val_uri = 0;
|
req_val_uri = nullptr;
|
||||||
req_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
req_val_headers = new TableVal({NewRef{}, bt_tracker_headers});
|
||||||
|
|
||||||
res_state = BTT_RES_STATUS;
|
res_state = BTT_RES_STATUS;
|
||||||
|
@ -230,16 +230,16 @@ void BitTorrentTracker_Analyzer::InitBencParser(void)
|
||||||
benc_count.clear();
|
benc_count.clear();
|
||||||
|
|
||||||
benc_state = BENC_STATE_EMPTY;
|
benc_state = BENC_STATE_EMPTY;
|
||||||
benc_raw = 0;
|
benc_raw = nullptr;
|
||||||
benc_raw_type = BENC_TYPE_NONE;
|
benc_raw_type = BENC_TYPE_NONE;
|
||||||
benc_raw_len = 0;
|
benc_raw_len = 0;
|
||||||
benc_key = 0;
|
benc_key = nullptr;
|
||||||
benc_key_len = 0;
|
benc_key_len = 0;
|
||||||
benc_strlen = 0;
|
benc_strlen = nullptr;
|
||||||
benc_str = 0;
|
benc_str = nullptr;
|
||||||
benc_str_len = 0;
|
benc_str_len = 0;
|
||||||
benc_str_have = 0;
|
benc_str_have = 0;
|
||||||
benc_int = 0;
|
benc_int = nullptr;
|
||||||
benc_int_val = 0;
|
benc_int_val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,8 +353,8 @@ void BitTorrentTracker_Analyzer::EmitRequest(void)
|
||||||
IntrusivePtr{AdoptRef{}, req_val_headers}
|
IntrusivePtr{AdoptRef{}, req_val_headers}
|
||||||
);
|
);
|
||||||
|
|
||||||
req_val_uri = 0;
|
req_val_uri = nullptr;
|
||||||
req_val_headers = 0;
|
req_val_headers = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BitTorrentTracker_Analyzer::ParseResponse(char* line)
|
bool BitTorrentTracker_Analyzer::ParseResponse(char* line)
|
||||||
|
@ -406,7 +406,7 @@ bool BitTorrentTracker_Analyzer::ParseResponse(char* line)
|
||||||
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(res_status)},
|
IntrusivePtr{AdoptRef{}, val_mgr->GetCount(res_status)},
|
||||||
IntrusivePtr{AdoptRef{}, res_val_headers}
|
IntrusivePtr{AdoptRef{}, res_val_headers}
|
||||||
);
|
);
|
||||||
res_val_headers = 0;
|
res_val_headers = nullptr;
|
||||||
res_buf_pos = res_buf + res_buf_len;
|
res_buf_pos = res_buf + res_buf_len;
|
||||||
res_state = BTT_RES_DONE;
|
res_state = BTT_RES_DONE;
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ void BitTorrentTracker_Analyzer::ResponseBenc(int name_len, char* name,
|
||||||
RecordVal* peer = new RecordVal(bittorrent_peer);
|
RecordVal* peer = new RecordVal(bittorrent_peer);
|
||||||
peer->Assign(0, make_intrusive<AddrVal>(ad));
|
peer->Assign(0, make_intrusive<AddrVal>(ad));
|
||||||
peer->Assign(1, val_mgr->GetPort(pt, TRANSPORT_TCP));
|
peer->Assign(1, val_mgr->GetPort(pt, TRANSPORT_TCP));
|
||||||
res_val_peers->Assign(peer, 0);
|
res_val_peers->Assign(peer, nullptr);
|
||||||
|
|
||||||
Unref(peer);
|
Unref(peer);
|
||||||
}
|
}
|
||||||
|
@ -617,9 +617,9 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
||||||
ResponseBenc(benc_key_len, benc_key,
|
ResponseBenc(benc_key_len, benc_key,
|
||||||
benc_raw_type,
|
benc_raw_type,
|
||||||
benc_raw_len, benc_raw);
|
benc_raw_len, benc_raw);
|
||||||
benc_key = 0;
|
benc_key = nullptr;
|
||||||
benc_key_len = 0;
|
benc_key_len = 0;
|
||||||
benc_raw = 0;
|
benc_raw = nullptr;
|
||||||
benc_raw_len = 0;
|
benc_raw_len = 0;
|
||||||
benc_raw_type = BENC_TYPE_NONE;
|
benc_raw_type = BENC_TYPE_NONE;
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
||||||
ResponseBenc(benc_key_len,
|
ResponseBenc(benc_key_len,
|
||||||
benc_key, BENC_TYPE_INT,
|
benc_key, BENC_TYPE_INT,
|
||||||
benc_int_val);
|
benc_int_val);
|
||||||
benc_key = 0;
|
benc_key = nullptr;
|
||||||
benc_key_len = 0;
|
benc_key_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -764,7 +764,7 @@ int BitTorrentTracker_Analyzer::ResponseParseBenc(void)
|
||||||
BENC_TYPE_STR,
|
BENC_TYPE_STR,
|
||||||
benc_str_len, benc_str);
|
benc_str_len, benc_str);
|
||||||
benc_key_len = 0;
|
benc_key_len = 0;
|
||||||
benc_key = 0;
|
benc_key = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! benc_str_len )
|
if ( ! benc_str_len )
|
||||||
|
@ -796,7 +796,7 @@ void BitTorrentTracker_Analyzer::EmitResponse(void)
|
||||||
IntrusivePtr{AdoptRef{}, res_val_benc}
|
IntrusivePtr{AdoptRef{}, res_val_benc}
|
||||||
);
|
);
|
||||||
|
|
||||||
res_val_headers = 0;
|
res_val_headers = nullptr;
|
||||||
res_val_peers = 0;
|
res_val_peers = nullptr;
|
||||||
res_val_benc = 0;
|
res_val_benc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ static analyzer::Analyzer* GetConnsizeAnalyzer(Val* cid)
|
||||||
{
|
{
|
||||||
Connection* c = sessions->FindConnection(cid);
|
Connection* c = sessions->FindConnection(cid);
|
||||||
if ( ! c )
|
if ( ! c )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
analyzer::Analyzer* a = c->FindAnalyzer("CONNSIZE");
|
analyzer::Analyzer* a = c->FindAnalyzer("CONNSIZE");
|
||||||
if ( ! a )
|
if ( ! a )
|
||||||
|
|
|
@ -545,7 +545,7 @@ bool DNS_Interpreter::ParseRR_Name(DNS_MsgInfo* msg,
|
||||||
|
|
||||||
default:
|
default:
|
||||||
analyzer->Conn()->Internal("DNS_RR_bad_name");
|
analyzer->Conn()->Internal("DNS_RR_bad_name");
|
||||||
reply_event = 0;
|
reply_event = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( reply_event && ! msg->skip_event )
|
if ( reply_event && ! msg->skip_event )
|
||||||
|
@ -757,7 +757,7 @@ bool DNS_Interpreter::ParseRR_TSIG(DNS_MsgInfo* msg,
|
||||||
ExtractOctets(data, len, dns_TSIG_addl ? &request_MAC : nullptr);
|
ExtractOctets(data, len, dns_TSIG_addl ? &request_MAC : nullptr);
|
||||||
unsigned int orig_id = ExtractShort(data, len);
|
unsigned int orig_id = ExtractShort(data, len);
|
||||||
unsigned int rr_error = ExtractShort(data, len);
|
unsigned int rr_error = ExtractShort(data, len);
|
||||||
ExtractOctets(data, len, 0); // Other Data
|
ExtractOctets(data, len, nullptr); // Other Data
|
||||||
|
|
||||||
if ( dns_TSIG_addl )
|
if ( dns_TSIG_addl )
|
||||||
{
|
{
|
||||||
|
@ -1256,7 +1256,7 @@ static StringVal* extract_char_string(analyzer::Analyzer* analyzer,
|
||||||
const u_char*& data, int& len, int& rdlen)
|
const u_char*& data, int& len, int& rdlen)
|
||||||
{
|
{
|
||||||
if ( rdlen <= 0 )
|
if ( rdlen <= 0 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
uint8_t str_size = data[0];
|
uint8_t str_size = data[0];
|
||||||
|
|
||||||
|
@ -1267,7 +1267,7 @@ static StringVal* extract_char_string(analyzer::Analyzer* analyzer,
|
||||||
if ( str_size > rdlen )
|
if ( str_size > rdlen )
|
||||||
{
|
{
|
||||||
analyzer->Weird("DNS_TXT_char_str_past_rdlen");
|
analyzer->Weird("DNS_TXT_char_str_past_rdlen");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringVal* rval = new StringVal(str_size,
|
StringVal* rval = new StringVal(str_size,
|
||||||
|
@ -1428,7 +1428,7 @@ DNS_MsgInfo::DNS_MsgInfo(DNS_RawMsgHdr* hdr, int arg_is_query)
|
||||||
id = ntohs(hdr->id);
|
id = ntohs(hdr->id);
|
||||||
is_query = arg_is_query;
|
is_query = arg_is_query;
|
||||||
|
|
||||||
query_name = 0;
|
query_name = nullptr;
|
||||||
atype = TYPE_ALL;
|
atype = TYPE_ALL;
|
||||||
aclass = 0;
|
aclass = 0;
|
||||||
ttl = 0;
|
ttl = 0;
|
||||||
|
@ -1612,7 +1612,7 @@ Contents_DNS::Contents_DNS(Connection* conn, bool orig,
|
||||||
{
|
{
|
||||||
interp = arg_interp;
|
interp = arg_interp;
|
||||||
|
|
||||||
msg_buf = 0;
|
msg_buf = nullptr;
|
||||||
buf_n = buf_len = msg_size = 0;
|
buf_n = buf_len = msg_size = 0;
|
||||||
state = DNS_LEN_HI;
|
state = DNS_LEN_HI;
|
||||||
}
|
}
|
||||||
|
@ -1685,7 +1685,7 @@ void Contents_DNS::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
// Haven't filled up the message buffer yet, no more to do.
|
// Haven't filled up the message buffer yet, no more to do.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ForwardPacket(msg_size, msg_buf, orig, -1, 0, 0);
|
ForwardPacket(msg_size, msg_buf, orig, -1, nullptr, 0);
|
||||||
|
|
||||||
buf_n = 0;
|
buf_n = 0;
|
||||||
state = DNS_LEN_HI;
|
state = DNS_LEN_HI;
|
||||||
|
@ -1699,7 +1699,7 @@ DNS_Analyzer::DNS_Analyzer(Connection* conn)
|
||||||
: tcp::TCP_ApplicationAnalyzer("DNS", conn)
|
: tcp::TCP_ApplicationAnalyzer("DNS", conn)
|
||||||
{
|
{
|
||||||
interp = new DNS_Interpreter(this);
|
interp = new DNS_Interpreter(this);
|
||||||
contents_dns_orig = contents_dns_resp = 0;
|
contents_dns_orig = contents_dns_resp = nullptr;
|
||||||
|
|
||||||
if ( Conn()->ConnTransport() == TRANSPORT_TCP )
|
if ( Conn()->ConnTransport() == TRANSPORT_TCP )
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("DNS", ::analyzer::dns::DNS_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("DNS", ::analyzer::dns::DNS_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Contents_DNS", 0));
|
AddComponent(new ::analyzer::Component("Contents_DNS", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::DNS";
|
config.name = "Zeek::DNS";
|
||||||
|
|
|
@ -60,7 +60,7 @@ void Finger_Analyzer::DeliverStream(int length, const u_char* data, bool is_orig
|
||||||
assert(line <= end_of_line);
|
assert(line <= end_of_line);
|
||||||
size_t n = end_of_line >= line ? end_of_line - line : 0; // just to be sure if assertions aren't on.
|
size_t n = end_of_line >= line ? end_of_line - line : 0; // just to be sure if assertions aren't on.
|
||||||
const char* at = reinterpret_cast<const char*>(memchr(line, '@', n));
|
const char* at = reinterpret_cast<const char*>(memchr(line, '@', n));
|
||||||
const char* host = 0;
|
const char* host = nullptr;
|
||||||
if ( ! at )
|
if ( ! at )
|
||||||
at = host = end_of_line;
|
at = host = end_of_line;
|
||||||
else
|
else
|
||||||
|
|
|
@ -204,7 +204,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
const char* line = (const char*) data;
|
const char* line = (const char*) data;
|
||||||
const char* end_of_line = line + len;
|
const char* end_of_line = line + len;
|
||||||
|
|
||||||
BroString* decoded_adat = 0;
|
BroString* decoded_adat = nullptr;
|
||||||
|
|
||||||
if ( orig )
|
if ( orig )
|
||||||
{
|
{
|
||||||
|
@ -217,7 +217,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
{
|
{
|
||||||
line = skip_whitespace(line + cmd_len, end_of_line);
|
line = skip_whitespace(line + cmd_len, end_of_line);
|
||||||
StringVal encoded(end_of_line - line, line);
|
StringVal encoded(end_of_line - line, line);
|
||||||
decoded_adat = decode_base64(encoded.AsString(), 0, Conn());
|
decoded_adat = decode_base64(encoded.AsString(), nullptr, Conn());
|
||||||
|
|
||||||
if ( first_token )
|
if ( first_token )
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
// Doesn't look like TLS/SSL, so done analyzing.
|
// Doesn't look like TLS/SSL, so done analyzing.
|
||||||
done = true;
|
done = true;
|
||||||
delete decoded_adat;
|
delete decoded_adat;
|
||||||
decoded_adat = 0;
|
decoded_adat = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ void FTP_ADAT_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
{
|
{
|
||||||
line += 5;
|
line += 5;
|
||||||
StringVal encoded(end_of_line - line, line);
|
StringVal encoded(end_of_line - line, line);
|
||||||
decoded_adat = decode_base64(encoded.AsString(), 0, Conn());
|
decoded_adat = decode_base64(encoded.AsString(), nullptr, Conn());
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("FTP", ::analyzer::ftp::FTP_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("FTP", ::analyzer::ftp::FTP_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("FTP_ADAT", 0));
|
AddComponent(new ::analyzer::Component("FTP_ADAT", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::FTP";
|
config.name = "Zeek::FTP";
|
||||||
|
|
|
@ -40,7 +40,7 @@ Gnutella_Analyzer::Gnutella_Analyzer(Connection* conn)
|
||||||
new_state = 0;
|
new_state = 0;
|
||||||
sent_establish = 0;
|
sent_establish = 0;
|
||||||
|
|
||||||
ms = 0;
|
ms = nullptr;
|
||||||
|
|
||||||
orig_msg_state = new GnutellaMsgState();
|
orig_msg_state = new GnutellaMsgState();
|
||||||
resp_msg_state = new GnutellaMsgState();
|
resp_msg_state = new GnutellaMsgState();
|
||||||
|
|
|
@ -48,7 +48,7 @@ HTTP_Entity::HTTP_Entity(HTTP_Message *arg_message, MIME_Entity* parent_entity,
|
||||||
header_length = 0;
|
header_length = 0;
|
||||||
deliver_body = true;
|
deliver_body = true;
|
||||||
encoding = IDENTITY;
|
encoding = IDENTITY;
|
||||||
zip = 0;
|
zip = nullptr;
|
||||||
is_partial_content = false;
|
is_partial_content = false;
|
||||||
offset = 0;
|
offset = 0;
|
||||||
instance_length = -1; // unspecified
|
instance_length = -1; // unspecified
|
||||||
|
@ -67,7 +67,7 @@ void HTTP_Entity::EndOfData()
|
||||||
{
|
{
|
||||||
zip->Done();
|
zip->Done();
|
||||||
delete zip;
|
delete zip;
|
||||||
zip = 0;
|
zip = nullptr;
|
||||||
encoding = IDENTITY;
|
encoding = IDENTITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ void HTTP_Entity::Deliver(int len, const char* data, bool trailing_CRLF)
|
||||||
switch ( chunked_transfer_state ) {
|
switch ( chunked_transfer_state ) {
|
||||||
case EXPECT_CHUNK_SIZE:
|
case EXPECT_CHUNK_SIZE:
|
||||||
ASSERT(trailing_CRLF);
|
ASSERT(trailing_CRLF);
|
||||||
if ( ! atoi_n(len, data, 0, 16, expect_data_length) )
|
if ( ! atoi_n(len, data, nullptr, 16, expect_data_length) )
|
||||||
{
|
{
|
||||||
http_message->Weird("HTTP_bad_chunk_size");
|
http_message->Weird("HTTP_bad_chunk_size");
|
||||||
expect_data_length = 0;
|
expect_data_length = 0;
|
||||||
|
@ -365,7 +365,7 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
||||||
if ( ! mime::is_null_data_chunk(vt) )
|
if ( ! mime::is_null_data_chunk(vt) )
|
||||||
{
|
{
|
||||||
int64_t n;
|
int64_t n;
|
||||||
if ( atoi_n(vt.length, vt.data, 0, 10, n) )
|
if ( atoi_n(vt.length, vt.data, nullptr, 10, n) )
|
||||||
{
|
{
|
||||||
content_length = n;
|
content_length = n;
|
||||||
|
|
||||||
|
@ -427,8 +427,8 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
||||||
instance_length_str.c_str());
|
instance_length_str.c_str());
|
||||||
|
|
||||||
int64_t f, l;
|
int64_t f, l;
|
||||||
atoi_n(first_byte_pos.size(), first_byte_pos.c_str(), 0, 10, f);
|
atoi_n(first_byte_pos.size(), first_byte_pos.c_str(), nullptr, 10, f);
|
||||||
atoi_n(last_byte_pos.size(), last_byte_pos.c_str(), 0, 10, l);
|
atoi_n(last_byte_pos.size(), last_byte_pos.c_str(), nullptr, 10, l);
|
||||||
int64_t len = l - f + 1;
|
int64_t len = l - f + 1;
|
||||||
|
|
||||||
if ( DEBUG_http )
|
if ( DEBUG_http )
|
||||||
|
@ -439,7 +439,7 @@ void HTTP_Entity::SubmitHeader(mime::MIME_Header* h)
|
||||||
if ( instance_length_str != "*" )
|
if ( instance_length_str != "*" )
|
||||||
{
|
{
|
||||||
if ( ! atoi_n(instance_length_str.size(),
|
if ( ! atoi_n(instance_length_str.size(),
|
||||||
instance_length_str.c_str(), 0, 10,
|
instance_length_str.c_str(), nullptr, 10,
|
||||||
instance_length) )
|
instance_length) )
|
||||||
instance_length = 0;
|
instance_length = 0;
|
||||||
}
|
}
|
||||||
|
@ -596,9 +596,9 @@ HTTP_Message::HTTP_Message(HTTP_Analyzer* arg_analyzer,
|
||||||
content_line = arg_cl;
|
content_line = arg_cl;
|
||||||
is_orig = arg_is_orig;
|
is_orig = arg_is_orig;
|
||||||
|
|
||||||
current_entity = 0;
|
current_entity = nullptr;
|
||||||
top_level = new HTTP_Entity(this, 0, expect_body);
|
top_level = new HTTP_Entity(this, nullptr, expect_body);
|
||||||
entity_data_buffer = 0;
|
entity_data_buffer = nullptr;
|
||||||
BeginEntity(top_level);
|
BeginEntity(top_level);
|
||||||
|
|
||||||
start_time = network_time;
|
start_time = network_time;
|
||||||
|
@ -837,20 +837,20 @@ HTTP_Analyzer::HTTP_Analyzer(Connection* conn)
|
||||||
keep_alive = 0;
|
keep_alive = 0;
|
||||||
connection_close = 0;
|
connection_close = 0;
|
||||||
|
|
||||||
request_message = reply_message = 0;
|
request_message = reply_message = nullptr;
|
||||||
request_state = EXPECT_REQUEST_LINE;
|
request_state = EXPECT_REQUEST_LINE;
|
||||||
reply_state = EXPECT_REPLY_LINE;
|
reply_state = EXPECT_REPLY_LINE;
|
||||||
|
|
||||||
request_ongoing = 0;
|
request_ongoing = 0;
|
||||||
request_method = request_URI = 0;
|
request_method = request_URI = nullptr;
|
||||||
unescaped_URI = 0;
|
unescaped_URI = nullptr;
|
||||||
|
|
||||||
reply_ongoing = 0;
|
reply_ongoing = 0;
|
||||||
reply_code = 0;
|
reply_code = 0;
|
||||||
reply_reason_phrase = 0;
|
reply_reason_phrase = nullptr;
|
||||||
|
|
||||||
connect_request = false;
|
connect_request = false;
|
||||||
pia = 0;
|
pia = nullptr;
|
||||||
upgraded = false;
|
upgraded = false;
|
||||||
upgrade_connection = false;
|
upgrade_connection = false;
|
||||||
upgrade_protocol.clear();
|
upgrade_protocol.clear();
|
||||||
|
@ -882,10 +882,10 @@ void HTTP_Analyzer::Done()
|
||||||
ReplyMade(true, "message interrupted when connection done");
|
ReplyMade(true, "message interrupted when connection done");
|
||||||
|
|
||||||
delete request_message;
|
delete request_message;
|
||||||
request_message = 0;
|
request_message = nullptr;
|
||||||
|
|
||||||
delete reply_message;
|
delete reply_message;
|
||||||
reply_message = 0;
|
reply_message = nullptr;
|
||||||
|
|
||||||
GenStats();
|
GenStats();
|
||||||
|
|
||||||
|
@ -1061,8 +1061,8 @@ void HTTP_Analyzer::DeliverStream(int len, const u_char* data, bool is_orig)
|
||||||
|
|
||||||
if ( AddChildAnalyzer(pia) )
|
if ( AddChildAnalyzer(pia) )
|
||||||
{
|
{
|
||||||
pia->FirstPacket(true, 0);
|
pia->FirstPacket(true, nullptr);
|
||||||
pia->FirstPacket(false, 0);
|
pia->FirstPacket(false, nullptr);
|
||||||
|
|
||||||
// This connection has transitioned to no longer
|
// This connection has transitioned to no longer
|
||||||
// being http and the content line support analyzers
|
// being http and the content line support analyzers
|
||||||
|
@ -1073,7 +1073,7 @@ void HTTP_Analyzer::DeliverStream(int len, const u_char* data, bool is_orig)
|
||||||
|
|
||||||
else
|
else
|
||||||
// AddChildAnalyzer() will have deleted PIA.
|
// AddChildAnalyzer() will have deleted PIA.
|
||||||
pia = 0;
|
pia = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1193,7 +1193,7 @@ const char* HTTP_Analyzer::PrefixMatch(const char* line,
|
||||||
|
|
||||||
if ( *prefix )
|
if ( *prefix )
|
||||||
// It didn't match.
|
// It didn't match.
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@ -1201,15 +1201,15 @@ const char* HTTP_Analyzer::PrefixMatch(const char* line,
|
||||||
const char* HTTP_Analyzer::PrefixWordMatch(const char* line,
|
const char* HTTP_Analyzer::PrefixWordMatch(const char* line,
|
||||||
const char* end_of_line, const char* prefix)
|
const char* end_of_line, const char* prefix)
|
||||||
{
|
{
|
||||||
if ( (line = PrefixMatch(line, end_of_line, prefix)) == 0 )
|
if ( (line = PrefixMatch(line, end_of_line, prefix)) == nullptr )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
const char* orig_line = line;
|
const char* orig_line = line;
|
||||||
line = skip_whitespace(line, end_of_line);
|
line = skip_whitespace(line, end_of_line);
|
||||||
|
|
||||||
if ( line == orig_line )
|
if ( line == orig_line )
|
||||||
// Word didn't end at prefix.
|
// Word didn't end at prefix.
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@ -1235,7 +1235,7 @@ static const char* get_HTTP_token(const char* s, const char* e)
|
||||||
|
|
||||||
int HTTP_Analyzer::HTTP_RequestLine(const char* line, const char* end_of_line)
|
int HTTP_Analyzer::HTTP_RequestLine(const char* line, const char* end_of_line)
|
||||||
{
|
{
|
||||||
const char* rest = 0;
|
const char* rest = nullptr;
|
||||||
const char* end_of_method = get_HTTP_token(line, end_of_line);
|
const char* end_of_method = get_HTTP_token(line, end_of_line);
|
||||||
|
|
||||||
if ( end_of_method == line )
|
if ( end_of_method == line )
|
||||||
|
@ -1439,7 +1439,7 @@ void HTTP_Analyzer::HTTP_Reply()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Unref(reply_reason_phrase);
|
Unref(reply_reason_phrase);
|
||||||
reply_reason_phrase = 0;
|
reply_reason_phrase = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1459,7 +1459,7 @@ void HTTP_Analyzer::RequestMade(bool interrupted, const char* msg)
|
||||||
Unref(unescaped_URI);
|
Unref(unescaped_URI);
|
||||||
Unref(request_URI);
|
Unref(request_URI);
|
||||||
|
|
||||||
request_method = request_URI = unescaped_URI = 0;
|
request_method = request_URI = unescaped_URI = nullptr;
|
||||||
|
|
||||||
num_request_lines = 0;
|
num_request_lines = 0;
|
||||||
|
|
||||||
|
@ -1492,7 +1492,7 @@ void HTTP_Analyzer::ReplyMade(bool interrupted, const char* msg)
|
||||||
if ( reply_reason_phrase )
|
if ( reply_reason_phrase )
|
||||||
{
|
{
|
||||||
Unref(reply_reason_phrase);
|
Unref(reply_reason_phrase);
|
||||||
reply_reason_phrase = 0;
|
reply_reason_phrase = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// unanswered requests = 1 because there is no pop after 101.
|
// unanswered requests = 1 because there is no pop after 101.
|
||||||
|
@ -1531,7 +1531,7 @@ void HTTP_Analyzer::RequestClash(Val* /* clash_val */)
|
||||||
|
|
||||||
const BroString* HTTP_Analyzer::UnansweredRequestMethod()
|
const BroString* HTTP_Analyzer::UnansweredRequestMethod()
|
||||||
{
|
{
|
||||||
return unanswered_requests.empty() ? 0 : unanswered_requests.front()->AsString();
|
return unanswered_requests.empty() ? nullptr : unanswered_requests.front()->AsString();
|
||||||
}
|
}
|
||||||
|
|
||||||
int HTTP_Analyzer::HTTP_ReplyLine(const char* line, const char* end_of_line)
|
int HTTP_Analyzer::HTTP_ReplyLine(const char* line, const char* end_of_line)
|
||||||
|
|
|
@ -81,7 +81,7 @@ void ICMP_Analyzer::DeliverPacket(int len, const u_char* data,
|
||||||
if ( rule_matcher )
|
if ( rule_matcher )
|
||||||
{
|
{
|
||||||
if ( ! matcher_state.MatcherInitialized(is_orig) )
|
if ( ! matcher_state.MatcherInitialized(is_orig) )
|
||||||
matcher_state.InitEndpointMatcher(this, ip, len, is_orig, 0);
|
matcher_state.InitEndpointMatcher(this, ip, len, is_orig, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
type = icmpp->icmp_type;
|
type = icmpp->icmp_type;
|
||||||
|
@ -497,7 +497,7 @@ void ICMP_Analyzer::Echo(double t, const struct icmp* icmpp, int len,
|
||||||
int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
// For handling all Echo related ICMP messages
|
// For handling all Echo related ICMP messages
|
||||||
EventHandlerPtr f = 0;
|
EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
if ( ip_hdr->NextProto() == IPPROTO_ICMPV6 )
|
if ( ip_hdr->NextProto() == IPPROTO_ICMPV6 )
|
||||||
f = (icmpp->icmp_type == ICMP6_ECHO_REQUEST)
|
f = (icmpp->icmp_type == ICMP6_ECHO_REQUEST)
|
||||||
|
@ -658,7 +658,7 @@ void ICMP_Analyzer::RouterSolicit(double t, const struct icmp* icmpp, int len,
|
||||||
void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
||||||
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = 0;
|
EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
switch ( icmpp->icmp_type )
|
switch ( icmpp->icmp_type )
|
||||||
{
|
{
|
||||||
|
@ -684,7 +684,7 @@ void ICMP_Analyzer::Context4(double t, const struct icmp* icmpp,
|
||||||
void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
||||||
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
int len, int caplen, const u_char*& data, const IP_Hdr* ip_hdr)
|
||||||
{
|
{
|
||||||
EventHandlerPtr f = 0;
|
EventHandlerPtr f = nullptr;
|
||||||
|
|
||||||
switch ( icmpp->icmp_type )
|
switch ( icmpp->icmp_type )
|
||||||
{
|
{
|
||||||
|
@ -720,8 +720,8 @@ void ICMP_Analyzer::Context6(double t, const struct icmp* icmpp,
|
||||||
|
|
||||||
VectorVal* ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_char* data)
|
VectorVal* ICMP_Analyzer::BuildNDOptionsVal(int caplen, const u_char* data)
|
||||||
{
|
{
|
||||||
static RecordType* icmp6_nd_option_type = 0;
|
static RecordType* icmp6_nd_option_type = nullptr;
|
||||||
static RecordType* icmp6_nd_prefix_info_type = 0;
|
static RecordType* icmp6_nd_prefix_info_type = nullptr;
|
||||||
|
|
||||||
if ( ! icmp6_nd_option_type )
|
if ( ! icmp6_nd_option_type )
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,7 +52,7 @@ void Ident_Analyzer::DeliverStream(int length, const u_char* data, bool is_orig)
|
||||||
const char* orig_line = line;
|
const char* orig_line = line;
|
||||||
const char* end_of_line = line + length;
|
const char* end_of_line = line + length;
|
||||||
|
|
||||||
tcp::TCP_Endpoint* s = 0;
|
tcp::TCP_Endpoint* s = nullptr;
|
||||||
|
|
||||||
if ( TCP() )
|
if ( TCP() )
|
||||||
s = is_orig ? TCP()->Orig() : TCP()->Resp();
|
s = is_orig ? TCP()->Orig() : TCP()->Resp();
|
||||||
|
@ -194,17 +194,17 @@ const char* Ident_Analyzer::ParsePair(const char* line, const char* end_of_line,
|
||||||
line = ParsePort(line, end_of_line, p1);
|
line = ParsePort(line, end_of_line, p1);
|
||||||
if ( ! line )
|
if ( ! line )
|
||||||
{
|
{
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( line >= end_of_line || line[0] != ',' )
|
if ( line >= end_of_line || line[0] != ',' )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
++line;
|
++line;
|
||||||
|
|
||||||
line = ParsePort(line, end_of_line, p2);
|
line = ParsePort(line, end_of_line, p2);
|
||||||
if ( ! line )
|
if ( ! line )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return line;
|
return line;
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ const char* Ident_Analyzer::ParsePort(const char* line, const char* end_of_line,
|
||||||
|
|
||||||
line = skip_whitespace(line, end_of_line);
|
line = skip_whitespace(line, end_of_line);
|
||||||
if ( ! isdigit(*line) )
|
if ( ! isdigit(*line) )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
const char* l = line;
|
const char* l = line;
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
if ( parts[i][0] == '@' )
|
if ( parts[i][0] == '@' )
|
||||||
parts[i] = parts[i].substr(1);
|
parts[i] = parts[i].substr(1);
|
||||||
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
||||||
set->Assign(idx.get(), 0);
|
set->Assign(idx.get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnqueueConnEvent(irc_names_info,
|
EnqueueConnEvent(irc_names_info,
|
||||||
|
@ -468,7 +468,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
for ( unsigned int i = 0; i < parts.size(); ++i )
|
for ( unsigned int i = 0; i < parts.size(); ++i )
|
||||||
{
|
{
|
||||||
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
auto idx = make_intrusive<StringVal>(parts[i].c_str());
|
||||||
set->Assign(idx.get(), 0);
|
set->Assign(idx.get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnqueueConnEvent(irc_whois_channel_line,
|
EnqueueConnEvent(irc_whois_channel_line,
|
||||||
|
@ -857,7 +857,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
||||||
// User mode.
|
// User mode.
|
||||||
info->Assign(3, make_intrusive<StringVal>(empty_string.c_str()));
|
info->Assign(3, make_intrusive<StringVal>(empty_string.c_str()));
|
||||||
list->Assign(info, 0);
|
list->Assign(info, nullptr);
|
||||||
Unref(info);
|
Unref(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -918,7 +918,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
info->Assign(2, make_intrusive<StringVal>(empty_string.c_str()));
|
||||||
// User mode:
|
// User mode:
|
||||||
info->Assign(3, make_intrusive<StringVal>(mode.c_str()));
|
info->Assign(3, make_intrusive<StringVal>(mode.c_str()));
|
||||||
list->Assign(info.get(), 0);
|
list->Assign(info.get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnqueueConnEvent(irc_join_message,
|
EnqueueConnEvent(irc_join_message,
|
||||||
|
@ -957,7 +957,7 @@ void IRC_Analyzer::DeliverStream(int length, const u_char* line, bool orig)
|
||||||
for ( unsigned int i = 0; i < channelList.size(); ++i )
|
for ( unsigned int i = 0; i < channelList.size(); ++i )
|
||||||
{
|
{
|
||||||
auto idx = make_intrusive<StringVal>(channelList[i].c_str());
|
auto idx = make_intrusive<StringVal>(channelList[i].c_str());
|
||||||
set->Assign(idx.get(), 0);
|
set->Assign(idx.get(), nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EnqueueConnEvent(irc_part_message,
|
EnqueueConnEvent(irc_part_message,
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
using namespace analyzer::login;
|
using namespace analyzer::login;
|
||||||
|
|
||||||
static RE_Matcher* re_skip_authentication = 0;
|
static RE_Matcher* re_skip_authentication = nullptr;
|
||||||
static RE_Matcher* re_direct_login_prompts;
|
static RE_Matcher* re_direct_login_prompts;
|
||||||
static RE_Matcher* re_login_prompts;
|
static RE_Matcher* re_login_prompts;
|
||||||
static RE_Matcher* re_login_non_failure_msgs;
|
static RE_Matcher* re_login_non_failure_msgs;
|
||||||
|
@ -39,7 +39,7 @@ Login_Analyzer::Login_Analyzer(const char* name, Connection* conn)
|
||||||
user_text_first = 0;
|
user_text_first = 0;
|
||||||
user_text_last = MAX_USER_TEXT - 1;
|
user_text_last = MAX_USER_TEXT - 1;
|
||||||
num_user_text = 0;
|
num_user_text = 0;
|
||||||
client_name = username = 0;
|
client_name = username = nullptr;
|
||||||
saw_ploy = is_VMS = false;
|
saw_ploy = is_VMS = false;
|
||||||
|
|
||||||
if ( ! re_skip_authentication )
|
if ( ! re_skip_authentication )
|
||||||
|
@ -214,7 +214,7 @@ void Login_Analyzer::AuthenticationDialog(bool orig, char* line)
|
||||||
// respect to it (see below).
|
// respect to it (see below).
|
||||||
login_prompt_line != failure_line);
|
login_prompt_line != failure_line);
|
||||||
|
|
||||||
const char* next_prompt = 0;
|
const char* next_prompt = nullptr;
|
||||||
while ( (*prompt != '\0' &&
|
while ( (*prompt != '\0' &&
|
||||||
(next_prompt = IsLoginPrompt(prompt + 1))) ||
|
(next_prompt = IsLoginPrompt(prompt + 1))) ||
|
||||||
multi_line_prompt )
|
multi_line_prompt )
|
||||||
|
@ -507,7 +507,7 @@ const char* Login_Analyzer::IsLoginPrompt(const char* line) const
|
||||||
int prompt_match = re_login_prompts->MatchAnywhere(line);
|
int prompt_match = re_login_prompts->MatchAnywhere(line);
|
||||||
if ( ! prompt_match || IsFailureMsg(line) )
|
if ( ! prompt_match || IsFailureMsg(line) )
|
||||||
// IRIX can report "login: ERROR: Login incorrect"
|
// IRIX can report "login: ERROR: Login incorrect"
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return &line[prompt_match];
|
return &line[prompt_match];
|
||||||
}
|
}
|
||||||
|
@ -565,7 +565,7 @@ char* Login_Analyzer::PeekUserText()
|
||||||
{
|
{
|
||||||
reporter->AnalyzerError(this,
|
reporter->AnalyzerError(this,
|
||||||
"underflow in Login_Analyzer::PeekUserText()");
|
"underflow in Login_Analyzer::PeekUserText()");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return user_text[user_text_first];
|
return user_text[user_text_first];
|
||||||
|
@ -576,7 +576,7 @@ char* Login_Analyzer::PopUserText()
|
||||||
char* s = PeekUserText();
|
char* s = PeekUserText();
|
||||||
|
|
||||||
if ( ! s )
|
if ( ! s )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( ++user_text_first == MAX_USER_TEXT )
|
if ( ++user_text_first == MAX_USER_TEXT )
|
||||||
user_text_first = 0;
|
user_text_first = 0;
|
||||||
|
|
|
@ -320,7 +320,7 @@ char* TelnetEnvironmentOption::ExtractEnv(u_char*& data, int& len, int& code)
|
||||||
|
|
||||||
if ( code != ENVIRON_VAR && code != ENVIRON_VAL &&
|
if ( code != ENVIRON_VAR && code != ENVIRON_VAL &&
|
||||||
code != ENVIRON_USERVAR )
|
code != ENVIRON_USERVAR )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// Move past code.
|
// Move past code.
|
||||||
--len;
|
--len;
|
||||||
|
@ -338,7 +338,7 @@ char* TelnetEnvironmentOption::ExtractEnv(u_char*& data, int& len, int& code)
|
||||||
{
|
{
|
||||||
++d; // move past ESC
|
++d; // move past ESC
|
||||||
if ( d >= data_end )
|
if ( d >= data_end )
|
||||||
return 0;
|
return nullptr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ TelnetOption* NVT_Analyzer::FindOption(unsigned int code)
|
||||||
if ( options[i]->Code() == code )
|
if ( options[i]->Code() == code )
|
||||||
return options[i];
|
return options[i];
|
||||||
|
|
||||||
TelnetOption* opt = 0;
|
TelnetOption* opt = nullptr;
|
||||||
if ( i < NUM_TELNET_OPTIONS )
|
if ( i < NUM_TELNET_OPTIONS )
|
||||||
{ // Maybe we haven't created this option yet.
|
{ // Maybe we haven't created this option yet.
|
||||||
switch ( code ) {
|
switch ( code ) {
|
||||||
|
|
|
@ -17,10 +17,10 @@ public:
|
||||||
AddComponent(new ::analyzer::Component("Telnet", ::analyzer::login::Telnet_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("Telnet", ::analyzer::login::Telnet_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Rsh", ::analyzer::login::Rsh_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("Rsh", ::analyzer::login::Rsh_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Rlogin", ::analyzer::login::Rlogin_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("Rlogin", ::analyzer::login::Rlogin_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("NVT", 0));
|
AddComponent(new ::analyzer::Component("NVT", nullptr));
|
||||||
AddComponent(new ::analyzer::Component("Login", 0));
|
AddComponent(new ::analyzer::Component("Login", nullptr));
|
||||||
AddComponent(new ::analyzer::Component("Contents_Rsh", 0));
|
AddComponent(new ::analyzer::Component("Contents_Rsh", nullptr));
|
||||||
AddComponent(new ::analyzer::Component("Contents_Rlogin", 0));
|
AddComponent(new ::analyzer::Component("Contents_Rlogin", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::Login";
|
config.name = "Zeek::Login";
|
||||||
|
|
|
@ -16,7 +16,7 @@ Contents_Rlogin_Analyzer::Contents_Rlogin_Analyzer(Connection* conn, bool orig,
|
||||||
{
|
{
|
||||||
num_bytes_to_scan = 0;
|
num_bytes_to_scan = 0;
|
||||||
analyzer = arg_analyzer;
|
analyzer = arg_analyzer;
|
||||||
peer = 0;
|
peer = nullptr;
|
||||||
|
|
||||||
if ( orig )
|
if ( orig )
|
||||||
state = save_state = RLOGIN_FIRST_NULL;
|
state = save_state = RLOGIN_FIRST_NULL;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
namespace analyzer { namespace mime {
|
namespace analyzer { namespace mime {
|
||||||
|
|
||||||
static const data_chunk_t null_data_chunk = { 0, 0 };
|
static const data_chunk_t null_data_chunk = { 0, nullptr };
|
||||||
|
|
||||||
int mime_header_only = 0;
|
int mime_header_only = 0;
|
||||||
int mime_decode_data = 1;
|
int mime_decode_data = 1;
|
||||||
|
@ -65,14 +65,14 @@ enum MIME_BOUNDARY_DELIMITER {
|
||||||
static const char* MIMEHeaderName[] = {
|
static const char* MIMEHeaderName[] = {
|
||||||
"content-type",
|
"content-type",
|
||||||
"content-transfer-encoding",
|
"content-transfer-encoding",
|
||||||
0,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* MIMEContentTypeName[] = {
|
static const char* MIMEContentTypeName[] = {
|
||||||
"MULTIPART",
|
"MULTIPART",
|
||||||
"MESSAGE",
|
"MESSAGE",
|
||||||
"TEXT",
|
"TEXT",
|
||||||
0,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* MIMEContentSubtypeName[] = {
|
static const char* MIMEContentSubtypeName[] = {
|
||||||
|
@ -86,7 +86,7 @@ static const char* MIMEContentSubtypeName[] = {
|
||||||
|
|
||||||
"PLAIN", // for text
|
"PLAIN", // for text
|
||||||
|
|
||||||
0, // other
|
nullptr, // other
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char* MIMEContentEncodingName[] = {
|
static const char* MIMEContentEncodingName[] = {
|
||||||
|
@ -95,12 +95,12 @@ static const char* MIMEContentEncodingName[] = {
|
||||||
"BINARY",
|
"BINARY",
|
||||||
"QUOTED-PRINTABLE",
|
"QUOTED-PRINTABLE",
|
||||||
"BASE64",
|
"BASE64",
|
||||||
0,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
bool is_null_data_chunk(data_chunk_t b)
|
bool is_null_data_chunk(data_chunk_t b)
|
||||||
{
|
{
|
||||||
return b.data == 0;
|
return b.data == nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_lws(char ch)
|
bool is_lws(char ch)
|
||||||
|
@ -437,7 +437,7 @@ using namespace analyzer::mime;
|
||||||
|
|
||||||
MIME_Multiline::MIME_Multiline()
|
MIME_Multiline::MIME_Multiline()
|
||||||
{
|
{
|
||||||
line = 0;
|
line = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
MIME_Multiline::~MIME_Multiline()
|
MIME_Multiline::~MIME_Multiline()
|
||||||
|
@ -454,7 +454,7 @@ void MIME_Multiline::append(int len, const char* data)
|
||||||
BroString* MIME_Multiline::get_concatenated_line()
|
BroString* MIME_Multiline::get_concatenated_line()
|
||||||
{
|
{
|
||||||
if ( buffer.empty() )
|
if ( buffer.empty() )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
delete line;
|
delete line;
|
||||||
line = concatenate(buffer);
|
line = concatenate(buffer);
|
||||||
|
@ -546,7 +546,7 @@ void MIME_Entity::init()
|
||||||
in_header = 1;
|
in_header = 1;
|
||||||
end_of_data = 0;
|
end_of_data = 0;
|
||||||
|
|
||||||
current_header_line = 0;
|
current_header_line = nullptr;
|
||||||
current_field_type = MIME_FIELD_OTHER;
|
current_field_type = MIME_FIELD_OTHER;
|
||||||
|
|
||||||
need_to_parse_parameters = 0;
|
need_to_parse_parameters = 0;
|
||||||
|
@ -554,22 +554,22 @@ void MIME_Entity::init()
|
||||||
content_type_str = new StringVal("TEXT");
|
content_type_str = new StringVal("TEXT");
|
||||||
content_subtype_str = new StringVal("PLAIN");
|
content_subtype_str = new StringVal("PLAIN");
|
||||||
|
|
||||||
content_encoding_str = 0;
|
content_encoding_str = nullptr;
|
||||||
multipart_boundary = 0;
|
multipart_boundary = nullptr;
|
||||||
content_type = CONTENT_TYPE_TEXT;
|
content_type = CONTENT_TYPE_TEXT;
|
||||||
content_subtype = CONTENT_SUBTYPE_PLAIN;
|
content_subtype = CONTENT_SUBTYPE_PLAIN;
|
||||||
content_encoding = CONTENT_ENCODING_OTHER;
|
content_encoding = CONTENT_ENCODING_OTHER;
|
||||||
|
|
||||||
parent = 0;
|
parent = nullptr;
|
||||||
current_child_entity = 0;
|
current_child_entity = nullptr;
|
||||||
|
|
||||||
base64_decoder = 0;
|
base64_decoder = nullptr;
|
||||||
|
|
||||||
data_buf_length = 0;
|
data_buf_length = 0;
|
||||||
data_buf_data = 0;
|
data_buf_data = nullptr;
|
||||||
data_buf_offset = -1;
|
data_buf_offset = -1;
|
||||||
|
|
||||||
message = 0;
|
message = nullptr;
|
||||||
delay_adding_implicit_CRLF = false;
|
delay_adding_implicit_CRLF = false;
|
||||||
want_all_headers = false;
|
want_all_headers = false;
|
||||||
}
|
}
|
||||||
|
@ -577,7 +577,7 @@ void MIME_Entity::init()
|
||||||
MIME_Entity::~MIME_Entity()
|
MIME_Entity::~MIME_Entity()
|
||||||
{
|
{
|
||||||
if ( ! end_of_data )
|
if ( ! end_of_data )
|
||||||
reporter->AnalyzerError(message ? message->GetAnalyzer() : 0,
|
reporter->AnalyzerError(message ? message->GetAnalyzer() : nullptr,
|
||||||
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
"missing MIME_Entity::EndOfData() before ~MIME_Entity");
|
||||||
|
|
||||||
delete current_header_line;
|
delete current_header_line;
|
||||||
|
@ -653,7 +653,7 @@ void MIME_Entity::EndOfData()
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( current_child_entity != 0 )
|
if ( current_child_entity != nullptr )
|
||||||
{
|
{
|
||||||
if ( content_type == CONTENT_TYPE_MULTIPART )
|
if ( content_type == CONTENT_TYPE_MULTIPART )
|
||||||
IllegalFormat("multipart closing boundary delimiter missing");
|
IllegalFormat("multipart closing boundary delimiter missing");
|
||||||
|
@ -675,13 +675,13 @@ void MIME_Entity::NewDataLine(int len, const char* data, bool trailing_CRLF)
|
||||||
{
|
{
|
||||||
switch ( CheckBoundaryDelimiter(len, data) ) {
|
switch ( CheckBoundaryDelimiter(len, data) ) {
|
||||||
case MULTIPART_BOUNDARY:
|
case MULTIPART_BOUNDARY:
|
||||||
if ( current_child_entity != 0 )
|
if ( current_child_entity != nullptr )
|
||||||
EndChildEntity();
|
EndChildEntity();
|
||||||
BeginChildEntity();
|
BeginChildEntity();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case MULTIPART_CLOSING_BOUNDARY:
|
case MULTIPART_CLOSING_BOUNDARY:
|
||||||
if ( current_child_entity != 0 )
|
if ( current_child_entity != nullptr )
|
||||||
EndChildEntity();
|
EndChildEntity();
|
||||||
EndOfData();
|
EndOfData();
|
||||||
return;
|
return;
|
||||||
|
@ -695,7 +695,7 @@ void MIME_Entity::NewDataLine(int len, const char* data, bool trailing_CRLF)
|
||||||
// binary encoding, and thus do not need to decode
|
// binary encoding, and thus do not need to decode
|
||||||
// before passing the data to child.
|
// before passing the data to child.
|
||||||
|
|
||||||
if ( current_child_entity != 0 )
|
if ( current_child_entity != nullptr )
|
||||||
// Data before the first or after the last
|
// Data before the first or after the last
|
||||||
// boundary delimiter are ignored
|
// boundary delimiter are ignored
|
||||||
current_child_entity->Deliver(len, data, trailing_CRLF);
|
current_child_entity->Deliver(len, data, trailing_CRLF);
|
||||||
|
@ -722,7 +722,7 @@ void MIME_Entity::NewHeader(int len, const char* data)
|
||||||
|
|
||||||
void MIME_Entity::ContHeader(int len, const char* data)
|
void MIME_Entity::ContHeader(int len, const char* data)
|
||||||
{
|
{
|
||||||
if ( current_header_line == 0 )
|
if ( current_header_line == nullptr )
|
||||||
{
|
{
|
||||||
IllegalFormat("first header line starts with linear whitespace");
|
IllegalFormat("first header line starts with linear whitespace");
|
||||||
|
|
||||||
|
@ -737,11 +737,11 @@ void MIME_Entity::ContHeader(int len, const char* data)
|
||||||
|
|
||||||
void MIME_Entity::FinishHeader()
|
void MIME_Entity::FinishHeader()
|
||||||
{
|
{
|
||||||
if ( current_header_line == 0 )
|
if ( current_header_line == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MIME_Header* h = new MIME_Header(current_header_line);
|
MIME_Header* h = new MIME_Header(current_header_line);
|
||||||
current_header_line = 0;
|
current_header_line = nullptr;
|
||||||
|
|
||||||
if ( ! is_null_data_chunk(h->get_name()) )
|
if ( ! is_null_data_chunk(h->get_name()) )
|
||||||
{
|
{
|
||||||
|
@ -762,7 +762,7 @@ int MIME_Entity::LookupMIMEHeaderName(data_chunk_t name)
|
||||||
// A linear lookup should be fine for now.
|
// A linear lookup should be fine for now.
|
||||||
// header names are case-insensitive (RFC 822, 2822, 2045).
|
// header names are case-insensitive (RFC 822, 2822, 2045).
|
||||||
|
|
||||||
for ( int i = 0; MIMEHeaderName[i] != 0; ++i )
|
for ( int i = 0; MIMEHeaderName[i] != nullptr; ++i )
|
||||||
if ( istrequal(name, MIMEHeaderName[i]) )
|
if ( istrequal(name, MIMEHeaderName[i]) )
|
||||||
return i;
|
return i;
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -770,7 +770,7 @@ int MIME_Entity::LookupMIMEHeaderName(data_chunk_t name)
|
||||||
|
|
||||||
void MIME_Entity::ParseMIMEHeader(MIME_Header* h)
|
void MIME_Entity::ParseMIMEHeader(MIME_Header* h)
|
||||||
{
|
{
|
||||||
if ( h == 0 )
|
if ( h == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
current_field_type = LookupMIMEHeaderName(h->get_name());
|
current_field_type = LookupMIMEHeaderName(h->get_name());
|
||||||
|
@ -884,7 +884,7 @@ bool MIME_Entity::ParseFieldParameters(int len, const char* data)
|
||||||
data += offset;
|
data += offset;
|
||||||
len -= offset;
|
len -= offset;
|
||||||
|
|
||||||
BroString* val = 0;
|
BroString* val = nullptr;
|
||||||
|
|
||||||
if ( current_field_type == MIME_CONTENT_TYPE &&
|
if ( current_field_type == MIME_CONTENT_TYPE &&
|
||||||
content_type == CONTENT_TYPE_MULTIPART &&
|
content_type == CONTENT_TYPE_MULTIPART &&
|
||||||
|
@ -1172,13 +1172,13 @@ void MIME_Entity::FinishDecodeBase64()
|
||||||
}
|
}
|
||||||
|
|
||||||
delete base64_decoder;
|
delete base64_decoder;
|
||||||
base64_decoder = 0;
|
base64_decoder = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MIME_Entity::GetDataBuffer()
|
bool MIME_Entity::GetDataBuffer()
|
||||||
{
|
{
|
||||||
int ret = message->RequestBuffer(&data_buf_length, &data_buf_data);
|
int ret = message->RequestBuffer(&data_buf_length, &data_buf_data);
|
||||||
if ( ! ret || data_buf_length == 0 || data_buf_data == 0 )
|
if ( ! ret || data_buf_length == 0 || data_buf_data == nullptr )
|
||||||
{
|
{
|
||||||
// reporter->InternalError("cannot get data buffer from MIME_Message", "");
|
// reporter->InternalError("cannot get data buffer from MIME_Message", "");
|
||||||
return false;
|
return false;
|
||||||
|
@ -1250,18 +1250,18 @@ void MIME_Entity::SubmitAllHeaders()
|
||||||
|
|
||||||
void MIME_Entity::BeginChildEntity()
|
void MIME_Entity::BeginChildEntity()
|
||||||
{
|
{
|
||||||
ASSERT(current_child_entity == 0);
|
ASSERT(current_child_entity == nullptr);
|
||||||
current_child_entity = NewChildEntity();
|
current_child_entity = NewChildEntity();
|
||||||
message->BeginEntity(current_child_entity);
|
message->BeginEntity(current_child_entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIME_Entity::EndChildEntity()
|
void MIME_Entity::EndChildEntity()
|
||||||
{
|
{
|
||||||
ASSERT(current_child_entity != 0);
|
ASSERT(current_child_entity != nullptr);
|
||||||
|
|
||||||
current_child_entity->EndOfData();
|
current_child_entity->EndOfData();
|
||||||
delete current_child_entity;
|
delete current_child_entity;
|
||||||
current_child_entity = 0;
|
current_child_entity = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MIME_Entity::IllegalFormat(const char* explanation)
|
void MIME_Entity::IllegalFormat(const char* explanation)
|
||||||
|
@ -1349,7 +1349,7 @@ MIME_Mail::MIME_Mail(analyzer::Analyzer* mail_analyzer, bool orig, int buf_size)
|
||||||
|
|
||||||
content_hash_length = 0;
|
content_hash_length = 0;
|
||||||
|
|
||||||
top_level = new MIME_Entity(this, 0); // to be changed to MIME_Mail
|
top_level = new MIME_Entity(this, nullptr); // to be changed to MIME_Mail
|
||||||
BeginEntity(top_level);
|
BeginEntity(top_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ public:
|
||||||
// Cannot initialize top_level entity because we do
|
// Cannot initialize top_level entity because we do
|
||||||
// not know its type yet (MIME_Entity / MIME_Mail /
|
// not know its type yet (MIME_Entity / MIME_Mail /
|
||||||
// etc.).
|
// etc.).
|
||||||
top_level = 0;
|
top_level = nullptr;
|
||||||
finished = false;
|
finished = false;
|
||||||
analyzer = arg_analyzer;
|
analyzer = arg_analyzer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,7 +83,7 @@ void NCP_Session::DeliverFrame(const binpac::NCP::ncp_frame* frame)
|
||||||
FrameBuffer::FrameBuffer(size_t header_length)
|
FrameBuffer::FrameBuffer(size_t header_length)
|
||||||
{
|
{
|
||||||
hdr_len = header_length;
|
hdr_len = header_length;
|
||||||
msg_buf = 0;
|
msg_buf = nullptr;
|
||||||
buf_len = 0;
|
buf_len = 0;
|
||||||
Reset();
|
Reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("NCP", ::analyzer::ncp::NCP_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("NCP", ::analyzer::ncp::NCP_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Contents_NCP", 0));
|
AddComponent(new ::analyzer::Component("Contents_NCP", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::NCP";
|
config.name = "Zeek::NCP";
|
||||||
|
|
|
@ -214,7 +214,7 @@ int NetbiosSSN_Interpreter::ConvertName(const u_char* name, int name_len,
|
||||||
{
|
{
|
||||||
// Taken from tcpdump's smbutil.c.
|
// Taken from tcpdump's smbutil.c.
|
||||||
|
|
||||||
xname = 0;
|
xname = nullptr;
|
||||||
|
|
||||||
if ( name_len < 1 )
|
if ( name_len < 1 )
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -340,7 +340,7 @@ Contents_NetbiosSSN::Contents_NetbiosSSN(Connection* conn, bool orig,
|
||||||
{
|
{
|
||||||
interp = arg_interp;
|
interp = arg_interp;
|
||||||
type = flags = msg_size = 0;
|
type = flags = msg_size = 0;
|
||||||
msg_buf = 0;
|
msg_buf = nullptr;
|
||||||
buf_n = buf_len = msg_size = 0;
|
buf_n = buf_len = msg_size = 0;
|
||||||
state = NETBIOS_SSN_TYPE;
|
state = NETBIOS_SSN_TYPE;
|
||||||
}
|
}
|
||||||
|
@ -455,7 +455,7 @@ NetbiosSSN_Analyzer::NetbiosSSN_Analyzer(Connection* conn)
|
||||||
{
|
{
|
||||||
//smb_session = new SMB_Session(this);
|
//smb_session = new SMB_Session(this);
|
||||||
interp = new NetbiosSSN_Interpreter(this);
|
interp = new NetbiosSSN_Interpreter(this);
|
||||||
orig_netbios = resp_netbios = 0;
|
orig_netbios = resp_netbios = nullptr;
|
||||||
did_session_done = 0;
|
did_session_done = 0;
|
||||||
|
|
||||||
if ( Conn()->ConnTransport() == TRANSPORT_TCP )
|
if ( Conn()->ConnTransport() == TRANSPORT_TCP )
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("NetbiosSSN", ::analyzer::netbios_ssn::NetbiosSSN_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("NetbiosSSN", ::analyzer::netbios_ssn::NetbiosSSN_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Contents_NetbiosSSN", 0));
|
AddComponent(new ::analyzer::Component("Contents_NetbiosSSN", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::NetBIOS";
|
config.name = "Zeek::NetBIOS";
|
||||||
|
|
|
@ -22,7 +22,7 @@ PIA::~PIA()
|
||||||
|
|
||||||
void PIA::ClearBuffer(Buffer* buffer)
|
void PIA::ClearBuffer(Buffer* buffer)
|
||||||
{
|
{
|
||||||
DataBlock* next = 0;
|
DataBlock* next = nullptr;
|
||||||
for ( DataBlock* b = buffer->head; b; b = next )
|
for ( DataBlock* b = buffer->head; b; b = next )
|
||||||
{
|
{
|
||||||
next = b->next;
|
next = b->next;
|
||||||
|
@ -31,14 +31,14 @@ void PIA::ClearBuffer(Buffer* buffer)
|
||||||
delete b;
|
delete b;
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer->head = buffer->tail = 0;
|
buffer->head = buffer->tail = nullptr;
|
||||||
buffer->size = 0;
|
buffer->size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIA::AddToBuffer(Buffer* buffer, uint64_t seq, int len, const u_char* data,
|
void PIA::AddToBuffer(Buffer* buffer, uint64_t seq, int len, const u_char* data,
|
||||||
bool is_orig, const IP_Hdr* ip)
|
bool is_orig, const IP_Hdr* ip)
|
||||||
{
|
{
|
||||||
u_char* tmp = 0;
|
u_char* tmp = nullptr;
|
||||||
|
|
||||||
if ( data )
|
if ( data )
|
||||||
{
|
{
|
||||||
|
@ -47,12 +47,12 @@ void PIA::AddToBuffer(Buffer* buffer, uint64_t seq, int len, const u_char* data,
|
||||||
}
|
}
|
||||||
|
|
||||||
DataBlock* b = new DataBlock;
|
DataBlock* b = new DataBlock;
|
||||||
b->ip = ip ? ip->Copy() : 0;
|
b->ip = ip ? ip->Copy() : nullptr;
|
||||||
b->data = tmp;
|
b->data = tmp;
|
||||||
b->is_orig = is_orig;
|
b->is_orig = is_orig;
|
||||||
b->len = len;
|
b->len = len;
|
||||||
b->seq = seq;
|
b->seq = seq;
|
||||||
b->next = 0;
|
b->next = nullptr;
|
||||||
|
|
||||||
if ( buffer->tail )
|
if ( buffer->tail )
|
||||||
{
|
{
|
||||||
|
@ -117,14 +117,14 @@ void PIA::PIA_DeliverPacket(int len, const u_char* data, bool is_orig, uint64_t
|
||||||
|
|
||||||
pkt_buffer.state = new_state;
|
pkt_buffer.state = new_state;
|
||||||
|
|
||||||
current_packet.data = 0;
|
current_packet.data = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PIA::Match(Rule::PatternType type, const u_char* data, int len,
|
void PIA::Match(Rule::PatternType type, const u_char* data, int len,
|
||||||
bool is_orig, bool bol, bool eol, bool clear_state)
|
bool is_orig, bool bol, bool eol, bool clear_state)
|
||||||
{
|
{
|
||||||
if ( ! MatcherInitialized(is_orig) )
|
if ( ! MatcherInitialized(is_orig) )
|
||||||
InitEndpointMatcher(AsAnalyzer(), 0, 0, is_orig, this);
|
InitEndpointMatcher(AsAnalyzer(), nullptr, 0, is_orig, this);
|
||||||
|
|
||||||
RuleMatcherState::Match(type, data, len, is_orig, bol, eol, clear_state);
|
RuleMatcherState::Match(type, data, len, is_orig, bol, eol, clear_state);
|
||||||
}
|
}
|
||||||
|
@ -207,9 +207,9 @@ void PIA_TCP::Init()
|
||||||
void PIA_TCP::FirstPacket(bool is_orig, const IP_Hdr* ip)
|
void PIA_TCP::FirstPacket(bool is_orig, const IP_Hdr* ip)
|
||||||
{
|
{
|
||||||
static char dummy_packet[sizeof(struct ip) + sizeof(struct tcphdr)];
|
static char dummy_packet[sizeof(struct ip) + sizeof(struct tcphdr)];
|
||||||
static struct ip* ip4 = 0;
|
static struct ip* ip4 = nullptr;
|
||||||
static struct tcphdr* tcp4 = 0;
|
static struct tcphdr* tcp4 = nullptr;
|
||||||
static IP_Hdr* ip4_hdr = 0;
|
static IP_Hdr* ip4_hdr = nullptr;
|
||||||
|
|
||||||
DBG_LOG(DBG_ANALYZER, "PIA_TCP[%d] FirstPacket(%s)", GetID(), (is_orig ? "T" : "F"));
|
DBG_LOG(DBG_ANALYZER, "PIA_TCP[%d] FirstPacket(%s)", GetID(), (is_orig ? "T" : "F"));
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ void PIA_TCP::DeliverStream(int len, const u_char* data, bool is_orig)
|
||||||
SKIPPING : MATCHING_ONLY;
|
SKIPPING : MATCHING_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
DoMatch(data, len, is_orig, false, false, false, 0);
|
DoMatch(data, len, is_orig, false, false, false, nullptr);
|
||||||
|
|
||||||
stream_buffer.state = new_state;
|
stream_buffer.state = new_state;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ void PIA_TCP::Undelivered(uint64_t seq, int len, bool is_orig)
|
||||||
|
|
||||||
if ( stream_buffer.state == BUFFERING )
|
if ( stream_buffer.state == BUFFERING )
|
||||||
// We use data=nil to mark an undelivered.
|
// We use data=nil to mark an undelivered.
|
||||||
AddToBuffer(&stream_buffer, seq, len, 0, is_orig);
|
AddToBuffer(&stream_buffer, seq, len, nullptr, is_orig);
|
||||||
|
|
||||||
// No check for buffer overrun here. I think that's ok.
|
// No check for buffer overrun here. I think that's ok.
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ public:
|
||||||
// Called when PIA wants to put an Analyzer in charge. rule is the
|
// Called when PIA wants to put an Analyzer in charge. rule is the
|
||||||
// signature that triggered the activitation, if any.
|
// signature that triggered the activitation, if any.
|
||||||
virtual void ActivateAnalyzer(analyzer::Tag tag,
|
virtual void ActivateAnalyzer(analyzer::Tag tag,
|
||||||
const Rule* rule = 0) = 0;
|
const Rule* rule = nullptr) = 0;
|
||||||
|
|
||||||
// Called when PIA wants to remove an Analyzer.
|
// Called when PIA wants to remove an Analyzer.
|
||||||
virtual void DeactivateAnalyzer(analyzer::Tag tag) = 0;
|
virtual void DeactivateAnalyzer(analyzer::Tag tag) = 0;
|
||||||
|
@ -58,7 +58,7 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Buffer {
|
struct Buffer {
|
||||||
Buffer() { head = tail = 0; size = 0; state = INIT; }
|
Buffer() { head = tail = nullptr; size = 0; state = INIT; }
|
||||||
|
|
||||||
DataBlock* head;
|
DataBlock* head;
|
||||||
DataBlock* tail;
|
DataBlock* tail;
|
||||||
|
@ -67,15 +67,15 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddToBuffer(Buffer* buffer, uint64_t seq, int len,
|
void AddToBuffer(Buffer* buffer, uint64_t seq, int len,
|
||||||
const u_char* data, bool is_orig, const IP_Hdr* ip = 0);
|
const u_char* data, bool is_orig, const IP_Hdr* ip = nullptr);
|
||||||
void AddToBuffer(Buffer* buffer, int len,
|
void AddToBuffer(Buffer* buffer, int len,
|
||||||
const u_char* data, bool is_orig, const IP_Hdr* ip = 0);
|
const u_char* data, bool is_orig, const IP_Hdr* ip = nullptr);
|
||||||
void ClearBuffer(Buffer* buffer);
|
void ClearBuffer(Buffer* buffer);
|
||||||
|
|
||||||
DataBlock* CurrentPacket() { return ¤t_packet; }
|
DataBlock* CurrentPacket() { return ¤t_packet; }
|
||||||
|
|
||||||
void DoMatch(const u_char* data, int len, bool is_orig, bool bol,
|
void DoMatch(const u_char* data, int len, bool is_orig, bool bol,
|
||||||
bool eol, bool clear_state, const IP_Hdr* ip = 0);
|
bool eol, bool clear_state, const IP_Hdr* ip = nullptr);
|
||||||
|
|
||||||
void SetConn(Connection* c) { conn = c; }
|
void SetConn(Connection* c) { conn = c; }
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ protected:
|
||||||
void Undelivered(uint64_t seq, int len, bool is_orig) override;
|
void Undelivered(uint64_t seq, int len, bool is_orig) override;
|
||||||
|
|
||||||
void ActivateAnalyzer(analyzer::Tag tag,
|
void ActivateAnalyzer(analyzer::Tag tag,
|
||||||
const Rule* rule = 0) override;
|
const Rule* rule = nullptr) override;
|
||||||
void DeactivateAnalyzer(analyzer::Tag tag) override;
|
void DeactivateAnalyzer(analyzer::Tag tag) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -43,7 +43,7 @@ POP3_Analyzer::POP3_Analyzer(Connection* conn)
|
||||||
lastRequiredCommand = 0;
|
lastRequiredCommand = 0;
|
||||||
authLines = 0;
|
authLines = 0;
|
||||||
|
|
||||||
mail = 0;
|
mail = nullptr;
|
||||||
|
|
||||||
cl_orig = new tcp::ContentLine_Analyzer(conn, true);
|
cl_orig = new tcp::ContentLine_Analyzer(conn, true);
|
||||||
AddSupportAnalyzer(cl_orig);
|
AddSupportAnalyzer(cl_orig);
|
||||||
|
@ -136,7 +136,7 @@ void POP3_Analyzer::ProcessRequest(int length, const char* line)
|
||||||
++authLines;
|
++authLines;
|
||||||
|
|
||||||
BroString encoded(line);
|
BroString encoded(line);
|
||||||
BroString* decoded = decode_base64(&encoded, 0, Conn());
|
BroString* decoded = decode_base64(&encoded, nullptr, Conn());
|
||||||
|
|
||||||
if ( ! decoded )
|
if ( ! decoded )
|
||||||
{
|
{
|
||||||
|
@ -854,7 +854,7 @@ void POP3_Analyzer::EndData()
|
||||||
{
|
{
|
||||||
mail->Done();
|
mail->Done();
|
||||||
delete mail;
|
delete mail;
|
||||||
mail = 0;
|
mail = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
||||||
int ParseCmd(string cmd);
|
int ParseCmd(string cmd);
|
||||||
void AuthSuccessfull();
|
void AuthSuccessfull();
|
||||||
void POP3Event(EventHandlerPtr event, bool is_orig,
|
void POP3Event(EventHandlerPtr event, bool is_orig,
|
||||||
const char* arg1 = 0, const char* arg2 = 0);
|
const char* arg1 = nullptr, const char* arg2 = nullptr);
|
||||||
|
|
||||||
mime::MIME_Mail* mail;
|
mime::MIME_Mail* mail;
|
||||||
list<string> cmds;
|
list<string> cmds;
|
||||||
|
|
|
@ -12,7 +12,7 @@ RDP_Analyzer::RDP_Analyzer(Connection* c)
|
||||||
interp = new binpac::RDP::RDP_Conn(this);
|
interp = new binpac::RDP::RDP_Conn(this);
|
||||||
|
|
||||||
had_gap = false;
|
had_gap = false;
|
||||||
pia = 0;
|
pia = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RDP_Analyzer::~RDP_Analyzer()
|
RDP_Analyzer::~RDP_Analyzer()
|
||||||
|
@ -66,8 +66,8 @@ void RDP_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pia->FirstPacket(true, 0);
|
pia->FirstPacket(true, nullptr);
|
||||||
pia->FirstPacket(false, 0);
|
pia->FirstPacket(false, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ForwardStream(len, data, orig);
|
ForwardStream(len, data, orig);
|
||||||
|
|
|
@ -22,7 +22,7 @@ bool MOUNT_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
|
|
||||||
uint32_t proc = c->Proc();
|
uint32_t proc = c->Proc();
|
||||||
// The call arguments, depends on the call type obviously ...
|
// The call arguments, depends on the call type obviously ...
|
||||||
Val *callarg = 0;
|
Val *callarg = nullptr;
|
||||||
|
|
||||||
switch ( proc ) {
|
switch ( proc ) {
|
||||||
case BifEnum::MOUNT3::PROC_NULL:
|
case BifEnum::MOUNT3::PROC_NULL:
|
||||||
|
@ -41,7 +41,7 @@ bool MOUNT_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
callarg = 0;
|
callarg = nullptr;
|
||||||
if ( proc < BifEnum::MOUNT3::PROC_END_OF_PROCS )
|
if ( proc < BifEnum::MOUNT3::PROC_END_OF_PROCS )
|
||||||
{
|
{
|
||||||
// We know the procedure but haven't implemented it.
|
// We know the procedure but haven't implemented it.
|
||||||
|
@ -65,7 +65,7 @@ bool MOUNT_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
// RecordVal was allocated but we failed to fill it). So we
|
// RecordVal was allocated but we failed to fill it). So we
|
||||||
// Unref() the call arguments, and we are fine.
|
// Unref() the call arguments, and we are fine.
|
||||||
Unref(callarg);
|
Unref(callarg);
|
||||||
callarg = 0;
|
callarg = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +78,8 @@ bool MOUNT_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_statu
|
||||||
const u_char*& buf, int& n, double start_time,
|
const u_char*& buf, int& n, double start_time,
|
||||||
double last_time, int reply_len)
|
double last_time, int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event = 0;
|
EventHandlerPtr event = nullptr;
|
||||||
Val* reply = 0;
|
Val* reply = nullptr;
|
||||||
BifEnum::MOUNT3::status_t mount_status = BifEnum::MOUNT3::MNT3_OK;
|
BifEnum::MOUNT3::status_t mount_status = BifEnum::MOUNT3::MNT3_OK;
|
||||||
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ bool MOUNT_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_statu
|
||||||
// We set the buffer to NULL, the function that extract the
|
// We set the buffer to NULL, the function that extract the
|
||||||
// reply from the data stream will then return empty records.
|
// reply from the data stream will then return empty records.
|
||||||
//
|
//
|
||||||
buf = NULL;
|
buf = nullptr;
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,14 +119,14 @@ bool MOUNT_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_statu
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BifEnum::MOUNT3::PROC_UMNT:
|
case BifEnum::MOUNT3::PROC_UMNT:
|
||||||
reply = 0;
|
reply = nullptr;
|
||||||
n = 0;
|
n = 0;
|
||||||
mount_status = BifEnum::MOUNT3::MNT3_OK;
|
mount_status = BifEnum::MOUNT3::MNT3_OK;
|
||||||
event = mount_proc_umnt;
|
event = mount_proc_umnt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BifEnum::MOUNT3::PROC_UMNT_ALL:
|
case BifEnum::MOUNT3::PROC_UMNT_ALL:
|
||||||
reply = 0;
|
reply = nullptr;
|
||||||
n = 0;
|
n = 0;
|
||||||
mount_status = BifEnum::MOUNT3::MNT3_OK;
|
mount_status = BifEnum::MOUNT3::MNT3_OK;
|
||||||
event = mount_proc_umnt;
|
event = mount_proc_umnt;
|
||||||
|
@ -151,7 +151,7 @@ bool MOUNT_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_statu
|
||||||
// There was a parse error. We have to unref the reply. (see
|
// There was a parse error. We have to unref the reply. (see
|
||||||
// also comments in RPC_BuildCall.
|
// also comments in RPC_BuildCall.
|
||||||
Unref(reply);
|
Unref(reply);
|
||||||
reply = 0;
|
reply = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ StringVal* MOUNT_Interp::mount3_fh(const u_char*& buf, int& n)
|
||||||
const u_char* fh = extract_XDR_opaque(buf, n, fh_n, 64);
|
const u_char* fh = extract_XDR_opaque(buf, n, fh_n, 64);
|
||||||
|
|
||||||
if ( ! fh )
|
if ( ! fh )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new StringVal(new BroString(fh, fh_n, false));
|
return new StringVal(new BroString(fh, fh_n, false));
|
||||||
}
|
}
|
||||||
|
@ -241,7 +241,7 @@ StringVal* MOUNT_Interp::mount3_filename(const u_char*& buf, int& n)
|
||||||
const u_char* name = extract_XDR_opaque(buf, n, name_len);
|
const u_char* name = extract_XDR_opaque(buf, n, name_len);
|
||||||
|
|
||||||
if ( ! name )
|
if ( ! name )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new StringVal(new BroString(name, name_len, false));
|
return new StringVal(new BroString(name, name_len, false));
|
||||||
}
|
}
|
||||||
|
@ -288,8 +288,8 @@ RecordVal* MOUNT_Interp::mount3_mnt_reply(const u_char*& buf, int& n,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rep->Assign(0, 0);
|
rep->Assign(0, nullptr);
|
||||||
rep->Assign(1, 0);
|
rep->Assign(1, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rep;
|
return rep;
|
||||||
|
@ -298,7 +298,7 @@ RecordVal* MOUNT_Interp::mount3_mnt_reply(const u_char*& buf, int& n,
|
||||||
MOUNT_Analyzer::MOUNT_Analyzer(Connection* conn)
|
MOUNT_Analyzer::MOUNT_Analyzer(Connection* conn)
|
||||||
: RPC_Analyzer("MOUNT", conn, new MOUNT_Interp(this))
|
: RPC_Analyzer("MOUNT", conn, new MOUNT_Interp(this))
|
||||||
{
|
{
|
||||||
orig_rpc = resp_rpc = 0;
|
orig_rpc = resp_rpc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MOUNT_Analyzer::Init()
|
void MOUNT_Analyzer::Init()
|
||||||
|
|
|
@ -22,7 +22,7 @@ bool NFS_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
|
|
||||||
uint32_t proc = c->Proc();
|
uint32_t proc = c->Proc();
|
||||||
// The call arguments, depends on the call type obviously ...
|
// The call arguments, depends on the call type obviously ...
|
||||||
Val *callarg = 0;
|
Val *callarg = nullptr;
|
||||||
|
|
||||||
switch ( proc ) {
|
switch ( proc ) {
|
||||||
case BifEnum::NFS3::PROC_NULL:
|
case BifEnum::NFS3::PROC_NULL:
|
||||||
|
@ -95,7 +95,7 @@ bool NFS_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
callarg = 0;
|
callarg = nullptr;
|
||||||
if ( proc < BifEnum::NFS3::PROC_END_OF_PROCS )
|
if ( proc < BifEnum::NFS3::PROC_END_OF_PROCS )
|
||||||
{
|
{
|
||||||
// We know the procedure but haven't implemented it.
|
// We know the procedure but haven't implemented it.
|
||||||
|
@ -119,7 +119,7 @@ bool NFS_Interp::RPC_BuildCall(RPC_CallInfo* c, const u_char*& buf, int& n)
|
||||||
// RecordVal was allocated but we failed to fill it). So we
|
// RecordVal was allocated but we failed to fill it). So we
|
||||||
// Unref() the call arguments, and we are fine.
|
// Unref() the call arguments, and we are fine.
|
||||||
Unref(callarg);
|
Unref(callarg);
|
||||||
callarg = 0;
|
callarg = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ bool NFS_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_status,
|
||||||
const u_char*& buf, int& n, double start_time,
|
const u_char*& buf, int& n, double start_time,
|
||||||
double last_time, int reply_len)
|
double last_time, int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event = 0;
|
EventHandlerPtr event = nullptr;
|
||||||
Val *reply = 0;
|
Val *reply = nullptr;
|
||||||
BifEnum::NFS3::status_t nfs_status = BifEnum::NFS3::NFS3ERR_OK;
|
BifEnum::NFS3::status_t nfs_status = BifEnum::NFS3::NFS3ERR_OK;
|
||||||
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
bool rpc_success = ( rpc_status == BifEnum::RPC_SUCCESS );
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ bool NFS_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_status,
|
||||||
// We set the buffer to NULL, the function that extract the
|
// We set the buffer to NULL, the function that extract the
|
||||||
// reply from the data stream will then return empty records.
|
// reply from the data stream will then return empty records.
|
||||||
//
|
//
|
||||||
buf = NULL;
|
buf = nullptr;
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ bool NFS_Interp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status rpc_status,
|
||||||
// There was a parse error. We have to unref the reply. (see
|
// There was a parse error. We have to unref the reply. (see
|
||||||
// also comments in RPC_BuildCall.
|
// also comments in RPC_BuildCall.
|
||||||
Unref(reply);
|
Unref(reply);
|
||||||
reply = 0;
|
reply = nullptr;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,10 +303,10 @@ StringVal* NFS_Interp::nfs3_file_data(const u_char*& buf, int& n, uint64_t offse
|
||||||
|
|
||||||
// check whether we have to deliver data to the event
|
// check whether we have to deliver data to the event
|
||||||
if ( ! BifConst::NFS3::return_data )
|
if ( ! BifConst::NFS3::return_data )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( BifConst::NFS3::return_data_first_only && offset != 0 )
|
if ( BifConst::NFS3::return_data_first_only && offset != 0 )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
// Ok, so we want to return some data
|
// Ok, so we want to return some data
|
||||||
data_n = min(data_n, size);
|
data_n = min(data_n, size);
|
||||||
|
@ -315,7 +315,7 @@ StringVal* NFS_Interp::nfs3_file_data(const u_char*& buf, int& n, uint64_t offse
|
||||||
if ( data && data_n > 0 )
|
if ( data && data_n > 0 )
|
||||||
return new StringVal(new BroString(data, data_n, false));
|
return new StringVal(new BroString(data, data_n, false));
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
zeek::Args NFS_Interp::event_common_vl(RPC_CallInfo *c, BifEnum::rpc_status rpc_status,
|
zeek::Args NFS_Interp::event_common_vl(RPC_CallInfo *c, BifEnum::rpc_status rpc_status,
|
||||||
|
@ -358,7 +358,7 @@ StringVal* NFS_Interp::nfs3_fh(const u_char*& buf, int& n)
|
||||||
const u_char* fh = extract_XDR_opaque(buf, n, fh_n, 64);
|
const u_char* fh = extract_XDR_opaque(buf, n, fh_n, 64);
|
||||||
|
|
||||||
if ( ! fh )
|
if ( ! fh )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new StringVal(new BroString(fh, fh_n, false));
|
return new StringVal(new BroString(fh, fh_n, false));
|
||||||
}
|
}
|
||||||
|
@ -368,22 +368,22 @@ RecordVal* NFS_Interp::nfs3_sattr(const u_char*& buf, int& n)
|
||||||
{
|
{
|
||||||
RecordVal* attrs = new RecordVal(BifType::Record::NFS3::sattr_t);
|
RecordVal* attrs = new RecordVal(BifType::Record::NFS3::sattr_t);
|
||||||
|
|
||||||
attrs->Assign(0, 0); // mode
|
attrs->Assign(0, nullptr); // mode
|
||||||
int mode_set_it = extract_XDR_uint32(buf, n);
|
int mode_set_it = extract_XDR_uint32(buf, n);
|
||||||
if ( mode_set_it )
|
if ( mode_set_it )
|
||||||
attrs->Assign(0, ExtractUint32(buf, n)); // mode
|
attrs->Assign(0, ExtractUint32(buf, n)); // mode
|
||||||
|
|
||||||
attrs->Assign(1, 0); // uid
|
attrs->Assign(1, nullptr); // uid
|
||||||
int uid_set_it = extract_XDR_uint32(buf, n);
|
int uid_set_it = extract_XDR_uint32(buf, n);
|
||||||
if ( uid_set_it )
|
if ( uid_set_it )
|
||||||
attrs->Assign(1, ExtractUint32(buf, n)); // uid
|
attrs->Assign(1, ExtractUint32(buf, n)); // uid
|
||||||
|
|
||||||
attrs->Assign(2, 0); // gid
|
attrs->Assign(2, nullptr); // gid
|
||||||
int gid_set_it = extract_XDR_uint32(buf, n);
|
int gid_set_it = extract_XDR_uint32(buf, n);
|
||||||
if ( gid_set_it )
|
if ( gid_set_it )
|
||||||
attrs->Assign(2, ExtractUint32(buf, n)); // gid
|
attrs->Assign(2, ExtractUint32(buf, n)); // gid
|
||||||
|
|
||||||
attrs->Assign(3, 0); // size
|
attrs->Assign(3, nullptr); // size
|
||||||
int size_set_it = extract_XDR_uint32(buf, n);
|
int size_set_it = extract_XDR_uint32(buf, n);
|
||||||
if ( size_set_it )
|
if ( size_set_it )
|
||||||
attrs->Assign(3, ExtractTime(buf, n)); // size
|
attrs->Assign(3, ExtractTime(buf, n)); // size
|
||||||
|
@ -406,8 +406,8 @@ RecordVal* NFS_Interp::nfs3_sattr_reply(const u_char*& buf, int& n, BifEnum::NFS
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rep->Assign(1, 0);
|
rep->Assign(1, nullptr);
|
||||||
rep->Assign(2, 0);
|
rep->Assign(2, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rep;
|
return rep;
|
||||||
|
@ -464,7 +464,7 @@ StringVal *NFS_Interp::nfs3_filename(const u_char*& buf, int& n)
|
||||||
const u_char* name = extract_XDR_opaque(buf, n, name_len);
|
const u_char* name = extract_XDR_opaque(buf, n, name_len);
|
||||||
|
|
||||||
if ( ! name )
|
if ( ! name )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
return new StringVal(new BroString(name, name_len, false));
|
return new StringVal(new BroString(name, name_len, false));
|
||||||
}
|
}
|
||||||
|
@ -508,7 +508,7 @@ RecordVal* NFS_Interp::nfs3_post_op_attr(const u_char*& buf, int& n)
|
||||||
if ( have_attrs )
|
if ( have_attrs )
|
||||||
return nfs3_fattr(buf, n);
|
return nfs3_fattr(buf, n);
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
StringVal* NFS_Interp::nfs3_post_op_fh(const u_char*& buf, int& n)
|
StringVal* NFS_Interp::nfs3_post_op_fh(const u_char*& buf, int& n)
|
||||||
|
@ -518,7 +518,7 @@ StringVal* NFS_Interp::nfs3_post_op_fh(const u_char*& buf, int& n)
|
||||||
if ( have_fh )
|
if ( have_fh )
|
||||||
return nfs3_fh(buf, n);
|
return nfs3_fh(buf, n);
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordVal* NFS_Interp::nfs3_pre_op_attr(const u_char*& buf, int& n)
|
RecordVal* NFS_Interp::nfs3_pre_op_attr(const u_char*& buf, int& n)
|
||||||
|
@ -527,7 +527,7 @@ RecordVal* NFS_Interp::nfs3_pre_op_attr(const u_char*& buf, int& n)
|
||||||
|
|
||||||
if ( have_attrs )
|
if ( have_attrs )
|
||||||
return nfs3_wcc_attr(buf, n);
|
return nfs3_wcc_attr(buf, n);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EnumVal *NFS_Interp::nfs3_stable_how(const u_char*& buf, int& n)
|
EnumVal *NFS_Interp::nfs3_stable_how(const u_char*& buf, int& n)
|
||||||
|
@ -548,8 +548,8 @@ RecordVal* NFS_Interp::nfs3_lookup_reply(const u_char*& buf, int& n, BifEnum::NF
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rep->Assign(0, 0);
|
rep->Assign(0, nullptr);
|
||||||
rep->Assign(1, 0);
|
rep->Assign(1, nullptr);
|
||||||
rep->Assign(2, nfs3_post_op_attr(buf, n));
|
rep->Assign(2, nfs3_post_op_attr(buf, n));
|
||||||
}
|
}
|
||||||
return rep;
|
return rep;
|
||||||
|
@ -710,8 +710,8 @@ RecordVal* NFS_Interp::nfs3_newobj_reply(const u_char*& buf, int& n, BifEnum::NF
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rep->Assign(0, 0);
|
rep->Assign(0, nullptr);
|
||||||
rep->Assign(1, 0);
|
rep->Assign(1, nullptr);
|
||||||
rep->Assign(2, nfs3_pre_op_attr(buf, n));
|
rep->Assign(2, nfs3_pre_op_attr(buf, n));
|
||||||
rep->Assign(3, nfs3_post_op_attr(buf, n));
|
rep->Assign(3, nfs3_post_op_attr(buf, n));
|
||||||
}
|
}
|
||||||
|
@ -833,7 +833,7 @@ Val* NFS_Interp::ExtractBool(const u_char*& buf, int& n)
|
||||||
NFS_Analyzer::NFS_Analyzer(Connection* conn)
|
NFS_Analyzer::NFS_Analyzer(Connection* conn)
|
||||||
: RPC_Analyzer("NFS", conn, new NFS_Interp(this))
|
: RPC_Analyzer("NFS", conn, new NFS_Interp(this))
|
||||||
{
|
{
|
||||||
orig_rpc = resp_rpc = 0;
|
orig_rpc = resp_rpc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NFS_Analyzer::Init()
|
void NFS_Analyzer::Init()
|
||||||
|
|
|
@ -17,8 +17,8 @@ public:
|
||||||
AddComponent(new ::analyzer::Component("NFS", ::analyzer::rpc::NFS_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("NFS", ::analyzer::rpc::NFS_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("MOUNT", ::analyzer::rpc::MOUNT_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("MOUNT", ::analyzer::rpc::MOUNT_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Portmapper", ::analyzer::rpc::Portmapper_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("Portmapper", ::analyzer::rpc::Portmapper_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Contents_RPC", 0));
|
AddComponent(new ::analyzer::Component("Contents_RPC", nullptr));
|
||||||
AddComponent(new ::analyzer::Component("Contents_NFS", 0));
|
AddComponent(new ::analyzer::Component("Contents_NFS", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::RPC";
|
config.name = "Zeek::RPC";
|
||||||
|
|
|
@ -79,7 +79,7 @@ bool PortmapperInterp::RPC_BuildReply(RPC_CallInfo* c, BifEnum::rpc_status statu
|
||||||
int reply_len)
|
int reply_len)
|
||||||
{
|
{
|
||||||
EventHandlerPtr event;
|
EventHandlerPtr event;
|
||||||
Val *reply = 0;
|
Val *reply = nullptr;
|
||||||
int success = (status == BifEnum::RPC_SUCCESS);
|
int success = (status == BifEnum::RPC_SUCCESS);
|
||||||
|
|
||||||
switch ( c->Proc() ) {
|
switch ( c->Proc() ) {
|
||||||
|
@ -208,7 +208,7 @@ Val* PortmapperInterp::ExtractMapping(const u_char*& buf, int& len)
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
{
|
{
|
||||||
Unref(mapping);
|
Unref(mapping);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return mapping;
|
return mapping;
|
||||||
|
@ -228,7 +228,7 @@ Val* PortmapperInterp::ExtractPortRequest(const u_char*& buf, int& len)
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
{
|
{
|
||||||
Unref(pr);
|
Unref(pr);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return pr;
|
return pr;
|
||||||
|
@ -249,7 +249,7 @@ Val* PortmapperInterp::ExtractCallItRequest(const u_char*& buf, int& len)
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
{
|
{
|
||||||
Unref(c);
|
Unref(c);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
|
@ -307,7 +307,7 @@ void PortmapperInterp::Event(EventHandlerPtr f, Val* request, BifEnum::rpc_statu
|
||||||
Portmapper_Analyzer::Portmapper_Analyzer(Connection* conn)
|
Portmapper_Analyzer::Portmapper_Analyzer(Connection* conn)
|
||||||
: RPC_Analyzer("PORTMAPPER", conn, new PortmapperInterp(this))
|
: RPC_Analyzer("PORTMAPPER", conn, new PortmapperInterp(this))
|
||||||
{
|
{
|
||||||
orig_rpc = resp_rpc = 0;
|
orig_rpc = resp_rpc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
Portmapper_Analyzer::~Portmapper_Analyzer()
|
Portmapper_Analyzer::~Portmapper_Analyzer()
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
|
|
||||||
void AddVal(Val* arg_v) { Unref(v); v = arg_v; }
|
void AddVal(Val* arg_v) { Unref(v); v = arg_v; }
|
||||||
Val* RequestVal() const { return v; }
|
Val* RequestVal() const { return v; }
|
||||||
Val* TakeRequestVal() { Val* rv = v; v = 0; return rv; }
|
Val* TakeRequestVal() { Val* rv = v; v = nullptr; return rv; }
|
||||||
|
|
||||||
bool CompareRexmit(const u_char* buf, int n) const;
|
bool CompareRexmit(const u_char* buf, int n) const;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
RPC_Reasm_Buffer() {
|
RPC_Reasm_Buffer() {
|
||||||
maxsize = expected = 0;
|
maxsize = expected = 0;
|
||||||
fill = processed = 0;
|
fill = processed = 0;
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
~RPC_Reasm_Buffer() { if (buf) delete [] buf; }
|
~RPC_Reasm_Buffer() { if (buf) delete [] buf; }
|
||||||
|
|
|
@ -17,7 +17,7 @@ uint32_t analyzer::rpc::extract_XDR_uint32(const u_char*& buf, int& len)
|
||||||
|
|
||||||
if ( len < 4 )
|
if ( len < 4 )
|
||||||
{
|
{
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ uint64_t analyzer::rpc::extract_XDR_uint64(const u_char*& buf, int& len)
|
||||||
{
|
{
|
||||||
if ( ! buf || len < 8 )
|
if ( ! buf || len < 8 )
|
||||||
{
|
{
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ double analyzer::rpc::extract_XDR_time(const u_char*& buf, int& len)
|
||||||
{
|
{
|
||||||
if ( ! buf || len < 8 )
|
if ( ! buf || len < 8 )
|
||||||
{
|
{
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,15 +64,15 @@ const u_char* analyzer::rpc::extract_XDR_opaque(const u_char*& buf, int& len, in
|
||||||
{
|
{
|
||||||
n = int(extract_XDR_uint32(buf, len));
|
n = int(extract_XDR_uint32(buf, len));
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
if ( short_buf_ok )
|
if ( short_buf_ok )
|
||||||
n = std::min(n, len);
|
n = std::min(n, len);
|
||||||
|
|
||||||
if ( n < 0 || n > len || n > max_len )
|
if ( n < 0 || n > len || n > max_len )
|
||||||
{ // ### Should really flag this as a different sort of error.
|
{ // ### Should really flag this as a different sort of error.
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int n4 = ((n + 3) >> 2) << 2; // n rounded up to next multiple of 4
|
int n4 = ((n + 3) >> 2) << 2; // n rounded up to next multiple of 4
|
||||||
|
@ -87,11 +87,11 @@ const u_char* analyzer::rpc::extract_XDR_opaque(const u_char*& buf, int& len, in
|
||||||
const u_char* analyzer::rpc::extract_XDR_opaque_fixed(const u_char*& buf, int& len, int n)
|
const u_char* analyzer::rpc::extract_XDR_opaque_fixed(const u_char*& buf, int& len, int n)
|
||||||
{
|
{
|
||||||
if ( ! buf )
|
if ( ! buf )
|
||||||
return 0;
|
return nullptr;
|
||||||
if ( n < 0 || n > len)
|
if ( n < 0 || n > len)
|
||||||
{
|
{
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
int n4 = ((n + 3) >> 2) << 2; // n rounded up to next multiple of 4
|
int n4 = ((n + 3) >> 2) << 2; // n rounded up to next multiple of 4
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("SMB", ::analyzer::smb::SMB_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("SMB", ::analyzer::smb::SMB_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("Contents_SMB", 0));
|
AddComponent(new ::analyzer::Component("Contents_SMB", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::SMB";
|
config.name = "Zeek::SMB";
|
||||||
|
|
|
@ -43,8 +43,8 @@ SMTP_Analyzer::SMTP_Analyzer(Connection* conn)
|
||||||
|
|
||||||
skip_data = false;
|
skip_data = false;
|
||||||
orig_is_sender = true;
|
orig_is_sender = true;
|
||||||
line_after_gap = 0;
|
line_after_gap = nullptr;
|
||||||
mail = 0;
|
mail = nullptr;
|
||||||
UpdateState(first_cmd, 0, true);
|
UpdateState(first_cmd, 0, true);
|
||||||
cl_orig = new tcp::ContentLine_Analyzer(conn, true);
|
cl_orig = new tcp::ContentLine_Analyzer(conn, true);
|
||||||
cl_orig->SetIsNULSensitive(true);
|
cl_orig->SetIsNULSensitive(true);
|
||||||
|
@ -103,7 +103,7 @@ void SMTP_Analyzer::Undelivered(uint64_t seq, int len, bool is_orig)
|
||||||
if ( line_after_gap )
|
if ( line_after_gap )
|
||||||
{
|
{
|
||||||
delete line_after_gap;
|
delete line_after_gap;
|
||||||
line_after_gap = 0;
|
line_after_gap = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_cmd_q.clear();
|
pending_cmd_q.clear();
|
||||||
|
@ -247,7 +247,7 @@ void SMTP_Analyzer::ProcessLine(int length, const char* line, bool orig)
|
||||||
if ( cmd_code == -1 )
|
if ( cmd_code == -1 )
|
||||||
{
|
{
|
||||||
Unexpected(true, "unknown command", cmd_len, cmd);
|
Unexpected(true, "unknown command", cmd_len, cmd);
|
||||||
cmd = 0;
|
cmd = nullptr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
NewCmd(cmd_code);
|
NewCmd(cmd_code);
|
||||||
|
@ -921,7 +921,7 @@ void SMTP_Analyzer::BeginData(bool orig)
|
||||||
{
|
{
|
||||||
state = SMTP_IN_DATA;
|
state = SMTP_IN_DATA;
|
||||||
skip_data = false; // reset the flag at the beginning of the mail
|
skip_data = false; // reset the flag at the beginning of the mail
|
||||||
if ( mail != 0 )
|
if ( mail != nullptr )
|
||||||
{
|
{
|
||||||
Weird("smtp_nested_mail_transaction");
|
Weird("smtp_nested_mail_transaction");
|
||||||
mail->Done();
|
mail->Done();
|
||||||
|
@ -939,6 +939,6 @@ void SMTP_Analyzer::EndData()
|
||||||
{
|
{
|
||||||
mail->Done();
|
mail->Done();
|
||||||
delete mail;
|
delete mail;
|
||||||
mail = 0;
|
mail = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ SOCKS_Analyzer::SOCKS_Analyzer(Connection* conn)
|
||||||
{
|
{
|
||||||
interp = new binpac::SOCKS::SOCKS_Conn(this);
|
interp = new binpac::SOCKS::SOCKS_Conn(this);
|
||||||
orig_done = resp_done = false;
|
orig_done = resp_done = false;
|
||||||
pia = 0;
|
pia = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
SOCKS_Analyzer::~SOCKS_Analyzer()
|
SOCKS_Analyzer::~SOCKS_Analyzer()
|
||||||
|
@ -63,11 +63,11 @@ void SOCKS_Analyzer::DeliverStream(int len, const u_char* data, bool orig)
|
||||||
pia = new pia::PIA_TCP(Conn());
|
pia = new pia::PIA_TCP(Conn());
|
||||||
if ( AddChildAnalyzer(pia) )
|
if ( AddChildAnalyzer(pia) )
|
||||||
{
|
{
|
||||||
pia->FirstPacket(true, 0);
|
pia->FirstPacket(true, nullptr);
|
||||||
pia->FirstPacket(false, 0);
|
pia->FirstPacket(false, nullptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pia = 0;
|
pia = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ForwardStream(len, data, orig);
|
ForwardStream(len, data, orig);
|
||||||
|
|
|
@ -158,7 +158,7 @@ SteppingStone_Analyzer::SteppingStone_Analyzer(Connection* c)
|
||||||
{
|
{
|
||||||
stp_manager = sessions->GetSTPManager();
|
stp_manager = sessions->GetSTPManager();
|
||||||
|
|
||||||
orig_endp = resp_endp = 0;
|
orig_endp = resp_endp = nullptr;
|
||||||
orig_stream_pos = resp_stream_pos = 1;
|
orig_stream_pos = resp_stream_pos = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,9 +179,9 @@ void SteppingStone_Analyzer::DeliverPacket(int len, const u_char* data,
|
||||||
ip, caplen);
|
ip, caplen);
|
||||||
|
|
||||||
if ( is_orig )
|
if ( is_orig )
|
||||||
orig_endp->DataSent(network_time, seq, len, caplen, data, 0, 0);
|
orig_endp->DataSent(network_time, seq, len, caplen, data, nullptr, nullptr);
|
||||||
else
|
else
|
||||||
resp_endp->DataSent(network_time, seq, len, caplen, data, 0, 0);
|
resp_endp->DataSent(network_time, seq, len, caplen, data, nullptr, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SteppingStone_Analyzer::DeliverStream(int len, const u_char* data,
|
void SteppingStone_Analyzer::DeliverStream(int len, const u_char* data,
|
||||||
|
@ -192,14 +192,14 @@ void SteppingStone_Analyzer::DeliverStream(int len, const u_char* data,
|
||||||
if ( is_orig )
|
if ( is_orig )
|
||||||
{
|
{
|
||||||
orig_endp->DataSent(network_time, orig_stream_pos, len, len,
|
orig_endp->DataSent(network_time, orig_stream_pos, len, len,
|
||||||
data, 0, 0);
|
data, nullptr, nullptr);
|
||||||
orig_stream_pos += len;
|
orig_stream_pos += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
resp_endp->DataSent(network_time, resp_stream_pos, len, len,
|
resp_endp->DataSent(network_time, resp_stream_pos, len, len,
|
||||||
data, 0, 0);
|
data, nullptr, nullptr);
|
||||||
resp_stream_pos += len;
|
resp_stream_pos += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ void ContentLine_Analyzer::InitState()
|
||||||
CR_LF_as_EOL = (CR_as_EOL | LF_as_EOL);
|
CR_LF_as_EOL = (CR_as_EOL | LF_as_EOL);
|
||||||
skip_deliveries = false;
|
skip_deliveries = false;
|
||||||
skip_partial = false;
|
skip_partial = false;
|
||||||
buf = 0;
|
buf = nullptr;
|
||||||
seq_delivered_in_lines = 0;
|
seq_delivered_in_lines = 0;
|
||||||
skip_pending = 0;
|
skip_pending = 0;
|
||||||
seq = 0;
|
seq = 0;
|
||||||
|
|
|
@ -13,8 +13,8 @@ public:
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("TCP", ::analyzer::tcp::TCP_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("TCP", ::analyzer::tcp::TCP_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("TCPStats", ::analyzer::tcp::TCPStats_Analyzer::Instantiate));
|
AddComponent(new ::analyzer::Component("TCPStats", ::analyzer::tcp::TCPStats_Analyzer::Instantiate));
|
||||||
AddComponent(new ::analyzer::Component("CONTENTLINE", 0));
|
AddComponent(new ::analyzer::Component("CONTENTLINE", nullptr));
|
||||||
AddComponent(new ::analyzer::Component("Contents", 0));
|
AddComponent(new ::analyzer::Component("Contents", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::TCP";
|
config.name = "Zeek::TCP";
|
||||||
|
|
|
@ -192,7 +192,7 @@ analyzer::Analyzer* TCP_Analyzer::FindChild(ID arg_id)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
analyzer::Analyzer* TCP_Analyzer::FindChild(Tag arg_tag)
|
analyzer::Analyzer* TCP_Analyzer::FindChild(Tag arg_tag)
|
||||||
|
@ -209,7 +209,7 @@ analyzer::Analyzer* TCP_Analyzer::FindChild(Tag arg_tag)
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TCP_Analyzer::RemoveChildAnalyzer(ID id)
|
bool TCP_Analyzer::RemoveChildAnalyzer(ID id)
|
||||||
|
@ -253,7 +253,7 @@ const struct tcphdr* TCP_Analyzer::ExtractTCP_Header(const u_char*& data,
|
||||||
if ( tcp_hdr_len < sizeof(struct tcphdr) )
|
if ( tcp_hdr_len < sizeof(struct tcphdr) )
|
||||||
{
|
{
|
||||||
Weird("bad_TCP_header_len");
|
Weird("bad_TCP_header_len");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( tcp_hdr_len > uint32_t(len) ||
|
if ( tcp_hdr_len > uint32_t(len) ||
|
||||||
|
@ -262,7 +262,7 @@ const struct tcphdr* TCP_Analyzer::ExtractTCP_Header(const u_char*& data,
|
||||||
// This can happen even with the above test, due to TCP
|
// This can happen even with the above test, due to TCP
|
||||||
// options.
|
// options.
|
||||||
Weird("truncated_header");
|
Weird("truncated_header");
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
len -= tcp_hdr_len; // remove TCP header
|
len -= tcp_hdr_len; // remove TCP header
|
||||||
|
@ -1587,8 +1587,8 @@ void TCP_Analyzer::SetContentsFile(unsigned int direction, BroFile* f)
|
||||||
{
|
{
|
||||||
if ( direction == CONTENTS_NONE )
|
if ( direction == CONTENTS_NONE )
|
||||||
{
|
{
|
||||||
orig->SetContentsFile(0);
|
orig->SetContentsFile(nullptr);
|
||||||
resp->SetContentsFile(0);
|
resp->SetContentsFile(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1604,7 +1604,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
||||||
{
|
{
|
||||||
switch ( direction ) {
|
switch ( direction ) {
|
||||||
case CONTENTS_NONE:
|
case CONTENTS_NONE:
|
||||||
return 0;
|
return nullptr;
|
||||||
|
|
||||||
case CONTENTS_ORIG:
|
case CONTENTS_ORIG:
|
||||||
return orig->GetContentsFile();
|
return orig->GetContentsFile();
|
||||||
|
@ -1615,7 +1615,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
||||||
case CONTENTS_BOTH:
|
case CONTENTS_BOTH:
|
||||||
if ( orig->GetContentsFile() != resp->GetContentsFile())
|
if ( orig->GetContentsFile() != resp->GetContentsFile())
|
||||||
// This is an "error".
|
// This is an "error".
|
||||||
return 0;
|
return nullptr;
|
||||||
else
|
else
|
||||||
return orig->GetContentsFile();
|
return orig->GetContentsFile();
|
||||||
|
|
||||||
|
@ -1625,7 +1625,7 @@ BroFile* TCP_Analyzer::GetContentsFile(unsigned int direction) const
|
||||||
|
|
||||||
reporter->Error("bad direction %u in TCP_Analyzer::GetContentsFile",
|
reporter->Error("bad direction %u in TCP_Analyzer::GetContentsFile",
|
||||||
direction);
|
direction);
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCP_Analyzer::ConnectionClosed(TCP_Endpoint* endpoint, TCP_Endpoint* peer,
|
void TCP_Analyzer::ConnectionClosed(TCP_Endpoint* endpoint, TCP_Endpoint* peer,
|
||||||
|
@ -2127,7 +2127,7 @@ void TCPStats_Analyzer::DeliverPacket(int len, const u_char* data, bool is_orig,
|
||||||
TCP_ApplicationAnalyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
|
TCP_ApplicationAnalyzer::DeliverPacket(len, data, is_orig, seq, ip, caplen);
|
||||||
|
|
||||||
if ( is_orig )
|
if ( is_orig )
|
||||||
orig_stats->DataSent(network_time, seq, len, caplen, data, ip, 0);
|
orig_stats->DataSent(network_time, seq, len, caplen, data, ip, nullptr);
|
||||||
else
|
else
|
||||||
resp_stats->DataSent(network_time, seq, len, caplen, data, ip, 0);
|
resp_stats->DataSent(network_time, seq, len, caplen, data, ip, nullptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,7 +161,7 @@ protected:
|
||||||
// A couple utility functions that may also be useful to derived analyzers.
|
// A couple utility functions that may also be useful to derived analyzers.
|
||||||
static uint64_t get_relative_seq(const TCP_Endpoint* endpoint,
|
static uint64_t get_relative_seq(const TCP_Endpoint* endpoint,
|
||||||
uint32_t cur_base, uint32_t last,
|
uint32_t cur_base, uint32_t last,
|
||||||
uint32_t wraps, bool* underflow = 0);
|
uint32_t wraps, bool* underflow = nullptr);
|
||||||
|
|
||||||
static int get_segment_len(int payload_len, TCP_Flags flags);
|
static int get_segment_len(int payload_len, TCP_Flags flags);
|
||||||
|
|
||||||
|
@ -192,12 +192,10 @@ private:
|
||||||
class TCP_ApplicationAnalyzer : public analyzer::Analyzer {
|
class TCP_ApplicationAnalyzer : public analyzer::Analyzer {
|
||||||
public:
|
public:
|
||||||
TCP_ApplicationAnalyzer(const char* name, Connection* conn)
|
TCP_ApplicationAnalyzer(const char* name, Connection* conn)
|
||||||
: Analyzer(name, conn)
|
: Analyzer(name, conn), tcp(nullptr) { }
|
||||||
{ tcp = 0; }
|
|
||||||
|
|
||||||
explicit TCP_ApplicationAnalyzer(Connection* conn)
|
explicit TCP_ApplicationAnalyzer(Connection* conn)
|
||||||
: Analyzer(conn)
|
: Analyzer(conn), tcp(nullptr) { }
|
||||||
{ tcp = 0; }
|
|
||||||
|
|
||||||
~TCP_ApplicationAnalyzer() override { }
|
~TCP_ApplicationAnalyzer() override { }
|
||||||
|
|
||||||
|
@ -235,7 +233,7 @@ public:
|
||||||
// This suppresses violations if the TCP connection wasn't
|
// This suppresses violations if the TCP connection wasn't
|
||||||
// fully established.
|
// fully established.
|
||||||
void ProtocolViolation(const char* reason,
|
void ProtocolViolation(const char* reason,
|
||||||
const char* data = 0, int len = 0) override;
|
const char* data = nullptr, int len = 0) override;
|
||||||
|
|
||||||
// "name" and "val" both now belong to this object, which needs to
|
// "name" and "val" both now belong to this object, which needs to
|
||||||
// delete them when done with them.
|
// delete them when done with them.
|
||||||
|
|
|
@ -16,9 +16,9 @@ using namespace analyzer::tcp;
|
||||||
|
|
||||||
TCP_Endpoint::TCP_Endpoint(TCP_Analyzer* arg_analyzer, bool arg_is_orig)
|
TCP_Endpoint::TCP_Endpoint(TCP_Analyzer* arg_analyzer, bool arg_is_orig)
|
||||||
{
|
{
|
||||||
contents_processor = 0;
|
contents_processor = nullptr;
|
||||||
prev_state = state = TCP_ENDPOINT_INACTIVE;
|
prev_state = state = TCP_ENDPOINT_INACTIVE;
|
||||||
peer = 0;
|
peer = nullptr;
|
||||||
start_time = last_time = 0.0;
|
start_time = last_time = 0.0;
|
||||||
start_seq = last_seq = ack_seq = 0;
|
start_seq = last_seq = ack_seq = 0;
|
||||||
seq_wraps = ack_wraps = 0;
|
seq_wraps = ack_wraps = 0;
|
||||||
|
@ -29,7 +29,7 @@ TCP_Endpoint::TCP_Endpoint(TCP_Analyzer* arg_analyzer, bool arg_is_orig)
|
||||||
FIN_seq = 0;
|
FIN_seq = 0;
|
||||||
SYN_cnt = FIN_cnt = RST_cnt = 0;
|
SYN_cnt = FIN_cnt = RST_cnt = 0;
|
||||||
did_close = false;
|
did_close = false;
|
||||||
contents_file = 0;
|
contents_file = nullptr;
|
||||||
tcp_analyzer = arg_analyzer;
|
tcp_analyzer = arg_analyzer;
|
||||||
is_orig = arg_is_orig;
|
is_orig = arg_is_orig;
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,7 @@ public:
|
||||||
|
|
||||||
Connection* Conn() const;
|
Connection* Conn() const;
|
||||||
|
|
||||||
bool HasContents() const { return contents_processor != 0; }
|
bool HasContents() const { return contents_processor != nullptr; }
|
||||||
bool HadGap() const;
|
bool HadGap() const;
|
||||||
|
|
||||||
inline bool IsOrig() const { return is_orig; }
|
inline bool IsOrig() const { return is_orig; }
|
||||||
|
|
|
@ -30,7 +30,7 @@ TCP_Reassembler::TCP_Reassembler(analyzer::Analyzer* arg_dst_analyzer,
|
||||||
type = arg_type;
|
type = arg_type;
|
||||||
endp = arg_endp;
|
endp = arg_endp;
|
||||||
had_gap = false;
|
had_gap = false;
|
||||||
record_contents_file = 0;
|
record_contents_file = nullptr;
|
||||||
deliver_tcp_contents = false;
|
deliver_tcp_contents = false;
|
||||||
skip_deliveries = false;
|
skip_deliveries = false;
|
||||||
did_EOF = false;
|
did_EOF = false;
|
||||||
|
|
|
@ -121,7 +121,7 @@ function set_contents_file%(cid: conn_id, direction: count, f: file%): bool
|
||||||
function get_contents_file%(cid: conn_id, direction: count%): file
|
function get_contents_file%(cid: conn_id, direction: count%): file
|
||||||
%{
|
%{
|
||||||
Connection* c = sessions->FindConnection(cid);
|
Connection* c = sessions->FindConnection(cid);
|
||||||
BroFile* f = c ? c->GetRootAnalyzer()->GetContentsFile(direction) : 0;
|
BroFile* f = c ? c->GetRootAnalyzer()->GetContentsFile(direction) : nullptr;
|
||||||
|
|
||||||
if ( f )
|
if ( f )
|
||||||
{
|
{
|
||||||
|
|
|
@ -98,9 +98,9 @@ bool TeredoEncapsulation::DoParse(const u_char* data, int& len,
|
||||||
|
|
||||||
RecordVal* TeredoEncapsulation::BuildVal(const IP_Hdr* inner) const
|
RecordVal* TeredoEncapsulation::BuildVal(const IP_Hdr* inner) const
|
||||||
{
|
{
|
||||||
static RecordType* teredo_hdr_type = 0;
|
static RecordType* teredo_hdr_type = nullptr;
|
||||||
static RecordType* teredo_auth_type = 0;
|
static RecordType* teredo_auth_type = nullptr;
|
||||||
static RecordType* teredo_origin_type = 0;
|
static RecordType* teredo_origin_type = nullptr;
|
||||||
|
|
||||||
if ( ! teredo_hdr_type )
|
if ( ! teredo_hdr_type )
|
||||||
{
|
{
|
||||||
|
@ -167,7 +167,7 @@ void Teredo_Analyzer::DeliverPacket(int len, const u_char* data, bool orig,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IP_Hdr* inner = 0;
|
IP_Hdr* inner = nullptr;
|
||||||
int rslt = sessions->ParseIPPacket(len, te.InnerIP(), IPPROTO_IPV6, inner);
|
int rslt = sessions->ParseIPPacket(len, te.InnerIP(), IPPROTO_IPV6, inner);
|
||||||
|
|
||||||
if ( rslt > 0 )
|
if ( rslt > 0 )
|
||||||
|
@ -201,33 +201,33 @@ void Teredo_Analyzer::DeliverPacket(int len, const u_char* data, bool orig,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Val* teredo_hdr = 0;
|
Val* teredo_hdr = nullptr;
|
||||||
|
|
||||||
if ( teredo_packet )
|
if ( teredo_packet )
|
||||||
{
|
{
|
||||||
teredo_hdr = te.BuildVal(inner);
|
teredo_hdr = te.BuildVal(inner);
|
||||||
Conn()->Event(teredo_packet, 0, teredo_hdr);
|
Conn()->Event(teredo_packet, nullptr, teredo_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( te.Authentication() && teredo_authentication )
|
if ( te.Authentication() && teredo_authentication )
|
||||||
{
|
{
|
||||||
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
||||||
Conn()->Event(teredo_authentication, 0, teredo_hdr);
|
Conn()->Event(teredo_authentication, nullptr, teredo_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( te.OriginIndication() && teredo_origin_indication )
|
if ( te.OriginIndication() && teredo_origin_indication )
|
||||||
{
|
{
|
||||||
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
||||||
Conn()->Event(teredo_origin_indication, 0, teredo_hdr);
|
Conn()->Event(teredo_origin_indication, nullptr, teredo_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( inner->NextProto() == IPPROTO_NONE && teredo_bubble )
|
if ( inner->NextProto() == IPPROTO_NONE && teredo_bubble )
|
||||||
{
|
{
|
||||||
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
teredo_hdr = teredo_hdr ? teredo_hdr->Ref() : te.BuildVal(inner);
|
||||||
Conn()->Event(teredo_bubble, 0, teredo_hdr);
|
Conn()->Event(teredo_bubble, nullptr, teredo_hdr);
|
||||||
}
|
}
|
||||||
|
|
||||||
EncapsulatingConn ec(Conn(), BifEnum::Tunnel::TEREDO);
|
EncapsulatingConn ec(Conn(), BifEnum::Tunnel::TEREDO);
|
||||||
|
|
||||||
sessions->DoNextInnerPacket(network_time, 0, inner, e, ec);
|
sessions->DoNextInnerPacket(network_time, nullptr, inner, e, ec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ protected:
|
||||||
class TeredoEncapsulation {
|
class TeredoEncapsulation {
|
||||||
public:
|
public:
|
||||||
explicit TeredoEncapsulation(const Teredo_Analyzer* ta)
|
explicit TeredoEncapsulation(const Teredo_Analyzer* ta)
|
||||||
: inner_ip(0), origin_indication(0), auth(0), analyzer(ta)
|
: inner_ip(nullptr), origin_indication(nullptr), auth(nullptr), analyzer(ta)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -101,7 +101,7 @@ void VXLAN_Analyzer::DeliverPacket(int len, const u_char* data, bool orig,
|
||||||
ProtocolConfirmation();
|
ProtocolConfirmation();
|
||||||
|
|
||||||
if ( vxlan_packet )
|
if ( vxlan_packet )
|
||||||
Conn()->Event(vxlan_packet, 0, inner->BuildPktHdrVal(),
|
Conn()->Event(vxlan_packet, nullptr, inner->BuildPktHdrVal(),
|
||||||
val_mgr->GetCount(vni));
|
val_mgr->GetCount(vni));
|
||||||
|
|
||||||
EncapsulatingConn ec(Conn(), BifEnum::Tunnel::VXLAN);
|
EncapsulatingConn ec(Conn(), BifEnum::Tunnel::VXLAN);
|
||||||
|
|
|
@ -11,7 +11,7 @@ class Plugin : public plugin::Plugin {
|
||||||
public:
|
public:
|
||||||
plugin::Configuration Configure() override
|
plugin::Configuration Configure() override
|
||||||
{
|
{
|
||||||
AddComponent(new ::analyzer::Component("ZIP", 0));
|
AddComponent(new ::analyzer::Component("ZIP", nullptr));
|
||||||
|
|
||||||
plugin::Configuration config;
|
plugin::Configuration config;
|
||||||
config.name = "Zeek::ZIP";
|
config.name = "Zeek::ZIP";
|
||||||
|
|
|
@ -7,7 +7,7 @@ using namespace analyzer::zip;
|
||||||
ZIP_Analyzer::ZIP_Analyzer(Connection* conn, bool orig, Method arg_method)
|
ZIP_Analyzer::ZIP_Analyzer(Connection* conn, bool orig, Method arg_method)
|
||||||
: tcp::TCP_SupportAnalyzer("ZIP", conn, orig)
|
: tcp::TCP_SupportAnalyzer("ZIP", conn, orig)
|
||||||
{
|
{
|
||||||
zip = 0;
|
zip = nullptr;
|
||||||
zip_status = Z_OK;
|
zip_status = Z_OK;
|
||||||
method = arg_method;
|
method = arg_method;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ ZIP_Analyzer::ZIP_Analyzer(Connection* conn, bool orig, Method arg_method)
|
||||||
{
|
{
|
||||||
Weird("inflate_init_failed");
|
Weird("inflate_init_failed");
|
||||||
delete zip;
|
delete zip;
|
||||||
zip = 0;
|
zip = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue