Mercurial > dovecot > core-2.2
changeset 21248:31d8446fb62f
mail-crypt: Do not attempt to cache keys on failure
author | Aki Tuomi <aki.tuomi@dovecot.fi> |
---|---|
date | Mon, 28 Nov 2016 23:05:16 +0200 |
parents | 5af715500928 |
children | a75e52d91e65 |
files | src/plugins/mail-crypt/mail-crypt-key.c |
diffstat | 1 files changed, 5 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/plugins/mail-crypt/mail-crypt-key.c Tue Nov 29 10:57:49 2016 +0200 +++ b/src/plugins/mail-crypt/mail-crypt-key.c Mon Nov 28 23:05:16 2016 +0200 @@ -1063,14 +1063,12 @@ ret = 0; - if (mail_crypt_generate_keypair(curve, pair, pubid_r, error_r) < 0) - ret = -1; - if (ret == 0 && - mail_crypt_box_set_keys(box, *pubid_r, - pair->priv, user_key, pair->pub, - error_r) < 0) { + if ((ret = mail_crypt_generate_keypair(curve, pair, pubid_r, error_r)) < 0) { + /* failed */ + } else if ((ret = mail_crypt_box_set_keys(box, *pubid_r, + pair->priv, user_key, pair->pub, + error_r)) < 0) { dcrypt_keypair_unref(pair); - ret = -1; } else { mail_crypt_put_key_cache(&muser->key_cache, *pubid_r, pair->priv, pair->pub);