dovecot-2.0: Mail search register getting API change to fix a do...
dovecot at dovecot.org
dovecot at dovecot.org
Fri May 7 21:28:56 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/0a35407e6ff4
changeset: 11268:0a35407e6ff4
user: Timo Sirainen <tss at iki.fi>
date: Fri May 07 21:28:51 2010 +0300
description:
Mail search register getting API change to fix a doveadm crash bug.
diffstat:
src/doveadm/doveadm-mail.c | 4 ++--
src/imap/imap-search-args.c | 4 ++--
src/lib-storage/mail-search-register-human.c | 14 +++++++++++++-
src/lib-storage/mail-search-register-imap.c | 10 +++++++++-
src/lib-storage/mail-search-register.h | 8 ++------
src/lib-storage/mail-storage-settings.c | 1 +
src/lib-storage/mail-storage.c | 13 +++++++------
src/plugins/virtual/virtual-config.c | 4 ++--
8 files changed, 38 insertions(+), 20 deletions(-)
diffs (168 lines):
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/doveadm/doveadm-mail.c
--- a/src/doveadm/doveadm-mail.c Wed May 05 16:48:40 2010 +0300
+++ b/src/doveadm/doveadm-mail.c Fri May 07 21:28:51 2010 +0300
@@ -108,8 +108,8 @@
const char *error;
parser = mail_search_parser_init_cmdline(args);
- if (mail_search_build(mail_search_register_human, parser, "UTF-8",
- &sargs, &error) < 0)
+ if (mail_search_build(mail_search_register_get_human(),
+ parser, "UTF-8", &sargs, &error) < 0)
i_fatal("%s", error);
mail_search_parser_deinit(&parser);
return sargs;
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/imap/imap-search-args.c
--- a/src/imap/imap-search-args.c Wed May 05 16:48:40 2010 +0300
+++ b/src/imap/imap-search-args.c Fri May 07 21:28:51 2010 +0300
@@ -51,8 +51,8 @@
}
parser = mail_search_parser_init_imap(args);
- ret = mail_search_build(mail_search_register_imap, parser, charset,
- &sargs, &error);
+ ret = mail_search_build(mail_search_register_get_imap(),
+ parser, charset, &sargs, &error);
mail_search_parser_deinit(&parser);
if (ret < 0) {
client_send_command_error(cmd, error);
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/lib-storage/mail-search-register-human.c
--- a/src/lib-storage/mail-search-register-human.c Wed May 05 16:48:40 2010 +0300
+++ b/src/lib-storage/mail-search-register-human.c Fri May 07 21:28:51 2010 +0300
@@ -164,7 +164,7 @@
{ "MAILBOX-GUID", human_search_mailbox_guid }
};
-struct mail_search_register *
+static struct mail_search_register *
mail_search_register_init_human(struct mail_search_register *imap_register)
{
struct mail_search_register *reg;
@@ -203,3 +203,15 @@
mail_search_register_fallback(reg, fallback);
return reg;
}
+
+struct mail_search_register *mail_search_register_get_human(void)
+{
+ if (mail_search_register_human == NULL) {
+ struct mail_search_register *imap_reg =
+ mail_search_register_get_imap();
+
+ mail_search_register_human =
+ mail_search_register_init_human(imap_reg);
+ }
+ return mail_search_register_human;
+}
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/lib-storage/mail-search-register-imap.c
--- a/src/lib-storage/mail-search-register-imap.c Wed May 05 16:48:40 2010 +0300
+++ b/src/lib-storage/mail-search-register-imap.c Fri May 07 21:28:51 2010 +0300
@@ -501,7 +501,7 @@
{ "X-MAILBOX", imap_search_x_mailbox }
};
-struct mail_search_register *mail_search_register_init_imap(void)
+static struct mail_search_register *mail_search_register_init_imap(void)
{
struct mail_search_register *reg;
@@ -511,3 +511,11 @@
mail_search_register_fallback(reg, imap_search_fallback);
return reg;
}
+
+struct mail_search_register *
+mail_search_register_get_imap(void)
+{
+ if (mail_search_register_imap == NULL)
+ mail_search_register_imap = mail_search_register_init_imap();
+ return mail_search_register_imap;
+}
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/lib-storage/mail-search-register.h
--- a/src/lib-storage/mail-search-register.h Wed May 05 16:48:40 2010 +0300
+++ b/src/lib-storage/mail-search-register.h Fri May 07 21:28:51 2010 +0300
@@ -12,9 +12,6 @@
(*build)(struct mail_search_build_context *ctx);
};
-extern struct mail_search_register *mail_search_register_imap;
-extern struct mail_search_register *mail_search_register_human;
-
typedef struct mail_search_arg *
mail_search_register_fallback_t(struct mail_search_build_context *ctx,
const char *key);
@@ -43,8 +40,7 @@
bool mail_search_register_get_fallback(struct mail_search_register *reg,
mail_search_register_fallback_t **fallback_r);
-struct mail_search_register *mail_search_register_init_imap(void);
-struct mail_search_register *
-mail_search_register_init_human(struct mail_search_register *imap_register);
+struct mail_search_register *mail_search_register_get_imap(void);
+struct mail_search_register *mail_search_register_get_human(void);
#endif
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/lib-storage/mail-storage-settings.c
--- a/src/lib-storage/mail-storage-settings.c Wed May 05 16:48:40 2010 +0300
+++ b/src/lib-storage/mail-storage-settings.c Fri May 07 21:28:51 2010 +0300
@@ -386,6 +386,7 @@
{
struct mail_user_settings *set = _set;
+ set->mail_privileged_group = "baba";
#ifndef CONFIG_BINARY
fix_base_path(set, pool, &set->auth_socket_path);
#else
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/lib-storage/mail-storage.c
--- a/src/lib-storage/mail-storage.c Wed May 05 16:48:40 2010 +0300
+++ b/src/lib-storage/mail-storage.c Fri May 07 21:28:51 2010 +0300
@@ -23,12 +23,14 @@
#define MAILBOX_DELETE_RETRY_SECS (60*5)
+extern struct mail_search_register *mail_search_register_imap;
+extern struct mail_search_register *mail_search_register_human;
+
struct mail_storage_module_register mail_storage_module_register = { 0 };
struct mail_module_register mail_module_register = { 0 };
struct mail_storage_mail_index_module mail_storage_mail_index_module =
MODULE_CONTEXT_INIT(&mail_index_module_register);
-
ARRAY_TYPE(mail_storage) mail_storage_classes;
void mail_storage_init(void)
@@ -36,15 +38,14 @@
mailbox_lists_init();
mail_storage_hooks_init();
i_array_init(&mail_storage_classes, 8);
- mail_search_register_imap = mail_search_register_init_imap();
- mail_search_register_human =
- mail_search_register_init_human(mail_search_register_imap);
}
void mail_storage_deinit(void)
{
- mail_search_register_deinit(&mail_search_register_human);
- mail_search_register_deinit(&mail_search_register_imap);
+ if (mail_search_register_human != NULL)
+ mail_search_register_deinit(&mail_search_register_human);
+ if (mail_search_register_imap != NULL)
+ mail_search_register_deinit(&mail_search_register_imap);
if (array_is_created(&mail_storage_classes))
array_free(&mail_storage_classes);
mail_storage_hooks_deinit();
diff -r 5d76f5b13883 -r 0a35407e6ff4 src/plugins/virtual/virtual-config.c
--- a/src/plugins/virtual/virtual-config.c Wed May 05 16:48:40 2010 +0300
+++ b/src/plugins/virtual/virtual-config.c Fri May 07 21:28:51 2010 +0300
@@ -54,8 +54,8 @@
*error_r = t_strdup(imap_parser_get_error(imap_parser, &fatal));
} else {
parser = mail_search_parser_init_imap(args);
- if (mail_search_build(mail_search_register_imap, parser, "UTF-8",
- &sargs, error_r) < 0)
+ if (mail_search_build(mail_search_register_get_imap(),
+ parser, "UTF-8", &sargs, error_r) < 0)
sargs = NULL;
mail_search_parser_deinit(&parser);
}
More information about the dovecot-cvs
mailing list