Hello Mark,

attached is a patch which extends sender notification control.
We want to notify local users if an (outgoing) mail got quarantined,
but not external senders.

The patch introduces a new "warn_banned_offsite" variable
and is 100% backward compatible.

Cheers,
Thomas
--- amavisd.old	Mon Oct 17 16:35:16 2005
+++ amavisd	Tue Oct 18 14:57:25 2005
@@ -180,7 +180,7 @@
       $final_virus_destiny $final_spam_destiny
       $final_banned_destiny $final_bad_header_destiny
       $warnvirussender $warnspamsender $warnbannedsender $warnbadhsender
-      $warn_offsite
+      $warn_offsite $warn_offsite_sender
 
       @av_scanners @av_scanners_backup $first_infected_stops_scan
       $bypass_decode_parts @decoders
@@ -571,6 +571,9 @@
 $bad_header_quarantine_to = 'bad-header-quarantine'; # %local_delivery_aliases
 $spam_quarantine_to   = 'spam-quarantine';    # %local_delivery_aliases mapped
 
+# warn offsite malware sender compatibility
+$warn_offsite_sender = 1;
+
 $banned_admin     = [EMAIL PROTECTED];  # compatibility
 $bad_header_admin = [EMAIL PROTECTED];  # compatibility
 
@@ -7795,6 +7798,12 @@
                            $msginfo->sender, $what_bad_content);
         if (!$dsn_needed) { do_log(4, $msg) }
         else { do_log(1, "NOTICE: $msg, mail intentionally dropped") }
+        $msginfo->dsn_sent(2);       # pretend the message was bounced
+      } elsif (!c('warn_offsite_sender') && !lookup(0,$msginfo->sender,@{ca('local_domains_maps')})) {
+        my($msg) = sprintf("Not sending DSN as sender <%s> is offsite, mail containing %s",
+                           $msginfo->sender, $what_bad_content);
+        if (!$dsn_needed) { do_log(4, $msg) }
+        else { do_log(2, "NOTICE: $msg intentionally dropped") }
         $msginfo->dsn_sent(2);       # pretend the message was bounced
       } else {  # prepare a notification
         ### TODO: better selection of DSN reason is still needed!

Reply via email to