[Amavisd-new-commits] [SCM] Debian packaging for amavisd-new branch, master, updated. debian/1%2.7.0-1-3-g757361d
Alexander Wirt
formorer at debian.org
Sat Jan 7 13:06:31 UTC 2012
The following commit has been merged in the master branch:
commit 4fa518eb98e729f073534c52cef8cd8b3196f9a1
Author: Alexander Wirt <formorer at debian.org>
Date: Wed Dec 21 18:04:19 2011 +0100
Don't use su to call the cronjob
Closes: #652894
diff --git a/debian/amavisd-new-cronjob b/debian/amavisd-new-cronjob
index 59aca0e..415c934 100755
--- a/debian/amavisd-new-cronjob
+++ b/debian/amavisd-new-cronjob
@@ -2,7 +2,7 @@
# amavisd-new cronjob helper
#
-# Run it as root or as the amavis user
+# Run it as the amavis user
#
# First parameter specifies which cronjob routine to run:
# sa-sync: spamassassin fast sync
@@ -11,23 +11,17 @@
test -e /usr/bin/sa-learn || exit 0
test -e /usr/sbin/amavisd-new || exit 0
-SUUSER="amavis"
+if [ "$(id --name -u)" != "amavis" ]
+then
+ echo "Please run this cronjob as user amavis"
+ exit 1
+fi
set -e
umask 022
-# WATCH OUT FOR PROPER QUOTING LEVEL WHEN CALLING THIS!
-do_amavis_cmd() {
- if [ "$(id -u -n)" != "${SUUSER}" ]; then
- exec /bin/su -s /bin/sh - "${SUUSER}" -c "$*" >/dev/null
- else
- # to get the same quoting level as the su path
- CMD="$*"
- exec ${CMD} >/dev/null
- fi
-}
-
-if ! /bin/su -s /bin/sh - "${SUUSER}" -c 'perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new(); \$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"'
+if perl -MMail::SpamAssassin -e "my \$spamtest = Mail::SpamAssassin->new();
+\$spamtest->compile_now (); \$spamtest->{conf}->{use_bayes} ? exit 0 : exit 1"
then
#bayes is disabled - just exit
exit
@@ -35,10 +29,10 @@ fi
case $1 in
sa-sync)
- do_amavis_cmd "/usr/bin/sa-learn --sync"
+ /usr/bin/sa-learn --sync
;;
sa-clean)
- do_amavis_cmd "/usr/bin/sa-learn --sync --force-expire"
+ /usr/bin/sa-learn --sync --force-expire
;;
*)
echo "$0: unknown cron routine $1" >&2
--
Debian packaging for amavisd-new
More information about the Amavisd-new-commits
mailing list