http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5384
------- Additional Comments From [EMAIL PROTECTED] 2007-04-12 05:26 ------- Created an attachment (id=3900) --> (http://issues.apache.org/SpamAssassin/attachment.cgi?id=3900&action=view) fix some debugging inaccuracies (AsyncLoop.pm and Dns.pm), and add the rbl_min_time conf setting. See the change to Conf.pm for the explanation. While debugging, I ran across some debugging inaccuracies... I would have submitted this yesterday afternoon, but my ISP has been down. Also, I implemented the minimum rbl wait setting that Daryl suggested/requested. Please at least use/apply the debugging fixes (from "# URIDNSBL queries were producing" to "$deadline - $self->{async}->get_last_start_lookup_time();" in Dns.pm and from "# These should not be reset here" to "#$self->{queries_completed} = 0;" in AsyncLoop.pm. Index: AsyncLoop.pm =================================================================== --- AsyncLoop.pm (revision 527887) +++ AsyncLoop.pm (working copy) @@ -185,8 +185,10 @@ return 1; # nothing left to do } - $self->{queries_started} = 0; - $self->{queries_completed} = 0; + # These should not be reset here, if $self->{queries_started}++ + # in start_lookup means anything. Fixes imprecise debug output. + #$self->{queries_started} = 0; + #$self->{queries_completed} = 0; # trap this loop in an eval { } block, as Net::DNS could throw # die()s our way; in particular, process_dnsbl_results() has Index: Conf.pm =================================================================== --- Conf.pm (revision 527887) +++ Conf.pm (working copy) @@ -2436,6 +2436,26 @@ type => $CONF_TYPE_NUMERIC }); +=item rbl_min_time n (default: 3) + +Overrides the dynamic RBL timeout algorithm with a minimum RBL timeout, in +seconds. If you set this to the same value as rbl_timeout, SpamAssassin +will timeout exactly n seconds after the last DNSBL query was initiated, if +at least of the DNSBL queries has not returned. + +If you leave this setting too low, some spam messages may avoid hits on DNSBL +rules (including URIDNSBL rules) by ensuring that most of their DNS lookups +return quickly, by configuring the "payload" URI's nameservers (for example) +to induce lookup delays longer than your rbl_min_time. + +=cut + + push (@cmds, { + setting => 'rbl_min_time', + default => 3, + type => $CONF_TYPE_NUMERIC + }); + =item util_rb_tld tld1 tld2 ... This option allows the addition of new TLDs to the RegistrarBoundaries code. Index: Dns.pm =================================================================== --- Dns.pm (revision 527887) +++ Dns.pm (working copy) @@ -349,7 +349,11 @@ my $dynamic = (int($self->{conf}->{rbl_timeout} * (1 - (($total - scalar @left) / $total) ** 2) + 0.5) + $self->{async}->get_last_start_lookup_time()); - $deadline = $dynamic if ($dynamic < $deadline); + # give the queries at least $self->{conf}->{rbl_min_time} seconds + # (default to 3) past the time the last query started (a minimum wait time + # to override the dynamically calculated one) + $deadline = $dynamic if ($dynamic < $deadline && + ($self->{async}->get_last_start_lookup_time() + $self->{conf}->{rbl_min_time} <= $dynamic) ); $now = time; } } @@ -374,7 +378,11 @@ my $dynamic = (int($self->{conf}->{rbl_timeout} * (1 - (($total - scalar @left) / $total) ** 2) + 0.5) + $self->{async}->get_last_start_lookup_time()); - $deadline = $dynamic if ($dynamic < $deadline); + # give the queries at least $self->{conf}->{rbl_min_time} seconds + # (default to 3) past the time the last query started (a minimum wait time + # to override the dynamically calculated one) + $deadline = $dynamic if ($dynamic < $deadline && + ($self->{async}->get_last_start_lookup_time() + $self->{conf}->{rbl_min_time} <= $dynamic) ); $now = time; # and loop again } @@ -390,7 +398,18 @@ elsif (defined @{$query->{rules}}) { $string = join(",", grep defined, @{$query->{rules}}); } - my $delay = time - $self->{async}->get_last_start_lookup_time(); + # URIDNSBL queries were producing an empty $string for debug + elsif (exists $query->{key} && defined $query->{key}) { + $string = $query->{key}; + } + my $delay = (exists $query->{obj} && defined $query->{obj} + && defined $query->{obj}->{querystart})? + # use $deadline instead of time() because it more accurately represents + # what occurred. + # It's an URIDNSBL query; use its own start time to be precise. + $deadline - $query->{obj}->{querystart}: + # Use the start time of the last DNSBL query to start. + $deadline - $self->{async}->get_last_start_lookup_time(); dbg("dns: timeout for $string after $delay seconds"); } ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee.
