handle failure to store message. this helps with invalid messages like
0-byte files after crashes.
This commit is contained in:
parent
b546877d70
commit
608a2863e0
|
@ -1586,6 +1586,7 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int *uid )
|
||||||
}
|
}
|
||||||
/* invalid message */
|
/* invalid message */
|
||||||
free( fmap );
|
free( fmap );
|
||||||
|
fprintf( stderr, "IMAP warning: storing message with incomplete header.\n" );
|
||||||
return DRV_MSG_BAD;
|
return DRV_MSG_BAD;
|
||||||
mktid:
|
mktid:
|
||||||
for (j = 0; j < TUIDL; j++)
|
for (j = 0; j < TUIDL; j++)
|
||||||
|
|
14
src/sync.c
14
src/sync.c
|
@ -301,6 +301,13 @@ sync_old( int tops, store_t *sctx, store_t *tctx, store_conf_t *tconf, FILE *jfp
|
||||||
case DRV_OK:
|
case DRV_OK:
|
||||||
smsg->flags = msgdata.flags;
|
smsg->flags = msgdata.flags;
|
||||||
switch (tdriver->store_msg( tctx, &msgdata, &uid )) {
|
switch (tdriver->store_msg( tctx, &msgdata, &uid )) {
|
||||||
|
case DRV_MSG_BAD:
|
||||||
|
warn( pull ?
|
||||||
|
"Warning: Slave refuses to store message %d from master.\n" :
|
||||||
|
"Warning: Master refuses to store message %d from slave.\n",
|
||||||
|
smsg->uid );
|
||||||
|
smsg->status |= M_NOT_SYNCED;
|
||||||
|
break;
|
||||||
case DRV_STORE_BAD: return pull ? SYNC_SLAVE_BAD : SYNC_MASTER_BAD;
|
case DRV_STORE_BAD: return pull ? SYNC_SLAVE_BAD : SYNC_MASTER_BAD;
|
||||||
default: return SYNC_FAIL;
|
default: return SYNC_FAIL;
|
||||||
case DRV_OK:
|
case DRV_OK:
|
||||||
|
@ -399,6 +406,13 @@ sync_new( int tops, store_t *sctx, store_t *tctx, store_conf_t *tconf, FILE *jfp
|
||||||
}
|
}
|
||||||
msg->flags = msgdata.flags;
|
msg->flags = msgdata.flags;
|
||||||
switch (tdriver->store_msg( tctx, &msgdata, &uid )) {
|
switch (tdriver->store_msg( tctx, &msgdata, &uid )) {
|
||||||
|
case DRV_MSG_BAD:
|
||||||
|
warn( pull ?
|
||||||
|
"Warning: Slave refuses to store message %d from master.\n" :
|
||||||
|
"Warning: Master refuses to store message %d from slave.\n",
|
||||||
|
msg->uid );
|
||||||
|
msg->status |= M_NOT_SYNCED;
|
||||||
|
continue;
|
||||||
case DRV_STORE_BAD: return pull ? SYNC_SLAVE_BAD : SYNC_MASTER_BAD;
|
case DRV_STORE_BAD: return pull ? SYNC_SLAVE_BAD : SYNC_MASTER_BAD;
|
||||||
default: return SYNC_FAIL;
|
default: return SYNC_FAIL;
|
||||||
case DRV_OK: break;
|
case DRV_OK: break;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user