[Mimedefang] check_valid_mx followup

Kevin A. McGrail kmcgrail at pccc.com
Fri Nov 4 19:24:42 EST 2005


I put the new check_valid_mx into work on a production system today and
caught two small implementation changes needed with the new check_valid_mx
routine

1st, I am getting emails like <Polk_diana at collahuasi.cl > (NOTE the space at
the end).  So I have added to quick lines to strip leading and trailing
spaces.  Should I have to do this?  Is this just a real-world oddity?  Some
examples:

Nov  4 18:56:22 intel1 mimedefang.pl[26988]: filter_sender rejected sender
<Gorman_tollgate at racqi.com.au >
Nov  4 18:56:59 intel1 mimedefang.pl[26988]: filter_sender rejected sender
<Pike_disruption at valentini.net.ar >
Nov  4 19:06:10 intel1 mimedefang.pl[26990]: filter_sender rejected sender
<Medrano_sanction at umontreal.ca >
Nov  4 19:08:17 intel1 mimedefang.pl[26994]: filter_sender rejected sender
<Polk_diana at collahuasi.cl >

2nd, to avoid filtering bounce messages, I just escaped out now to check if
$sender is <> for filter_sender.  Seems to be fine.  Anyone have comments if
this is a good/bad idea?

sub filter_sender {
  my ($sender, $ip, $hostname, $helo) = @_;
  my ($rv, $reason);
  #md_syslog('warning', "Testing $sender, $ip, $hostname, $helo");

  if ($sender ne '<>') {
    ($rv, $reason) = &check_valid_mx($sender);
    unless ($rv) {
      return ('REJECT', "Sorry; $sender has an invalid MX record:
$reason.");
      md_syslog('warning', "Rejecting $sender - Invalid MX: $reason.");
    }
  }

  return ('CONTINUE', "ok");
}

Regards,
KAM




More information about the MIMEDefang mailing list