commit 3d5539bb63b7f494f20357d7491d96228a432600
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Sat Jun 28 11:58:26 2014 +0200

    detect inconsistent state of highest assigned UID
    
    the highest assigned UID must always be at least as high as the highest
    actually found UID, as otherwise we'd hand out duplicate UIDs at some
    point. also, getting into such a state in the first place indicates some
    potentially serious trouble, or at least external interference (e.g.,
    moving/copying a message from another folder without giving it a
    pristine filename).
    
    REFMAIL: 20140626211831.ga11...@sie.protva.ru

 src/drv_maildir.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 0f58318..0142631 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -787,6 +787,13 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist )
 #endif
                                }
                                uid = entry->uid;
+                               if (uid > ctx->nuid) {
+                                       /* In principle, we could just warn and 
top up nuid. However, getting into this
+                                        * situation might indicate some 
serious trouble, so let's not make it worse. */
+                                       error( "Maildir error: UID %d is beyond 
highest assigned UID %d.\n", uid, ctx->nuid );
+                                       maildir_free_scan( msglist );
+                                       return DRV_BOX_BAD;
+                               }
                                if ((ctx->gen.opts & OPEN_SIZE) || 
((ctx->gen.opts & OPEN_FIND) && uid >= ctx->newuid))
                                        nfsnprintf( buf + bl, sizeof(buf) - bl, 
"%s/%s", subdirs[entry->recent], entry->base );
 #ifdef USE_DB

------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to