CVS commit by ossi:
backport: deal with UIDVALIDITY of 0 properly.
CCMAIL: [EMAIL PROTECTED]
M +6 -3 drv_imap.c 1.10.2.9
M +6 -5 sync.c 1.43.2.4
--- isync/src/drv_imap.c #1.10.2.8:1.10.2.9
@@ -818,5 +818,5 @@ parse_response_code( imap_store_t *ctx,
{
imap_t *imap = ctx->imap;
- char *arg, *p;
+ char *arg, *earg, *p;
if (*s != '[')
@@ -830,5 +830,7 @@ parse_response_code( imap_store_t *ctx,
arg = next_arg( &s );
if (!strcmp( "UIDVALIDITY", arg )) {
- if (!(arg = next_arg( &s )) || !(ctx->gen.uidvalidity = atoi(
arg ))) {
+ if (!(arg = next_arg( &s )) ||
+ (ctx->gen.uidvalidity = strtoll( arg, &earg, 10 ), *earg))
+ {
fprintf( stderr, "IMAP error: malformed UIDVALIDITY
status\n" );
return RESP_BAD;
@@ -848,5 +850,6 @@ parse_response_code( imap_store_t *ctx,
fprintf( stderr, "*** IMAP ALERT *** %s\n", p );
} else if (cb && cb->ctx && !strcmp( "APPENDUID", arg )) {
- if (!(arg = next_arg( &s )) || !(ctx->gen.uidvalidity = atoi(
arg )) ||
+ if (!(arg = next_arg( &s )) ||
+ (ctx->gen.uidvalidity = strtoll( arg, &earg, 10 ), *earg) ||
!(arg = next_arg( &s )) || !(*(int *)cb->ctx = atoi( arg )))
{
--- isync/src/sync.c #1.43.2.3:1.43.2.4
@@ -475,5 +475,5 @@ sync_boxes( store_t *mctx, const char *m
nmmsg = nsmsg = 0;
- mctx->uidvalidity = sctx->uidvalidity = 0;
+ mctx->uidvalidity = sctx->uidvalidity = -1;
mopts = sopts = 0;
makeopts( chan->sops, chan->slave, &sopts, chan->master, &mopts );
@@ -511,5 +511,6 @@ sync_boxes( store_t *mctx, const char *m
nfasprintf( &nname, "%s.new", dname );
nfasprintf( &lname, "%s.lock", dname );
- muidval = suidval = smaxxuid = mmaxuid = smaxuid = 0;
+ muidval = suidval = -1;
+ smaxxuid = mmaxuid = smaxuid = 0;
memset( &lck, 0, sizeof(lck) );
#if SEEK_SET != 0
@@ -706,5 +707,5 @@ sync_boxes( store_t *mctx, const char *m
dump_box( sctx );
- if (suidval && suidval != sctx->uidvalidity) {
+ if (suidval >= 0 && suidval != sctx->uidvalidity) {
fprintf( stderr, "Error: UIDVALIDITY of slave changed\n" );
ret = SYNC_FAIL;
@@ -810,5 +811,5 @@ sync_boxes( store_t *mctx, const char *m
dump_box( mctx );
- if (muidval && muidval != mctx->uidvalidity) {
+ if (muidval >= 0 && muidval != mctx->uidvalidity) {
fprintf( stderr, "Error: UIDVALIDITY of master changed\n" );
ret = SYNC_FAIL;
@@ -816,5 +817,5 @@ sync_boxes( store_t *mctx, const char *m
}
- if (!muidval || !suidval) {
+ if (muidval < 0 || suidval < 0) {
muidval = mctx->uidvalidity;
suidval = sctx->uidvalidity;
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel