dovecot-2.0: doveadm: Unload plugins only after calling command'...

dovecot at dovecot.org dovecot at dovecot.org
Mon Feb 28 18:57:24 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/60daca1d28c7
changeset: 12627:60daca1d28c7
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 28 18:57:21 2011 +0200
description:
doveadm: Unload plugins only after calling command's deinit() function.
This fixes a crash on deinit when using a plugin that hooks into
user.deinit().

diffstat:

 src/doveadm/doveadm-mail.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r f7cb34c45864 -r 60daca1d28c7 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c	Mon Feb 28 17:50:41 2011 +0200
+++ b/src/doveadm/doveadm-mail.c	Mon Feb 28 18:57:21 2011 +0200
@@ -248,7 +248,6 @@
 		i_fatal("%s", error);
 	else if (ret == 0)
 		i_fatal("User doesn't exist");
-	mail_storage_service_deinit(&ctx->storage_service);
 }
 
 static void sig_die(const siginfo_t *si, void *context ATTR_UNUSED)
@@ -319,7 +318,6 @@
 	i_set_failure_prefix("doveadm: ");
 	if (ret < 0)
 		i_error("Failed to iterate through some users");
-	mail_storage_service_deinit(&ctx->storage_service);
 }
 
 static void
@@ -420,14 +418,17 @@
 		service_flags |= MAIL_STORAGE_SERVICE_FLAG_TEMP_PRIV_DROP;
 		doveadm_mail_all_users(ctx, argv, wildcard_user, service_flags);
 	}
+	if (ctx->search_args != NULL)
+		mail_search_args_unref(&ctx->search_args);
 	doveadm_mail_server_flush();
 	ctx->v.deinit(ctx);
 	doveadm_print_flush();
 
+	/* service deinit unloads mail plugins, so do it late */
+	mail_storage_service_deinit(&ctx->storage_service);
+
 	if (ctx->failed)
 		exit(FATAL_DEFAULT);
-	if (ctx->search_args != NULL)
-		mail_search_args_unref(&ctx->search_args);
 	pool_unref(&ctx->pool);
 }
 


More information about the dovecot-cvs mailing list