dovecot: Don't break when renaming mailboxes with '*' or '%' cha...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Oct 6 03:05:43 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/d4d6457550b5
changeset: 6535:d4d6457550b5
user: Timo Sirainen <tss at iki.fi>
date: Sat Oct 06 03:05:37 2007 +0300
description:
Don't break when renaming mailboxes with '*' or '%' characters and children.
diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
src/lib-storage/list/mailbox-list-maildir.c | 12 ++++++++----
diffs (22 lines):
diff -r dea6ed0002ae -r d4d6457550b5 src/lib-storage/list/mailbox-list-maildir.c
--- a/src/lib-storage/list/mailbox-list-maildir.c Sat Oct 06 02:48:07 2007 +0300
+++ b/src/lib-storage/list/mailbox-list-maildir.c Sat Oct 06 03:05:37 2007 +0300
@@ -322,10 +322,14 @@ static int rename_children(struct mailbo
while ((info = mailbox_list_iter_next(iter)) != NULL) {
const char *name;
- i_assert(oldnamelen <= strlen(info->name));
-
- name = p_strdup(pool, info->name + oldnamelen);
- array_append(&names_arr, &name, 1);
+ /* verify that the prefix matches, otherwise we could have
+ problems with mailbox names containing '%' and '*' chars */
+ if (strncmp(info->name, oldname, oldnamelen) == 0 &&
+ info->name[oldnamelen] ==
+ mailbox_list_get_hierarchy_sep(list)) {
+ name = p_strdup(pool, info->name + oldnamelen);
+ array_append(&names_arr, &name, 1);
+ }
}
if (mailbox_list_iter_deinit(&iter) < 0) {
ret = -1;
More information about the dovecot-cvs
mailing list