dovecot-2.2: expire plugin: Fixed crash at deinit if expire_dict...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 4 12:08:05 UTC 2014
details: http://hg.dovecot.org/dovecot-2.2/rev/cac32684b3d6
changeset: 17675:cac32684b3d6
user: Timo Sirainen <tss at iki.fi>
date: Mon Aug 04 14:05:51 2014 +0200
description:
expire plugin: Fixed crash at deinit if expire_dict initialization failed.
diffstat:
src/plugins/expire/expire-plugin.c | 40 ++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 18 deletions(-)
diffs (60 lines):
diff -r 417a984e91f3 -r cac32684b3d6 src/plugins/expire/expire-plugin.c
--- a/src/plugins/expire/expire-plugin.c Fri Aug 01 17:17:53 2014 +0300
+++ b/src/plugins/expire/expire-plugin.c Mon Aug 04 14:05:51 2014 +0200
@@ -325,34 +325,38 @@
static void expire_mail_namespaces_created(struct mail_namespace *ns)
{
struct mail_user *user = ns->user;
+ struct mail_user_vfuncs *v = user->vlast;
struct expire_mail_user *euser;
+ struct dict *db;
const char *dict_uri, *error;
dict_uri = mail_user_plugin_getenv(user, "expire_dict");
if (mail_user_plugin_getenv(user, "expire") == NULL) {
if (user->mail_debug)
i_debug("expire: No expire setting - plugin disabled");
- } else if (dict_uri == NULL) {
+ return;
+ }
+ if (dict_uri == NULL) {
i_error("expire plugin: expire_dict setting missing");
- } else {
- struct mail_user_vfuncs *v = user->vlast;
+ return;
+ }
- euser = p_new(user->pool, struct expire_mail_user, 1);
- euser->module_ctx.super = *v;
- user->vlast = &euser->module_ctx.super;
- v->deinit = expire_mail_user_deinit;
+ /* we're using only shared dictionary, the username doesn't matter. */
+ if (dict_init(dict_uri, DICT_DATA_TYPE_UINT32, "",
+ user->set->base_dir, &db, &error) < 0) {
+ i_error("expire plugin: dict_init(%s) failed: %s",
+ dict_uri, error);
+ return;
+ }
- euser->set = expire_set_init(expire_get_patterns(user));
- /* we're using only shared dictionary, the username
- doesn't matter. */
- if (dict_init(dict_uri, DICT_DATA_TYPE_UINT32, "",
- user->set->base_dir, &euser->db, &error) < 0) {
- i_error("expire plugin: dict_init(%s) failed: %s",
- dict_uri, error);
- } else {
- MODULE_CONTEXT_SET(user, expire_mail_user_module, euser);
- }
- }
+ euser = p_new(user->pool, struct expire_mail_user, 1);
+ euser->module_ctx.super = *v;
+ user->vlast = &euser->module_ctx.super;
+ v->deinit = expire_mail_user_deinit;
+
+ euser->db = db;
+ euser->set = expire_set_init(expire_get_patterns(user));
+ MODULE_CONTEXT_SET(user, expire_mail_user_module, euser);
}
static struct mail_storage_hooks expire_mail_storage_hooks = {
More information about the dovecot-cvs
mailing list