diff options
author | tron <tron@pkgsrc.org> | 2012-04-06 15:56:26 +0000 |
---|---|---|
committer | tron <tron@pkgsrc.org> | 2012-04-06 15:56:26 +0000 |
commit | 33623a038166de792200c99a3de836ab137160f5 (patch) | |
tree | d36bbfc9ba75cf8d7ca87505b94577fd3c73f834 /mail/dovecot2 | |
parent | 838c030ae90b4b288fac451e4710f387edb35ab2 (diff) | |
download | pkgsrc-33623a038166de792200c99a3de836ab137160f5.tar.gz |
Add patch from Dovecot Mercury repository to fix crash this crash in
the IMAP server:
Panic: file mail-storage.c: line 628 (mailbox_alloc): assertion failed:
(uni_utf8_str_is_valid(vname))
Problem reported and fix tested by Thorsten Frueauf.
Diffstat (limited to 'mail/dovecot2')
-rw-r--r-- | mail/dovecot2/Makefile | 3 | ||||
-rw-r--r-- | mail/dovecot2/distinfo | 3 | ||||
-rw-r--r-- | mail/dovecot2/patches/patch-src_lib-storage_list_mailbox-list-fs-iter.c | 104 |
3 files changed, 108 insertions, 2 deletions
diff --git a/mail/dovecot2/Makefile b/mail/dovecot2/Makefile index da6c0e4193a..d3af8382176 100644 --- a/mail/dovecot2/Makefile +++ b/mail/dovecot2/Makefile @@ -1,6 +1,7 @@ -# $NetBSD: Makefile,v 1.19 2012/03/17 02:14:15 ghen Exp $ +# $NetBSD: Makefile,v 1.20 2012/04/06 15:56:26 tron Exp $ DISTNAME= dovecot-2.1.3 +PKGREVISION= 1 CATEGORIES= mail MASTER_SITES= http://www.dovecot.org/releases/2.1/ diff --git a/mail/dovecot2/distinfo b/mail/dovecot2/distinfo index 7a24f654afc..e27b488f5b9 100644 --- a/mail/dovecot2/distinfo +++ b/mail/dovecot2/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.17 2012/03/17 02:14:15 ghen Exp $ +$NetBSD: distinfo,v 1.18 2012/04/06 15:56:26 tron Exp $ SHA1 (dovecot-2.1.3.tar.gz) = b11d9dc3e058c291243e75d9cfda86241cf65f8a RMD160 (dovecot-2.1.3.tar.gz) = c5130de9737ee93fba896e02a7dba9725e4176c7 @@ -10,3 +10,4 @@ SHA1 (patch-ae) = 51d8cb998cc2ded8bfc767710e465b752c50e656 SHA1 (patch-af) = 6d4b339898cba762243c1ff415e0fd09e3dec750 SHA1 (patch-aj) = 9e7970d29d11c097b9588ad16611f6d0e48235c2 SHA1 (patch-ak) = ca4edaa46472a0cb609cea4d06893c7bd1312f54 +SHA1 (patch-src_lib-storage_list_mailbox-list-fs-iter.c) = ec4a21ff3b357e6e97a2ab40491f90cbfa2e3144 diff --git a/mail/dovecot2/patches/patch-src_lib-storage_list_mailbox-list-fs-iter.c b/mail/dovecot2/patches/patch-src_lib-storage_list_mailbox-list-fs-iter.c new file mode 100644 index 00000000000..d0362e4f311 --- /dev/null +++ b/mail/dovecot2/patches/patch-src_lib-storage_list_mailbox-list-fs-iter.c @@ -0,0 +1,104 @@ +$NetBSD: patch-src_lib-storage_list_mailbox-list-fs-iter.c,v 1.1 2012/04/06 15:56:27 tron Exp $ + +Fix crash triggered by certain IMAP clients e.g. an Apple iPad. +Patch taken from here: + +http://hg.dovecot.org/dovecot-2.1/rev/c77fbfce438d + +--- src/lib-storage/list/mailbox-list-fs-iter.c.orig 2012-03-14 14:22:50.000000000 +0000 ++++ src/lib-storage/list/mailbox-list-fs-iter.c 2012-04-06 16:35:15.000000000 +0100 +@@ -85,6 +85,33 @@ + return 0; + } + ++static void ++fs_list_rename_invalid(struct fs_list_iterate_context *ctx, ++ const char *storage_name) ++{ ++ /* the storage_name is completely invalid, rename it to ++ something more sensible. we could do this for all names that ++ aren't valid mUTF-7, but that might lead to accidents in ++ future when UTF-8 storage names are used */ ++ string_t *destname = t_str_new(128); ++ string_t *dest = t_str_new(128); ++ const char *root, *src; ++ ++ root = mailbox_list_get_path(ctx->ctx.list, NULL, ++ MAILBOX_LIST_PATH_TYPE_MAILBOX); ++ src = t_strconcat(root, "/", storage_name, NULL); ++ ++ (void)uni_utf8_get_valid_data((const void *)storage_name, ++ strlen(storage_name), destname); ++ ++ str_append(dest, root); ++ str_append_c(dest, '/'); ++ (void)imap_utf8_to_utf7(str_c(destname), dest); ++ ++ if (rename(src, str_c(dest)) < 0 && errno != ENOENT) ++ i_error("rename(%s, %s) failed: %m", src, str_c(dest)); ++} ++ + static int + dir_entry_get(struct fs_list_iterate_context *ctx, const char *dir_path, + struct list_dir_context *dir, const struct dirent *d) +@@ -120,6 +147,13 @@ + storage_name = *dir->storage_name == '\0' ? d->d_name : + t_strconcat(dir->storage_name, "/", d->d_name, NULL); + vname = mailbox_list_get_vname(ctx->ctx.list, storage_name); ++ if (!uni_utf8_str_is_valid(vname)) { ++ fs_list_rename_invalid(ctx, storage_name); ++ /* just skip this in this iteration, we'll see it on the ++ next list */ ++ return 0; ++ } ++ + match = imap_match(ctx->ctx.glob, vname); + + if ((dir->info_flags & (MAILBOX_CHILDREN | MAILBOX_NOCHILDREN | +@@ -512,33 +546,6 @@ + return strcmp(path, inbox_path) == 0; + } + +-static void +-fs_list_rename_invalid(struct fs_list_iterate_context *ctx, +- const char *storage_name) +-{ +- /* the storage_name is completely invalid, rename it to +- something more sensible. we could do this for all names that +- aren't valid mUTF-7, but that might lead to accidents in +- future when UTF-8 storage names are used */ +- string_t *destname = t_str_new(128); +- string_t *dest = t_str_new(128); +- const char *root, *src; +- +- root = mailbox_list_get_path(ctx->ctx.list, NULL, +- MAILBOX_LIST_PATH_TYPE_MAILBOX); +- src = t_strconcat(root, "/", storage_name, NULL); +- +- (void)uni_utf8_get_valid_data((const void *)storage_name, +- strlen(storage_name), destname); +- +- str_append(dest, root); +- str_append_c(dest, '/'); +- (void)imap_utf8_to_utf7(str_c(destname), dest); +- +- if (rename(src, str_c(dest)) < 0 && errno != ENOENT) +- i_error("rename(%s, %s) failed: %m", src, str_c(dest)); +-} +- + static int + fs_list_entry(struct fs_list_iterate_context *ctx, + const struct list_dir_entry *entry) +@@ -553,12 +560,6 @@ + t_strconcat(dir->storage_name, "/", entry->fname, NULL); + + vname = mailbox_list_get_vname(ctx->ctx.list, storage_name); +- if (!uni_utf8_str_is_valid(vname)) { +- fs_list_rename_invalid(ctx, storage_name); +- /* just skip this in this iteration, we'll see it on the +- next list */ +- return 0; +- } + ctx->info.name = p_strdup(ctx->info_pool, vname); + ctx->info.flags = entry->info_flags; + |