# Small patch to Cyrus 2.1.16 to stop mailbox_append_index() from installing # negative timestamps which later cause problems. # diff -ur cyrus-imapd-2.1.16-DIST/imap/mailbox.c cyrus-imapd-2.1.16/imap/mailbox.c --- cyrus-imapd-2.1.16-DIST/imap/mailbox.c 2003-11-04 21:43:00.000000000 +0000 +++ cyrus-imapd-2.1.16/imap/mailbox.c 2004-04-18 16:02:02.000000000 +0100 @@ -1318,6 +1318,20 @@ memset(buf, 0, len); for (i = 0; i < num; i++) { + /* Negative timestamps cause later index_fetchreply() to call + * abort(), which isn't very friendly. Saw this happen with a Mac + * which had a broken system clock claiming that it was 1929 (!) + */ + + if (record[i].internaldate <= 0) + record[i].internaldate = time(NULL); + + if (record[i].sentdate <= 0) + record[i].sentdate = time(NULL); + + if (record[i].last_updated <= 0) + record[i].internaldate = time(NULL); + p = buf + i*mailbox->record_size; *((bit32 *)(p+OFFSET_UID)) = htonl(record[i].uid); *((bit32 *)(p+OFFSET_INTERNALDATE)) = htonl(record[i].internaldate);