dovecot-2.2: layout=fs: Fixed iteration with mail_full_filesyste...
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 20 03:26:31 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/86e6dc46a80e
changeset: 14429:86e6dc46a80e
user: Timo Sirainen <tss at iki.fi>
date: Wed Apr 04 11:07:05 2012 +0300
description:
layout=fs: Fixed iteration with mail_full_filesystem_access=yes
diffstat:
src/lib-storage/list/mailbox-list-fs-iter.c | 28 +++++++++++++++++++++-------
1 files changed, 21 insertions(+), 7 deletions(-)
diffs (66 lines):
diff -r f03e81b702a8 -r 86e6dc46a80e src/lib-storage/list/mailbox-list-fs-iter.c
--- a/src/lib-storage/list/mailbox-list-fs-iter.c Wed Apr 04 10:07:41 2012 +0300
+++ b/src/lib-storage/list/mailbox-list-fs-iter.c Wed Apr 04 11:07:05 2012 +0300
@@ -112,6 +112,21 @@
i_error("rename(%s, %s) failed: %m", src, str_c(dest));
}
+static const char *
+dir_get_storage_name(struct list_dir_context *dir, const char *fname)
+{
+ if (*dir->storage_name == '\0') {
+ /* regular root */
+ return fname;
+ } else if (strcmp(dir->storage_name, "/") == 0) {
+ /* full_filesystem_access=yes "/" root */
+ return t_strconcat("/", fname, NULL);
+ } else {
+ /* child */
+ return t_strconcat(dir->storage_name, "/", fname, NULL);
+ }
+}
+
static int
dir_entry_get(struct fs_list_iterate_context *ctx, const char *dir_path,
struct list_dir_context *dir, const struct dirent *d)
@@ -144,8 +159,7 @@
}
/* check the pattern */
- storage_name = *dir->storage_name == '\0' ? d->d_name :
- t_strconcat(dir->storage_name, "/", d->d_name, NULL);
+ storage_name = dir_get_storage_name(dir, d->d_name);
vname = mailbox_list_get_vname(ctx->ctx.list, storage_name);
if (!uni_utf8_str_is_valid(vname)) {
fs_list_rename_invalid(ctx, storage_name);
@@ -205,8 +219,9 @@
if (*path == '~') {
if (!mailbox_list_try_get_absolute_path(ctx->ctx.list, &path)) {
- /* couldn't expand ~user/ */
- return FALSE;
+ /* a) couldn't expand ~user/
+ b) mailbox is under our mail root, we changed
+ path to storage_name */
}
/* NOTE: the path may have been translated to a storage_name
instead of path */
@@ -374,7 +389,7 @@
if (*p == '/')
last = p;
}
- if (p == last && *pattern == '/')
+ if (p == last+1 && *pattern == '/')
root = "/";
else {
root = mailbox_list_get_storage_name(ctx->ctx.list,
@@ -560,8 +575,7 @@
const char *storage_name, *vname, *child_dir_name;
dir = ctx->dir;
- storage_name = *dir->storage_name == '\0' ? entry->fname :
- t_strconcat(dir->storage_name, "/", entry->fname, NULL);
+ storage_name = dir_get_storage_name(dir, entry->fname);
vname = mailbox_list_get_vname(ctx->ctx.list, storage_name);
ctx->info.name = p_strdup(ctx->info_pool, vname);
More information about the dovecot-cvs
mailing list