[Tickets #1620] NEW: infinite loop in IMAP folder listing
bugs at bugs.horde.org
bugs at bugs.horde.org
Thu Mar 24 13:52:19 PST 2005
DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.
Ticket URL: http://bugs.horde.org/ticket/?id=1620
-----------------------------------------------------------------------
Ticket | 1620
Created By | eli at experthost.com
Summary | infinite loop in IMAP folder listing
Queue | Horde Framework Packages
State | Unconfirmed
Priority | 3. High
Type | Bug
Owners |
+New Attachment | imap_getmailboxes.php
-----------------------------------------------------------------------
eli at experthost.com (2005-03-24 13:52) wrote:
I have confirmed that Horde (though, I use Horde just for IMP, but from what
I can tell the bug is in the underlying Horde IMAP classes) has a bug that:
1) Ignores the LATT_NOINFERIORS flag for folders.
and/or
2) Ignores that the folder "delimiter" is empty() for subfolders that it
should not query.
I was able to confirm the bug by writing a very simple PHP script which
lists IMAP folders. I was able to duplicate the bug that IMAP does by
incorrectly formatting subfolder queries.
What I mean by that is, if you have a folder called "Blah" in the parent
list (and it does not have the LATT_NOINFERIORS flag and does have a
delimiter) and you try to list folders under it, you would query "Blah/%"
for example (assuming / is the delimiter). If that query yeilds another box
called "Foo" (that also does not have the LATT_NOINFERIORS flag and does
have a delimiter), you should be querying "Blah/Foo/%" next time.
However, it appears as though Horde is ignoring the parent folder when
looking for subfolders of subfolders. If it does this, when it sees "Foo",
it then issues a query for "Foo/%".
In my particular case, it was in fact that the subfolder "Foo" (as an
example) did have the LATT_NOINFERIORS flag set as well as a delimiter set,
so it should not have been queried (for two reasons). Because it was also
improperly querying the subfolder, it was causing an infinite loop which
probably nobody ever encounted due to the weird way my particular IMAP
daemon works (SmartMax IMAPMax5).
My problem is because the IMAP daemon reports that beneath every folder,
there is another folder called "INBOX". This "INBOX" subfolder has the
LATT_NOINFERIORS flag set and does not have a delimiter so it technically
should not have been queried, but it was. That caused it to query "INBOX/%"
(rather than "Trash/INBOX/%" for example). This then caused the IMAP daemon
to report a folder called INBOX under the INBOX folder, which caused an
infinite loop.
If you take in to consideration the LATT_NOINFERIORS flag, the loop is
stopped because the INBOX subfolders apparently all have that flag set.
If you take in to consideration the presense of the folder delimiter (for
the folder you're querying), the loop is also stopped because the subfolders
do not have a delimiter.
If you take in to consideration both cases, the loop is also stopped.
I have attached my test script (minus IMAP credentials that query my IMAP
server). The code may not be streamlined, but it demonstrates proper IMAP
folder querying.
Eli.
More information about the bugs
mailing list