From 1d89886e00a36788cf16d1c5de9cca224074edcf Mon Sep 17 00:00:00 2001 From: james Date: Wed, 1 Nov 2006 00:07:21 +0000 Subject: Merged Alon's branch: 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 --- pkcs11.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) (limited to 'pkcs11.c') 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; + } } } -- cgit