]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fixed tb-extra-mailbox-sep workeround.
authorTimo Sirainen <tss@iki.fi>
Tue, 4 Aug 2009 18:35:21 +0000 (14:35 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 4 Aug 2009 18:35:21 +0000 (14:35 -0400)
--HG--
branch : HEAD

src/imap/cmd-delete.c
src/imap/imap-commands-util.c

index 8db06484a109d237f8b8d91566084775a0eede90..ba504806118c09dead195f3382295503ecd2c805 100644 (file)
@@ -34,13 +34,6 @@ bool cmd_delete(struct client_command_context *cmd)
        }
        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 {
index 5a16ae1853cc97134afb554630b1db17cc206bc1..3b890ddd6b5e9212d21485ffded86c2df49e0d81 100644 (file)
@@ -26,6 +26,7 @@ client_find_namespace(struct client_command_context *cmd, const char **mailboxp,
        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);
@@ -44,6 +45,14 @@ client_find_namespace(struct client_command_context *cmd, const char **mailboxp,
                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)) {
                /* make sure there are no real separators used in the mailbox
                   name. */
@@ -67,7 +76,7 @@ client_find_namespace(struct client_command_context *cmd, const char **mailboxp,
                }
        }
 
-       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;
        }