]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
control.pl: Do not sent email to the Control address master
authorAnthony PERARD <anthony.perard@citrix.com>
Fri, 1 Apr 2016 11:29:19 +0000 (12:29 +0100)
committerAnthony PERARD <anthony.perard@citrix.com>
Fri, 1 Apr 2016 11:29:19 +0000 (12:29 +0100)
Some spam may send email with the control address in both from: and to:
which result in a loop of reply to the fail command of the email.

scripts/control.pl

index 31bfe07caef6ccf4b202a4b054050bb7f4aea803..2e6a09fb3d8ef4521cfb08762641c660a646a7f6 100755 (executable)
@@ -87,12 +87,15 @@ sub genreply ($$@) {
         $references .= " $message_id";
     }
 
+    my @request_from_addr = Mail::Field::AddrList->extract( 'from', $head, 0 )->addresses()
+      if $request_from;
     # Send reply to:
     #   - Requester (optionally)
     #   - The list (only if successfully processed at least one command)
     #   - Dist list (optionally)
+    # and do not send reply to ourself.
     push @to_field, $request_from
-      if $c{ControlReplyToRequestor} and $request_from;
+      if $c{ControlReplyToRequestor} and $request_from and $request_from_addr[0] ne $c{ControlAddressFull};
     push @to_field, $c{ListAddress} if $c{ControlReplyToList} and $nrvalid > 0;
     push @bcc_field, $c{ControlDistAddress} if $c{ControlDistAddress};