/[pdpsoft]/nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.18/TrustAnchor.pm
ViewVC logotype

Diff of /nl.nikhef.pdp.fetchcrl/tags/fetch-crl-3.0.18/TrustAnchor.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2277 by davidg, Mon Apr 11 06:54:34 2011 UTC revision 2305 by davidg, Sun Jun 12 20:59:58 2011 UTC
# Line 121  sub loadAnchor($$) { Line 121  sub loadAnchor($$) {
121          $::log->err("File $path$basename$suffix contains a non-URL entry")          $::log->err("File $path$basename$suffix contains a non-URL entry")
122            and close CRLURL and return 0;            and close CRLURL and return 0;
123    
124        $urllist and $urllist .= "&";        $urllist and $urllist .= "\001";
125        $urllist .= $url;        $urllist .= $url;
126      }      }
127      close CRLURL;      close CRLURL;
# Line 152  sub loadAnchor($$) { Line 152  sub loadAnchor($$) {
152    
153      @{$self->{"crlurls"}} = ();      @{$self->{"crlurls"}} = ();
154      for ( my $i=0 ; defined $info->{_}{"crl_url.".$i} ; $i++ ) {      for ( my $i=0 ; defined $info->{_}{"crl_url.".$i} ; $i++ ) {
155        $info->{_}{"crl_url.".$i} =~ s/[;\s]+/&/g;        $info->{_}{"crl_url.".$i} =~ s/[;\s]+/\001/g;
156        $info->{_}{"crl_url.".$i} =~ s/^\s*([^\s]*)\s*$/$1/;        $info->{_}{"crl_url.".$i} =~ s/^\s*([^\s]*)\s*$/$1/;
157    
158        $info->{_}{"crl_url.".$i} =~ /^\w+:\/\// or        $info->{_}{"crl_url.".$i} =~ /^\w+:\/\// or
# Line 213  sub loadAnchor($$) { Line 213  sub loadAnchor($$) {
213      my $i = 0;      my $i = 0;
214      while ( defined ($::cnf->{$self->{$section}}->{"crl_url.".$i}) ) {      while ( defined ($::cnf->{$self->{$section}}->{"crl_url.".$i}) ) {
215        my $urls;        my $urls;
216        ($urls=$::cnf->{$self->{$section}}->{"crl_url.".$i} )=~s/[;\s]+/&/g;        ($urls=$::cnf->{$self->{$section}}->{"crl_url.".$i} )=~s/[;\s]+/\001/g;
217        ${$self->{"crlurls"}}[$i] = $urls;        ${$self->{"crlurls"}}[$i] = $urls;
218        $i++;        $i++;
219      }      }
220    }    }
221    
222    # templates to construct a CA name may still have other separators    # templates to construct a CA name may still have other separators
223    $self->{"catemplate"} =~ s/[;\s]+/&/g;    $self->{"catemplate"} =~ s/[;\s]+/\001/g;
224    
225    # select only http/https/ftp/file URLs    # select only http/https/ftp/file URLs
226    # also transform the URLs using the base patterns and prepend any    # also transform the URLs using the base patterns and prepend any
227    # local URL patterns (@ANCHORNAME@, @ALIAS@, and @R@)    # local URL patterns (@ANCHORNAME@, @ALIAS@, and @R@)
228    for ( my $i=0; $i <= $#{$self->{"crlurls"}} ; $i++ ) {    for ( my $i=0; $i <= $#{$self->{"crlurls"}} ; $i++ ) {
229      my $urlstring = @{$self->{"crlurls"}}[$i];      my $urlstring = @{$self->{"crlurls"}}[$i];
230      my @urls = split(/&/,$urlstring);      my @urls = split(/\001/,$urlstring);
231      $urlstring="";      $urlstring="";
232      foreach my $url ( @urls ) {      foreach my $url ( @urls ) {
233        if ( $url =~ /^(http:|https:|ftp:|file:)/ ) {        if ( $url =~ /^(http:|https:|ftp:|file:)/ ) {
234          $urlstring.="&" if $urlstring; $urlstring.=$url;          $urlstring.="\001" if $urlstring; $urlstring.=$url;
235        } else {        } else {
236          $::log->verb(0,"URL $url in $basename$suffix unsupported, ignored");          $::log->verb(0,"URL $url in $basename$suffix unsupported, ignored");
237        }        }
238      }      }
239      if ( my $purl = $self->{"prepend_url"} ) {      if ( my $purl = $self->{"prepend_url"} ) {
240        $purl =~ s/\@R\@/$i/g;        $purl =~ s/\@R\@/$i/g;
241        $urlstring = join "&" , $purl , $urlstring;        $urlstring = join "\001" , $purl , $urlstring;
242      }      }
243      if ( my $purl = $self->{"postpend_url"} ) {      if ( my $purl = $self->{"postpend_url"} ) {
244        $purl =~ s/\@R\@/$i/g;        $purl =~ s/\@R\@/$i/g;
245        $urlstring = join "&" , $urlstring, $purl;        $urlstring = join "\001" , $urlstring, $purl;
246      }      }
247      if ( ! $urlstring ) {      if ( ! $urlstring ) {
248        $::log->err("No usable CRL URLs for",$self->getAnchorName);        $::log->err("No usable CRL URLs for",$self->getAnchorName);
# Line 279  sub loadCAfiles($) { Line 279  sub loadCAfiles($) {
279    @{$self->{"cafile"}} = ();    @{$self->{"cafile"}} = ();
280    do {    do {
281      my $cafile;      my $cafile;
282      foreach my $catpl ( split /&/, $self->{"catemplate"} ) {      foreach my $catpl ( split /\001/, $self->{"catemplate"} ) {
283        $catpl =~ s/\@R\@/$idx/g;        $catpl =~ s/\@R\@/$idx/g;
284        -e $cadir.'/'.$catpl and        -e $cadir.'/'.$catpl and
285          $cafile = $cadir.'/'.$catpl and last;          $cafile = $cadir.'/'.$catpl and last;
# Line 333  sub loadState($$) { Line 333  sub loadState($$) {
333             $::cnf->{_}->{"output_der"}, $::cnf->{_}->{"output_pem"},             $::cnf->{_}->{"output_der"}, $::cnf->{_}->{"output_pem"},
334             $::cnf->{_}->{"output_nss"}, $::cnf->{_}->{"output_openssl"}) ) {             $::cnf->{_}->{"output_nss"}, $::cnf->{_}->{"output_openssl"}) ) {
335          defined $output and $output or next;          defined $output and $output or next;
336          foreach my $file (          foreach my $ref (
337                $self->{"nametemplate_der"},                $self->{"nametemplate_der"},
338                $self->{"nametemplate_pem"},                $self->{"nametemplate_pem"},
339                $self->{"alias"}.".r\@R\@",                $self->{"alias"}.".r\@R\@",
340                $self->{"anchorname"}.".r\@R\@",                $self->{"anchorname"}.".r\@R\@",
341              ) {              ) {
342            next unless $file;            next unless $ref;
343              my $file = $ref; # copy, not to change original
344            $file =~ s/\@R\@/$i/g;            $file =~ s/\@R\@/$i/g;
345            $file = join "/", $output, $file;            $file = join "/", $output, $file;
346            next if ! -e $file;            next if ! -e $file;
# Line 563  sub retrieve($) { Line 564  sub retrieve($) {
564          "sourceurl" => $self->{"crl"}[$i]{"state"}{"sourceurl"} || "null:"          "sourceurl" => $self->{"crl"}[$i]{"state"}{"sourceurl"} || "null:"
565        );        );
566      } else {      } else {
567        foreach my $url ( split(/&/,$self->{"crlurls"}[$i]) ) {        foreach my $url ( split(/\001/,$self->{"crlurls"}[$i]) ) {
568          # of these, the first one wins          # of these, the first one wins
569          $url =~ /^(http:|https:|ftp:)/ and          $url =~ /^(http:|https:|ftp:)/ and
570            ($result,%response) = $self->retrieveHTTP($i,$url);            ($result,%response) = $self->retrieveHTTP($i,$url);

Legend:
Removed from v.2277  
changed lines
  Added in v.2305

grid.support@nikhef.nl
ViewVC Help
Powered by ViewVC 1.1.28