dovecot-2.0: imap: Fixed tb-extra-mailbox-sep workeround.
dovecot at dovecot.org
dovecot at dovecot.org
Tue Aug 4 21:35:31 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/497b2f2bd175
changeset: 9722:497b2f2bd175
user: Timo Sirainen <tss at iki.fi>
date: Tue Aug 04 14:35:21 2009 -0400
description:
imap: Fixed tb-extra-mailbox-sep workeround.
diffstat:
2 files changed, 10 insertions(+), 8 deletions(-)
src/imap/cmd-delete.c | 7 -------
src/imap/imap-commands-util.c | 11 ++++++++++-
diffs (52 lines):
diff -r 51d280d34bfa -r 497b2f2bd175 src/imap/cmd-delete.c
--- a/src/imap/cmd-delete.c Mon Aug 03 16:01:04 2009 -0400
+++ b/src/imap/cmd-delete.c Tue Aug 04 14:35:21 2009 -0400
@@ -34,13 +34,6 @@ bool cmd_delete(struct client_command_co
}
mailbox_close(&mailbox);
- if ((client->workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
- *name != '\0' &&
- name[strlen(name)-1] == mailbox_list_get_hierarchy_sep(ns->list)) {
- /* drop the extra trailing hierarchy separator */
- name = t_strndup(name, strlen(name)-1);
- }
-
if (mailbox_list_delete_mailbox(ns->list, name) < 0)
client_send_list_error(cmd, ns->list);
else {
diff -r 51d280d34bfa -r 497b2f2bd175 src/imap/imap-commands-util.c
--- a/src/imap/imap-commands-util.c Mon Aug 03 16:01:04 2009 -0400
+++ b/src/imap/imap-commands-util.c Tue Aug 04 14:35:21 2009 -0400
@@ -26,6 +26,7 @@ client_find_namespace(struct client_comm
struct mail_namespace *ns;
enum mailbox_name_status mailbox_status;
const char *orig_mailbox, *mailbox, *p, *resp_code = NULL;
+ unsigned int mailbox_len;
orig_mailbox = *mailboxp;
ns = mail_namespace_find(cmd->client->user->namespaces, mailboxp);
@@ -42,6 +43,14 @@ client_find_namespace(struct client_comm
if (*mailbox == '\0' && !(*orig_mailbox != '\0' && ns->list)) {
client_send_tagline(cmd, "NO Empty mailbox name.");
return NULL;
+ }
+
+ mailbox_len = strlen(mailbox);
+ if ((cmd->client->workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
+ mailbox[mailbox_len-1] == mailbox_list_get_hierarchy_sep(ns->list)) {
+ /* drop the extra trailing hierarchy separator */
+ mailbox = t_strndup(mailbox, mailbox_len-1);
+ *mailboxp = mailbox;
}
if (ns->real_sep != ns->sep && ns->prefix_len < strlen(orig_mailbox)) {
@@ -67,7 +76,7 @@ client_find_namespace(struct client_comm
}
}
- if (strlen(mailbox) > MAILBOX_MAX_NAME_LEN) {
+ if (mailbox_len > MAILBOX_MAX_NAME_LEN) {
client_send_tagline(cmd, "NO Mailbox name too long.");
return NULL;
}
More information about the dovecot-cvs
mailing list