aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorswills <swills@FreeBSD.org>2017-08-19 04:49:16 +0800
committerswills <swills@FreeBSD.org>2017-08-19 04:49:16 +0800
commit9b04dea0f3758c6cae85c4d284143db85a1e1d84 (patch)
tree0635a6d25a09856a30ac00314e358b1190fdd3cb /mail
parentfb6b2ab95811848476e86cf817a0a392754dff0a (diff)
downloadfreebsd-ports-gnome-9b04dea0f3758c6cae85c4d284143db85a1e1d84.tar.gz
freebsd-ports-gnome-9b04dea0f3758c6cae85c4d284143db85a1e1d84.tar.zst
freebsd-ports-gnome-9b04dea0f3758c6cae85c4d284143db85a1e1d84.zip
mail/opendkim: Add GID support to the rc script
PR: 208056 Submitted by: Krzysztof <ports@bsdserwis.com> Approved by: Daniel Austin <freebsd-ports@dan.me.uk> (maintainer)
Diffstat (limited to 'mail')
-rw-r--r--mail/opendkim/Makefile2
-rw-r--r--mail/opendkim/files/milter-opendkim.in26
2 files changed, 27 insertions, 1 deletions
diff --git a/mail/opendkim/Makefile b/mail/opendkim/Makefile
index c87d41b29238..3a81f65c8b5f 100644
--- a/mail/opendkim/Makefile
+++ b/mail/opendkim/Makefile
@@ -3,7 +3,7 @@
PORTNAME= opendkim
PORTVERSION= 2.10.3
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= mail security
MASTER_SITES= SF/${PORTNAME} \
SF/${PORTNAME}/Previous%20Releases \
diff --git a/mail/opendkim/files/milter-opendkim.in b/mail/opendkim/files/milter-opendkim.in
index c69ba0b5ddbf..68d1c03b017e 100644
--- a/mail/opendkim/files/milter-opendkim.in
+++ b/mail/opendkim/files/milter-opendkim.in
@@ -16,6 +16,7 @@
# milteropendkim_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable dkim-milter
# milteropendkim_uid (str): Set username to run milter.
+# milteropendkim_gid (str): Set group to run milter.
# milteropendkim_profiles (list): Set to "" by default.
# Define your profiles here.
# milteropendkim_cfgfile (str): Configuration file. See opendkim.conf(5)
@@ -38,9 +39,11 @@ rcvar=milteropendkim_enable
extra_commands="reload"
start_precmd="dkim_prepcmd"
+start_postcmd="dkim_start_postcmd"
stop_postcmd="dkim_postcmd"
command="%%PREFIX%%/sbin/opendkim"
_piddir="/var/run/milteropendkim"
+_piddir_perms="0755"
pidfile="${_piddir}/pid"
sig_reload="USR1"
@@ -51,6 +54,7 @@ load_rc_config $name
#
: ${milteropendkim_enable="NO"}
: ${milteropendkim_uid="mailnull"}
+: ${milteropendkim_gid="mailnull"}
: ${milteropendkim_cfgfile="%%PREFIX%%/etc/mail/opendkim.conf"}
# Options other than above can be set with $milteropendkim_flags.
@@ -82,6 +86,9 @@ if [ -n "$2" ]; then
fi
if [ "x${milteropendkim_uid}" != "x" ];then
_uid_prefix="-u"
+ if [ "x${milteropendkim_gid}" != "x" ];then
+ milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid}
+ fi
fi
if [ "x${milteropendkim_domain}" != "x" ];then
milteropendkim_domain="-d ${milteropendkim_domain}"
@@ -127,6 +134,9 @@ else
fi
if [ "x${milteropendkim_uid}" != "x" ];then
_uid_prefix="-u"
+ if [ "x${milteropendkim_gid}" != "x" ];then
+ milteropendkim_uid=${milteropendkim_uid}:${milteropendkim_gid}
+ fi
fi
if [ "x${milteropendkim_domain}" != "x" ];then
milteropendkim_domain="-d ${milteropendkim_domain}"
@@ -157,6 +167,22 @@ dkim_prepcmd ()
if [ -n "${milteropendkim_uid}" ] ; then
chown ${milteropendkim_uid} ${_piddir}
fi
+ if [ -n "${milteropendkim_gid}" ] ; then
+ chgrp ${milteropendkim_gid} ${_piddir}
+ _piddir_perms="0775"
+ fi
+ chmod ${_piddir_perms} ${_piddir}
+}
+
+dkim_start_postcmd ()
+{
+ # postcmd is executed too fast and socket is not created before checking...
+ sleep 1
+ if [ -S ${milteropendkim_socket##local:} ] ; then
+ chmod ${_piddir_perms} ${milteropendkim_socket##local:}
+ elif [ -S ${milteropendkim_socket##unix:} ] ; then
+ chmod ${_piddir_perms} ${milteropendkim_socket##unix:}
+ fi
}
dkim_postcmd()