git: 27f7397a8f59 - main - mail/opendkim: Silence RC script warning

From: Chris Rees <crees_at_FreeBSD.org>
Date: Sun, 16 Jan 2022 19:27:40 UTC
The branch main has been updated by crees:

URL: https://cgit.FreeBSD.org/ports/commit/?id=27f7397a8f598df0953ed8f9db562308ac6f1bee

commit 27f7397a8f598df0953ed8f9db562308ac6f1bee
Author:     Chris Rees <crees@FreeBSD.org>
AuthorDate: 2022-01-16 19:18:53 +0000
Commit:     Chris Rees <crees@FreeBSD.org>
CommitDate: 2022-01-16 19:26:46 +0000

    mail/opendkim: Silence RC script warning
    
    Reported by:    Herbert J. Skuhra <herbert@gojira.at>
---
 mail/opendkim/Makefile                 |  2 +-
 mail/opendkim/files/milter-opendkim.in | 26 ++++++++++++++++++--------
 2 files changed, 19 insertions(+), 9 deletions(-)

diff --git a/mail/opendkim/Makefile b/mail/opendkim/Makefile
index 620252c2fff5..7e8e2f02bda1 100644
--- a/mail/opendkim/Makefile
+++ b/mail/opendkim/Makefile
@@ -2,7 +2,7 @@
 
 PORTNAME=	opendkim
 PORTVERSION=	2.10.3
-PORTREVISION=	14
+PORTREVISION=	15
 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 8d83197d8884..7672c9352e68 100644
--- a/mail/opendkim/files/milter-opendkim.in
+++ b/mail/opendkim/files/milter-opendkim.in
@@ -69,7 +69,11 @@ sig_reload="USR1"
 
 dkim_cleansockets()
 {
-    rm -f "${milteropendkim_socket##local:}" "${milteropendkim_socket##unix:}"
+    case ${milteropendkim_socket%:*} in
+    local|unix)
+	rm -f "${milteropendkim_socket#*:}"
+	;;
+    esac
 }
 
 dkim_get_pidfile()
@@ -85,19 +89,25 @@ dkim_prepcmd()
 {
     dkim_cleansockets
     dkim_get_pidfile
-    install -d -o ${milteropendkim_uid%:*} -g $milteropendkim_gid \
-    	-m ${milteropendkim_socket_perms} ${pidfile%/*}
+    case ${milteropendkim_socket%:*} in
+    local|unix)
+	socketfile=${milteropendkim_socket#*:}
+	install -d -o ${milteropendkim_uid%:*} -g $milteropendkim_gid \
+	    -m ${milteropendkim_socket_perms} \
+	       ${pidfile%/*} ${socketfile%/*}
+	;;
+    esac
 }
 
 dkim_start_postcmd()
 {
-    if [ -n "${milteropendkim_socket}" ] ; then
+    case ${milteropendkim_socket%:*} in
+    local|unix)
 	# postcmd is executed too fast and socket is not created before checking...
 	sleep 1
-	chmod -f ${milteropendkim_socket_perms} \
-	    ${milteropendkim_socket##local:} \
-	    ${milteropendkim_socket##unix:}
-    fi
+	chmod -f ${milteropendkim_socket_perms} ${milteropendkim_socket#*:}
+	;;
+    esac
 }
 
 if [ -n "$2" ]; then