You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2018/11/04 13:36:22 UTC

svn commit: r1845736 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm

Author: hege
Date: Sun Nov  4 13:36:22 2018
New Revision: 1845736

URL: http://svn.apache.org/viewvc?rev=1845736&view=rev
Log:
Skip duplicate lookups

Modified:
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm?rev=1845736&r1=1845735&r2=1845736&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm Sun Nov  4 13:36:22 2018
@@ -1059,6 +1059,10 @@ sub lookup_dnsbl_for_ip {
 sub lookup_single_dnsbl {
   my ($self, $pms, $obj, $rulename, $lookupstr, $dnsbl, $qtype) = @_;
 
+  my $qkey = "$rulename:$lookupstr:$dnsbl:$qtype";
+  return if exists $pms->{uridnsbl_seen_lookups}{$qkey};
+  $pms->{uridnsbl_seen_lookups}{$qkey} = 1;
+
   my $key = "DNSBL:" . $lookupstr . ':' . $dnsbl;
   my $ent = {
     key => $key, zone => $dnsbl, obj => $obj, type => 'URI-DNSBL',



Re: svn commit: r1845736 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm

Posted by Henrik K <he...@hege.li>.
On Sun, Nov 04, 2018 at 09:40:55PM +0200, Henrik K wrote:
> On Sun, Nov 04, 2018 at 12:53:34PM -0500, Bill Cole wrote:
> >
> > I'm uneasy about adding a de facto DNS caching change in 3.4.3. (And
> > generally about apps caching name lookups, but that's a larger
> > discussion...)
> 
> It's not really caching.  Just skipping lookups that are already done, just
> one way to achieve it.  There's no need to do the same callbacks potential
> dozens of time like in some messages.

PS.  It's no different than the already existing $seen_lookups you find
there.  Just something someone forgot to add.  I've been going through it
for like 8 hours today, so I'm pretty sure how it works..


Re: svn commit: r1845736 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm

Posted by Henrik K <he...@hege.li>.
On Sun, Nov 04, 2018 at 12:53:34PM -0500, Bill Cole wrote:
>
> I'm uneasy about adding a de facto DNS caching change in 3.4.3. (And
> generally about apps caching name lookups, but that's a larger
> discussion...)

It's not really caching.  Just skipping lookups that are already done, just
one way to achieve it.  There's no need to do the same callbacks potential
dozens of time like in some messages.

> Are we absolutely sure that the pms object isn't EVER going to be reused for
> another message? e.g. in tools like MIMEDefang that spawn long-running
> workers to handle multiple messages?

Umm yes.  Otherwise nothing would work, as it's the state data for pretty
much all internals and plugins.


Re: svn commit: r1845736 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm

Posted by Bill Cole <sa...@billmail.scconsult.com>.
On 4 Nov 2018, at 8:36, hege@apache.org wrote:

> Author: hege
> Date: Sun Nov  4 13:36:22 2018
> New Revision: 1845736
>
> URL: http://svn.apache.org/viewvc?rev=1845736&view=rev
> Log:
> Skip duplicate lookups

I'm uneasy about adding a de facto DNS caching change in 3.4.3. (And 
generally about apps caching name lookups, but that's a larger 
discussion...)

Are we absolutely sure that the pms object isn't EVER going to be reused 
for another message? e.g. in tools like MIMEDefang that spawn 
long-running workers to handle multiple messages?

Does the duplicate lookup really matter if the system resolver should 
have the result in a cache that presumably honors TTLs, making replies 
very fast for queries that should be cached?


> Modified:
>     spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
>
> Modified: 
> spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
> URL: 
> http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm?rev=1845736&r1=1845735&r2=1845736&view=diff
> ==============================================================================
> --- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm 
> (original)
> +++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm 
> Sun Nov  4 13:36:22 2018
> @@ -1059,6 +1059,10 @@ sub lookup_dnsbl_for_ip {
>  sub lookup_single_dnsbl {
>    my ($self, $pms, $obj, $rulename, $lookupstr, $dnsbl, $qtype) = @_;
>
> +  my $qkey = "$rulename:$lookupstr:$dnsbl:$qtype";
> +  return if exists $pms->{uridnsbl_seen_lookups}{$qkey};
> +  $pms->{uridnsbl_seen_lookups}{$qkey} = 1;
> +
>    my $key = "DNSBL:" . $lookupstr . ':' . $dnsbl;
>    my $ent = {
>      key => $key, zone => $dnsbl, obj => $obj, type => 'URI-DNSBL',


-- 
Bill Cole