Fixed in-place update of cached base and delta CRLs

This commit is contained in:
Andreas Steffen
2016-10-30 16:37:24 +01:00
parent 2271ebb325
commit 880c312458
@@ -1,6 +1,7 @@
/* /*
* Copyright (C) 2008 Martin Willi * Copyright (C) 2008 Martin Willi
* Hochschule fuer Technik Rapperswil * Copyright (C) 2016 Andreas Steffen
* HSR Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@@ -92,12 +93,10 @@ static void cache(private_cert_cache_t *this,
/* cache a CRL by replacing a previous CRL cache entry if present */ /* cache a CRL by replacing a previous CRL cache entry if present */
if (subject->get_type(subject) == CERT_X509_CRL) if (subject->get_type(subject) == CERT_X509_CRL)
{ {
bool is_delta_crl;
crl_t *crl, *cached_crl; crl_t *crl, *cached_crl;
/* cache a delta CRL ? */ /* cache a delta CRL ? */
crl = (crl_t*)subject; crl = (crl_t*)subject;
is_delta_crl = crl->is_delta_crl(crl, NULL);
for (i = 0; i < CACHE_SIZE; i++) for (i = 0; i < CACHE_SIZE; i++)
{ {
@@ -113,7 +112,8 @@ static void cache(private_cert_cache_t *this,
{ {
cached_crl = (crl_t*)rel->subject; cached_crl = (crl_t*)rel->subject;
if (cached_crl->is_delta_crl(crl, NULL) == is_delta_crl && if (cached_crl->is_delta_crl(cached_crl, NULL) ==
crl->is_delta_crl(crl, NULL) &&
crl_is_newer(crl, cached_crl)) crl_is_newer(crl, cached_crl))
{ {
rel->subject->destroy(rel->subject); rel->subject->destroy(rel->subject);