mirror of
https://github.com/zeek/zeek.git
synced 2025-10-05 16:18:19 +00:00
X509: add check if function succeeds
Addresses feedback of GH-1634
This commit is contained in:
parent
8972676e92
commit
43ef7d43fb
1 changed files with 5 additions and 0 deletions
|
@ -1088,6 +1088,11 @@ function x509_check_cert_hostname%(cert_opaque: opaque of x509, hostname: string
|
||||||
{
|
{
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
BIO *bio = BIO_new(BIO_s_mem());
|
BIO *bio = BIO_new(BIO_s_mem());
|
||||||
|
if ( ! bio )
|
||||||
|
{
|
||||||
|
zeek::emit_builtin_error(zeek::util::fmt("Could create bio"));
|
||||||
|
return zeek::make_intrusive<zeek::StringVal>("");
|
||||||
|
}
|
||||||
ASN1_STRING_print(bio, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subject, found_nid)));
|
ASN1_STRING_print(bio, X509_NAME_ENTRY_get_data(X509_NAME_get_entry(subject, found_nid)));
|
||||||
size_t len = BIO_gets(bio, buf, sizeof(buf));
|
size_t len = BIO_gets(bio, buf, sizeof(buf));
|
||||||
BIO_free(bio);
|
BIO_free(bio);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue