From owner-svn-ports-all@freebsd.org Tue Oct 6 23:09:40 2020 Return-Path: Delivered-To: svn-ports-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD91D43D7B9; Tue, 6 Oct 2020 23:09:40 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C5Y845LCsz446t; Tue, 6 Oct 2020 23:09:40 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 96518DF6C; Tue, 6 Oct 2020 23:09:40 +0000 (UTC) (envelope-from mandree@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 096N9e7I064592; Tue, 6 Oct 2020 23:09:40 GMT (envelope-from mandree@FreeBSD.org) Received: (from mandree@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 096N9eZt064590; Tue, 6 Oct 2020 23:09:40 GMT (envelope-from mandree@FreeBSD.org) Message-Id: <202010062309.096N9eZt064590@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mandree set sender to mandree@FreeBSD.org using -f From: Matthias Andree Date: Tue, 6 Oct 2020 23:09:40 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r551607 - in head/mail/fetchmail: . files X-SVN-Group: ports-head X-SVN-Commit-Author: mandree X-SVN-Commit-Paths: in head/mail/fetchmail: . files X-SVN-Commit-Revision: 551607 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 23:09:40 -0000 Author: mandree Date: Tue Oct 6 23:09:39 2020 New Revision: 551607 URL: https://svnweb.freebsd.org/changeset/ports/551607 Log: mail/fetchmail: fix rcscript regression from _1 that broke global mode In a situation where fetchmail is to be started globally with the configuration in $LOCALBASE/etc, the rc.d file would try to run fetchmail for the wrong user. Simplify script more, avoiding recursive call in single-user mode. Submitted by: Corey Halpin (maintainer, direct mail to mandree@) Reported by: Armin Tüting Modified: head/mail/fetchmail/Makefile head/mail/fetchmail/files/fetchmail.in Modified: head/mail/fetchmail/Makefile ============================================================================== --- head/mail/fetchmail/Makefile Tue Oct 6 22:33:12 2020 (r551606) +++ head/mail/fetchmail/Makefile Tue Oct 6 23:09:39 2020 (r551607) @@ -3,7 +3,7 @@ PORTNAME?= fetchmail DISTVERSION= 6.4.12 -PORTREVISION?= 1 +PORTREVISION?= 2 CATEGORIES= mail # The next line is inherited by the fetchmailconf slave port, # do NOT replace fetchmail by ${PORTNAME} Modified: head/mail/fetchmail/files/fetchmail.in ============================================================================== --- head/mail/fetchmail/files/fetchmail.in Tue Oct 6 22:33:12 2020 (r551606) +++ head/mail/fetchmail/files/fetchmail.in Tue Oct 6 23:09:39 2020 (r551607) @@ -126,8 +126,7 @@ fetchmail_dump_config() # if this is the global or 'umbrella' run if [ -z "$2" ] ; then - uid=$(id -u) - if [ "x${fetchmail_users}" != "x" -a "x$1" != "x" -a "$uid" = "0" ]; then + if [ "x${fetchmail_users}" != "x" -a "x$1" != "x" -a "$(id -u)" = "0" ]; then # root mode: multiple user profiles are handled by recursive # calls of this script for user in ${fetchmail_users}; do @@ -138,66 +137,53 @@ if [ -z "$2" ] ; then failed="${user} (${retcode}) ${failed:-}" fi done - else - if [ "x${fetchmail_users}" = "x" ]; then - # There is only one global configuration file - globalconfig=GLOBALCONFIG + + # if we had any failures, exit with an error + if [ -n "${failed}" ] ; then + exit 1 fi - $fetchmail_script "$1" "$(id -u -n)" $globalconfig - retcode="$?" - if [ "0${retcode}" -ne 0 ]; then - failed="${name} (${retcode}) ${failed:-}" - fi - fi - # if we had any failures, exit witn an error - if [ -n "${failed}" ] ; then - exit 1 - fi - - # otherwise, exit success - exit 0 + # otherwise, exit success + exit 0 + fi +else + fetchmail_user="$2" fi # perform action for an instance of fetchmail daemon -fetchmail_user="$2" -if [ "x${fetchmail_users}" != "x" -o "x$3" = "xGLOBALCONFIG" ]; then - if [ "x${fetchmail_users}" != "x" ]; then - # multiuser setup: determine user specific config and pid file - fetchmail_home="$(getent passwd ${fetchmail_user} | cut -f6 -d:)" - fetchmail_home="${fetchmail_home%/}" - fetchmail_config="${fetchmail_home}/${fetchmail_config_name}" - pidfile="${fetchmail_home}/.fetchmail.pid" - # PULLVARS - pull user specific variables into scope if existing - # else use global defaults - for i in chdir chroot env env_file fib flags nice \ - limits login_class oomprotect program user group groups prepend \ - logging_facility polling_interval - do - uvarname=fetchmail_${fetchmail_user}_${i} - eval fetchmail_${i}="\${${uvarname}-\${fetchmail_${i}}}" - done - else - pidfile=/var/run/fetchmail/fetchmail.pid - fi - required_files=${fetchmail_config} +if [ "x${fetchmail_users}" != "x" ]; then + # multiuser setup: determine user specific config and pid file + fetchmail_home="$(getent passwd ${fetchmail_user} | cut -f6 -d:)" + fetchmail_home="${fetchmail_home%/}" + fetchmail_config="${fetchmail_home}/${fetchmail_config_name}" + pidfile="${fetchmail_home}/.fetchmail.pid" + # PULLVARS - pull user specific variables into scope if existing + # else use global defaults + for i in chdir chroot env env_file fib flags nice \ + limits login_class oomprotect program user group groups prepend \ + logging_facility polling_interval + do + uvarname=fetchmail_${fetchmail_user}_${i} + eval fetchmail_${i}="\${${uvarname}-\${fetchmail_${i}}}" + done +else + pidfile=/var/run/fetchmail/fetchmail.pid +fi +required_files=${fetchmail_config} - # add early command line arguments - # if logfile set in config file, do not override with rc.conf default (note logfile overrides syslog) - _logfile="$(fetchmail_dump_config logfile)" - if [ _"${_logfile}" != _"None," ] ; then - fetchmail_logging_facility="" - fi +# add early command line arguments +# if logfile set in config file, do not override with rc.conf default (note logfile overrides syslog) +_logfile="$(fetchmail_dump_config logfile)" +if [ _"${_logfile}" != _"None," ] ; then + fetchmail_logging_facility="" +fi - fetchmail_flags="${fetchmail_flags} -f ${fetchmail_config} --pidfile ${pidfile} ${fetchmail_logging_facility}" +fetchmail_flags="${fetchmail_flags} -f ${fetchmail_config} --pidfile ${pidfile} ${fetchmail_logging_facility}" - # add late command line arguments - # if no polling interval in config file, use value from rc.conf - if [ "$(fetchmail_dump_config poll_interval)" = "0," ] ; then - fetchmail_flags="${fetchmail_flags} -d ${fetchmail_polling_interval}" - fi -else - echo "$0: extra argument ignored" +# add late command line arguments +# if no polling interval in config file, use value from rc.conf +if [ "$(fetchmail_dump_config poll_interval)" = "0," ] ; then + fetchmail_flags="${fetchmail_flags} -d ${fetchmail_polling_interval}" fi # actually execute the fetchmail program