Subject: | LIST command fails with UW IMAP |
Hello,
I am using IMAP::Admin.pm v1.6.1.
There may be a bug in handling the response received from the server for the LIST command. Specifically it does not handle the case when the untagged response contains the NIL hierarchy delimiter. As a result of that, it prematurely breaks out of the while loop and returns a failure.
As per IMAP4Rev1 [RFC 3501] section 7.2.2, the LIST response could return a NIL hierarchy delimiter when no hierarchy exists.
I reproduced the problem running against UW IMAP
== begin trace ==
* OK [CAPABILITY IMAP4REV1 LOGIN-REFERRALS STARTTLS AUTH=LOGIN] xxxx IMAP4rev1 2001.315rh at Tue, 17 Feb 2004 14:25:32 -0800 (PST)
try LIST "" "*"
* LIST (\NoSelect) "/" .kde
* LIST (\NoSelect) "/" .kde/Autostart
* LIST (\NoInferiors \UnMarked) "/" .kde/Autostart/Autorun.desktop
* LIST (\NoInferiors \UnMarked) "/" .bash_history
* LIST (\NoInferiors) NIL INBOX
try OK LIST comple
== end trace ==
The last line "* LIST (\NoInferiors) NIL INBOX" is then assumed to be the tagged response from the server and since it does not match /^try OK/, the module behaves as if the server returned an error.
Inefficient Patch:
==================
Change Line 606 of Admin.pm
From:
while ($try =~ /^\* LIST.*?\) \".\" \"*(.*?)\"*$/) {
To:
while ( ($try =~ /^\* LIST.*?\) \".\" \"*(.*?)\"*$/) ||
($try =~ /^\* LIST.*?\) NIL \"*(.*?)\"*$/) )