summaryrefslogtreecommitdiff
path: root/client/bankid.c
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@slbdata.se>2011-04-17 21:59:52 +0200
committerSamuel Lidén Borell <samuel@slbdata.se>2011-04-17 21:59:52 +0200
commiteb269afe8a7f6ca1e0b3f40fc75bd8d82c27a4bf (patch)
treec4df72b341d2a5da1330b307affe19820bab0abe /client/bankid.c
parent1fee2ac46ccb39a87eb000af4526b2c7d3bb13d7 (diff)
downloadfribid-eb269afe8a7f6ca1e0b3f40fc75bd8d82c27a4bf.tar.gz
fribid-eb269afe8a7f6ca1e0b3f40fc75bd8d82c27a4bf.tar.bz2
fribid-eb269afe8a7f6ca1e0b3f40fc75bd8d82c27a4bf.zip
Show more specific error messages and use g_strerror
Diffstat (limited to 'client/bankid.c')
-rw-r--r--client/bankid.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/client/bankid.c b/client/bankid.c
index 8f2ea71..19d7caf 100644
--- a/client/bankid.c
+++ b/client/bankid.c
@@ -345,22 +345,29 @@ BankIDError bankid_sign(Token *token,
* @param params Parameters (from SetParam/InitRequest calls).
* @param password A password or PIN entered on the keyboard.
* @param request The certificate request, Base64 encoded.
+ * @param error A more detailed error code is stored here
*/
BankIDError bankid_createRequest(const RegutilInfo *params,
const char *password,
- char **request) {
+ char **request,
+ TokenError *error) {
*request = NULL;
char *binaryRequest;
size_t brlen;
- TokenError error = backend_createRequest(params, password,
- &binaryRequest, &brlen);
- if (error) return BIDERR_InternalError;
+ *error = backend_createRequest(params, password,
+ &binaryRequest, &brlen);
+ if (*error) return BIDERR_InternalError;
// Encode with Base64
*request = base64_encode(binaryRequest, brlen);
free(binaryRequest);
- return (*request ? BIDERR_OK : BIDERR_InternalError);
+ if (!*request) {
+ *error = TokenError_Unknown;
+ return BIDERR_InternalError;
+ } else {
+ return BIDERR_OK;
+ }
}
/**