This should work as a Net::DNS replacement for the gethostbyname issue in
rhsbl, although i'm not sure it will fix the CNAME/wildcard issue.

sub check_rhsbl {
  my ($self, $rhsbl, $host) = @_;
  return 0 unless $host;

  use Net::DNS;
  $self->log(2, "checking $host in $rhsbl");

  my $resolver = Net::DNS::Resolver->new;
  my $query = $resolver->search("$host.$rhsbl");

  if($query) {
      foreach my $rr ($query->answer) {
         next unless $rr->type eq "A";
         return(1);
      }
  }

  return 0;
}

----- Original Message -----
From: "Ask Bjoern Hansen" <[EMAIL PROTECTED]>
To: "Andreas Gunleikskaas" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, February 05, 2003 9:02 PM
Subject: Re: rhsbl rejects all hosts


> On Sat, 1 Feb 2003, Andreas Gunleikskaas wrote:
>
> > I don't know if this is a problem within qpsmtpd or with the dns. Heres
an
> > exerpt from dnscache log when sending mail from a 'tx.no' address - if
that
> > helps
>
> Yes, indeed it did.  Good catch!
>
> It seems like the rhsbl is doing a lookup for
> tx.no.dsn.rfc-ignorant.org.tx.no that returns an A record via a
> CNAME.  If you remove the wildcard record from the tx.no domain then
> it won't happen.
>
> It does this because the rhsbl plugin is using gethostbyname which
> goes through your "search" path from /etc/resolv.conf.
> gethostbyname should be replaced by Net::DNS, I think.
>
> Patches welcome.  :-)
>
>
>  - ask
>
> --
> ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();
>

Reply via email to