cvs commit: qpsmtpd/plugins check_relay

[email protected] (Matt Sergeant)
Newsgroups perl.cvs.qpsmtpd
Message-ID <[email protected]>
cvsuser     03/11/02 03:14:44

  Modified:    plugins  check_relay
  Log:
  Allow relayclients and morerelayclients files (paves the way for separate
  server outside of tcpserver)
  
  Revision  Changes    Path
  1.5       +12 -0     qpsmtpd/plugins/check_relay
  
  Index: check_relay
  ===================================================================
  RCS file: /cvs/public/qpsmtpd/plugins/check_relay,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -w -r1.4 -r1.5
  --- check_relay	25 Mar 2003 12:50:07 -0000	1.4
  +++ check_relay	2 Nov 2003 11:14:44 -0000	1.5
  @@ -22,7 +22,19 @@
     $host = $self->qp->config("me")
       if ($host eq "" && (lc $user eq "postmaster" || lc $user eq "abuse"));
   
  +  # Check if this IP is allowed to relay
     return (OK) if exists $ENV{RELAYCLIENT};
  +  my @relay_clients = $self->qp->config("relayclients");
  +  my $more_relay_clients = $self->qp->config("morerelayclients", "map");
  +  my %relay_clients = map { $_ => 1 } @relay_clients;
  +  my $client_ip = $self->qp->connection->remote_ip;
  +  while ($client_ip) {
  +    return (OK) if exists $relay_clients{$client_ip};
  +    return (OK) if exists $more_relay_clients->{$client_ip};
  +    $client_ip =~ s/\d+\.?$//; # strip off another 8 bits
  +  }
  +  
  +  # Check if this recipient host is allowed
     for my $allowed (@rcpt_hosts) {
       $allowed =~ s/^\s*(\S+)/$1/;
       return (OK) if $host eq lc $allowed;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.