dovecot-2.2: doveadm: Avoid calling init() in doveadm binary if ...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Dec 5 02:39:46 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/3b89f2f4ffb3
changeset: 18127:3b89f2f4ffb3
user: Timo Sirainen <tss at iki.fi>
date: Fri Dec 05 04:39:11 2014 +0200
description:
doveadm: Avoid calling init() in doveadm binary if the command is sent to doveadm-server.
The init() is still always called when -A or -u *wildcards* are used though.
I'm not sure if that can be delayed. At least all commands should be
verified that they don't rely on the current init() location.
diffstat:
src/doveadm/doveadm-mail.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diffs (49 lines):
diff -r 7c834633922c -r 3b89f2f4ffb3 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c Fri Dec 05 03:53:02 2014 +0200
+++ b/src/doveadm/doveadm-mail.c Fri Dec 05 04:39:11 2014 +0200
@@ -266,7 +266,7 @@
}
static int
-doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx,
+doveadm_mail_next_user(struct doveadm_mail_cmd_context *ctx, bool init_user,
const struct mail_storage_service_input *input,
const char **error_r)
{
@@ -285,6 +285,14 @@
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) {
@@ -330,11 +338,7 @@
ctx->storage_service_input = *input;
ctx->storage_service = mail_storage_service_init(master_service, NULL,
ctx->service_flags);
- 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);
+ return doveadm_mail_next_user(ctx, TRUE, input, error_r);
}
static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED)
@@ -379,7 +383,7 @@
ctx->cur_username = user;
doveadm_print_sticky("username", user);
T_BEGIN {
- ret = doveadm_mail_next_user(ctx, &input, &error);
+ ret = doveadm_mail_next_user(ctx, FALSE, &input, &error);
if (ret < 0)
i_error("%s", error);
else if (ret == 0)
More information about the dovecot-cvs
mailing list