$OpenBSD: patch-lib_Mail_SpamAssassin_Plugin_URIDNSBL_pm,v 1.1 2016/03/04 00:05:35 sthen Exp $
--- lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm.orig	Tue Apr 28 20:56:47 2015
+++ lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm	Thu Mar  3 23:59:55 2016
@@ -942,9 +942,8 @@ sub complete_ns_lookup {
     next unless (defined($str) && defined($dom));
     dbg("uridnsbl: got($j) NS for $dom: $str");
 
-    if ($str =~ /IN\s+NS\s+(\S+)/) {
-      my $nsmatch = lc $1;
-      $nsmatch =~ s/\.$//;
+    if ($rr->type eq 'NS') {
+      my $nsmatch = lc $rr->nsdname;  # available since at least Net::DNS 0.14
       my $nsrhblstr = $nsmatch;
       my $fullnsrhblstr = $nsmatch;
 
@@ -1025,9 +1024,9 @@ sub complete_a_lookup {
     }
     dbg("uridnsbl: complete_a_lookup got(%d) A for %s: %s", $j,$hname,$str);
 
-    local $1;
-    if ($str =~ /IN\s+A\s+(\S+)/) {
-      $self->lookup_dnsbl_for_ip($pms, $ent->{obj}, $1);
+    if ($rr->type eq 'A') {
+      my $ip_address = $rr->rdatastr;
+      $self->lookup_dnsbl_for_ip($pms, $ent->{obj}, $ip_address);
     }
   }
 }
