Skip to content

Commit

Permalink
perl-Razor-Agent: Update Version from 2.85 -> 2.86
Browse files Browse the repository at this point in the history
  • Loading branch information
v-smalavathu committed Dec 31, 2024
1 parent 81fb40a commit ab0a4f0
Show file tree
Hide file tree
Showing 8 changed files with 361 additions and 215 deletions.
14 changes: 0 additions & 14 deletions SPECS-EXTENDED/perl-Razor-Agent/perl-Razor-Agent-2.85-mandir.patch

This file was deleted.

This file was deleted.

199 changes: 199 additions & 0 deletions SPECS-EXTENDED/perl-Razor-Agent/perl-Razor-Agent-2.86-digest-sha.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
From 1a8dc0ea64c6bbe187babdb1079bc0cf05926e59 Mon Sep 17 00:00:00 2001
From: Robert Scheck <[email protected]>
Date: Fri, 10 Dec 2021 00:21:56 +0100
Subject: [PATCH] Use Digest::SHA instead of Digest::SHA1

Switch from Digest::SHA1 to Digest::SHA, because: Digest::SHA is a bit
faster than Digest::SHA1, Digest::SHA1 has been removed from some Linux
distributions, Digest::SHA is a core library (as of Perl >= 5.10.0) and
Digest::SHA1 is not (and never will be). See also:

- https://src.fedoraproject.org/rpms/perl-Razor-Agent/c/75fa8a6c1f1fdf779312dac68f331a288bd2920f?branch=rawhide
- https://stackoverflow.com/questions/3420720/what-are-the-advantages-of-digestsha-over-digestsha1

Original author: Warren Togami <[email protected]>
---
INSTALL | 2 +-
META.json | 2 +-
META.yml | 2 +-
Makefile.PL | 2 +-
lib/Razor2/Client/Engine.pm | 1 -
lib/Razor2/Signature/Ephemeral.pm | 14 +++++++-------
lib/Razor2/Signature/Whiplash.pm | 14 ++++++--------
lib/Razor2/String.pm | 17 +++++++----------
8 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/INSTALL b/INSTALL
index 2de1b42..1852ba0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -25,7 +25,7 @@ option, like so:
following Perl modules from CPAN:

Time::HiRes
- Digest::SHA1
+ Digest::SHA
MIME::Base64
Test::Simple
Test::Harness
diff --git a/META.json b/META.json
index f893748..e616292 100644
--- a/META.json
+++ b/META.json
@@ -33,7 +33,7 @@
},
"runtime" : {
"requires" : {
- "Digest::SHA1" : "0",
+ "Digest::SHA" : "0",
"File::Copy" : "0",
"File::Spec" : "0",
"Getopt::Long" : "0",
diff --git a/META.yml b/META.yml
index 4a0831c..314b0fc 100644
--- a/META.yml
+++ b/META.yml
@@ -19,7 +19,7 @@ no_index:
- t
- inc
requires:
- Digest::SHA1: '0'
+ Digest::SHA: '0'
File::Copy: '0'
File::Spec: '0'
Getopt::Long: '0'
diff --git a/Makefile.PL b/Makefile.PL
index 833d1dc..095f7e3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -22,7 +22,7 @@ WriteMakefile(
( $ExtUtils::MakeMaker::VERSION >= 6.3002 ? ( 'LICENSE' => 'perl', ) : () ),
EXE_FILES => [qw( bin/razor-client bin/razor-admin bin/razor-check bin/razor-report bin/razor-revoke )],
PREREQ_PM => {
- 'Digest::SHA1' => 0,
+ 'Digest::SHA' => 0,
'File::Copy' => 0,
'File::Spec' => 0,
'Getopt::Long' => 0,
diff --git a/lib/Razor2/Client/Engine.pm b/lib/Razor2/Client/Engine.pm
index 98f2f44..f3610b4 100644
--- a/lib/Razor2/Client/Engine.pm
+++ b/lib/Razor2/Client/Engine.pm
@@ -1,7 +1,6 @@
package Razor2::Client::Engine;

use strict;
-use Digest::SHA1 qw(sha1_hex);
use Data::Dumper;
use Razor2::Signature::Ephemeral;
use Razor2::Engine::VR8;
diff --git a/lib/Razor2/Signature/Ephemeral.pm b/lib/Razor2/Signature/Ephemeral.pm
index 4310b6c..6764e8e 100644
--- a/lib/Razor2/Signature/Ephemeral.pm
+++ b/lib/Razor2/Signature/Ephemeral.pm
@@ -2,9 +2,13 @@

package Razor2::Signature::Ephemeral;
use strict;
-use Digest::SHA1;
use Data::Dumper;

+BEGIN {
+ eval { require Digest::SHA; import Digest::SHA qw(sha1_hex); 1 }
+ or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
+}
+
sub new {

my ( $class, %args ) = @_;
@@ -88,17 +92,13 @@ sub hexdigest {
}

my $digest;
- my $ctx = Digest::SHA1->new;

if ( $seclength > 128 ) {
- $ctx->add($section1);
- $ctx->add($section2);
- $digest = $ctx->hexdigest;
+ $digest = sha1_hex($section1, $section2);
}
else {
debug("Sections too small... reverting back to orginal content.");
- $ctx->add($content);
- $digest = $ctx->hexdigest;
+ $digest = sha1_hex($content);
}

debug("Computed e-hash is $digest");
diff --git a/lib/Razor2/Signature/Whiplash.pm b/lib/Razor2/Signature/Whiplash.pm
index 2977371..40ace61 100644
--- a/lib/Razor2/Signature/Whiplash.pm
+++ b/lib/Razor2/Signature/Whiplash.pm
@@ -7,7 +7,10 @@

package Razor2::Signature::Whiplash;

-use Digest::SHA1;
+BEGIN {
+ eval { require Digest::SHA; import Digest::SHA qw(sha1_hex); 1 }
+ or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
+}

sub new {

@@ -682,13 +685,8 @@ sub whiplash {
# the value of length to the nearest multiple of ``length_error''.
# Take the first 20 hex chars from SHA1 and call it the signature.

- my $sha1 = Digest::SHA1->new();
-
- $sha1->add($host);
- $sig = substr $sha1->hexdigest, 0, 12;
-
- $sha1->add($corrected_length);
- $sig .= substr $sha1->hexdigest, 0, 4;
+ $sig = substr sha1_hex($host), 0, 12;
+ $sig .= substr sha1_hex($corrected_length), 0, 4;

push @sigs, $sig;
$sig_meta{$sig} = [ $host, $corrected_length ];
diff --git a/lib/Razor2/String.pm b/lib/Razor2/String.pm
index dbcb903..b623917 100644
--- a/lib/Razor2/String.pm
+++ b/lib/Razor2/String.pm
@@ -1,11 +1,15 @@
# $Id: String.pm,v 1.48 2005/06/13 21:09:59 vipul Exp $
package Razor2::String;

-use Digest::SHA1 qw(sha1_hex);
use URI::Escape;
use Razor2::Preproc::enBase64;
use Data::Dumper;

+BEGIN {
+ eval { require Digest::SHA; import Digest::SHA qw(sha1_hex); 1 }
+ or do { require Digest::SHA1; import Digest::SHA1 qw(sha1_hex) }
+}
+
#use MIME::Parser;

require Exporter;
@@ -65,15 +69,8 @@ sub hmac2_sha1 {
return unless $text && $iv1 && $iv2;
die "no ref's allowed" if ref($text);

- my $ctx = Digest::SHA1->new;
- $ctx->add($iv2);
- $ctx->add($text);
- my $digest = $ctx->hexdigest;
-
- $ctx = Digest::SHA1->new;
- $ctx->add($iv1);
- $ctx->add($digest);
- $digest = $ctx->hexdigest;
+ my $digest = sha1_hex($iv2, $text);
+ $digest = sha1_hex($iv1, $digest);

return ( hextobase64($digest), $digest );
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From 033b00e94741550ef3ef087d9903742ac881a7ba Mon Sep 17 00:00:00 2001
From: Robert Scheck <[email protected]>
Date: Thu, 9 Dec 2021 03:10:51 +0100
Subject: [PATCH] Unbreak builds with parallel make at manifypods-razor

The 'manifypods-razor' target depends on INST_MAN5DIR which gets
created by the 'config' target. Without this, there may problems
building with parallel make. See also:

- https://sourceforge.net/p/razor/bugs/67/
- https://bugzilla.redhat.com/show_bug.cgi?id=1379566

Original author: Klaus Heinz <https://sourceforge.net/u/kheinz/>
---
Makefile.PL | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile.PL b/Makefile.PL
index 833d1dc..bcfbee3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -131,7 +131,8 @@ MAKE_FRAG
# begin razor-agents
%s

-manifypods-razor : docs/razor-agent.conf.pod \
+manifypods-razor : config \
+ docs/razor-agent.conf.pod \
docs/razor-agents.pod \
docs/razor-whitelist.pod
$(POD2MAN) \
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"Signatures": {
"perl-Razor-Agent-2.85.tar.bz2": "7fe0afe73e5b3979444dd86e2ad25ea99bc05b23d5648d357544f78f0b6eb6d7"
"Razor2-Client-Agent-2.86.tar.gz": "5e062e02ebb65e24b708e7eefa5300c43d6f657bf20d08fec4ca8a0a3b94845f"
}
}
}
Loading

0 comments on commit ab0a4f0

Please sign in to comment.