Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Dec 2015 03:02:17 +0000 (UTC)
From:      "Andrey A. Chernov" <ache@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r402719 - in head/mail/opendmarc: . files
Message-ID:  <201512010302.tB132HMr069608@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ache
Date: Tue Dec  1 03:02:16 2015
New Revision: 402719
URL: https://svnweb.freebsd.org/changeset/ports/402719

Log:
  1) Makes opendmarc rc script more local: sockets friendly (create
  directory with needed permissions, start/stop cleanups).
  
  2) Move pidfile to newly created /var/run/opendmarc by default.
  This directory is perfectly suitable and needed mainly for local: sockets,
  but to not violate POLA socket still remains as "inet:8893@localhost".
  
  Approved by:    maintainer timeout

Modified:
  head/mail/opendmarc/Makefile
  head/mail/opendmarc/files/opendmarc.in

Modified: head/mail/opendmarc/Makefile
==============================================================================
--- head/mail/opendmarc/Makefile	Tue Dec  1 03:00:50 2015	(r402718)
+++ head/mail/opendmarc/Makefile	Tue Dec  1 03:02:16 2015	(r402719)
@@ -3,7 +3,7 @@
 
 PORTNAME=	opendmarc
 PORTVERSION=	1.3.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	mail security
 MASTER_SITES=	SF/${PORTNAME} \
 		SF/${PORTNAME}/Previous%20Releases

Modified: head/mail/opendmarc/files/opendmarc.in
==============================================================================
--- head/mail/opendmarc/files/opendmarc.in	Tue Dec  1 03:00:50 2015	(r402718)
+++ head/mail/opendmarc/files/opendmarc.in	Tue Dec  1 03:02:16 2015	(r402719)
@@ -19,16 +19,44 @@
 name="opendmarc"
 rcvar=opendmarc_enable
 
+start_precmd="dmarc_prepcmd"
+stop_postcmd="dmarc_postcmd"
 command="%%PREFIX%%/sbin/opendmarc"
+_piddir="/var/run/opendmarc"
 
 load_rc_config $name
 
 opendmarc_enable=${opendmarc_enable-"NO"}
 opendmarc_runas=${opendmarc_runas-"mailnull:mailnull"}
-opendmarc_pidfile=${opendmarc_pidfile-"/var/run/opendmarc.pid"}
+opendmarc_pidfile=${opendmarc_pidfile-"${_piddir}/pid"}
+#opendmarc_socketspec=${opendmarc_socketspec-"local:${_piddir}/socket"}
 opendmarc_socketspec=${opendmarc_socketspec-"inet:8893@localhost"}
 opendmarc_cfgfile=${opendmarc_cfgfile-"%%PREFIX%%/etc/mail/opendmarc.conf"}
 opendmarc_flags=${opendmarc_flags-"-l -P $opendmarc_pidfile \
  -c $opendmarc_cfgfile -p $opendmarc_socketspec -u $opendmarc_runas"}
 
+dmarc_prepcmd ()
+{
+    if [ -S ${opendmarc_socketspec##local:} ] ; then
+	rm -f ${opendmarc_socketspec##local:}
+    elif [ -S ${opendmarc_socketspec##unix:} ] ; then
+	rm -f ${opendmarc_socketspec##unix:}
+    fi
+    if [ ! -d ${_piddir} ] ; then
+	mkdir -p ${_piddir}
+    fi
+    chown ${opendmarc_runas} ${_piddir}
+}
+
+dmarc_postcmd()
+{
+    if [ -S ${opendmarc_socketspec##local:} ] ; then
+	rm -f ${opendmarc_socketspec##local:}
+    elif [ -S ${opendmarc_socketspec##unix:} ] ; then
+	rm -f ${opendmarc_socketspec##unix:}
+    fi
+    # just if the directory is empty
+    rmdir ${_piddir} > /dev/null 2>&1
+}
+
 run_rc_command "$1"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512010302.tB132HMr069608>