ports/85706: clamsmtp working only in debug mode (fix included)
Alex L. Demidov
alexd at vinf.ru
Sun Sep 4 08:20:12 UTC 2005
>Number: 85706
>Category: ports
>Synopsis: clamsmtp working only in debug mode (fix included)
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: update
>Submitter-Id: current-users
>Arrival-Date: Sun Sep 04 08:20:11 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator: Alex L. Demidov
>Release: FreeBSD 5.4-RELEASE i386
>Organization:
Variant-Inform ISP (www.vinf.ru)
>Environment:
System: FreeBSD texaco.vinf.ru 5.4-RELEASE FreeBSD 5.4-RELEASE #6: Thu May 12 00:46:23 MSD 2005 root at texaco:/usr/obj/usr/src/sys/TEXACO i386
>Description:
clamsmtp 1.5 works only in debug mode.
Included patch fix this bug by moving socket creation after daemonizing as
suggested in mailing list clamsmtp-users at lists.sourceforge.net
http://sourceforge.net/mailarchive/forum.php?thread_id=8060741&forum_id=42732
>How-To-Repeat:
>Fix:
diff -urN clamsmtp.orig/Makefile clamsmtp/Makefile
--- clamsmtp.orig/Makefile Sun Sep 4 03:17:22 2005
+++ clamsmtp/Makefile Sun Sep 4 11:56:09 2005
@@ -7,7 +7,7 @@
PORTNAME= clamsmtp
PORTVERSION= 1.5
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= security
MASTER_SITES= http://memberwebs.com/nielsen/software/clamsmtp/
diff -urN clamsmtp.orig/files/clamsmtpd.sh.tmpl clamsmtp/files/clamsmtpd.sh.tmpl
--- clamsmtp.orig/files/clamsmtpd.sh.tmpl Sun Sep 4 03:17:22 2005
+++ clamsmtp/files/clamsmtpd.sh.tmpl Sun Sep 4 11:54:45 2005
@@ -24,9 +24,8 @@
clamsmtpd_enable=${clamsmtpd_enable-"NO"}
clamsmtpd_conf=${clamsmtpd_conf-"%%PREFIX%%/etc/clamsmtpd.conf"}
clamsmtpd_pid=${clamsmtpd_pid-"%%CLAMAV_PID_DIR%%/clamsmtpd.pid"}
clamsmtpd_debug=${clamsmtpd_debug-"4"}
-command_args="-f ${clamsmtpd_conf} -p ${clamsmtpd_pid} -d ${clamsmtpd_debug}"
+command_args="-f ${clamsmtpd_conf} -p ${clamsmtpd_pid}"
pidfile=${clamsmtpd_pid}
diff -urN clamsmtp.orig/files/patch-smtppass.c clamsmtp/files/patch-smtppass.c
--- clamsmtp.orig/files/patch-smtppass.c Thu Jan 1 03:00:00 1970
+++ clamsmtp/files/patch-smtppass.c Sun Sep 4 11:53:53 2005
@@ -0,0 +1,57 @@
+diff -ur ../clamsmtp-1.5-orig/common/smtppass.c common/smtppass.c
+--- common/smtppass.c Tue Aug 2 01:23:05 2005
++++ common/smtppass.c Sun Sep 4 11:52:13 2005
+@@ -275,6 +275,26 @@
+
+ sp_messagex(NULL, LOG_DEBUG, "starting up (%s)...", VERSION);
+
++ /* Drop privileges before daemonizing */
++ drop_privileges();
++
++ /* When set to this we daemonize */
++ if(g_state.debug_level == -1)
++ {
++ /* Fork a daemon nicely here */
++ if(daemon(0, 0) == -1)
++ {
++ sp_message(NULL, LOG_ERR, "couldn't run as daemon");
++ exit(1);
++ }
++
++ sp_messagex(NULL, LOG_DEBUG, "running as a daemon");
++ g_state.daemonized = 1;
++
++ /* Open the system log */
++ openlog(g_state.name, 0, LOG_MAIL);
++ }
++
+ /* Create the socket */
+ sock = socket(SANY_TYPE(g_state.listenaddr), SOCK_STREAM, 0);
+ if(sock < 0)
+@@ -297,26 +317,6 @@
+ exit(1);
+ }
+
+- /* Drop privileges before daemonizing */
+- drop_privileges();
+-
+- /* When set to this we daemonize */
+- if(g_state.debug_level == -1)
+- {
+- /* Fork a daemon nicely here */
+- if(daemon(0, 0) == -1)
+- {
+- sp_message(NULL, LOG_ERR, "couldn't run as daemon");
+- exit(1);
+- }
+-
+- sp_messagex(NULL, LOG_DEBUG, "running as a daemon");
+- g_state.daemonized = 1;
+-
+- /* Open the system log */
+- openlog(g_state.name, 0, LOG_MAIL);
+- }
+-
+ sp_messagex(NULL, LOG_DEBUG, "created socket: %s", g_state.listenname);
+
+ /* Handle some signals */
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list