On Sat, Jun 14, 2014 at 4:14 PM, Takaaki Kobayashi <
takaaki.kobaya...@nifty.com> wrote:
>
> I update to 5.5 and build from stable source OPENBSD_5_5.
> pkg_delete cyrus-imapd from rebuild from ports.
>
> cyrus-imapd lmtpd crash and sendmail can not deliver to cyrusv2.
>
> —
> Jun 15 00:17:14 saturn master[7397]: about to exec
> /usr/local/libexec/cyrus-imap
> d/lmtpd
> Jun 15 00:17:14 saturn lmtpunix[7397]: executed
> Jun 15 00:17:14 saturn lmtpunix[7397]: skiplist: checkpointed
> /var/imap/deliver.
> db (22 records, 3380 bytes) in 0 seconds
> Jun 15 00:17:14 saturn lmtpunix[7397]: skiplist: checkpointed
> /var/imap/statusca
> che.db (0 records, 144 bytes) in 0 seconds
> Jun 15 00:17:14 saturn lmtpunix[7397]: accepted connection
> Jun 15 00:17:14 saturn lmtpunix[7397]: lmtp connection preauth'd as postman
> Jun 15 00:17:15 saturn master[9420]: process 7397 exited, signaled to
> death by 11
> Jun 15 00:17:15 saturn master[9420]: service lmtpunix pid 7397 in BUSY
> state: terminated abnormally
> —
>
> I found where lmtpd crash at.
> imap/mailbox.c line 1963
>
> —
>     snprintf(buf, 4096, "%u " MODSEQ_FMT " %lu (%u) %lu %s",
>             record->uid, record->modseq, record->last_updated,
>             flagcrc,
>             record->internaldate,
>             message_guid_encode(&record->guid));
> —
>

You didn't provide a dmesg so I don't know what architecture you're on, but
that code will certainly fail on i386 and other ILP32 archs because it
assumes time_t is the same size as long.  As of OpenBSD 5.5 it's now a long
long, which is larger on ILP32 archs.  That and other printing/scanning
code should be using %lld and casting time_t values to (long long)
explicitly, ala:

        snprintf(buf, sizeof(buf), "%u " MODSEQ_FMT " %lld (%u) %lld %s",
                record->uid, record->modseq, (long
long)record->last_updated,
                flagcrc, (long long)record->internaldate,
                message_guid_encode(&record->guid));

...

> I tried to modify source mailbox.c
> —
> snprintf(buf, 4096, "%u %llu %lu (%u) %lu %s”,   … this code crash
> —
> —
> snprintf(buf, 4096, "%u %lu %lu (%u) %lu %s”,   … this code work
correct!!!
>
...

> Is my work right ?
>

While it didn't crash, I doubt it wrote the correct time and flag values to
the file.


Philip Guenther

Reply via email to