commit a91d7e4c28665e3944149aabcbb76f2e7205afea
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Thu Jun 2 19:21:19 2011 +0200

    reject qualified mailboxes with the magic name INBOX
    
    otherwise we couldn't tell them apart from the real INBOX after
    stripping away the Path.

 src/drv_imap.c    |    4 ++++
 src/drv_maildir.c |   10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 8fa0017..c9ff404 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -797,6 +797,10 @@ parse_list_rsp( imap_store_t *ctx, char *cmd )
        if (memcmp( arg, ctx->gen.conf->path, l ))
                return;
        arg += l;
+       if (l && !strcmp( arg, "INBOX" )) {
+               warn( "IMAP warning: ignoring INBOX in %s\n", 
ctx->gen.conf->path );
+               return;
+       }
        if (!memcmp( arg + strlen( arg ) - 5, ".lock", 5 )) /* workaround 
broken servers */
                return;
        add_string_list( &ctx->gen.boxes, arg );
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 6013846..b68d9ce 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -180,7 +180,7 @@ maildir_list( store_t *gctx,
        }
        while ((de = readdir( dir ))) {
                const char *inbox = ((maildir_store_conf_t *)gctx->conf)->inbox;
-               int bl;
+               int bl, isibx;
                struct stat st;
                char buf[PATH_MAX];
 
@@ -189,8 +189,12 @@ maildir_list( store_t *gctx,
                bl = nfsnprintf( buf, sizeof(buf), "%s%s/cur", 
gctx->conf->path, de->d_name );
                if (stat( buf, &st ) || !S_ISDIR(st.st_mode))
                        continue;
-               add_string_list( &gctx->boxes,
-                                !memcmp( buf, inbox, bl - 4 ) && !inbox[bl - 
4] ? "INBOX" : de->d_name );
+               isibx = !memcmp( buf, inbox, bl - 4 ) && !inbox[bl - 4];
+               if (!isibx && !strcmp( de->d_name, "INBOX" )) {
+                       warn( "Maildir warning: ignoring INBOX in %s\n", 
gctx->conf->path );
+                       continue;
+               }
+               add_string_list( &gctx->boxes, isibx ? "INBOX" : de->d_name );
        }
        closedir (dir);
 

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to