1
0
mirror of https://blitiri.com.ar/repos/chasquid synced 2026-01-26 20:35:56 +00:00

smtpsrv: If the hook exits with code 20, it's a permanent failure

It is can be convenient for hooks to indicate that an error is
permanent; for example if the anti-virus found something.

This patch makes it so that if the hook exits with code 20, then it's
considered permanent. Otherwise it is considered transient, to help
prevent accidental errors cause final delivery issues.
This commit is contained in:
Alberto Bertogli
2016-10-22 18:24:31 +01:00
parent 38b4e76090
commit 14c48153aa
2 changed files with 23 additions and 11 deletions

View File

@@ -5,6 +5,9 @@
#
# - spamc (from Spamassassin) to filter spam.
# - clamdscan (from ClamAV) to filter virus.
#
# If it exits with code 20, it will be considered a permanent error.
# Otherwise, temporary.
set -e
@@ -19,7 +22,7 @@ cat > "$TF"
if command -v spamc >/dev/null; then
if ! SL=$(spamc -c - < "$TF") ; then
echo "spam detected"
exit 1
exit 20 # permanent
fi
echo "X-Spam-Score: $SL"
fi
@@ -28,7 +31,7 @@ fi
if command -v clamdscan >/dev/null; then
if ! clamdscan --no-summary --infected - < "$TF" 1>&2 ; then
echo "virus detected"
exit 1
exit 20 # permanent
fi
echo "X-Virus-Scanned: pass"
fi