Mercurial > dovecot > core-2.2
changeset 15462:b1267f135417
dbox: dbox-alt-root symlink now points to the alt root directory, not to mailboxes dir.
Existing mailboxes/ symlinks are silently changed to new ones. This also
means that accessing the dbox with an older version will log a warning about
the change.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 13 Dec 2012 12:24:32 +0200 |
parents | 2125cf15b26d |
children | f9e8cbb2792d |
files | src/lib-storage/index/dbox-common/dbox-storage.c |
diffstat | 1 files changed, 15 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-storage.c Wed Dec 12 15:21:45 2012 +0200 +++ b/src/lib-storage/index/dbox-common/dbox-storage.c Thu Dec 13 12:24:32 2012 +0200 @@ -30,8 +30,8 @@ } static bool -dbox_alt_path_has_changed(const char *root_dir, - const char *alt_path, const char *alt_symlink_path) +dbox_alt_path_has_changed(const char *root_dir, const char *alt_path, + const char *alt_path2, const char *alt_symlink_path) { const char *linkpath; @@ -47,6 +47,13 @@ "but currently no ALT path set", root_dir, linkpath); return TRUE; } else if (strcmp(linkpath, alt_path) != 0) { + if (strcmp(linkpath, alt_path2) == 0) { + /* FIXME: for backwards compatibility. old versions + created the symlink to mailboxes/ directory, which + was fine with sdbox, but didn't even exist with + mdbox. we'll silently replace the symlink. */ + return TRUE; + } i_warning("dbox %s: Original ALT=%s, " "but currently ALT=%s", root_dir, linkpath, alt_path); return TRUE; @@ -56,14 +63,17 @@ static void dbox_verify_alt_path(struct mailbox_list *list) { - const char *root_dir, *alt_symlink_path, *alt_path; + const char *root_dir, *alt_symlink_path, *alt_path, *alt_path2; root_dir = mailbox_list_get_root_forced(list, MAILBOX_LIST_PATH_TYPE_DIR); alt_symlink_path = t_strconcat(root_dir, "/"DBOX_ALT_SYMLINK_NAME, NULL); - (void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX, + (void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_DIR, &alt_path); - if (!dbox_alt_path_has_changed(root_dir, alt_path, alt_symlink_path)) + (void)mailbox_list_get_root_path(list, MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX, + &alt_path2); + if (!dbox_alt_path_has_changed(root_dir, alt_path, alt_path2, + alt_symlink_path)) return; /* unlink/create the current alt path symlink */