summaryrefslogtreecommitdiff
path: root/pith/smkeys.c
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2017-05-04 22:18:35 -0600
committerEduardo Chappa <chappa@washington.edu>2017-05-04 22:18:35 -0600
commit65dea5ff595b089c5d46131381f01d84b7dfd79a (patch)
tree6164e02d0b1cb667430ff0a0fa9157b44a8977c7 /pith/smkeys.c
parent8f8122b0ec2d9a73b42bd0bc21781cc7fa95a1e2 (diff)
downloadalpine-65dea5ff595b089c5d46131381f01d84b7dfd79a.tar.xz
* Creating key for password file could not be cancelled.
Diffstat (limited to 'pith/smkeys.c')
-rw-r--r--pith/smkeys.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/pith/smkeys.c b/pith/smkeys.c
index cd940868..46501d08 100644
--- a/pith/smkeys.c
+++ b/pith/smkeys.c
@@ -98,11 +98,13 @@ create_master_password(char *pass, size_t passlen, int first_time)
_("Create master password \(attempt %d of %d): "), trial+1, MAXTRIAL);
prompt[sizeof(prompt)- 1] = '\0';
pass[0] = '\0';
- do {
+ do {
+ /* rv == 1 means cancel */
rv = (pith_smime_enter_password)(prompt, pass, passlen);
- if(password_policy_check(pass) == 0)
+ if(rv == 1 || password_policy_check(pass) == 0)
pass[0] = '\0';
- } while ((rv !=0 && rv !=1 && rv > 0) || pass[0] == '\0');
+ if(rv == 1) return 0;
+ } while ((rv != 0 && rv != 1) || (rv == 0 && pass[0] == '\0'));
snprintf(prompt, sizeof(prompt),
_("Confirm master password \(attempt %d of %d): "), trial+1, MAXTRIAL);