From: Timo Sirainen Date: Sun, 30 Jul 2017 06:39:18 +0000 (+0300) Subject: lib-storage: MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS wasn't working correctly X-Git-Tag: 2.2.32.rc1~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=956bcf69b794e4eb2e2a67171a851bc77d9a304a;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS wasn't working correctly Especially with "doveadm user" it still triggered running the plugins, because doveadm loads all the plugins early. --- diff --git a/src/lib-storage/mail-storage-service.c b/src/lib-storage/mail-storage-service.c index edfc6dd7c2..2f83c81e48 100644 --- a/src/lib-storage/mail-storage-service.c +++ b/src/lib-storage/mail-storage-service.c @@ -1296,6 +1296,19 @@ mail_storage_service_lookup_real(struct mail_storage_service_ctx *ctx, ret = -2; } } + if ((ctx->flags & MAIL_STORAGE_SERVICE_FLAG_NO_PLUGINS) != 0 && + user_set->mail_plugins[0] != '\0') { + /* mail_storage_service_load_modules() already avoids loading + plugins when the _NO_PLUGINS flag is set. However, it's + possible that the plugins are already loaded, because the + plugin loading is a global state. This is especially true + with doveadm, which loads the mail_plugins immediately at + startup so it can find commands registered by plugins. It's + fine that extra plugins are loaded - we'll just need to + prevent any of their hooks from being called. One easy way + to do this is just to clear out the mail_plugins setting: */ + (void)settings_parse_line(user->set_parser, "mail_plugins="); + } *user_r = user; return ret;