Mail archive
alpine-devel

Re: [alpine-devel] SpamAssassin DNSBL tests fail after changes in perl (patch included)

From: Johan Dahlberg <johan_at_dnix.se>
Date: Mon, 22 Dec 2014 21:11:08 +0200

On Mon, 22 Dec 2014 at 19:05:29, Johan Dahlberg wrote:
> On Mon, 22 Dec 2014 at 17:12:13, Leonardo Arena wrote:
> > On mer, 2014-12-17 at 11:49 +0200, Johan Dahlberg wrote:
> > > --- SpamAssassin/DnsResolver.pm.bak
> > > +++ SpamAssassin/DnsResolver.pm
> > > _at_@ -204,8 +204,10 @@
> > > _at_ns_addr_port = @{$self->{conf}->{dns_servers}};
> > > dbg("dns: servers set by config to: %s", join(',
> > > ',_at_ns_addr_port));
> > > } elsif ($res) { # default as provided by Net::DNS, e.g.
> > > /etc/resolv.conf
> > > - _at_ns_addr_port = map(untaint_var("[$_]:" . $res->{port}),
> > > - _at_{$res->{nameservers}});
> > > + my _at_ns = $res->UNIVERSAL::can('nameservers') ? $res->nameservers
> > > + :
> > > _at_{$res->{nameservers}};
> > > + my $port = $res->UNIVERSAL::can('port') ? $res->port :
> > > $res->{port};
> > > + _at_ns_addr_port = map(untaint_var("[$_]:" . $port), @ns);
> > > dbg("dns: servers obtained from Net::DNS : %s", join(',
> > > ',_at_ns_addr_port));
> > > }
> > > return _at_ns_addr_port;
> >
> >
> > Hi,
> > thanks for your contribution.
> > Would it be possible to have a GIT patch? It would be easier and 100%
> > error-free to apply.
> > Thanks!
> >
> > R,
> > leo
>
> Hello, I'm not so used to working with git, but I think the attached
> patch is correct.
>
> Johan

> diff --git a/lib/Mail/SpamAssassin/DnsResolver.pm.orig b/lib/Mail/SpamAssassin/DnsResolver.pm
> index 41ae81c..fdc1e5e 100644
> --- a/lib/Mail/SpamAssassin/DnsResolver.pm.orig
> +++ b/lib/Mail/SpamAssassin/DnsResolver.pm
> _at_@ -204,8 +204,10 @@ sub configured_nameservers {
> _at_ns_addr_port = @{$self->{conf}->{dns_servers}};
> dbg("dns: servers set by config to: %s", join(', ',_at_ns_addr_port));
> } elsif ($res) { # default as provided by Net::DNS, e.g. /etc/resolv.conf
> - _at_ns_addr_port = map(untaint_var("[$_]:" . $res->{port}),
> - _at_{$res->{nameservers}});
> + my _at_ns = $res->UNIVERSAL::can('nameservers') ? $res->nameservers
> + : _at_{$res->{nameservers}};
> + my $port = $res->UNIVERSAL::can('port') ? $res->port : $res->{port};
> + _at_ns_addr_port = map(untaint_var("[$_]:" . $port), @ns);
> dbg("dns: servers obtained from Net::DNS : %s", join(', ',_at_ns_addr_port));
> }
> return _at_ns_addr_port;




I took some time to figure out git a bit so I guess the following
attached patch is more accurate(?).

Regards,
Johan

--qDbXVdCdHGoSgWSk
Content-Type: text/x-diff; charset=utf-8
Content-Disposition: attachment; filename="sa-fix-dns.patch"
Content-Transfer-Encoding: quoted-printable

---
 lib/Mail/SpamAssassin/DnsResolver.pm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/Mail/SpamAssassin/DnsResolver.pm b/lib/Mail/SpamAssassin/DnsResolver.pm
index 41ae81c..fdc1e5e 100644
--- a/lib/Mail/SpamAssassin/DnsResolver.pm
+++ b/lib/Mail/SpamAssassin/DnsResolver.pm
_at_@ -204,8 +204,10 @@ sub configured_nameservers {
     _at_ns_addr_port = @{$self->{conf}->{dns_servers}};
     dbg("dns: servers set by config to: %s", join(', ',_at_ns_addr_port));
   } elsif ($res) {  # default as provided by Net::DNS, e.g. /etc/resolv.conf
-    _at_ns_addr_port = map(untaint_var("[$_]:" . $res->{port}),
-                        _at_{$res->{nameservers}});
+    my _at_ns = $res->UNIVERSAL::can('nameservers') ? $res->nameservers
+                                                 : _at_{$res->{nameservers}};
+    my $port = $res->UNIVERSAL::can('port') ? $res->port : $res->{port};
+    _at_ns_addr_port = map(untaint_var("[$_]:" . $port), @ns);
     dbg("dns: servers obtained from Net::DNS : %s", join(', ',_at_ns_addr_port));
   }
   return _at_ns_addr_port;
-- 
2.2.1
--qDbXVdCdHGoSgWSk--
--gj572EiMnwbLXET9
Content-Type: application/pgp-signature
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABCAAGBQJUmGzLAAoJEAcoCTcJhy3fXpcP/1PP+se+AdndxxRruyQPPIk6
39Vb1x3TO8yAcVdEr089DPLUz6OeWPmk9+26VSrBP8xvmQz1A6UFSZ4OJ3mkYtsc
DysXmNi+szqVIBBHANgdygPG1r00PxCpqLKT1rHW76GhMwSpB4Oj8DPj23I6HuGC
UBYpfb2FXpnNCwytkFr13u/L7SBuCeM2uRNbA5pEehL8R7Uk/nyAhDCX/+n97/Kp
xc0m2jH1zjYlRc+xXeUdpgp1idxbxSXO+msM/PgLCx7Eh53s8gYOo+sXD7fCxwFC
gxwrGq8LaqQJcIoThYkwrc5PUeGDOeqK9y36X8HtEnTt0RLIzh2jyWBBe9TQhKMu
kw5T69MjAbI9rYlMQ+Ky2p2F05PV1D0uNZc/oVrhjOqRWk5kAcwTfzWy2l+8chmj
t80BTZlIFOeXMmjPV4racymsYMpQHJt43y+PXlplJeAE852OOpAi9O4FBoldu5ZW
O2qvfZV5vGEOtWTxCPAHL/xQNyKv8Qz6yIC8KwVTIKrTpZeXBrKEtL31f8SUuFRf
3oXpftmaKO2GU1AENrvHqAOnJQ0qN/BVXqKdtauoVXiwsVu+PyKzyXVAVVI00AcY
U0jSnAOT+ecOBljDj0J6LT4A4vhVp8qgw41jbBKr/A8TAyCPcVPdk2ZG+0a84YQv
0D9MfYMXDEhcMhseqYVw
=wi/Y
-----END PGP SIGNATURE-----
--gj572EiMnwbLXET9--
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Mon Dec 22 2014 - 21:11:08 GMT