1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Wed, 21 Apr 2010 15:52:10 +0200
Subject: also create old hash for compatibility
---
tools/c_rehash.in | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/tools/c_rehash.in b/tools/c_rehash.in
index 9f33895a4fd9..c98de9619a4d 100644
--- a/tools/c_rehash.in
+++ b/tools/c_rehash.in
@@ -17,8 +17,6 @@ my $prefix = {- quotify1($config{prefix}) -};
my $errorcount = 0;
my $openssl = $ENV{OPENSSL} || "openssl";
my $pwd;
-my $x509hash = "-subject_hash";
-my $crlhash = "-hash";
my $verbose = 0;
my $symlink_exists=eval {symlink("",""); 1};
my $removelinks = 1;
@@ -27,10 +25,7 @@ my $removelinks = 1;
while ( $ARGV[0] =~ /^-/ ) {
my $flag = shift @ARGV;
last if ( $flag eq '--');
- if ( $flag eq '-old') {
- $x509hash = "-subject_hash_old";
- $crlhash = "-hash_old";
- } elsif ( $flag eq '-h' || $flag eq '-help' ) {
+ if ( $flag eq '-h' || $flag eq '-help' ) {
help();
} elsif ( $flag eq '-n' ) {
$removelinks = 0;
@@ -203,22 +198,24 @@ sub compute_hash {
# certificate fingerprints
sub link_hash_cert {
- link_hash($_[0], 'cert');
+ link_hash($_[0], 'cert', '-subject_hash');
+ link_hash($_[0], 'cert', '-subject_hash_old');
}
# Same as above except for a CRL. CRL links are of the form <hash>.r<n>
sub link_hash_crl {
- link_hash($_[0], 'crl');
+ link_hash($_[0], 'crl', '-hash');
+ link_hash($_[0], 'crl', '-hash_old');
}
sub link_hash {
- my ($fname, $type) = @_;
- my $is_cert = $type eq 'cert';
+ my ($fname, $type, $hash_name) = @_;
+ my $is_cert = $type eq 'cert' or $type eq 'cert_old';
my ($hash, $fprint) = compute_hash($openssl,
$is_cert ? "x509" : "crl",
- $is_cert ? $x509hash : $crlhash,
+ $hash_name,
"-fingerprint", "-noout",
"-in", $fname);
chomp $hash;
|