Re: Anybody else experience this namespace bug?
Michael J Rubinsky <[email protected]>
| Newsgroups | gmane.comp.horde.devel |
|---|---|
| Message-ID | <20160411103459.Horde.dRtl3UrP-_JvOzEwV04VQ4p@h4.theupstairsroom.com> |
Quoting Quinn Comendant <[email protected]>: > Hello horde-dev, > > I have had difficulty setting the IMAP path prefix in horde webmail > 5.2 on a CentOS 6 server running Courier-IMAP 4.1.2. When creating > folders I was getting the error, "The mailbox 'New folder' was not > created. This is what the server said: IMAP error reported by server." > > The imp_imap debug log shows that it is trying to create folders > without the `INBOX.` prefix, which I think is the reason it is failing: > > S: * OK [CAPABILITY IMAP4rev1] Courier-IMAP ready. Copyright 1998-2005 > Double Precision, Inc. See COPYING for distribution information. > C: 1 LOGIN [email protected] [PASSWORD] > S: 1 OK LOGIN Ok. > C: 2 LSUB "" New folder > S: 2 OK LSUB completed > C: 3 LIST "" New folder > S: 3 OK LIST completed > C: 4 CREATE New folder > S: 4 NO Invalid mailbox name. > C: 5 LOGOUT > S: * BYE Courier-IMAP server shutting down > S: 5 OK LOGOUT completed > > I *am* able to create a folder if I manually include the IMAP prefix > to its name, i.e. I go to Folder Actions > Create Mailbox and then use > a folder name literally as `INBOX.New folder`. The new folder is created > with that name literally and `INBOX.New folder` is created on the server and > is displayed in IMP's sidebar. =\ > > As far as I can tell, this is configured using the 'namespace' option > in backends.local.php, but I have tried the following variations with > no success: > > 'namespace' => array('INBOX.') > 'namespace' => array('#INBOX.') > 'namespace' => array('INBOX/') > 'namespace' => array('#INBOX/') > > I believe the correct method of setting the IMAP path prefix is to > define the following in backends.local.php: > > 'namespace' => array('INBOX.'), > > However, that alone has not solved the problem. I may have found > issues with horde/imp or our server configuration. Now, even with > the namespace specified thusly, IMP is still sending IMAP commands > without the namespace (i.e., `CREATE New folder` instead of `CREATE > INBOX.New folder`). > > I have read the source code of horde/imp and found the following > changes were required for this to work: > > ## /var/www/html/horde/imp/lib/Imap.php : 474 > > The `getNamespace()` function defined here would return null when > the specified mailbox was the default, despite > `$this->getNamespaces()` returning a valid result. To solve this I > added the following at line 474: > > if ($mailbox === self::NS_DEFAULT && $ns->count() == 1) { > return end(end($ns)); > } > > ## /usr/share/pear/Horde/Imap/Client/Base.php : 742 > > Here, the name of the namespace is an array and would result in an > array-to-string conversion, with the resulting namespace name > `Array` instead of the correct name `INBOX`. I've added a tertiary > clause to test if it is an array before assigning the value. > Secondly, the namespace name lacking the delimiter would result in > the use of folder names such as `INBOXNew folder` instead of > `INBOX.New folder` (because in other parts of the code where the > namespace is used the namespace is concatenated with the folder name > with no delimiter), so I added the delimiter to the name here. The > following is a modification of line 742: > > $ob->name = (is_array($val) ? end($val) : $val) . $val['delimiter']; > > With these two changes, horde/imp is now successfully creating > folders, displaying folders, auto-creating special folders, and > moving messages between folders. The IMAP transactions now send the > prefix correctly: > > S: * OK [CAPABILITY IMAP4rev1] Courier-IMAP ready. Copyright > 1998-2005 Double Precision, Inc. See COPYING for distribution > information. > C: 1 LOGIN [email protected] [PASSWORD] > S: 1 OK LOGIN Ok. > C: 2 LIST "" INBOX. > S: * LIST (\Marked \HasChildren) "." "INBOX" > S: 2 OK LIST completed > C: 3 LSUB "" "INBOX.New folder" > S: 3 OK LSUB completed > C: 4 LIST "" "INBOX.New folder" > S: 4 OK LIST completed > C: 5 CREATE "INBOX.New folder" > S: 5 OK "INBOX.New folder" created. > C: 6 LSUB "" "INBOX.New folder" > S: 6 OK LSUB completed > C: 7 LIST "" "INBOX.New folder" > S: * LIST (\HasNoChildren) "." "INBOX.New folder" > S: 7 OK LIST completed > C: 8 LOGOUT > S: * BYE Courier-IMAP server shutting down > S: 8 OK LOGOUT completed > > If I have discovered bugs in horde/imp 5.2, please let me know how > best I can contribute these changes (pull request on github?) or if > you believe this is a problem with my Courier IMAP configuration, I > would appreciate some help identifying if that may be the case. > > Attached is IMP's imap log output during a successful folder > creation operation (also so you can see imap capabilities, etc). > > > Regards, > > > Quinn > -- > dev mailing list > Frequently Asked Questions: http://wiki.horde.org/FAQ > To unsubscribe, mail: [email protected] I haven't had time to verify or look at this yet. Please add a ticket to bugs.horde.org so it doesn't get lost. -- mike The Horde Project http://www.horde.org https://www.facebook.com/hordeproject https://www.twitter.com/hordeproject -- dev mailing list Frequently Asked Questions: http://wiki.horde.org/FAQ To unsubscribe, mail: [email protected]
smime.p7s
(application/pkcs7-signature, 5.6 KB) - not displayed