aboutsummaryrefslogtreecommitdiff
path: root/pkcs11.c
diff options
context:
space:
mode:
authorjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-11-01 00:07:21 +0000
committerjames <james@e7ae566f-a301-0410-adde-c780ea21d3b5>2006-11-01 00:07:21 +0000
commit1d89886e00a36788cf16d1c5de9cca224074edcf (patch)
tree4a377c091d927368dcde5678f8e6157aca333f03 /pkcs11.c
parentVersion 2.1_beta16 released (diff)
downloadopenvpn-1d89886e00a36788cf16d1c5de9cca224074edcf.tar.xz
Merged Alon's branch:v2.1_rc1
svn merge -r1322:1392 https://svn.openvpn.net/projects/openvpn/contrib/alon/21rc/openvpn . Version 2.1_rc1 released git-svn-id: http://svn.openvpn.net/projects/openvpn/branches/BETA21/openvpn@1420 e7ae566f-a301-0410-adde-c780ea21d3b5
Diffstat (limited to 'pkcs11.c')
-rw-r--r--pkcs11.c42
1 files changed, 30 insertions, 12 deletions
diff --git a/pkcs11.c b/pkcs11.c
index 9f30407..bdd2690 100644
--- a/pkcs11.c
+++ b/pkcs11.c
@@ -166,14 +166,20 @@ _pkcs11_openvpn_token_prompt (
"Please insert %s token",
token->label
);
- get_user_pass (
- &token_resp,
- NULL,
- "token-insertion-request",
- GET_USER_PASS_MANAGEMENT|GET_USER_PASS_NEED_OK
- );
- return strcmp (token_resp.password, "ok") == 0;
+ if (
+ !get_user_pass (
+ &token_resp,
+ NULL,
+ "token-insertion-request",
+ GET_USER_PASS_MANAGEMENT|GET_USER_PASS_NEED_OK|GET_USER_PASS_NOFATAL
+ )
+ ) {
+ return false;
+ }
+ else {
+ return strcmp (token_resp.password, "ok") == 0;
+ }
}
static
@@ -195,15 +201,27 @@ _pkcs11_openvpn_pin_prompt (
token_pass.defined = false;
token_pass.nocache = true;
- get_user_pass (&token_pass, NULL, szPrompt, GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY);
- strncpynt (szPIN, token_pass.password, nMaxPIN);
- purge_user_pass (&token_pass, true);
- if (strlen (szPIN) == 0) {
+ if (
+ !get_user_pass (
+ &token_pass,
+ NULL,
+ szPrompt,
+ GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY|GET_USER_PASS_NOFATAL
+ )
+ ) {
return false;
}
else {
- return true;
+ strncpynt (szPIN, token_pass.password, nMaxPIN);
+ purge_user_pass (&token_pass, true);
+
+ if (strlen (szPIN) == 0) {
+ return false;
+ }
+ else {
+ return true;
+ }
}
}