File openssl-0.9.8j-c_rehash-with-openssl1.patch of Package compat-openssl098.11471

Index: openssl-0.9.8j/tools/c_rehash.in
===================================================================
--- openssl-0.9.8j.orig/tools/c_rehash.in
+++ openssl-0.9.8j/tools/c_rehash.in
@@ -1,4 +1,4 @@
-#!/usr/local/bin/perl
+#!/usr/bin/perl
 
 
 # Perl c_rehash script, scan all files in a directory
@@ -11,7 +11,11 @@ my $dir;
 if(defined $ENV{OPENSSL}) {
 	$openssl = $ENV{OPENSSL};
 } else {
-	$openssl = "openssl";
+	if (-f "/usr/bin/openssl1") {
+		$openssl = "openssl1";
+	} else {
+		$openssl = "openssl";
+	}
 	$ENV{OPENSSL} = $openssl;
 }
 
@@ -66,7 +70,14 @@ sub hash_dir {
 			print STDERR "WARNING: $fname does not contain a certificate or CRL: skipping\n";
 			next;
 		}
-		link_hash_cert($fname) if($cert);
+		if ($cert) {
+			if ($openssl =~ /openssl1/) {
+				link_hash_cert($fname,"-subject_hash");
+				link_hash_cert($fname,"-subject_hash_old");
+			} else {
+				link_hash_cert($fname);
+			}
+		}
 		link_hash_crl($fname) if($crl);
 	}
 }
@@ -100,8 +111,9 @@ sub check_file {
 
 sub link_hash_cert {
 		my $fname = $_[0];
+		my $hashopt = $_[1] || '-hash';
 		$fname =~ s/'/'\\''/g;
-		my ($hash, $fprint) = `"$openssl" x509 -hash -fingerprint -noout -in '$fname'`;
+		my ($hash, $fprint) = `"$openssl" x509 $hashopt -fingerprint -noout -in '$fname'`;
 		chomp $hash;
 		chomp $fprint;
 		$fprint =~ s/^.*=//;
openSUSE Build Service is sponsored by