openbsd-ports/mail/mailscanner/patches/patch-bin_check_mailscanner
sthen e3cbc9ab0b Have check_mailscanner pick up the "Run As User" setting from
MailScanner.conf and explicitly start as that user. This avoids setuid
in perl (triggering taint mode) and so it sidesteps taint mode fallout
which has appeared recently, most likely due to the CVE-2011-1487 fix
in Perl.

Maintainer believed to be away this week, so committing now and we
can change it later if he disagrees when he returns.   ok todd@
2011-04-21 20:25:35 +00:00

26 lines
974 B
Plaintext

$OpenBSD: patch-bin_check_mailscanner,v 1.2 2011/04/21 20:25:35 sthen Exp $
--- bin/check_mailscanner.orig Wed Mar 16 19:41:34 2011
+++ bin/check_mailscanner Thu Apr 21 18:41:07 2011
@@ -42,8 +42,8 @@
# unless MailScanner actually had to be started.
process=MailScanner
-msbindir=/opt/MailScanner/bin
-config=/opt/MailScanner/etc/MailScanner.conf
+msbindir=%PREFIX%/bin
+config=%SYSCONFDIR%/MailScanner/MailScanner.conf
# These seem to get put all over the shop...
PATH=/usr/bin:/bin
@@ -121,7 +121,9 @@ if [ "x$pid" = "x" ]; then
PATH=${msbindir}:$PATH
echo -n 'Starting MailScanner...'
cd $msbindir
- $process $config 2>/dev/null || RETVALUE=" Failed."
+ username=$(awk '/^Run As User/ {print $5;}' /etc/MailScanner/MailScanner.conf)
+ [ -n "$username" -a "$(whoami)" != "$username" ] && preamble="su -l -s /bin/sh $username -c "
+ $preamble $process $config 2>/dev/null || RETVALUE=" Failed."
echo "$RETVALUE"
else
if [ "x$1" != "x-q" ]; then