~clint-fewbar/ubuntu/hardy/spamassassin/remove-open-whois

« back to all changes in this revision

Viewing changes to sa-update.raw

  • Committer: Bazaar Package Importer
  • Author(s): Scott Kitterman
  • Date: 2008-01-12 21:11:43 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20080112211143-x6bpcnj60h9hsb6v
Tags: 3.2.4-0ubuntu1
* New upstream release
* Bump standards version to 3.7.3 without further change

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# </@LICENSE>
19
19
 
20
20
my $VERSION = 'svn' . (split(/\s+/,
21
 
        '$Id: sa-update.raw 540384 2007-05-22 01:01:44Z duncf $'))[2];
 
21
        '$Id: sa-update.raw 607589 2007-12-30 21:04:39Z jm $'))[2];
22
22
 
23
23
my $PREFIX          = '@@PREFIX@@';             # substituted at 'make' time
24
24
my $DEF_RULES_DIR   = '@@DEF_RULES_DIR@@';      # substituted at 'make' time
415
415
  my $DNSQ = "$RevSAVersion.$channel";
416
416
 
417
417
  my $newV;
418
 
  my $dnsV = do_txt_query($DNSQ);
 
418
  my $dnsV = join(' ', do_txt_query($DNSQ));
419
419
  if (defined $dnsV && $dnsV =~ /^(\d+)/) {
420
420
    $newV = $1 if (!defined $newV || $1 > $newV);
421
421
    dbg("dns: $DNSQ => $dnsV, parsed as $1");
477
477
  else {
478
478
    # We don't currently have the list of mirrors, so go grab it.
479
479
    dbg("channel: no MIRRORED.BY file available");
480
 
    my $mirror = do_txt_query("mirrors.$channel");
481
 
    unless ($mirror) {
 
480
    my @mirrors = do_txt_query("mirrors.$channel");
 
481
    unless (@mirrors) {
482
482
      warn "error: no mirror data available for channel $channel\n";
483
483
      channel_failed("channel: MIRRORED.BY file location was not in DNS");
484
 
    }
485
 
    $mirby = http_get($mirror);
 
484
      next;
 
485
    }
 
486
    foreach my $mirror (@mirrors) {
 
487
      $mirby = http_get($mirror);
 
488
      unless ($mirby) {
 
489
        dbg("channel: no mirror data available for channel $channel from $mirror");
 
490
        next;
 
491
      }
 
492
      last;
 
493
    }
486
494
    unless ($mirby) {
487
495
      warn "error: no mirror data available for channel $channel\n";
488
496
      channel_failed("channel: MIRRORED.BY contents were missing");
1012
1020
  my($query) = shift;
1013
1021
 
1014
1022
  my $RR = $res->query($query, 'TXT');
1015
 
  my $result = '';
 
1023
  my @result;
1016
1024
 
1017
1025
  if ($RR) {
1018
1026
    foreach my $rr ($RR->answer) {
1019
1027
      my $text = $rr->rdatastr;
1020
1028
      $text =~ /^"(.*)"$/;
1021
 
      if (length $result) {
1022
 
        $result .= " $1";
1023
 
      }
1024
 
      else {
1025
 
        $result = $1;
1026
 
      }
 
1029
      push @result, $1;
1027
1030
    }
1028
1031
  }
1029
1032
  else {
1030
1033
    dbg("dns: query failed: $query => " . $res->errorstring);
1031
1034
  }
1032
1035
 
1033
 
  return $result;
 
1036
  return @result;
1034
1037
}
1035
1038
 
1036
1039
##############################################################################