mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
libpv/cert.c: Improve error reporting
The current implementation drops the reason why a download of a CRL failed. This is changed to the reporting of the error triggered by the last CRL download attempt. This mainly helps to check for the download error during CI testing and prevent connectivity issues to be the reason of a test failure. Signed-off-by: Steffen Eiden <seiden@linux.ibm.com> Reviewed-by: Marc Hartmayer <mhartmay@linux.ibm.com> Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
e4733002da
commit
cd5d6a5004
19
libpv/cert.c
19
libpv/cert.c
@@ -492,7 +492,9 @@ static X509_CRL *load_crl_by_dist_point(DIST_POINT *crldp, GError **error)
|
||||
X509_CRL *pv_load_first_crl_by_cert(X509 *cert, GError **error)
|
||||
{
|
||||
g_autoptr(STACK_OF_DIST_POINT) crldps = NULL;
|
||||
g_autoptr(GError) last_error = NULL;
|
||||
g_autoptr(X509_CRL) ret = NULL;
|
||||
int dist_points_cnt;
|
||||
|
||||
g_assert(cert);
|
||||
|
||||
@@ -503,19 +505,24 @@ X509_CRL *pv_load_first_crl_by_cert(X509 *cert, GError **error)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < sk_DIST_POINT_num(crldps); i++) {
|
||||
dist_points_cnt = sk_DIST_POINT_num(crldps);
|
||||
for (int i = 0; i < dist_points_cnt; i++) {
|
||||
DIST_POINT *crldp = sk_DIST_POINT_value(crldps, i);
|
||||
|
||||
g_assert(crldp);
|
||||
|
||||
/* ignore error */
|
||||
ret = load_crl_by_dist_point(crldp, NULL);
|
||||
g_clear_error(&last_error);
|
||||
ret = load_crl_by_dist_point(crldp, &last_error);
|
||||
if (ret)
|
||||
return g_steal_pointer(&ret);
|
||||
}
|
||||
|
||||
g_set_error(error, PV_CERT_ERROR, PV_CERT_ERROR_FAILED_DOWNLOAD_CRL,
|
||||
_("failed to download CRL"));
|
||||
/* relabel error */
|
||||
if (last_error)
|
||||
g_set_error(error, PV_CERT_ERROR, PV_CERT_ERROR_FAILED_DOWNLOAD_CRL,
|
||||
"%s", last_error->message);
|
||||
else
|
||||
g_set_error(error, PV_CERT_ERROR, PV_CERT_ERROR_FAILED_DOWNLOAD_CRL,
|
||||
_("failed to download CRL"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user