mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
Deprecate EventMgr::QueueEvent() and update usages to Enqueue()
This commit is contained in:
parent
b667c637df
commit
0db484cc7a
14 changed files with 164 additions and 128 deletions
3
NEWS
3
NEWS
|
@ -52,6 +52,9 @@ Deprecated Functionality
|
||||||
be used instead. There's also now a variadic template that forwards all
|
be used instead. There's also now a variadic template that forwards all
|
||||||
arguments.
|
arguments.
|
||||||
|
|
||||||
|
- The ``EventMgr::QueueEvent()`` and EventMgr::QueueEventFast()`` methods
|
||||||
|
are now deprecated, use ``EventMgr::Enqueue()`` instead.
|
||||||
|
|
||||||
Zeek 3.1.0
|
Zeek 3.1.0
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
12
src/Conn.cc
12
src/Conn.cc
|
@ -497,14 +497,14 @@ void Connection::ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* a, val_l
|
||||||
}
|
}
|
||||||
|
|
||||||
// "this" is passed as a cookie for the event
|
// "this" is passed as a cookie for the event
|
||||||
mgr.QueueEvent(f, std::move(vl), SOURCE_LOCAL,
|
mgr.Enqueue(f, zeek::val_list_to_args(&vl), SOURCE_LOCAL,
|
||||||
a ? a->GetID() : 0, timer_mgr, this);
|
a ? a->GetID() : 0, timer_mgr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Connection::ConnectionEventFast(EventHandlerPtr f, analyzer::Analyzer* a, val_list vl)
|
void Connection::ConnectionEventFast(EventHandlerPtr f, analyzer::Analyzer* a, val_list vl)
|
||||||
{
|
{
|
||||||
// "this" is passed as a cookie for the event
|
// "this" is passed as a cookie for the event
|
||||||
mgr.QueueEventFast(f, std::move(vl), SOURCE_LOCAL,
|
mgr.Enqueue(f, zeek::val_list_to_args(&vl), SOURCE_LOCAL,
|
||||||
a ? a->GetID() : 0, timer_mgr, this);
|
a ? a->GetID() : 0, timer_mgr, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,6 +514,14 @@ void Connection::ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* a, val_l
|
||||||
delete vl;
|
delete vl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Connection::EnqueueEvent(EventHandlerPtr f, zeek::Args args,
|
||||||
|
analyzer::Analyzer* a)
|
||||||
|
{
|
||||||
|
// "this" is passed as a cookie for the event
|
||||||
|
mgr.Enqueue(f, std::move(args), SOURCE_LOCAL, a ? a->GetID() : 0,
|
||||||
|
timer_mgr, this);
|
||||||
|
}
|
||||||
|
|
||||||
void Connection::Weird(const char* name, const char* addl)
|
void Connection::Weird(const char* name, const char* addl)
|
||||||
{
|
{
|
||||||
weird = 1;
|
weird = 1;
|
||||||
|
|
10
src/Conn.h
10
src/Conn.h
|
@ -12,6 +12,7 @@
|
||||||
#include "IPAddr.h"
|
#include "IPAddr.h"
|
||||||
#include "UID.h"
|
#include "UID.h"
|
||||||
#include "WeirdState.h"
|
#include "WeirdState.h"
|
||||||
|
#include "ZeekArgs.h"
|
||||||
#include "iosource/Packet.h"
|
#include "iosource/Packet.h"
|
||||||
|
|
||||||
#include "analyzer/Tag.h"
|
#include "analyzer/Tag.h"
|
||||||
|
@ -187,6 +188,7 @@ public:
|
||||||
// If a handler exists for 'f', an event will be generated. In any case,
|
// If a handler exists for 'f', an event will be generated. In any case,
|
||||||
// reference count for each element in the 'vl' list are decremented. The
|
// reference count for each element in the 'vl' list are decremented. The
|
||||||
// arguments used for the event are whatevever is provided in 'vl'.
|
// arguments used for the event are whatevever is provided in 'vl'.
|
||||||
|
// TODO: deprecate
|
||||||
void ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
void ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
||||||
val_list vl);
|
val_list vl);
|
||||||
|
|
||||||
|
@ -194,6 +196,7 @@ public:
|
||||||
// pointer instead of by value. This function takes ownership of the
|
// pointer instead of by value. This function takes ownership of the
|
||||||
// memory pointed to by 'vl' and also for decrementing the reference count
|
// memory pointed to by 'vl' and also for decrementing the reference count
|
||||||
// of each of its elements.
|
// of each of its elements.
|
||||||
|
// TODO: deprecate
|
||||||
void ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
void ConnectionEvent(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
||||||
val_list* vl);
|
val_list* vl);
|
||||||
|
|
||||||
|
@ -205,9 +208,16 @@ public:
|
||||||
// the case where there's no handlers (one usually also does that because
|
// the case where there's no handlers (one usually also does that because
|
||||||
// it would be a waste of effort to construct all the event arguments when
|
// it would be a waste of effort to construct all the event arguments when
|
||||||
// there's no handlers to consume them).
|
// there's no handlers to consume them).
|
||||||
|
// TODO: deprecate
|
||||||
void ConnectionEventFast(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
void ConnectionEventFast(EventHandlerPtr f, analyzer::Analyzer* analyzer,
|
||||||
val_list vl);
|
val_list vl);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enqueues an event associated with this connection and given analyzer.
|
||||||
|
*/
|
||||||
|
void EnqueueEvent(EventHandlerPtr f, zeek::Args args,
|
||||||
|
analyzer::Analyzer* analyzer = nullptr);
|
||||||
|
|
||||||
void Weird(const char* name, const char* addl = "");
|
void Weird(const char* name, const char* addl = "");
|
||||||
bool DidWeird() const { return weird != 0; }
|
bool DidWeird() const { return weird != 0; }
|
||||||
|
|
||||||
|
|
30
src/Event.cc
30
src/Event.cc
|
@ -109,35 +109,27 @@ void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list vl,
|
||||||
SourceID src, analyzer::ID aid,
|
SourceID src, analyzer::ID aid,
|
||||||
TimerMgr* mgr, BroObj* obj)
|
TimerMgr* mgr, BroObj* obj)
|
||||||
{
|
{
|
||||||
|
auto args = zeek::val_list_to_args(&vl);
|
||||||
|
|
||||||
if ( h )
|
if ( h )
|
||||||
QueueEvent(new Event(h, zeek::val_list_to_args(&vl), src, aid, mgr, obj));
|
Enqueue(h, std::move(args), src, aid, mgr, obj);
|
||||||
else
|
|
||||||
{
|
|
||||||
for ( const auto& v : vl )
|
|
||||||
Unref(v);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
void EventMgr::QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
||||||
SourceID src, analyzer::ID aid,
|
SourceID src, analyzer::ID aid,
|
||||||
TimerMgr* mgr, BroObj* obj)
|
TimerMgr* mgr, BroObj* obj)
|
||||||
{
|
{
|
||||||
QueueEvent(h, std::move(*vl), src, aid, mgr, obj);
|
auto args = zeek::val_list_to_args(vl);
|
||||||
delete vl;
|
delete vl;
|
||||||
}
|
|
||||||
|
|
||||||
void EventMgr::QueueCheckedEvent(const EventHandlerPtr& h, zeek::Args vl,
|
|
||||||
SourceID src, analyzer::ID aid,
|
|
||||||
TimerMgr* mgr, BroObj* obj)
|
|
||||||
{
|
|
||||||
QueueEvent(new Event(h, std::move(vl), src, aid, mgr, obj));
|
|
||||||
}
|
|
||||||
|
|
||||||
void EventMgr::QueueUncheckedEvent(const EventHandlerPtr& h, zeek::Args vl,
|
|
||||||
SourceID src, analyzer::ID aid,
|
|
||||||
TimerMgr* mgr, BroObj* obj)
|
|
||||||
{
|
|
||||||
if ( h )
|
if ( h )
|
||||||
|
Enqueue(h, std::move(args), src, aid, mgr, obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventMgr::Enqueue(const EventHandlerPtr& h, zeek::Args vl,
|
||||||
|
SourceID src, analyzer::ID aid,
|
||||||
|
TimerMgr* mgr, BroObj* obj)
|
||||||
|
{
|
||||||
QueueEvent(new Event(h, std::move(vl), src, aid, mgr, obj));
|
QueueEvent(new Event(h, std::move(vl), src, aid, mgr, obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
42
src/Event.h
42
src/Event.h
|
@ -8,6 +8,9 @@
|
||||||
#include "Flare.h"
|
#include "Flare.h"
|
||||||
#include "ZeekArgs.h"
|
#include "ZeekArgs.h"
|
||||||
|
|
||||||
|
#include <tuple>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
class EventMgr;
|
class EventMgr;
|
||||||
|
|
||||||
class Event : public BroObj {
|
class Event : public BroObj {
|
||||||
|
@ -60,7 +63,7 @@ public:
|
||||||
// because it would be a waste of effort to construct all the event
|
// because it would be a waste of effort to construct all the event
|
||||||
// arguments when there's no handlers to consume them).
|
// arguments when there's no handlers to consume them).
|
||||||
// TODO: deprecate
|
// TODO: deprecate
|
||||||
/* [[deprecated("Remove in v4.1. Use IntrusivePtr overload instead.")]] */
|
/* [[deprecated("Remove in v4.1. Use Enqueue() instead.")]] */
|
||||||
void QueueEventFast(const EventHandlerPtr &h, val_list vl,
|
void QueueEventFast(const EventHandlerPtr &h, val_list vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||||
|
@ -71,8 +74,7 @@ public:
|
||||||
// checked for event handler existence, you may wish to call
|
// checked for event handler existence, you may wish to call
|
||||||
// QueueEventFast() instead of this function to prevent the redundant
|
// QueueEventFast() instead of this function to prevent the redundant
|
||||||
// existence check.
|
// existence check.
|
||||||
// TODO: deprecate
|
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||||
/* [[deprecated("Remove in v4.1. Use IntrusivePtr overload instead.")]] */
|
|
||||||
void QueueEvent(const EventHandlerPtr &h, val_list vl,
|
void QueueEvent(const EventHandlerPtr &h, val_list vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||||
|
@ -81,32 +83,36 @@ public:
|
||||||
// pointer instead of by value. This function takes ownership of the
|
// pointer instead of by value. This function takes ownership of the
|
||||||
// memory pointed to by 'vl' as well as decrementing the reference count of
|
// memory pointed to by 'vl' as well as decrementing the reference count of
|
||||||
// each of its elements.
|
// each of its elements.
|
||||||
// TODO: deprecate
|
[[deprecated("Remove in v4.1. Use Enqueue() instead.")]]
|
||||||
/* [[deprecated("Remove in v4.1. Use IntrusivePtr overload instead.")]] */
|
|
||||||
void QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
void QueueEvent(const EventHandlerPtr &h, val_list* vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = 0, BroObj* obj = 0);
|
TimerMgr* mgr = 0, BroObj* obj = 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues an event without first checking if there's an event handler
|
* Adds an event to the queue. If no handler is found for the event
|
||||||
* remote consumer. If there are actually no handlers/consumers upon
|
* when later going to call it, nothing happens except for having
|
||||||
* dispatching the event, nothing happens besides having wasted a bit of
|
* wasted a bit of time/resources, so callers may want to first check
|
||||||
* time and resources. This method is mostly useful from a performance
|
* if any handler/consumer exists before enqueuing an event.
|
||||||
* standpoint: usually callers have already checked that the event will
|
* @param h reference to the event handler to later call.
|
||||||
* consumed so they don't waste time creating an argument list that will
|
* @param vl the argument list to the event handler call.
|
||||||
* only be discarded, so there's no need to do the same check again when
|
* @param src indicates the origin of the event (local versus remote).
|
||||||
* going to queue the event.
|
* @param aid identifies the protocol analyzer generating the event.
|
||||||
|
* @param obj an arbitrary object to use as a "cookie" or just hold a
|
||||||
|
* reference to until dispatching the event.
|
||||||
*/
|
*/
|
||||||
void QueueUncheckedEvent(const EventHandlerPtr& h, zeek::Args vl,
|
void Enqueue(const EventHandlerPtr& h, zeek::Args vl,
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
||||||
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queues an event if it has an event handler or remote consumer.
|
* A version of Enqueue() taking a variable number of arguments.
|
||||||
*/
|
*/
|
||||||
void QueueCheckedEvent(const EventHandlerPtr& h, zeek::Args vl,
|
template <class... Args>
|
||||||
SourceID src = SOURCE_LOCAL, analyzer::ID aid = 0,
|
std::enable_if_t<
|
||||||
TimerMgr* mgr = nullptr, BroObj* obj = nullptr);
|
std::is_convertible_v<
|
||||||
|
std::tuple_element_t<0, std::tuple<Args...>>, IntrusivePtr<Val>>>
|
||||||
|
Enqueue(const EventHandlerPtr& h, Args&&... args)
|
||||||
|
{ return Enqueue(h, zeek::Args{std::forward<Args>(args)...}); }
|
||||||
|
|
||||||
void Dispatch(Event* event, bool no_remote = false);
|
void Dispatch(Event* event, bool no_remote = false);
|
||||||
|
|
||||||
|
|
|
@ -3897,7 +3897,8 @@ ScheduleTimer::~ScheduleTimer()
|
||||||
|
|
||||||
void ScheduleTimer::Dispatch(double /* t */, int /* is_expire */)
|
void ScheduleTimer::Dispatch(double /* t */, int /* is_expire */)
|
||||||
{
|
{
|
||||||
mgr.QueueUncheckedEvent(event, std::move(args), SOURCE_LOCAL, 0, tmgr);
|
if ( event )
|
||||||
|
mgr.Enqueue(event, std::move(args), SOURCE_LOCAL, 0, tmgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScheduleExpr::ScheduleExpr(IntrusivePtr<Expr> arg_when,
|
ScheduleExpr::ScheduleExpr(IntrusivePtr<Expr> arg_when,
|
||||||
|
@ -4443,7 +4444,10 @@ IntrusivePtr<Val> EventExpr::Eval(Frame* f) const
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
auto v = eval_list(f, args.get());
|
auto v = eval_list(f, args.get());
|
||||||
mgr.QueueUncheckedEvent(handler, std::move(*v));
|
|
||||||
|
if ( handler )
|
||||||
|
mgr.Enqueue(handler, std::move(*v));
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,8 @@ void NetSessions::DoNextPacket(double t, const Packet* pkt, const IP_Hdr* ip_hdr
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( mobile_ipv6_message )
|
if ( mobile_ipv6_message )
|
||||||
mgr.QueueEvent(mobile_ipv6_message, {ip_hdr->BuildPktHdrVal()});
|
mgr.Enqueue(mobile_ipv6_message,
|
||||||
|
IntrusivePtr{AdoptRef{}, ip_hdr->BuildPktHdrVal()});
|
||||||
|
|
||||||
if ( ip_hdr->NextProto() != IPPROTO_NONE )
|
if ( ip_hdr->NextProto() != IPPROTO_NONE )
|
||||||
Weird("mobility_piggyback", pkt, encapsulation);
|
Weird("mobility_piggyback", pkt, encapsulation);
|
||||||
|
|
|
@ -960,9 +960,10 @@ IntrusivePtr<Val> EventStmt::Exec(Frame* f, stmt_flow_type& flow) const
|
||||||
{
|
{
|
||||||
RegisterAccess();
|
RegisterAccess();
|
||||||
auto args = eval_list(f, event_expr->Args());
|
auto args = eval_list(f, event_expr->Args());
|
||||||
|
auto h = event_expr->Handler();
|
||||||
|
|
||||||
if ( args )
|
if ( args && h )
|
||||||
mgr.QueueUncheckedEvent(event_expr->Handler(), std::move(*args));
|
mgr.Enqueue(h, std::move(*args));
|
||||||
|
|
||||||
flow = FLOW_NEXT;
|
flow = FLOW_NEXT;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
|
@ -75,7 +75,7 @@ static bool OCSP_RESPID_bio(OCSP_BASICRESP* basic_resp, BIO* bio)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ocsp_add_cert_id(const OCSP_CERTID* cert_id, val_list* vl, BIO* bio)
|
static bool ocsp_add_cert_id(const OCSP_CERTID* cert_id, zeek::Args* vl, BIO* bio)
|
||||||
{
|
{
|
||||||
ASN1_OBJECT* hash_alg = nullptr;
|
ASN1_OBJECT* hash_alg = nullptr;
|
||||||
ASN1_OCTET_STRING* issuer_name_hash = nullptr;
|
ASN1_OCTET_STRING* issuer_name_hash = nullptr;
|
||||||
|
@ -89,10 +89,10 @@ bool ocsp_add_cert_id(const OCSP_CERTID* cert_id, val_list* vl, BIO* bio)
|
||||||
if ( ! res )
|
if ( ! res )
|
||||||
{
|
{
|
||||||
reporter->Weird("OpenSSL failed to get OCSP_CERTID info");
|
reporter->Weird("OpenSSL failed to get OCSP_CERTID info");
|
||||||
vl->push_back(val_mgr->GetEmptyString());
|
vl->emplace_back(AdoptRef{}, val_mgr->GetEmptyString());
|
||||||
vl->push_back(val_mgr->GetEmptyString());
|
vl->emplace_back(AdoptRef{}, val_mgr->GetEmptyString());
|
||||||
vl->push_back(val_mgr->GetEmptyString());
|
vl->emplace_back(AdoptRef{}, val_mgr->GetEmptyString());
|
||||||
vl->push_back(val_mgr->GetEmptyString());
|
vl->emplace_back(AdoptRef{}, val_mgr->GetEmptyString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,22 +101,22 @@ bool ocsp_add_cert_id(const OCSP_CERTID* cert_id, val_list* vl, BIO* bio)
|
||||||
|
|
||||||
i2a_ASN1_OBJECT(bio, hash_alg);
|
i2a_ASN1_OBJECT(bio, hash_alg);
|
||||||
int len = BIO_read(bio, buf, sizeof(buf));
|
int len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl->push_back(new StringVal(len, buf));
|
vl->emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
|
|
||||||
i2a_ASN1_STRING(bio, issuer_name_hash, V_ASN1_OCTET_STRING);
|
i2a_ASN1_STRING(bio, issuer_name_hash, V_ASN1_OCTET_STRING);
|
||||||
len = BIO_read(bio, buf, sizeof(buf));
|
len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl->push_back(new StringVal(len, buf));
|
vl->emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
|
|
||||||
i2a_ASN1_STRING(bio, issuer_key_hash, V_ASN1_OCTET_STRING);
|
i2a_ASN1_STRING(bio, issuer_key_hash, V_ASN1_OCTET_STRING);
|
||||||
len = BIO_read(bio, buf, sizeof(buf));
|
len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl->push_back(new StringVal(len, buf));
|
vl->emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
|
|
||||||
i2a_ASN1_INTEGER(bio, serial_number);
|
i2a_ASN1_INTEGER(bio, serial_number);
|
||||||
len = BIO_read(bio, buf, sizeof(buf));
|
len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl->push_back(new StringVal(len, buf));
|
vl->emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -430,14 +430,17 @@ void file_analysis::OCSP::ParseRequest(OCSP_REQUEST* req)
|
||||||
int req_count = OCSP_request_onereq_count(req);
|
int req_count = OCSP_request_onereq_count(req);
|
||||||
for ( int i=0; i<req_count; i++ )
|
for ( int i=0; i<req_count; i++ )
|
||||||
{
|
{
|
||||||
val_list rvl(5);
|
zeek::Args rvl;
|
||||||
rvl.push_back(GetFile()->GetVal()->Ref());
|
rvl.reserve(5);
|
||||||
|
rvl.emplace_back(NewRef{}, GetFile()->GetVal());
|
||||||
|
|
||||||
OCSP_ONEREQ *one_req = OCSP_request_onereq_get0(req, i);
|
OCSP_ONEREQ *one_req = OCSP_request_onereq_get0(req, i);
|
||||||
OCSP_CERTID *cert_id = OCSP_onereq_get0_id(one_req);
|
OCSP_CERTID *cert_id = OCSP_onereq_get0_id(one_req);
|
||||||
|
|
||||||
ocsp_add_cert_id(cert_id, &rvl, bio);
|
ocsp_add_cert_id(cert_id, &rvl, bio);
|
||||||
mgr.QueueEvent(ocsp_request_certificate, std::move(rvl));
|
|
||||||
|
if ( ocsp_request_certificate )
|
||||||
|
mgr.Enqueue(ocsp_request_certificate, std::move(rvl));
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
|
@ -479,7 +482,8 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
//int len = BIO_read(bio, buf, sizeof(buf));
|
//int len = BIO_read(bio, buf, sizeof(buf));
|
||||||
//BIO_reset(bio);
|
//BIO_reset(bio);
|
||||||
|
|
||||||
val_list vl(8);
|
zeek::Args vl;
|
||||||
|
vl.reserve(8);
|
||||||
|
|
||||||
// get the basic response
|
// get the basic response
|
||||||
basic_resp = OCSP_response_get1_basic(resp);
|
basic_resp = OCSP_response_get1_basic(resp);
|
||||||
|
@ -498,26 +502,26 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vl.push_back(GetFile()->GetVal()->Ref());
|
vl.emplace_back(NewRef{}, GetFile()->GetVal());
|
||||||
vl.push_back(status_val);
|
vl.emplace_back(AdoptRef{}, status_val);
|
||||||
|
|
||||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
vl.push_back(val_mgr->GetCount((uint64_t)ASN1_INTEGER_get(resp_data->version)));
|
vl.emplace_back(AdoptRef{}, val_mgr->GetCount((uint64_t)ASN1_INTEGER_get(resp_data->version)));
|
||||||
#else
|
#else
|
||||||
vl.push_back(parse_basic_resp_data_version(basic_resp));
|
vl.emplace_back(AdoptRef{}, parse_basic_resp_data_version(basic_resp));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// responderID
|
// responderID
|
||||||
if ( OCSP_RESPID_bio(basic_resp, bio) )
|
if ( OCSP_RESPID_bio(basic_resp, bio) )
|
||||||
{
|
{
|
||||||
len = BIO_read(bio, buf, sizeof(buf));
|
len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl.push_back(new StringVal(len, buf));
|
vl.emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
reporter->Weird("OpenSSL failed to get OCSP responder id");
|
reporter->Weird("OpenSSL failed to get OCSP responder id");
|
||||||
vl.push_back(val_mgr->GetEmptyString());
|
vl.emplace_back(AdoptRef{}, val_mgr->GetEmptyString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// producedAt
|
// producedAt
|
||||||
|
@ -527,7 +531,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
produced_at = OCSP_resp_get0_produced_at(basic_resp);
|
produced_at = OCSP_resp_get0_produced_at(basic_resp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
vl.push_back(new Val(GetTimeFromAsn1(produced_at, GetFile(), reporter), TYPE_TIME));
|
vl.emplace_back(make_intrusive<Val>(GetTimeFromAsn1(produced_at, GetFile(), reporter), TYPE_TIME));
|
||||||
|
|
||||||
// responses
|
// responses
|
||||||
|
|
||||||
|
@ -540,8 +544,9 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
if ( !single_resp )
|
if ( !single_resp )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
val_list rvl(10);
|
zeek::Args rvl;
|
||||||
rvl.push_back(GetFile()->GetVal()->Ref());
|
rvl.reserve(10);
|
||||||
|
rvl.emplace_back(NewRef{}, GetFile()->GetVal());
|
||||||
|
|
||||||
// cert id
|
// cert id
|
||||||
const OCSP_CERTID* cert_id = nullptr;
|
const OCSP_CERTID* cert_id = nullptr;
|
||||||
|
@ -569,38 +574,39 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
reporter->Weird("OpenSSL failed to find status of OCSP response");
|
reporter->Weird("OpenSSL failed to find status of OCSP response");
|
||||||
|
|
||||||
const char* cert_status_str = OCSP_cert_status_str(status);
|
const char* cert_status_str = OCSP_cert_status_str(status);
|
||||||
rvl.push_back(new StringVal(strlen(cert_status_str), cert_status_str));
|
rvl.emplace_back(make_intrusive<StringVal>(strlen(cert_status_str), cert_status_str));
|
||||||
|
|
||||||
// revocation time and reason if revoked
|
// revocation time and reason if revoked
|
||||||
if ( status == V_OCSP_CERTSTATUS_REVOKED )
|
if ( status == V_OCSP_CERTSTATUS_REVOKED )
|
||||||
{
|
{
|
||||||
rvl.push_back(new Val(GetTimeFromAsn1(revoke_time, GetFile(), reporter), TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(GetTimeFromAsn1(revoke_time, GetFile(), reporter), TYPE_TIME));
|
||||||
|
|
||||||
if ( reason != OCSP_REVOKED_STATUS_NOSTATUS )
|
if ( reason != OCSP_REVOKED_STATUS_NOSTATUS )
|
||||||
{
|
{
|
||||||
const char* revoke_reason = OCSP_crl_reason_str(reason);
|
const char* revoke_reason = OCSP_crl_reason_str(reason);
|
||||||
rvl.push_back(new StringVal(strlen(revoke_reason), revoke_reason));
|
rvl.emplace_back(make_intrusive<StringVal>(strlen(revoke_reason), revoke_reason));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rvl.push_back(new StringVal(0, ""));
|
rvl.emplace_back(make_intrusive<StringVal>(0, ""));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rvl.push_back(new Val(0.0, TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(0.0, TYPE_TIME));
|
||||||
rvl.push_back(new StringVal(0, ""));
|
rvl.emplace_back(make_intrusive<StringVal>(0, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this_update )
|
if ( this_update )
|
||||||
rvl.push_back(new Val(GetTimeFromAsn1(this_update, GetFile(), reporter), TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(GetTimeFromAsn1(this_update, GetFile(), reporter), TYPE_TIME));
|
||||||
else
|
else
|
||||||
rvl.push_back(new Val(0.0, TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(0.0, TYPE_TIME));
|
||||||
|
|
||||||
if ( next_update )
|
if ( next_update )
|
||||||
rvl.push_back(new Val(GetTimeFromAsn1(next_update, GetFile(), reporter), TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(GetTimeFromAsn1(next_update, GetFile(), reporter), TYPE_TIME));
|
||||||
else
|
else
|
||||||
rvl.push_back(new Val(0.0, TYPE_TIME));
|
rvl.emplace_back(make_intrusive<Val>(0.0, TYPE_TIME));
|
||||||
|
|
||||||
mgr.QueueEvent(ocsp_response_certificate, std::move(rvl));
|
if ( ocsp_response_certificate )
|
||||||
|
mgr.Enqueue(ocsp_response_certificate, std::move(rvl));
|
||||||
|
|
||||||
num_ext = OCSP_SINGLERESP_get_ext_count(single_resp);
|
num_ext = OCSP_SINGLERESP_get_ext_count(single_resp);
|
||||||
for ( int k = 0; k < num_ext; ++k )
|
for ( int k = 0; k < num_ext; ++k )
|
||||||
|
@ -616,10 +622,10 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
i2a_ASN1_OBJECT(bio, basic_resp->signatureAlgorithm->algorithm);
|
i2a_ASN1_OBJECT(bio, basic_resp->signatureAlgorithm->algorithm);
|
||||||
len = BIO_read(bio, buf, sizeof(buf));
|
len = BIO_read(bio, buf, sizeof(buf));
|
||||||
vl.push_back(new StringVal(len, buf));
|
vl.emplace_back(make_intrusive<StringVal>(len, buf));
|
||||||
BIO_reset(bio);
|
BIO_reset(bio);
|
||||||
#else
|
#else
|
||||||
vl.push_back(parse_basic_resp_sig_alg(basic_resp, bio, buf, sizeof(buf)));
|
vl.emplace_back(AdoptRef{}, parse_basic_resp_sig_alg(basic_resp, bio, buf, sizeof(buf)));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//i2a_ASN1_OBJECT(bio, basic_resp->signature);
|
//i2a_ASN1_OBJECT(bio, basic_resp->signature);
|
||||||
|
@ -628,7 +634,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
//BIO_reset(bio);
|
//BIO_reset(bio);
|
||||||
|
|
||||||
certs_vector = new VectorVal(internal_type("x509_opaque_vector")->AsVectorType());
|
certs_vector = new VectorVal(internal_type("x509_opaque_vector")->AsVectorType());
|
||||||
vl.push_back(certs_vector);
|
vl.emplace_back(AdoptRef{}, certs_vector);
|
||||||
|
|
||||||
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)
|
||||||
certs = basic_resp->certs;
|
certs = basic_resp->certs;
|
||||||
|
@ -650,7 +656,8 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mgr.QueueEvent(ocsp_response_bytes, std::move(vl));
|
if ( ocsp_response_bytes )
|
||||||
|
mgr.Enqueue(ocsp_response_bytes, std::move(vl));
|
||||||
|
|
||||||
// ok, now that we are done with the actual certificate - let's parse extensions :)
|
// ok, now that we are done with the actual certificate - let's parse extensions :)
|
||||||
num_ext = OCSP_BASICRESP_get_ext_count(basic_resp);
|
num_ext = OCSP_BASICRESP_get_ext_count(basic_resp);
|
||||||
|
|
|
@ -82,11 +82,11 @@ bool file_analysis::X509::EndOfFile()
|
||||||
RecordVal* cert_record = ParseCertificate(cert_val, GetFile());
|
RecordVal* cert_record = ParseCertificate(cert_val, GetFile());
|
||||||
|
|
||||||
// and send the record on to scriptland
|
// and send the record on to scriptland
|
||||||
mgr.QueueEvent(x509_certificate, {
|
if ( x509_certificate )
|
||||||
GetFile()->GetVal()->Ref(),
|
mgr.Enqueue(x509_certificate,
|
||||||
cert_val->Ref(),
|
IntrusivePtr{NewRef{}, GetFile()->GetVal()},
|
||||||
cert_record->Ref(), // we Ref it here, because we want to keep a copy around for now...
|
IntrusivePtr{NewRef{}, cert_val},
|
||||||
});
|
IntrusivePtr{NewRef{}, cert_record});
|
||||||
|
|
||||||
// after parsing the certificate - parse the extensions...
|
// after parsing the certificate - parse the extensions...
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RecordVal* sanExt = new RecordVal(BifType::Record::X509::SubjectAlternativeName);
|
auto sanExt = make_intrusive<RecordVal>(BifType::Record::X509::SubjectAlternativeName);
|
||||||
|
|
||||||
if ( names != 0 )
|
if ( names != 0 )
|
||||||
sanExt->Assign(0, names);
|
sanExt->Assign(0, names);
|
||||||
|
@ -436,10 +436,9 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
|
||||||
|
|
||||||
sanExt->Assign(4, val_mgr->GetBool(otherfields));
|
sanExt->Assign(4, val_mgr->GetBool(otherfields));
|
||||||
|
|
||||||
mgr.QueueEvent(x509_ext_subject_alternative_name, {
|
mgr.Enqueue(x509_ext_subject_alternative_name,
|
||||||
GetFile()->GetVal()->Ref(),
|
IntrusivePtr{NewRef{}, GetFile()->GetVal()},
|
||||||
sanExt,
|
std::move(sanExt));
|
||||||
});
|
|
||||||
GENERAL_NAMES_free(altname);
|
GENERAL_NAMES_free(altname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,12 +257,19 @@ void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const EventHa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StringVal* ext_val = GetExtensionFromBIO(bio, GetFile());
|
auto ext_val = GetExtensionFromBIO(bio, GetFile());
|
||||||
|
|
||||||
|
if ( ! h )
|
||||||
|
{
|
||||||
|
// let individual analyzers parse more.
|
||||||
|
ParseExtensionsSpecific(ex, global, ext_asn, oid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if ( ! ext_val )
|
if ( ! ext_val )
|
||||||
ext_val = new StringVal(0, "");
|
ext_val = make_intrusive<StringVal>(0, "");
|
||||||
|
|
||||||
RecordVal* pX509Ext = new RecordVal(BifType::Record::X509::Extension);
|
auto pX509Ext = make_intrusive<RecordVal>(BifType::Record::X509::Extension);
|
||||||
pX509Ext->Assign(0, make_intrusive<StringVal>(name));
|
pX509Ext->Assign(0, make_intrusive<StringVal>(name));
|
||||||
|
|
||||||
if ( short_name and strlen(short_name) > 0 )
|
if ( short_name and strlen(short_name) > 0 )
|
||||||
|
@ -280,22 +287,18 @@ void file_analysis::X509Common::ParseExtension(X509_EXTENSION* ex, const EventHa
|
||||||
// but I am not sure if there is a better way to do it...
|
// but I am not sure if there is a better way to do it...
|
||||||
|
|
||||||
if ( h == ocsp_extension )
|
if ( h == ocsp_extension )
|
||||||
mgr.QueueEvent(h, {
|
mgr.Enqueue(h, IntrusivePtr{NewRef{}, GetFile()->GetVal()},
|
||||||
GetFile()->GetVal()->Ref(),
|
std::move(pX509Ext),
|
||||||
pX509Ext,
|
IntrusivePtr{AdoptRef{}, val_mgr->GetBool(global)});
|
||||||
val_mgr->GetBool(global ? 1 : 0),
|
|
||||||
});
|
|
||||||
else
|
else
|
||||||
mgr.QueueEvent(h, {
|
mgr.Enqueue(h, IntrusivePtr{NewRef{}, GetFile()->GetVal()},
|
||||||
GetFile()->GetVal()->Ref(),
|
std::move(pX509Ext));
|
||||||
pX509Ext,
|
|
||||||
});
|
|
||||||
|
|
||||||
// let individual analyzers parse more.
|
// let individual analyzers parse more.
|
||||||
ParseExtensionsSpecific(ex, global, ext_asn, oid);
|
ParseExtensionsSpecific(ex, global, ext_asn, oid);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringVal* file_analysis::X509Common::GetExtensionFromBIO(BIO* bio, File* f)
|
IntrusivePtr<StringVal> file_analysis::X509Common::GetExtensionFromBIO(BIO* bio, File* f)
|
||||||
{
|
{
|
||||||
BIO_flush(bio);
|
BIO_flush(bio);
|
||||||
ERR_clear_error();
|
ERR_clear_error();
|
||||||
|
@ -313,7 +316,7 @@ StringVal* file_analysis::X509Common::GetExtensionFromBIO(BIO* bio, File* f)
|
||||||
if ( length == 0 )
|
if ( length == 0 )
|
||||||
{
|
{
|
||||||
BIO_free_all(bio);
|
BIO_free_all(bio);
|
||||||
return val_mgr->GetEmptyString();
|
return {AdoptRef{}, val_mgr->GetEmptyString()};
|
||||||
}
|
}
|
||||||
|
|
||||||
char* buffer = (char*) malloc(length);
|
char* buffer = (char*) malloc(length);
|
||||||
|
@ -328,7 +331,7 @@ StringVal* file_analysis::X509Common::GetExtensionFromBIO(BIO* bio, File* f)
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_read(bio, (void*) buffer, length);
|
BIO_read(bio, (void*) buffer, length);
|
||||||
StringVal* ext_val = new StringVal(length, buffer);
|
auto ext_val = make_intrusive<StringVal>(length, buffer);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
BIO_free_all(bio);
|
BIO_free_all(bio);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
class EventHandlerPtr;
|
class EventHandlerPtr;
|
||||||
class Reporter;
|
class Reporter;
|
||||||
class StringVal;
|
class StringVal;
|
||||||
|
template <class T> class IntrusivePtr;
|
||||||
|
|
||||||
namespace file_analysis {
|
namespace file_analysis {
|
||||||
|
|
||||||
|
@ -34,7 +35,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return The X509 extension value.
|
* @return The X509 extension value.
|
||||||
*/
|
*/
|
||||||
static StringVal* GetExtensionFromBIO(BIO* bio, File* f = 0);
|
static IntrusivePtr<StringVal> GetExtensionFromBIO(BIO* bio, File* f = 0);
|
||||||
|
|
||||||
static double GetTimeFromAsn1(const ASN1_TIME* atime, File* f, Reporter* reporter);
|
static double GetTimeFromAsn1(const ASN1_TIME* atime, File* f, Reporter* reporter);
|
||||||
|
|
||||||
|
|
|
@ -189,12 +189,12 @@ function x509_get_certificate_string%(cert: opaque of x509, pem: bool &default=F
|
||||||
else
|
else
|
||||||
i2d_X509_bio(bio, h->GetCertificate());
|
i2d_X509_bio(bio, h->GetCertificate());
|
||||||
|
|
||||||
StringVal* ext_val = file_analysis::X509::GetExtensionFromBIO(bio);
|
auto ext_val = file_analysis::X509::GetExtensionFromBIO(bio);
|
||||||
|
|
||||||
if ( ! ext_val )
|
if ( ! ext_val )
|
||||||
ext_val = val_mgr->GetEmptyString();
|
ext_val = {AdoptRef{}, val_mgr->GetEmptyString()};
|
||||||
|
|
||||||
return ext_val;
|
return ext_val.release();
|
||||||
%}
|
%}
|
||||||
|
|
||||||
## Verifies an OCSP reply.
|
## Verifies an OCSP reply.
|
||||||
|
|
|
@ -1837,12 +1837,14 @@ bool Manager::SendEvent(ReaderFrontend* reader, const string& name, const int nu
|
||||||
|
|
||||||
bool convert_error = false;
|
bool convert_error = false;
|
||||||
|
|
||||||
val_list vl(num_vals);
|
zeek::Args vl;
|
||||||
|
vl.reserve(num_vals);
|
||||||
|
|
||||||
for ( int j = 0; j < num_vals; j++)
|
for ( int j = 0; j < num_vals; j++)
|
||||||
{
|
{
|
||||||
Val* v = ValueToVal(i, vals[j], convert_error);
|
Val* v = ValueToVal(i, vals[j], convert_error);
|
||||||
vl.push_back(v);
|
vl.emplace_back(AdoptRef{}, v);
|
||||||
|
|
||||||
if ( v && ! convert_error && ! same_type(type->FieldType(j), v->Type()) )
|
if ( v && ! convert_error && ! same_type(type->FieldType(j), v->Type()) )
|
||||||
{
|
{
|
||||||
convert_error = true;
|
convert_error = true;
|
||||||
|
@ -1853,21 +1855,17 @@ bool Manager::SendEvent(ReaderFrontend* reader, const string& name, const int nu
|
||||||
delete_value_ptr_array(vals, num_vals);
|
delete_value_ptr_array(vals, num_vals);
|
||||||
|
|
||||||
if ( convert_error )
|
if ( convert_error )
|
||||||
{
|
|
||||||
for ( const auto& v : vl )
|
|
||||||
Unref(v);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
else if ( handler )
|
||||||
else
|
mgr.Enqueue(handler, std::move(vl), SOURCE_LOCAL);
|
||||||
mgr.QueueEvent(handler, std::move(vl), SOURCE_LOCAL);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::SendEvent(EventHandlerPtr ev, const int numvals, ...) const
|
void Manager::SendEvent(EventHandlerPtr ev, const int numvals, ...) const
|
||||||
{
|
{
|
||||||
val_list vl(numvals);
|
zeek::Args vl;
|
||||||
|
vl.reserve(numvals);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
DBG_LOG(DBG_INPUT, "SendEvent with %d vals",
|
DBG_LOG(DBG_INPUT, "SendEvent with %d vals",
|
||||||
|
@ -1877,16 +1875,18 @@ void Manager::SendEvent(EventHandlerPtr ev, const int numvals, ...) const
|
||||||
va_list lP;
|
va_list lP;
|
||||||
va_start(lP, numvals);
|
va_start(lP, numvals);
|
||||||
for ( int i = 0; i < numvals; i++ )
|
for ( int i = 0; i < numvals; i++ )
|
||||||
vl.push_back( va_arg(lP, Val*) );
|
vl.emplace_back(AdoptRef{}, va_arg(lP, Val*));
|
||||||
|
|
||||||
va_end(lP);
|
va_end(lP);
|
||||||
|
|
||||||
mgr.QueueEvent(ev, std::move(vl), SOURCE_LOCAL);
|
if ( ev )
|
||||||
|
mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Manager::SendEvent(EventHandlerPtr ev, list<Val*> events) const
|
void Manager::SendEvent(EventHandlerPtr ev, list<Val*> events) const
|
||||||
{
|
{
|
||||||
val_list vl(events.size());
|
zeek::Args vl;
|
||||||
|
vl.reserve(events.size());
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
DBG_LOG(DBG_INPUT, "SendEvent with %" PRIuPTR " vals (list)",
|
DBG_LOG(DBG_INPUT, "SendEvent with %" PRIuPTR " vals (list)",
|
||||||
|
@ -1894,9 +1894,10 @@ void Manager::SendEvent(EventHandlerPtr ev, list<Val*> events) const
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for ( list<Val*>::iterator i = events.begin(); i != events.end(); i++ )
|
for ( list<Val*>::iterator i = events.begin(); i != events.end(); i++ )
|
||||||
vl.push_back( *i );
|
vl.emplace_back(AdoptRef{}, *i);
|
||||||
|
|
||||||
mgr.QueueEvent(ev, std::move(vl), SOURCE_LOCAL);
|
if ( ev )
|
||||||
|
mgr.Enqueue(ev, std::move(vl), SOURCE_LOCAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert a bro list value to a bro record value.
|
// Convert a bro list value to a bro record value.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue