mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 08:08:19 +00:00
Change return value of OpaqueVal::DoSerialize.
Now it returns a broker::expected<broker::data>, instead of directly returning a broker::data before. This means that broker::data does no longer have to be abused to convey error information. In a way it would be kind of neat to have more fine-granular broker error types for this use-case - at the moment everything returns broker::ec::invalid_data, which seems to be the only reasonable choice.
This commit is contained in:
parent
53cde131e9
commit
e0f10fd6d3
6 changed files with 40 additions and 36 deletions
|
@ -491,13 +491,13 @@ Val* X509Val::DoClone(CloneState* state)
|
|||
|
||||
IMPLEMENT_OPAQUE_VALUE(X509Val)
|
||||
|
||||
broker::data X509Val::DoSerialize() const
|
||||
broker::expected<broker::data> X509Val::DoSerialize() const
|
||||
{
|
||||
unsigned char *buf = NULL;
|
||||
int length = i2d_X509(certificate, &buf);
|
||||
unsigned char *buf = NULL;
|
||||
int length = i2d_X509(certificate, &buf);
|
||||
|
||||
if ( length < 0 )
|
||||
return broker::none();
|
||||
if ( length < 0 )
|
||||
return broker::ec::invalid_data;
|
||||
|
||||
auto d = std::string(reinterpret_cast<const char*>(buf), length);
|
||||
OPENSSL_free(buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue