[Bug 264350] mail/opendkim

From: <bugzilla-noreply_at_freebsd.org>
Date: Mon, 30 May 2022 14:27:19 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264350

            Bug ID: 264350
           Summary: mail/opendkim
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: ports-bugs@FreeBSD.org
          Reporter: admin@sigma-soft.ru
                CC: freebsd-ports@dan.me.uk
             Flags: maintainer-feedback?(freebsd-ports@dan.me.uk)
                CC: freebsd-ports@dan.me.uk

opndkim-2.10.3_16 does not start without PidFile parameter in opendkim.conf and
with UserId parameter with group included:
=======================================================
##  Change to user "userid" before starting normal operation?  May include
##  a group ID as well, separated from the userid by a colon.

# UserID                userid
UserID                  mailnull:mailnull
=======================================================

Without colon

=======================================================
UserID                  mailnull
=======================================================

works fine.

This is a result of erroneous return of function get_pidfile_from_conf from
/etc/rc.subr

Test script:
=======================================================
#!/bin/sh

#
# get_pidfile_from_conf string file
#
#       Takes a string to search for in the specified file.
#       Ignores lines with traditional comment characters.
#
# Example:
#
# if get_pidfile_from_conf string file; then
#       pidfile="$_pidfile_from_conf"
# else
#       pidfile='appropriate default'
# fi
#
get_pidfile_from_conf()
{
        if [ -z "$1" -o -z "$2" ]; then
                err 3 "USAGE: get_pidfile_from_conf string file ($name)"
        fi

        local string file line

        string="$1" ; file="$2"

        if [ ! -s "$file" ]; then
                err 3 "get_pidfile_from_conf: $file does not exist ($name)"
        fi

        while read line; do
                case "$line" in
                *[#\;]*${string}*)      continue ;;
                *${string}*)            break ;;
                esac
        done < $file

        if [ -n "$line" ]; then
                line=${line#*/}
                _pidfile_from_conf="/${line%%[\"\;]*}"
        else
                return 1
        fi
}

    if get_pidfile_from_conf PidFile /usr/local/etc/mail/opendkim.conf; then
        pidfile="$_pidfile_from_conf"
        echo $pidfile
    else
        pidfile="/var/run/milteropendkim/${profile:-pid}"
    fi
=======================================================
Result with colon (UserID                       mailnull:mailnull):
/UserID mailnull:mailnull

Result without colon (UserID                    mailnull) - empty.

-- 
You are receiving this mail because:
You are the assignee for the bug.