265 |
print "" . ($self->{"anchorname"} || "undefined") ."\n"; |
print "" . ($self->{"anchorname"} || "undefined") ."\n"; |
266 |
} |
} |
267 |
|
|
268 |
|
sub displayAnchorName($) { |
269 |
|
my $self = shift; |
270 |
|
return ($self->{"anchorname"} || "undefined"); |
271 |
|
} |
272 |
|
|
273 |
sub loadCAfiles($) { |
sub loadCAfiles($) { |
274 |
my $self = shift; |
my $self = shift; |
275 |
my $idx = 0; |
my $idx = 0; |
281 |
$::log->err("CA directory",$cadir,"does not exist") and |
$::log->err("CA directory",$cadir,"does not exist") and |
282 |
return 0; |
return 0; |
283 |
|
|
284 |
|
# add @HASH@ support, inducing a file read and fork, only if really needed |
285 |
|
my $crlhash; |
286 |
|
if ( $self->{"catemplate"} =~ /\@HASH\@/ ) { |
287 |
|
$self->{"crl"}[0]{"data"} ne "" or |
288 |
|
$::log->err("CA name template contains HASH, but no CRL ". |
289 |
|
"could be loaded in time for ".$self->displayAnchorName) and |
290 |
|
return 0; |
291 |
|
my $probecrl = CRL->new(undef,$self->{"crl"}[0]{"data"}); |
292 |
|
$crlhash = $probecrl->getAttribute("hash"); |
293 |
|
$::log->verb(3,"Inferred CA template HASH ".($crlhash?$crlhash:"failed"). |
294 |
|
" for ".$self->displayAnchorName); |
295 |
|
} |
296 |
|
|
297 |
@{$self->{"cafile"}} = (); |
@{$self->{"cafile"}} = (); |
298 |
do { |
do { |
299 |
my $cafile; |
my $cafile; |
300 |
|
|
301 |
foreach my $catpl ( split /\001/, $self->{"catemplate"} ) { |
foreach my $catpl ( split /\001/, $self->{"catemplate"} ) { |
302 |
$catpl =~ s/\@R\@/$idx/g; |
$catpl =~ s/\@R\@/$idx/g; |
303 |
|
$catpl =~ s/\@HASH\@/$crlhash/g; |
304 |
-e $cadir.'/'.$catpl and |
-e $cadir.'/'.$catpl and |
305 |
$cafile = $cadir.'/'.$catpl and last; |
$cafile = $cadir.'/'.$catpl and last; |
306 |
} |
} |