>>>>> On Sat, 5 May 2001 09:21:55 -0700 (PDT)
>>>>> <[EMAIL PROTECTED]> said:

nsayer> 1. master crashes if the LMTP socket specified is in a nonexistent path.
nsayer> Yes, this is a misconfiguration, but master appears to work until it accepts
nsayer> the first imap/pop/whatever connection, then it crashes. The origin of the
nsayer> crash is in master.c at line 1296.

This was fixed in new IPv6 patch:

    http://www.imasy.or.jp/~ume/ipv6/cyrus-imapd-2.0.13-ipv6-20010506.diff.gz

and, ports-current of cyrus-imapd was changed to use it.  Please cvsup
and try it.

nsayer> 2. imapd loses its "-s" argument the 2nd time around. I suspect this is a
nsayer> setproctitle issue, but I haven't tried to prove it. If I do
nsayer> 'openssl s_client -connect localhost:imaps', then '. logout' and then
nsayer> very quickly 'telnet localhost imaps', I get a non-SSLed imapd.
nsayer> Further research shows that when this happens the 'imaps' variable in the
nsayer> code is set to 0, which can only be because the argv[][] given to
nsayer> service_main() does not have a "-s" in it.

How about this patch?  It seems fixed the problem here.  What I've
done is moving option parsing from service_main() to service_init().
I believe option parsing is good enough to be done only one time.
I think there is same problem in pop3d.

Index: imap/imapd.c
diff -u imap/imapd.c.orig imap/imapd.c
--- imap/imapd.c.orig   Mon May  7 02:45:36 2001
+++ imap/imapd.c        Mon May  7 03:31:46 2001
@@ -394,6 +394,9 @@
     imapd_exists = -1;
 }
 
+static int imaps = 0;
+static sasl_ssf_t extprops_ssf = 0;
+
 /*
  * run once when process is forked;
  * MUST NOT exit directly; must return with non-zero error code
@@ -401,6 +404,7 @@
 int service_init(int argc, char **argv, char **envp)
 {
     int r;
+    int opt;
 
     config_changeident("imapd");
     
@@ -447,6 +451,26 @@
     snmp_connect(); /* ignore return code */
     snmp_set_str(SERVER_NAME_VERSION,CYRUS_VERSION);
 
+    while ((opt = getopt(argc, argv, "C:sp:")) != EOF) {
+       switch (opt) {
+       case 'C': /* alt config file - handled by service::main() */
+           break;
+       case 's': /* imaps (do starttls right away) */
+           imaps = 1;
+           if (!starttls_enabled()) {
+               syslog(LOG_ERR, "imaps: required OpenSSL options not present");
+               fatal("imaps: required OpenSSL options not present",
+                     EC_CONFIG);
+           }
+           break;
+       case 'p': /* external protection */
+           extprops_ssf = atoi(optarg);
+           break;
+       default:
+           break;
+       }
+    }
+
     return 0;
 }
 
@@ -455,8 +479,6 @@
  */
 int service_main(int argc, char **argv, char **envp)
 {
-    int imaps = 0;
-    int opt;
     socklen_t salen;
     struct hostent *hp;
     int timeout;
@@ -478,25 +500,7 @@
 #endif
 
     memset(&extprops, 0, sizeof(sasl_external_properties_t));
-    while ((opt = getopt(argc, argv, "C:sp:")) != EOF) {
-       switch (opt) {
-       case 'C': /* alt config file - handled by service::main() */
-           break;
-       case 's': /* imaps (do starttls right away) */
-           imaps = 1;
-           if (!starttls_enabled()) {
-               syslog(LOG_ERR, "imaps: required OpenSSL options not present");
-               fatal("imaps: required OpenSSL options not present",
-                     EC_CONFIG);
-           }
-           break;
-       case 'p': /* external protection */
-           extprops.ssf = atoi(optarg);
-           break;
-       default:
-           break;
-       }
-    }
+    extprops.ssf = extprops_ssf;
 
     imapd_in = prot_new(0, 0);
     imapd_out = prot_new(1, 1);


nsayer> All of this was observed with cyrus-imap 2.0.13 running on FreeBSD 4.3
nsayer> built straight from the ports tree.

This patch is applicable for IPv6 patched version.  So, you can try it
by saving as cyrus-imapd/files/patch-dh or someting.

--
Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
[EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
http://www.imasy.org/~ume/

Reply via email to