dovecot-2.2: imap: Fixed RESETKEY command to not return failure ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 5 15:44:49 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/c4a017da9b3e
changeset: 16207:c4a017da9b3e
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 05 15:44:32 2013 +0300
description:
imap: Fixed RESETKEY command to not return failure when it actually succeeded.

diffstat:

 src/imap/cmd-resetkey.c                     |  11 +++--------
 src/lib-imap-urlauth/imap-urlauth-backend.c |   4 ++--
 2 files changed, 5 insertions(+), 10 deletions(-)

diffs (56 lines):

diff -r 83568daabff6 -r c4a017da9b3e src/imap/cmd-resetkey.c
--- a/src/imap/cmd-resetkey.c	Fri Apr 05 15:17:30 2013 +0300
+++ b/src/imap/cmd-resetkey.c	Fri Apr 05 15:44:32 2013 +0300
@@ -7,7 +7,7 @@
 
 static bool cmd_resetkey_all(struct client_command_context *cmd)
 {
-	if (imap_urlauth_reset_all_keys(cmd->client->urlauth_ctx) <= 0) {
+	if (imap_urlauth_reset_all_keys(cmd->client->urlauth_ctx) < 0) {
 		client_send_internal_error(cmd);
 		return TRUE;
 	}
@@ -23,7 +23,6 @@
 	struct mail_namespace *ns;
 	enum mailbox_flags flags = MAILBOX_FLAG_READONLY;
 	struct mailbox *box;
-	int ret;
 
 	/* check mechanism arguments (we support only INTERNAL mechanism) */
 	while (!IMAP_ARG_IS_EOL(mech_args)) {
@@ -57,12 +56,8 @@
 	}
 
 	/* check urlauth environment and reset requested key */
-	ret = imap_urlauth_reset_mailbox_key(cmd->client->urlauth_ctx, box);
-	if (ret <= 0) {
-		if (ret < 0)
-			client_send_internal_error(cmd);
-		else
-			client_send_storage_error(cmd, mailbox_get_storage(box));
+	if (imap_urlauth_reset_mailbox_key(cmd->client->urlauth_ctx, box) < 0) {
+		client_send_internal_error(cmd);
 		mailbox_free(&box);
 		return TRUE;
 	}
diff -r 83568daabff6 -r c4a017da9b3e src/lib-imap-urlauth/imap-urlauth-backend.c
--- a/src/lib-imap-urlauth/imap-urlauth-backend.c	Fri Apr 05 15:17:30 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-backend.c	Fri Apr 05 15:44:32 2013 +0300
@@ -95,7 +95,7 @@
 
 	t = mailbox_transaction_begin(box, MAILBOX_TRANSACTION_FLAG_EXTERNAL);
 	ret = mailbox_attribute_unset(t, MAIL_ATTRIBUTE_TYPE_PRIVATE,
-				      IMAP_URLAUTH_KEY) < 0 ? -1 : 1;
+				      IMAP_URLAUTH_KEY);
 	if (mailbox_transaction_commit(&t) < 0)
 		ret = -1;
 	return ret;
@@ -114,7 +114,7 @@
 			mailbox_get_vname(box), errstr);
 		return -1;
 	}
-	return imap_urlauth_backend_reset_mailbox_key(box) < 0 ? -1 : 0;
+	return imap_urlauth_backend_reset_mailbox_key(box);
 }
 
 int imap_urlauth_backend_reset_all_keys(struct mail_user *user)


More information about the dovecot-cvs mailing list