Fixed alt_names free, now using cleanup function to wrap details.
This commit is contained in:
parent
853bf40321
commit
ddab90ece4
@ -118,7 +118,10 @@ FREERDP_API CryptoCert crypto_cert_read(BYTE* data, UINT32 length);
|
||||
FREERDP_API char* crypto_cert_fingerprint(X509* xcert);
|
||||
FREERDP_API char* crypto_cert_subject(X509* xcert);
|
||||
FREERDP_API char* crypto_cert_subject_common_name(X509* xcert, int* length);
|
||||
FREERDP_API char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths);
|
||||
FREERDP_API char** crypto_cert_subject_alt_name(X509* xcert, int* count,
|
||||
int** lengths);
|
||||
FREERDP_API void crypto_cert_subject_alt_name_free(int count, int *lengths,
|
||||
char** alt_name);
|
||||
FREERDP_API char* crypto_cert_issuer(X509* xcert);
|
||||
FREERDP_API void crypto_cert_print_info(X509* xcert);
|
||||
FREERDP_API void crypto_cert_free(CryptoCert cert);
|
||||
|
@ -392,6 +392,26 @@ char* crypto_cert_subject_common_name(X509* xcert, int* length)
|
||||
return (char*) common_name;
|
||||
}
|
||||
|
||||
FREERDP_API void crypto_cert_subject_alt_name_free(int count, int *lengths,
|
||||
char** alt_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (lengths)
|
||||
free(lengths);
|
||||
|
||||
if (alt_name)
|
||||
{
|
||||
for (i=0; i<count; i++)
|
||||
{
|
||||
if (alt_name[i])
|
||||
OPENSSL_free(alt_name[i]);
|
||||
}
|
||||
|
||||
free(alt_name);
|
||||
}
|
||||
}
|
||||
|
||||
char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)
|
||||
{
|
||||
int index;
|
||||
|
@ -593,8 +593,6 @@ BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
free(alt_names_lengths);
|
||||
}
|
||||
|
||||
/* if the certificate is valid and the certificate name matches, verification succeeds */
|
||||
@ -694,7 +692,8 @@ BOOL tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
|
||||
#endif
|
||||
|
||||
if (alt_names)
|
||||
free(alt_names);
|
||||
crypto_cert_subject_alt_name_free(alt_names_count, alt_names_lengths,
|
||||
alt_names);
|
||||
|
||||
return verification_status;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user