commit c9f30c046a819edcdaa6552b50026fb147bc85d5
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Thu Jun 2 12:43:05 2011 +0200

    Revert "fix UIDNEXT handling"
    
    in fact, UIDNEXT (and UIDVALIDITY) null is *not* allowed (see RFC3501
    section 9). them popping up nonetheless was a dovecot bug (which would
    also confuse dovecot itself).
    having it in as a workaround was no good either, as quite some other
    code in mbsync assumes that UIDs are not null.
    
    This reverts commit 58e35bc and most of 1d0c484.
    

 TODO           |    3 ---
 src/drv_imap.c |    8 ++++----
 src/mbsync.1   |    2 --
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/TODO b/TODO
index c3fdb35..26b6f93 100644
--- a/TODO
+++ b/TODO
@@ -15,9 +15,6 @@ quotas are weird, they make close() fail.
 
 clarify error cases of transactions.
 
-sync.c does not consider UID 0 valid, which is wrong. fixing this requires
-an incompatible change or a remapping hack in sync state files.
-
 clarify UID 0 vs. < 0 returns vor store_msg & find_msg.
 
 create dbg_srec(srec, fmt, ...).
diff --git a/src/drv_imap.c b/src/drv_imap.c
index 07fab53..8fa0017 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -751,7 +751,7 @@ parse_response_code( imap_store_t *ctx, struct imap_cmd 
*cmd, char *s )
                        return RESP_CANCEL;
                }
        } else if (!strcmp( "UIDNEXT", arg )) {
-               if (!(arg = next_arg( &s )) || (ctx->gen.uidnext = strtol( arg, 
&p, 10 ), *p)) {
+               if (!(arg = next_arg( &s )) || !(ctx->gen.uidnext = atoi( arg 
))) {
                        error( "IMAP error: malformed NEXTUID status\n" );
                        return RESP_CANCEL;
                }
@@ -969,7 +969,7 @@ get_cmd_result_p2( imap_store_t *ctx, struct imap_cmd *cmd, 
int response )
        if (response != RESP_OK) {
                done_imap_cmd( ctx, ocmd, response );
        } else {
-               ctx->gen.uidnext = 0;
+               ctx->gen.uidnext = 1;
                if (ocmd->param.to_trash)
                        ctx->trashnc = TrashKnown;
                ocmd->param.create = 0;
@@ -1436,7 +1436,7 @@ imap_select( store_t *gctx, int create,
                prefix = ctx->prefix;
        }
 
-       ctx->gen.uidnext = -1;
+       ctx->gen.uidnext = 0;
 
        INIT_IMAP_CMD(imap_cmd_simple, cmd, cb, aux)
        cmd->gen.param.create = create;
@@ -1480,7 +1480,7 @@ imap_load( store_t *gctx, int minuid, int maxuid, int 
newuid, int *excs, int nex
                                goto done;
                }
                if (maxuid == INT_MAX)
-                       maxuid = ctx->gen.uidnext >= 0 ? ctx->gen.uidnext - 1 : 
1000000000;
+                       maxuid = ctx->gen.uidnext ? ctx->gen.uidnext - 1 : 
1000000000;
                if (maxuid >= minuid) {
                        if ((ctx->gen.opts & OPEN_FIND) && minuid < newuid) {
                                sprintf( buf, "%d:%d", minuid, newuid - 1 );
diff --git a/src/mbsync.1 b/src/mbsync.1
index e8cbabb..03178f3 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -466,8 +466,6 @@ lost if they are marked as deleted after the message list 
was retrieved but
 before the mailbox is expunged. This can be fixed by using UID EXPUNGE.
 There is no risk as long as the IMAP mailbox is not simultaneously accessed
 by \fBmbsync\fR and another mail client.
-.P
-The IMAP message UID 0 is assumed to be impossible, which is wrong.
 ..
 .SH FILES
 .TP

------------------------------------------------------------------------------
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