]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: Add explicit mail_storage_init/deinit() calls
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 19 Feb 2017 00:03:08 +0000 (02:03 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 19 Feb 2017 15:38:12 +0000 (17:38 +0200)
This mainly prevents losing hooks that were registered by doveadm plugins.

Otherwise what happens is:
 - mail_plugins are unloaded and they unregister their hooks
 - doveadm plugins (e.g. doveadm_sieve) are NOT unloaded
 - mail_storage_deinit() frees all the registered hooks
 - next mail_storage_init() initializes all new hooks
 - All mail_plugins are loaded and they register again their hooks
 - doveadm plugins are NOT re-loaded or re-initialized, so their existing
hooks were lost.

src/doveadm/doveadm-mail.c

index ec7f6524d79e819cedebe35eabafaf979c951f61..bd3ceb16346e8a32e1d4948ac10af97dd984cc31 100644 (file)
@@ -921,11 +921,14 @@ void doveadm_mail_init(void)
                                        doveadm_settings->mail_plugin_dir,
                                        doveadm_settings->mail_plugins,
                                        &mod_set);
+       /* keep mail_storage_init() referenced so that its _deinit() doesn't
+          try to free doveadm plugins' hooks too early. */
+       mail_storage_init();
 }
 
 void doveadm_mail_deinit(void)
 {
-       mail_storage_hooks_deinit();
+       mail_storage_deinit();
        array_free(&doveadm_mail_cmds);
 }