changeset 22589:103a6d51eefe

mail-crypt: Fix key generation handling Userkey generation would not set all required fields.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Thu, 05 Oct 2017 15:40:45 +0300
parents 041460202062
children b0da9b8fdae8
files src/plugins/mail-crypt/doveadm-mail-crypt.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/mail-crypt/doveadm-mail-crypt.c	Mon Oct 09 18:21:24 2017 +0300
+++ b/src/plugins/mail-crypt/doveadm-mail-crypt.c	Thu Oct 05 15:40:45 2017 +0300
@@ -329,9 +329,11 @@
 		if (mail_crypt_user_generate_keypair(user, &pair, &pubid,
 						     &error) < 0) {
 			res->success = FALSE;
-			res->id = p_strdup(_ctx->pool, error);
+			res->error = p_strdup(_ctx->pool, error);
 			return -1;
 		}
+		res->success = TRUE;
+		res->id = p_strdup(_ctx->pool, pubid);
 		user_key = pair.pub;
 		dcrypt_key_unref_private(&pair.priv);
 	}
@@ -419,6 +421,7 @@
 		if (res->success)
 			doveadm_print("\xE2\x9C\x93");
 		else {
+			_ctx->exit_code = EX_DATAERR;
 			ret = -1;
 			doveadm_print("x");
 		}