Skip to content

Commit

Permalink
* Version 71 with advisory from @fweimer
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyt committed Jun 4, 2013
1 parent 86d9415 commit 575f7bd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
8 changes: 8 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
[Changes for 0.71 - Tue Jun 4 18:24:10 CST 2013]

* Constrain the user-specified digest name to /^\w+\d+$/.

* Avoid loading Digest::* from relative paths in @INC.

Contributed by: Florian Weimer

[Changes for 0.70 - Thu Nov 29 01:45:54 CST 2012]

* Don't check gpg version if gpg does not exist.
Expand Down
2 changes: 1 addition & 1 deletion META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ requires:
perl: 5.005
resources:
repository: http://github.com/audreyt/module-signature
version: 0.70
version: 0.71
13 changes: 9 additions & 4 deletions lib/Module/Signature.pm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Module::Signature;
$Module::Signature::VERSION = '0.70';
$Module::Signature::VERSION = '0.71';

use 5.005;
use strict;
Expand Down Expand Up @@ -532,18 +532,23 @@ sub _mkdigest {

sub _digest_object {
my($algorithm) = @_;

# Avoid loading Digest::* from relative paths in @INC.
local @INC = grep { /^[^.]/ } @INC;

# Constrain algorithm name to be of form ABC123.
my ($base, $variant) = ($algorithm =~ /^([_a-zA-Z]+)([0-9]+)$/g)
or die "Malformed algorithm name: $algorithm (should match /\\w+\\d+/)";

my $obj = eval { Digest->new($algorithm) } || eval {
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
require "Digest/$base.pm"; "Digest::$base"->new($variant)
} || eval {
require "Digest/$algorithm.pm"; "Digest::$algorithm"->new
} || eval {
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
require "Digest/$base/PurePerl.pm"; "Digest::$base\::PurePerl"->new($variant)
} || eval {
require "Digest/$algorithm/PurePerl.pm"; "Digest::$algorithm\::PurePerl"->new
} or do { eval {
my ($base, $variant) = ($algorithm =~ /^(\w+?)(\d+)$/g) or die;
warn "Unknown cipher: $algorithm, please install Digest::$base, Digest::$base$variant, or Digest::$base\::PurePerl\n";
} and return } or do {
warn "Unknown cipher: $algorithm, please install Digest::$algorithm\n"; return;
Expand Down

0 comments on commit 575f7bd

Please sign in to comment.