Address feedback

Smaller fixes. I split out the API change of the fallback function into
a separate commit.
This commit is contained in:
Johanna Amann 2020-03-12 11:21:39 -07:00
parent 0a7b358985
commit 3ed9379b9e
4 changed files with 9 additions and 15 deletions

View file

@ -19,8 +19,6 @@
#include <openssl/opensslconf.h>
#include <openssl/err.h>
#include <iostream>
using namespace file_analysis;
file_analysis::X509::X509(RecordVal* args, file_analysis::File* file)
@ -64,8 +62,7 @@ bool file_analysis::X509::EndOfFile()
val_list vl(2);
vl.push_back(GetFile()->GetVal()->Ref());
vl.push_back(new StringVal(cert_sha256));
Val* v = cache_hit_callback->Call(&vl);
Unref(v);
IntrusivePtr<Val> v{AdoptRef{}, cache_hit_callback->Call(&vl)};
return false;
}
}

View file

@ -117,13 +117,13 @@ public:
* Sets the table[string] that used as the certificate cache inside of Zeek.
*/
static void SetCertificateCache(IntrusivePtr<TableVal> cache)
{ certificate_cache = cache; }
{ certificate_cache = std::move(cache); }
/**
* Sets the callback when a certificate cache hit is encountered
*/
static void SetCertificateCacheHitCallback(IntrusivePtr<Func> func)
{ cache_hit_callback = func; }
{ cache_hit_callback = std::move(func); }
protected:
X509(RecordVal* args, File* file);

View file

@ -902,7 +902,7 @@ function x509_set_certificate_cache%(tbl: string_any_table%) : bool
%{
file_analysis::X509::SetCertificateCache({NewRef{}, tbl->AsTableVal()});
return val_mgr->GetBool(1);
return val_mgr->GetTrue();
%}
## This function sets up the callback that is called when an entry is matched against the table set
@ -920,5 +920,5 @@ function x509_set_certificate_cache_hit_callback%(f: string_file_hook%) : bool
%{
file_analysis::X509::SetCertificateCacheHitCallback({NewRef{}, f->AsFunc()});
return val_mgr->GetBool(1);
return val_mgr->GetTrue();
%}