add change from Sara to return if a cert conversion or add to store fails

This commit is contained in:
unknown 2016-01-31 00:13:09 -05:00
parent 504881fc6f
commit f5290b6a68
1 changed files with 15 additions and 7 deletions

View File

@ -177,16 +177,24 @@ add_WIN_cacerts_to_openssl_store(SSL_CTX* tls_ctx)
hSystemStore,
pTargetCert))
{
X509 *cert1 = d2i_X509(NULL, (const unsigned char **)&pTargetCert->pbCertEncoded, pTargetCert->cbCertEncoded);
if (!cert1)
X509 *cert1 = d2i_X509(NULL,
(const unsigned char **)&pTargetCert->pbCertEncoded,
pTargetCert->cbCertEncoded);
if (!cert1) {
// do not return if a cert fails, continue and retrieve the rest
DEBUG_STUB("*** %s(%s)\n", __FUNCTION__,
"unable to parse certificate in memory");
DEBUG_STUB("*** %s(%s %d:%s)\n", __FUNCTION__,
"unable to parse certificate in memory",
ERR_get_error(), ERR_error_string(ERR_get_error(), NULL));
return 0;
}
else {
// do not return if a cert add to store fails, continue and retrieve the rest
if (X509_STORE_add_cert(store, cert1) == 0)
DEBUG_STUB("*** %s(%s)\n", __FUNCTION__,
"error adding certificate");
if (X509_STORE_add_cert(store, cert1) == 0) {
DEBUG_STUB("*** %s(%s %d:%s)\n", __FUNCTION__,
"error adding certificate", ERR_get_error(),
ERR_error_string(ERR_get_error(), NULL));
return 0;
}
X509_free(cert1);
}
}