[RCD] IMAP capability detection

Rudolfs Osins rudolfs.osins at sigmanet.lv
Wed Mar 24 10:42:41 CET 2010


Hello everyone!

I was wondering, why my Roundcube instance wouldn't show the quota bar,
turns out that there is a problem with detecting IMAP capabilities in
the RC code. And looks like I'm not the only one:
http://trac.roundcube.net/ticket/1485750

In short, our mail cluster setup doesn't return the full set of IMAP
capabilities before the user has been logged in.

Our setup (RC 0.3.1-20091031):

Webmail front-end   |         mail cluster
RC -> imapproxy   ->    perdition -> courier imap

Here is what an IMAP connection looks like from the webmail box:

root at webmail:/# nc 127.0.0.1 143
* OK IMAP4 Ready dzilna 00021323
C: CAPABILITY
* CAPABILITY IMAP4 IMAP4REV1 XIMAPPROXY
C: OK Completed
C: LOGIN rudolfs at sigmanet.lv xxx
C: OK User logged in
C: CAPABILITY
* CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT
THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION
C: OK CAPABILITY completed

But when logging in with roundcube I get the following (using xdebug):

public 'capability' => 
  array
    0 => string 'IMAP4' (length=5)
    1 => string 'IMAP4REV1' (length=9)
    2 => string 'XIMAPPROXY' (length=10)

After a little poking around in the Iloha IMAP library, I came up with
this hack:

root at webmail:/var/www/rc# git diff program/lib/imap.inc
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index 9d896ff..6df5855 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -452,6 +452,7 @@ function iil_C_Login(&$conn, $user, $password) {
     if ($result == 0) {
         $conn->error    .= '';
         $conn->errorNum  = 0;
+       iil_C_ClearCapability($conn);
         return $conn->fp;
     }

It clears the capability array after a successful login. After logging
in with this change I get:

public 'capability' => 
  array
    0 => string 'IMAP4REV1' (length=9)
    1 => string 'UIDPLUS' (length=7)
    2 => string 'CHILDREN' (length=8)
    3 => string 'NAMESPACE' (length=9)
    4 => string 'THREAD=ORDEREDSUBJECT' (length=21)
    5 => string 'THREAD=REFERENCES' (length=17)
    6 => string 'SORT' (length=4)
    7 => string 'QUOTA' (length=5)
    8 => string 'IDLE' (length=4)
    9 => string 'ACL' (length=3)
    10 => string 'ACL2=UNION' (length=10)

And the quota bar is working. Also this bug could be responsible for the
IMAP SORT feature not working on my setup...

Your thoughts?

Regards,
Rudolfs

_______________________________________________
List info: http://lists.roundcube.net/dev/



More information about the Dev mailing list