diff -u /usr/portage/mail-filter/postgrey/files/postgrey.conf files/postgrey.conf --- /usr/portage/mail-filter/postgrey/files/postgrey.conf 2005-04-29 02:28:44.000000000 +0200 +++ files/postgrey.conf 2005-07-30 12:11:39.000000000 +0200 @@ -4,15 +4,27 @@ # Config file for /etc/init.d/postgrey +# TYPE +# Do you want inet or unix socket version ? +POSTGREY_TYPE="unix" + +# SOCKET +# Which socket do you want to bind ? +# (ignored if inet type) +# +POSTGREY_SOCKET="/var/spool/postfix/private/postgrey" # HOST # What IP to listen to? # Leave to localhost unless you know what you do. +# (ignored if socket type) +# POSTGREY_HOST="127.0.0.1" # PORT # What PORT to listen to? +# (ignored if socket type) # POSTGREY_PORT="10030" diff -u /usr/portage/mail-filter/postgrey/files/postgrey.rc files/postgrey.rc --- /usr/portage/mail-filter/postgrey/files/postgrey.rc 2005-06-19 01:35:39.000000000 +0200 +++ files/postgrey.rc 2005-07-30 12:11:39.000000000 +0200 @@ -9,23 +9,56 @@ provide postfix_greylist } +conf_error() { + eerror "You need to setup variables in /etc/conf.d/postgrey first" + return 1 +} + checkconfig() { -if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ] || [ -z "${POSTGREY_PID}" ] +if [ -z "${POSTGREY_TYPE}" ] then + einfo "You need to choose the server type you want" + einfo "by setting the TYPE variable." + else + if [ "x${POSTGREY_TYPE}" = "xinet" ] + then + if [ -z "${POSTGREY_PORT}" ] || [ -z "${POSTGREY_HOST}" ] + then + einfo "The following entries are missing in /etc/conf.d/postgrey:" + [ -z "${POSTGREY_HOST}" ] && einfo " - POSTGREY_HOST" + [ -z "${POSTGREY_PORT}" ] && einfo " - POSTGREY_PORT" + conf_error + fi + POSTGREY_CONF="${POSTGREY_TYPE}=${POSTGREY_HOST}:${POSTGREY_PORT}" + else + if [ -z "${POSTGREY_SOCKET}" ] + then + einfo "The following entries are missing in /etc/conf.d/postgrey: POSTGREY_SOCKET" + conf_error + fi + POSTGREY_CONF="${POSTGREY_TYPE}=${POSTGREY_SOCKET}" + fi +fi + + if [ -z "${POSTGREY_PID}" ] + then einfo "The following entries are missing in /etc/conf.d/postgrey:" - [ -z "${POSTGREY_HOST}" ] && einfo " - POSTGREY_HOST" - [ -z "${POSTGREY_PORT}" ] && einfo " - POSTGREY_PORT" [ -z "${POSTGREY_PID}" ] && einfo " - POSTGREY_PID" - eerror "You need to setup variables in /etc/conf.d/postgrey first" - return 1 + conf_error fi } + start() { checkconfig || return 1 ebegin "Starting Postgrey" + + # HACK -- start a subshell and corrects perms on the socket... + ( if [ "x${POSTGREY_TYPE}" = "xunix" ]; then + sleep 2 && chmod a+rw,a-x ${POSTGREY_SOCKET}; fi ) & + start-stop-daemon --start --quiet --background \ --exec /usr/sbin/postgrey -- \ - --inet=${POSTGREY_HOST}:${POSTGREY_PORT} \ + --${POSTGREY_CONF} \ --daemonize \ --pidfile=${POSTGREY_PID} \ ${POSTGREY_OPTS}