Deprecate VectorVal(VectorType*) ctora

Adds a new one taking an IntrusivePtr.
This commit is contained in:
Jon Siwek 2020-05-09 12:01:03 -07:00
parent c5236ecaee
commit d4dba40727
51 changed files with 171 additions and 160 deletions

View file

@ -499,7 +499,7 @@ string Manager::DetectMIME(const u_char* data, uint64_t len) const
IntrusivePtr<VectorVal> file_analysis::GenMIMEMatchesVal(const RuleMatcher::MIME_Matches& m)
{
auto rval = make_intrusive<VectorVal>(mime_matches);
auto rval = make_intrusive<VectorVal>(IntrusivePtr{NewRef{}, mime_matches});
for ( RuleMatcher::MIME_Matches::const_iterator it = m.begin();
it != m.end(); ++it )

View file

@ -11,11 +11,12 @@ VectorVal* process_rvas(const RVAS* rvas);
%code{
VectorVal* process_rvas(const RVAS* rva_table)
{
VectorVal* rvas = new VectorVal(zeek::lookup_type("index_vec")->AsVectorType());
auto rvas = make_intrusive<VectorVal>(zeek::lookup_type<VectorType>("index_vec"));
for ( uint16 i=0; i < rva_table->rvas()->size(); ++i )
rvas->Assign(i, val_mgr->Count((*rva_table->rvas())[i]->size()));
return rvas;
return rvas.release();
}
%}

View file

@ -634,7 +634,7 @@ void file_analysis::OCSP::ParseResponse(OCSP_RESPONSE *resp)
//ocsp_resp_record->Assign(7, make_intrusive<StringVal>(len, buf));
//BIO_reset(bio);
certs_vector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
certs_vector = new VectorVal(zeek::lookup_type<VectorType>("x509_opaque_vector"));
vl.emplace_back(AdoptRef{}, certs_vector);
#if ( OPENSSL_VERSION_NUMBER < 0x10100000L ) || defined(LIBRESSL_VERSION_NUMBER)

View file

@ -367,21 +367,21 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
{
case GEN_DNS:
if ( names == nullptr )
names = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
names = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
names->Assign(names->Size(), bs);
break;
case GEN_URI:
if ( uris == nullptr )
uris = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
uris = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
uris->Assign(uris->Size(), bs);
break;
case GEN_EMAIL:
if ( emails == nullptr )
emails = new VectorVal(zeek::lookup_type("string_vec")->AsVectorType());
emails = new VectorVal(zeek::lookup_type<VectorType>("string_vec"));
emails->Assign(emails->Size(), bs);
break;
@ -391,7 +391,7 @@ void file_analysis::X509::ParseSAN(X509_EXTENSION* ext)
else if ( gen->type == GEN_IPADD )
{
if ( ips == nullptr )
ips = new VectorVal(zeek::lookup_type("addr_vec")->AsVectorType());
ips = new VectorVal(zeek::lookup_type<VectorType>("addr_vec"));
uint32_t* addr = (uint32_t*) gen->d.ip->data;

View file

@ -556,7 +556,7 @@ function x509_verify%(certs: x509_opaque_vector, root_certs: table_string_of_str
}
int num_certs = sk_X509_num(chain);
chainVector = new VectorVal(zeek::lookup_type("x509_opaque_vector")->AsVectorType());
chainVector = new VectorVal(zeek::lookup_type<VectorType>("x509_opaque_vector"));
for ( int i = 0; i < num_certs; i++ )
{