From ef9ea4272eb1b1248ebb71fb117076b768768c5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Mon, 22 May 2006 16:14:07 +0000 Subject: [PATCH] Sprinkle some hx509_set_error_strings git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@17584 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/hx509/ks_p11.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/hx509/ks_p11.c b/lib/hx509/ks_p11.c index 2b509a977..8bb7de0dd 100644 --- a/lib/hx509/ks_p11.c +++ b/lib/hx509/ks_p11.c @@ -660,35 +660,50 @@ p11_init(hx509_context context, p->dl_handle = dlopen(list, RTLD_NOW); free(list); if (p->dl_handle == NULL) { + hx509_set_error_string(context, 0, EINVAL, + "Failed to open %s: %s", list, dlerror()); ret = EINVAL; /* XXX */ goto out; } getFuncs = dlsym(p->dl_handle, "C_GetFunctionList"); if (getFuncs == NULL) { + hx509_set_error_string(context, 0, EINVAL, + "C_GetFunctionList missing in %s: %s", + list, dlerror()); ret = EINVAL; goto out; } ret = (*getFuncs)(&p->funcs); if (ret) { + hx509_set_error_string(context, 0, EINVAL, + "C_GetFunctionList failed in %s", list); ret = EINVAL; goto out; } ret = P11FUNC(p, Initialize, (NULL_PTR)); if (ret != CKR_OK) { + hx509_set_error_string(context, 0, EINVAL, + "Failed initialize the PKCS11 module"); ret = EINVAL; goto out; } ret = P11FUNC(p, GetSlotList, (FALSE, NULL, &p->num_slots)); if (ret) { + hx509_set_error_string(context, 0, EINVAL, + "Failed to get number of PKCS11 slots"); ret = EINVAL; goto out; } if (p->selected_slot >= p->num_slots) { + hx509_set_error_string(context, 0, EINVAL, + "Selected PKCS11 slot (%d) larger " + "then maximum slot (%d)", + p->selected_slot, p->num_slots); ret = EINVAL; goto out; }