Re: sendmail cannot deliver to cyrus-imapd(solved?)

2014-06-16 Thread Takaaki Kobayashi
 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));
 

Yes, I’m on i386 arch.

---
OpenBSD 5.5-stable (SATURN) #0: Fri Jun 13 14:39:46 JST 2014
taka...@saturn.takaaki.atnifty.com:/usr/obj/sys/arch/i386/compile/SATURN
cpu0: Intel(R) Core(TM)2 Quad CPU Q9400 @ 2.66GHz (GenuineIntel 686-class) 
2.67 GHz
---

I understand that.

I delete my patch patch-lib_util_h,
and add new patch-imap_maibox_c.

---
*** imap/mailbox.c.orig Sun Dec  2 04:57:54 2012
--- imap/mailbox.c  Mon Jun 16 17:24:01 2014
***
*** 1960,1969 
flagcrc ^= crc32_cstring(buf);
  }
  
! 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));
  
  return crc32_cstring(buf);
--- 1960,1969 
flagcrc ^= crc32_cstring(buf);
  }
  
! snprintf(buf, 4096, %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));
  
  return crc32_cstring(buf);
---

rebuilt and worked well, too.

But there are many other place that receive time_t value by “%lu” probably ….

Thank you very much.

---
Takaaki Kobayashi
takaaki.kobaya...@nifty.com



sendmail cannot deliver to cyrus-imapd(solved?)

2014-06-15 Thread Takaaki Kobayashi
Hello

I updated to 5.5 i386 and built from stable source OPENBSD_5_5.
pkg_delete cyrus-imapd and 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));
—

and MODSEQ_FMT defined at lib/util.h

—
#ifdef HAVE_LONG_LONG_INT
typedef unsigned long long int bit64;
typedef unsigned long long int modseq_t;
#define MODSEQ_FMT %llu
#define atomodseq_t(s) strtoull(s, NULL, 10)
#else
typedef unsigned long int modseq_t;
#define MODSEQ_FMT %lu
#define atomodseq_t(s) strtoul(s, NULL, 10)
#endif
—

OpenBSD has long long int, and MODSEQ_FMT is defined “%llu”.

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!!!
—

Then, I added following patch to ports
patch-lib_util_h
—
*** lib/util.h.orig Sun Jun 15 00:23:58 2014
--- lib/util.h  Sun Jun 15 00:18:43 2014
***
*** 68,74 
 #ifdef HAVE_LONG_LONG_INT
 typedef unsigned long long int bit64;
 typedef unsigned long long int modseq_t;
! #define MODSEQ_FMT %llu
 #define atomodseq_t(s) strtoull(s, NULL, 10)
 #else
 typedef unsigned long int modseq_t;
--- 68,74 
 #ifdef HAVE_LONG_LONG_INT
 typedef unsigned long long int bit64;
 typedef unsigned long long int modseq_t;
! #define MODSEQ_FMT %lu
 #define atomodseq_t(s) strtoull(s, NULL, 10)
 #else
 typedef unsigned long int modseq_t;
—

and rebuild ports.
Now, sendmail deliver to cyrusv2 correctly.

Is my solution right ?

---
Takaaki Kobayashi
takaaki.kobaya...@nifty.com



sendmail cannot deliver to cyrus-imapd(solved?)

2014-06-15 Thread Takaaki Kobayashi
Hello

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));
—

and MODSEQ_FMT defined at lib/util.h

—
#ifdef HAVE_LONG_LONG_INT
typedef unsigned long long int bit64;
typedef unsigned long long int modseq_t;
#define MODSEQ_FMT %llu
#define atomodseq_t(s) strtoull(s, NULL, 10)
#else
typedef unsigned long int modseq_t;
#define MODSEQ_FMT %lu
#define atomodseq_t(s) strtoul(s, NULL, 10)
#endif
—

OpenBSD has long long int, and MODSEQ_FMT is defined “%llu”.

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!!!
—

Then, I added following patch to ports
patch-lib_util_h
—
*** lib/util.h.orig Sun Jun 15 00:23:58 2014
--- lib/util.h  Sun Jun 15 00:18:43 2014
***
*** 68,74 
  #ifdef HAVE_LONG_LONG_INT
  typedef unsigned long long int bit64;
  typedef unsigned long long int modseq_t;
! #define MODSEQ_FMT %llu
  #define atomodseq_t(s) strtoull(s, NULL, 10)
  #else
  typedef unsigned long int modseq_t;
--- 68,74 
  #ifdef HAVE_LONG_LONG_INT
  typedef unsigned long long int bit64;
  typedef unsigned long long int modseq_t;
! #define MODSEQ_FMT %lu
  #define atomodseq_t(s) strtoull(s, NULL, 10)
  #else
  typedef unsigned long int modseq_t;
—

and rebuild ports.
Now, sendmail deliver to cyrusv2 correctly.

Is my work right ?

---
Takaaki Kobayashi
takaaki.kobaya...@nifty.com