Closed Bug 396837 Opened 17 years ago Closed 17 years ago

getquotaroot command doesn't escape folder name

Categories

(MailNews Core :: Networking: IMAP, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: blong, Assigned: Bienvenu)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6
Build Identifier: Thunderbird version 1.5.0.12 (20070604)

If you have a folder named Foo\Bar, thunderbird will issue a getquotaroot command without escaping the name, ie:

183 getquotaroot "Foo\Bar"

instead of:

183 getquotaroot "Foo\\Bar"

In nsImapProtocol.cpp, looks like nsImapProtocol::GetQuotaDataIfSupported(const char *aBoxName) should escape the name like
void nsImapProtocol::SelectMailbox(const char *mailboxName) does by calling
CreateEscapedMailboxName

Reproducible: Always

Steps to Reproduce:
1. Create a folder on the server named Foo\Bar
2. Try to get quota information about that folder, or just watch the logs
3. See server complain and send a BAD response
Actual Results:  
222 getquotaroot "Bar\Foo"
222 BAD Could not parse command


Expected Results:  
126 getquotaroot "Bar\\Foo"
 * QUOTAROOT "Bar\\Foo" ""
 * QUOTA "" (STORAGE 9408 2744320)
126 OK Success
Attached patch proposed fixSplinter Review
while I was here, I converted the code to use nsCStrings throughout, which saves us a copy
Attachment #281744 - Flags: superreview?(mscott)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #281744 - Flags: superreview?(mscott) → superreview+
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Product: Core → MailNews Core
(Open a new bug?  Or reopen this bug?)

I have a folder called "test/with\backslash" that thunderbird can be select just fine, but it seems to still have the broken getquotaroot command (here is a trace from win32 thunderbird 2.0.0.19):

9260[29b9008]: 2ba5a88:ps01:S-test2/name[square]in:SendData: DONE
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=22 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test2/name[square]in:CreateNewLineFromSocket: 43 OK IDLE completed
9260[29b9008]: 2ba5a88:ps01:S-test2/name[square]in:ProcessCurrentURL: entering
9260[29b9008]: 2ba5a88:ps01:S-test2/name[square]in:ProcessCurrentURL:imap://ptest01@ps01:143/select%3E/test/with%5Cbackslash:  = currentUrl
9260[29b9008]: 2ba5a88:ps01:S-test2/name[square]in:SendData: 44 select "test/with\\backslash"
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=12 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * 0 EXISTS
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=12 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * 0 RECENT
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=55 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * OK [UIDVALIDITY 37] UIDs are valid for this mailbox
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=45 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * OK [UIDNEXT 269] next expected UID is 269
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=131 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * FLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $MDNSent Forwarded $Junk $NotJunk Junk JunkRecorded NonJunk NotJunk)
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=136 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * OK [PERMANENTFLAGS (\Answered \Deleted \Draft \Flagged \Seen $Forwarded $MDNSent Forwarded \*)] junk-related flags are not permanent
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=56 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: * OK [HIGHESTMODSEQ 37] modseq tracked on this mailbox
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=37 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: 44 OK [READ-WRITE] SELECT completed
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:SendData: 45 getquotaroot "test/with\backslash"
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=60 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: 45 BAD parse error: illegal character 'b' in quoted string
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:SendData: 46 IDLE
9260[29b9008]: ReadNextLine [stream=2b5cdb8 nb=10 needmore=0]
9260[29b9008]: 2ba5a88:ps01:S-test/with\backslash:CreateNewLineFromSocket: + idling
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: