View | Details | Raw Unified | Return to bug 5589
Collapse All | Expand All

(-)Mail-SpamAssassin-3.2.3/lib/Mail/SpamAssassin/Conf.pm (-5 / +21 lines)
Lines 2412-2416 Link Here
2412
  });
2412
  });
2413
2413
2414
=item rbl_timeout t [t_min]		(default: 15 3)
2414
=item rbl_timeout t [t_min] [zone]		(default: 15 3)
2415
2415
2416
All DNS queries are made at the beginning of a check and we try to read
2416
All DNS queries are made at the beginning of a check and we try to read
Lines 2436-2439 Link Here
2436
additional time.
2436
additional time.
2437
2437
2438
If a parameter 'zone' is specified (it must end with a letter, which
2439
distinguishes it from other numeric parametrs), then the setting only
2440
applies to DNS queries against the specified DNS domain (host, domain or
2441
RBL (sub)zone).  Matching is case-insensitive, the actual domain may be a
2442
subdomain of the specified zone.
2443
2438
=cut
2444
=cut
2439
2445
Lines 2447-2457 Link Here
2447
	return $MISSING_REQUIRED_VALUE;
2453
	return $MISSING_REQUIRED_VALUE;
2448
      }
2454
      }
2449
      local ($1,$2);
2455
      local ($1,$2,$3);
2450
      unless ($value =~ /^        ( [+-]? \d+ (?: \. \d*)? )
2456
      unless ($value =~ /^        ( [+-]? \d+ (?: \. \d*)? )
2451
                          (?: \s+ ( [+-]? \d+ (?: \. \d*)? ) )? $/xs) {
2457
                          (?: \s+ ( [+-]? \d+ (?: \. \d*)? ) )?
2458
                          (?: \s+ (\S* [a-zA-Z]) )? $/xs) {
2452
	return $INVALID_VALUE;
2459
	return $INVALID_VALUE;
2453
      }
2460
      }
2454
      $self->{rbl_timeout}     = $1+0;
2461
      my $zone = $3;
2455
      $self->{rbl_timeout_min} = $2+0  if defined $2;
2462
      if (!defined $zone) {  # a global setting
2463
        $self->{rbl_timeout}     = $1+0;
2464
        $self->{rbl_timeout_min} = $2+0  if defined $2;
2465
      }
2466
      else {  # per-zone settings
2467
        $zone =~ s/^\.//;  $zone =~ s/\.$//;  # strip leading and trailing dot
2468
        $zone = lc $zone;
2469
        $self->{by_zone}{$zone}{rbl_timeout}     = $1+0;
2470
        $self->{by_zone}{$zone}{rbl_timeout_min} = $2+0  if defined $2;
2471
      }
2456
    }
2472
    }
2457
  });
2473
  });
(-)Mail-SpamAssassin-3.2.3/lib/Mail/SpamAssassin/AsyncLoop.pm (+23 lines)
Lines 178-186 Link Here
178
  $ent->{start_time} = $now  if !defined $ent->{start_time};
178
  $ent->{start_time} = $now  if !defined $ent->{start_time};
179
179
180
  # are there any applicable per-zone settings?
181
  my $zone = $ent->{zone};
182
  my $settings;  # a ref to a by-zone or to global settings
183
  my $conf_by_zone = $self->{main}->{conf}->{by_zone};
184
  if (defined $zone && $conf_by_zone) {
185
  # dbg("async: searching for by_zone settings for $zone");
186
    $zone =~ s/^\.//;  $zone =~ s/\.\z//;  # strip leading and trailing dot
187
    for (;;) {  # 2.10.example.com, 10.example.com, example.com, com, ''
188
      if (exists $conf_by_zone->{$zone}) {
189
        $settings = $conf_by_zone->{$zone};
190
        dbg("async: applying by_zone settings for $zone");
191
        last;
192
      } elsif ($zone eq '') {
193
        last;
194
      } else {  # strip one level, careful with address literals
195
        $zone = ($zone =~ /^( (?: [^.] | \[ (?: \\. | [^\]\\] )* \] )* )
196
                            \. (.*) \z/xs) ? $2 : '';
197
      }
198
    }
199
  }
200
180
  my $t_init = $ent->{timeout_initial};  # application-specified has precedence
201
  my $t_init = $ent->{timeout_initial};  # application-specified has precedence
202
  $t_init = $settings->{rbl_timeout}  if $settings && !defined $t_init;
181
  $t_init = $self->{main}->{conf}->{rbl_timeout}  if !defined $t_init;
203
  $t_init = $self->{main}->{conf}->{rbl_timeout}  if !defined $t_init;
182
  $t_init = 0  if !defined $t_init;      # last-resort default, just in case
204
  $t_init = 0  if !defined $t_init;      # last-resort default, just in case
183
205
184
  my $t_end = $ent->{timeout_min};       # application-specified has precedence
206
  my $t_end = $ent->{timeout_min};       # application-specified has precedence
207
  $t_end = $settings->{rbl_timeout_min}  if $settings && !defined $t_end;
185
  $t_end = 0.2 * $t_init  if !defined $t_end;
208
  $t_end = 0.2 * $t_init  if !defined $t_end;
186
  $t_end = 0  if $t_end < 0;  # just in case
209
  $t_end = 0  if $t_end < 0;  # just in case

Return to bug 5589