[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

smtpserver exited on signal 11




Contentfilter causes smtpserver to die (this happens
at "cleanup" stage, so all incoming mail processed normally).

The same function killr() used to kill router and contentfilter

smtpserver.c:
|    if (routerpid > 0)
|        killr(&SS, routerpid);
|    if (contentpolicypid > 1)
|      killr(&SS, contentpolicypid);

smtprouter.c
|void killr(SS, rpid)
|SmtpState *SS;
|int rpid;
|{
|    if (rpid > 0) {
|        fclose(tofp);   tofp   = NULL;
|        fclose(fromfp); fromfp = NULL;
|        kill(rpid, SIGKILL);
|    }
|}

We have both tofp, and fromfp FILE pointers == NULL, then called
"killr(&SS, contentpolicypid)" and fclose() fails.

My fix follows:

diff -bu smtpserver.orig/contentpolicy.c smtpserver/contentpolicy.c
--- smtpserver.orig/contentpolicy.c	Thu May 15 12:07:53 2003
+++ smtpserver/contentpolicy.c	Thu May 15 12:12:30 2003
@@ -257,3 +257,20 @@

   return rc;
 }
+
+void killcfilter(SS, cpid)
+SmtpState *SS;
+int cpid;
+{
+    if (cpid > 0) {
+	if (cpol_tofp == NULL)
+	    fclose(cpol_tofp);
+        cpol_tofp   = NULL;
+	if (cpol_fromfp == NULL)
+            fclose(cpol_fromfp);
+	cpol_fromfp = NULL;
+	sleep(1); /* for normal filter shutdown */
+	kill(cpid, SIGKILL);
+    }
+}
+
Only in smtpserver: kissg
diff -bu smtpserver.orig/smtprouter.c smtpserver/smtprouter.c
--- smtpserver.orig/smtprouter.c	Thu May 15 12:07:53 2003
+++ smtpserver/smtprouter.c	Thu May 15 12:12:29 2003
@@ -185,8 +185,12 @@
 int rpid;
 {
     if (rpid > 0) {
-	fclose(tofp);   tofp   = NULL;
-	fclose(fromfp); fromfp = NULL;
+	if (tofp == NULL)
+	    fclose(tofp);
+        tofp   = NULL;
+	if (fromfp == NULL)
+            fclose(fromfp);
+	fromfp = NULL;
 	kill(rpid, SIGKILL);
     }
 }
diff -bu smtpserver.orig/smtpserver.c smtpserver/smtpserver.c
--- smtpserver.orig/smtpserver.c	Thu May 15 12:07:53 2003
+++ smtpserver/smtpserver.c	Thu May 15 12:15:34 2003
@@ -1322,7 +1322,7 @@
 	    if (routerpid > 0)
 	      killr(&SS, routerpid);
 	    if (contentpolicypid > 1)
-	      killr(&SS, contentpolicypid);
+	      killcfilter(&SS, contentpolicypid);

 	    if (netconnected_flg)
 	      sleep(2);
@@ -1345,7 +1345,7 @@
     if (routerpid > 0)
 	killr(&SS, routerpid);
     if (contentpolicypid > 1)
-      killr(&SS, contentpolicypid);
+      killcfilter(&SS, contentpolicypid);
     if (netconnected_flg)
       sleep(2);
     exit(0);
@@ -1916,7 +1916,7 @@
 	if (routerpid > 0)
 	    killr(SS, routerpid);
 	if (contentpolicypid > 1)
-	  killr(SS, contentpolicypid);
+	  killcfilter(SS, contentpolicypid);
 	exit(0);
     }
     report(SS, "(connected)");
diff -bu smtpserver.orig/smtpserver.h smtpserver/smtpserver.h
--- smtpserver.orig/smtpserver.h	Thu May 15 12:07:53 2003
+++ smtpserver/smtpserver.h	Thu May 15 12:08:33 2003
@@ -489,6 +489,7 @@
 #endif				/* USE_TRANSLATION */

 extern void killr __((SmtpState * SS, int rpid));
+extern void killcfilter __((SmtpState * SS, int rpid));
 extern void typeflush __((SmtpState *));
 #if defined(HAVE_STDARG_H) && defined(HAVE_VPRINTF)
 extern void type __((SmtpState *, int code, const char *status, const char *fmt,...));
-
To unsubscribe from this list: send the line "unsubscribe zmailer" in
the body of a message to majordomo@nic.funet.fi