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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user