aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/x509/x509_lu.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-09-17 17:16:28 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-09-17 17:16:28 +0000
commit5d20c4fb3582a0e6cbf8513c94c60e4cd326716d (patch)
treef2d8a974055968c0315588ea30d369ace38fe1d5 /crypto/x509/x509_lu.c
parenta04549cc755408ff2dcab209fd87d3e46f7d662a (diff)
downloadopenssl-5d20c4fb3582a0e6cbf8513c94c60e4cd326716d.tar.gz
Overhaul of by_dir code to handle dynamic loading of CRLs.
Diffstat (limited to 'crypto/x509/x509_lu.c')
-rw-r--r--crypto/x509/x509_lu.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/crypto/x509/x509_lu.c b/crypto/x509/x509_lu.c
index fad7ea0689..ead1e0b811 100644
--- a/crypto/x509/x509_lu.c
+++ b/crypto/x509/x509_lu.c
@@ -288,7 +288,7 @@ int X509_STORE_get_by_subject(X509_STORE_CTX *vs, int type, X509_NAME *name,
tmp=X509_OBJECT_retrieve_by_subject(ctx->objs,type,name);
- if (tmp == NULL)
+ if (tmp == NULL || type == X509_LU_CRL)
{
for (i=vs->current_method; i<sk_X509_LOOKUP_num(ctx->get_cert_methods); i++)
{
@@ -530,33 +530,30 @@ STACK_OF(X509_CRL)* X509_STORE_get1_crls(X509_STORE_CTX *ctx, X509_NAME *nm)
int i, idx, cnt;
STACK_OF(X509_CRL) *sk;
X509_CRL *x;
- X509_OBJECT *obj;
+ X509_OBJECT *obj, xobj;
sk = sk_X509_CRL_new_null();
CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
/* Check cache first */
idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_CRL, nm, &cnt);
+
+ /* Always do lookup to possibly add new CRLs to cache
+ */
+ CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
+ if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
+ {
+ sk_X509_CRL_free(sk);
+ return NULL;
+ }
+ X509_OBJECT_free_contents(&xobj);
+ CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
+ idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
if (idx < 0)
{
- /* Nothing found in cache: do lookup to possibly add new
- * objects to cache
- */
- X509_OBJECT xobj;
CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
- if (!X509_STORE_get_by_subject(ctx, X509_LU_CRL, nm, &xobj))
- {
- sk_X509_CRL_free(sk);
- return NULL;
- }
- X509_OBJECT_free_contents(&xobj);
- CRYPTO_r_lock(CRYPTO_LOCK_X509_STORE);
- idx = x509_object_idx_cnt(ctx->ctx->objs,X509_LU_CRL, nm, &cnt);
- if (idx < 0)
- {
- CRYPTO_r_unlock(CRYPTO_LOCK_X509_STORE);
- sk_X509_CRL_free(sk);
- return NULL;
- }
+ sk_X509_CRL_free(sk);
+ return NULL;
}
+
for (i = 0; i < cnt; i++, idx++)
{
obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx);