dovecot-2.2: doveadm: Reverted changeset 3b89f2f4ffb3, which avo...

dovecot at dovecot.org dovecot at dovecot.org
Mon Feb 9 13:52:25 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/acebb486714e
changeset: 18233:acebb486714e
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 09 13:03:47 2015 +0200
description:
doveadm: Reverted changeset 3b89f2f4ffb3, which avoided calling init() for proxied commands.
The init() is required for all commands that print something, because
otherwise the doveadm_print_header*() isn't called and the commands crash.

The reason for the original change was that some commands' init() attempted
to do too much work on the proxy, which ended up failing. So looks like the
proper fix is to just remove this kind of extra work from init().

diffstat:

 src/doveadm/doveadm-mail.c |  18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diffs (49 lines):

diff -r 8f7dee2e7e05 -r acebb486714e src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Mon Feb 09 04:03:12 2015 +0200
+++ b/src/doveadm/doveadm-mail.c	Mon Feb 09 13:03:47 2015 +0200
@@ -277,7 +277,7 @@
 }
 
 static int
-doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx, bool init_user,
+doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx,
 		       const struct mail_storage_service_input *input,
 		       const char **error_r)
 {
@@ -296,14 +296,6 @@
 	if (ret != 0)
 		return ret;
 
-	if (init_user) {
-		/* call init() after we've checked whether we want to do this
-		   via doveadm-server or not */
-		ctx->v.init(ctx, ctx->args);
-		if (hook_doveadm_mail_init != NULL)
-			hook_doveadm_mail_init(ctx);
-	}
-
 	ret = mail_storage_service_lookup(ctx->storage_service, input,
 					  &ctx->cur_service_user, &error);
 	if (ret <= 0) {
@@ -349,7 +341,11 @@
 	ctx->storage_service_input = *input;
 	ctx->storage_service = mail_storage_service_init(master_service, NULL,
 							 ctx->service_flags);
-	return doveadm_mail_next_user(ctx, TRUE, input, error_r);
+	ctx->v.init(ctx, ctx->args);
+	if (hook_doveadm_mail_init != NULL)
+		hook_doveadm_mail_init(ctx);
+
+	return doveadm_mail_next_user(ctx, input, error_r);
 }
 
 static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED)
@@ -394,7 +390,7 @@
 		ctx->cur_username = user;
 		doveadm_print_sticky("username", user);
 		T_BEGIN {
-			ret = doveadm_mail_next_user(ctx, FALSE, &input, &error);
+			ret = doveadm_mail_next_user(ctx, &input, &error);
 			if (ret < 0)
 				i_error("%s", error);
 			else if (ret == 0)


More information about the dovecot-cvs mailing list