You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by do...@apache.org on 2002/04/03 19:39:36 UTC

cvs commit: httpd-test/perl-framework/Apache-Test/lib/Apache TestSSLCA.pm

dougm       02/04/03 09:39:36

  Modified:    perl-framework/Apache-Test/lib/Apache TestSSLCA.pm
  Log:
  setup symlinks for SSL{Proxy}CARevocationPath
  
  Revision  Changes    Path
  1.12      +43 -0     httpd-test/perl-framework/Apache-Test/lib/Apache/TestSSLCA.pm
  
  Index: TestSSLCA.pm
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestSSLCA.pm,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- TestSSLCA.pm	30 Mar 2002 02:17:21 -0000	1.11
  +++ TestSSLCA.pm	3 Apr 2002 17:39:36 -0000	1.12
  @@ -4,6 +4,7 @@
   use warnings FATAL => 'all';
   
   use Cwd ();
  +use DirHandle ();
   use File::Path ();
   use File::Copy 'cp';
   use File::Basename;
  @@ -14,6 +15,8 @@
   
   use vars qw(@EXPORT_OK &import);
   
  +use subs qw(symlink);
  +
   @EXPORT_OK = qw(dn dn_vars dn_oneline);
   *import = \&Exporter::import;
   
  @@ -319,6 +322,44 @@
       openssl ca => "-gencrl -out $cacrl", @args;
   }
   
  +sub symlink {
  +    my($file, $symlink) = @_;
  +
  +    my $what = 'linked';
  +
  +    if (Apache::TestConfig::WINFU) {
  +        cp $file, $symlink;
  +        $what = 'copied';
  +    }
  +    else {
  +        CORE::symlink($file, $symlink);
  +    }
  +
  +    info "$what $file to $symlink";
  +}
  +
  +sub hash_certs {
  +    my($type, $dir) = @_;
  +
  +    chdir $dir;
  +
  +    my $dh = DirHandle->new('.') or die "opendir $dir: $!";
  +    my $n = 0;
  +
  +    for my $file ($dh->read) {
  +        next unless $file =~ /\.cr[tl]$/;
  +        chomp(my $hash = `openssl $type -noout -hash < $file`);
  +        next unless $hash;
  +        my $symlink = "$hash.r$n";
  +        $n++;
  +        symlink $file, $symlink;
  +    }
  +
  +    close $dh;
  +
  +    chdir $CA;
  +}
  +
   sub make_proxy_cert {
       my $name = shift;
   
  @@ -378,6 +419,8 @@
               make_proxy_cert($name);
           }
       }
  +
  +    hash_certs(crl => 'crl');
   }
   
   sub generate {