mirror of
https://github.com/moparisthebest/curl
synced 2024-11-17 06:55:02 -05:00
nss: only cache valid CRL entries
Change the logic around such that we only keep CRLs that NSS actually ended up caching around for later deletion. If CERT_CacheCRL() fails then there is little point in delaying the freeing of the CRL as it is not used. Closes https://github.com/curl/curl/pull/4053
This commit is contained in:
parent
cf4255c847
commit
2028a1a977
@ -578,19 +578,21 @@ static CURLcode nss_cache_crl(SECItem *crl_der)
|
||||
/* acquire lock before call of CERT_CacheCRL() and accessing nss_crl_list */
|
||||
PR_Lock(nss_crllock);
|
||||
|
||||
if(SECSuccess != CERT_CacheCRL(db, crl_der)) {
|
||||
/* unable to cache CRL */
|
||||
SECITEM_FreeItem(crl_der, PR_TRUE);
|
||||
PR_Unlock(nss_crllock);
|
||||
return CURLE_SSL_CRL_BADFILE;
|
||||
}
|
||||
|
||||
/* store the CRL item so that we can free it in Curl_nss_cleanup() */
|
||||
if(insert_wrapped_ptr(&nss_crl_list, crl_der) != CURLE_OK) {
|
||||
if(SECSuccess == CERT_UncacheCRL(db, crl_der))
|
||||
SECITEM_FreeItem(crl_der, PR_TRUE);
|
||||
PR_Unlock(nss_crllock);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if(SECSuccess != CERT_CacheCRL(db, crl_der)) {
|
||||
/* unable to cache CRL */
|
||||
PR_Unlock(nss_crllock);
|
||||
return CURLE_SSL_CRL_BADFILE;
|
||||
}
|
||||
|
||||
/* we need to clear session cache, so that the CRL could take effect */
|
||||
SSL_ClearSessionCache();
|
||||
PR_Unlock(nss_crllock);
|
||||
|
Loading…
Reference in New Issue
Block a user