From: Brendan Cully Date: Fri, 23 May 2008 03:22:46 +0000 (-0700) Subject: Escape LSUB mailbox names given to mutt_parse_rc_line. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5d4508d89823491a79134157210f9fcabeff4925;p=neomutt Escape LSUB mailbox names given to mutt_parse_rc_line. Handle literals in STATUS responses for Notes compatibility. --- diff --git a/imap/command.c b/imap/command.c index ef835ecf7..12ef50d72 100644 --- a/imap/command.c +++ b/imap/command.c @@ -696,7 +696,10 @@ static void cmd_parse_lsub (IMAP_DATA* idata, char* s) strfcpy (buf, "mailboxes \"", sizeof (buf)); mutt_account_tourl (&idata->conn->account, &url); - url.path = list.name; + /* escape \ and " */ + imap_quote_string(errstr, sizeof (errstr), list.name); + url.path = errstr + 1; + url.path[strlen(url.path) - 1] = '\0'; if (!mutt_strcmp (url.user, ImapUser)) url.user = NULL; url_ciss_tostring (&url, buf + 11, sizeof (buf) - 10, 0); @@ -818,11 +821,30 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) int count; IMAP_STATUS *status; unsigned int olduv, oldun; + long litlen; mailbox = imap_next_word (s); - s = imap_next_word (mailbox); - *(s - 1) = '\0'; - imap_unmunge_mbox_name (mailbox); + + /* We need a real tokenizer. */ + if (!imap_get_literal_count (mailbox, &litlen)) + { + if (imap_cmd_step (idata) != IMAP_CMD_CONTINUE) + { + idata->status = IMAP_FATAL; + return; + } + mailbox = idata->buf; + s = mailbox + litlen; + *s = '\0'; + s++; + SKIPWS(s); + } + else + { + s = imap_next_word (mailbox); + *(s - 1) = '\0'; + imap_unmunge_mbox_name (mailbox); + } status = imap_mboxcache_get (idata, mailbox, 1); olduv = status->uidvalidity;