You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2017/04/16 06:00:55 UTC

svn commit: r1791569 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm

Author: sidney
Date: Sun Apr 16 06:00:55 2017
New Revision: 1791569

URL: http://svn.apache.org/viewvc?rev=1791569&view=rev
Log:
Merge from trunk - Bug 7265 - DNS resolving breaks with Net::DNS 1.03

Modified:
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm?rev=1791569&r1=1791568&r2=1791569&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/DnsResolver.pm Sun Apr 16 06:00:55 2017
@@ -581,7 +581,7 @@ sub new_dns_packet {
     #    time, $domain, $type, $packet->id);
     1;
   } or do {
-    # this can if a domain name in a query is invalid, or if a timeout signal
+    # get here if a domain name in a query is invalid, or if a timeout signal
     # happened to be trapped by this eval, or if Net::DNS signalled an error
     my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
     # resignal if alarm went off
@@ -747,7 +747,7 @@ sub bgread() {
   my($answerpkt, $decoded_length) = Net::DNS::Packet->new(\$data);
   $answerpkt or die "bgread: decoding DNS packet failed: $@";
   $answerpkt->answerfrom($peerhost);
-  if ($decoded_length ne length($data)) {
+  if (defined $decoded_length && $decoded_length ne "" && $decoded_length != length($data)) {
     warn sprintf("bgread: received a %d bytes packet from %s, decoded %d bytes\n",
                  length($data), $peerhost, $decoded_length);
   }
@@ -804,8 +804,10 @@ sub poll_responses {
     last  if $nfound == 0;
 
     my $packet;
+    # Bug 7265, use our own bgread() below
+    # $packet = $self->{res}->bgread($self->{sock});
     eval {
-      $packet = $self->bgread();
+      $packet = $self->bgread();  # Bug 7265, use our own bgread()
     } or do {
       undef $packet;
       my $eval_stat = $@ ne '' ? $@ : "errno=$!";  chomp $eval_stat;
@@ -814,9 +816,6 @@ sub poll_responses {
       info("dns: bad dns reply: %s", $eval_stat);
     };
 
-#   Bug 7265, use our own bgread()
-#   my $packet = $self->{res}->bgread($self->{sock});
-
     if (!$packet) {
       # error already reported above
 #     my $dns_err = $self->{res}->errorstring;
@@ -907,7 +906,8 @@ Emulates C<Net::DNS::Resolver::send()>.
 This subroutine is a simple synchronous leftover from SpamAssassin version
 3.3 and does not participate in packet query caching and callback grouping
 as implemented by AsyncLoop::bgsend_and_start_lookup().  As such it should
-be avoided for mainstream usage.
+be avoided for mainstream usage.  Currently used through Mail::SPF::Server
+by the SPF plugin.
 
 =cut