mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 18:57:27 +02:00
Address review comments.
This commit is contained in:
@ -4860,8 +4860,10 @@ void wolfSSL_GENERAL_NAME_set0_value(WOLFSSL_GENERAL_NAME *a, int type,
|
||||
|
||||
wolfSSL_GENERAL_NAME_type_free(a);
|
||||
a->type = type;
|
||||
if (type == GEN_DNS) {
|
||||
a->d.dNSName = value;
|
||||
}
|
||||
}
|
||||
|
||||
/* Frees GENERAL_NAME objects.
|
||||
*/
|
||||
|
12
tests/api.c
12
tests/api.c
@ -41889,6 +41889,7 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
|
||||
X509_EXTENSION* ext = NULL;
|
||||
AUTHORITY_INFO_ACCESS* aia = NULL;
|
||||
ACCESS_DESCRIPTION* ad = NULL;
|
||||
ASN1_IA5STRING *dnsname = NULL;
|
||||
|
||||
const unsigned char v4Addr[] = {192,168,53,1};
|
||||
const unsigned char v6Addr[] =
|
||||
@ -41943,6 +41944,17 @@ static int test_wolfSSL_GENERAL_NAME_print(void)
|
||||
X509_free(x509);
|
||||
x509 = NULL;
|
||||
|
||||
/* Lets test for setting as well. */
|
||||
ExpectNotNull(gn = GENERAL_NAME_new());
|
||||
ExpectNotNull(dnsname = ASN1_IA5STRING_new());
|
||||
ExpectIntEQ(ASN1_STRING_set(dnsname, "example.com", -1), 1);
|
||||
GENERAL_NAME_set0_value(gn, GEN_DNS, dnsname);
|
||||
dnsname = NULL;
|
||||
ExpectIntEQ(GENERAL_NAME_print(out, gn), 1);
|
||||
XMEMSET(outbuf, 0, sizeof(outbuf));
|
||||
ExpectIntGT(BIO_read(out, outbuf, sizeof(outbuf)), 0);
|
||||
ExpectIntEQ(XSTRNCMP((const char*)outbuf, dnsStr, XSTRLEN(dnsStr)), 0);
|
||||
|
||||
/* test for GEN_URI */
|
||||
|
||||
ExpectTrue((f = XFOPEN("./certs/ocsp/root-ca-cert.pem", "rb")) != XBADFILE);
|
||||
|
Reference in New Issue
Block a user