to install on older branches.
r=LpSolit, a=mkanat
version => '3.51',
feature => 'Recommended important security fix'
},
- {
- package => 'Math-Random-Secure',
- module => 'Math::Random::Secure',
- version => '0.05',
- feature => 'Improve cookie and token security',
- },
);
my $all_modules = _get_extension_requirements(
# strength of the string in bits.
sub generate_random_password {
my $size = shift || 10; # default to 10 chars if nothing specified
- my $rand;
- if (eval { require Math::Random::Secure; 1; }) {
- $rand = \&Math::Random::Secure::irand;
- }
- else {
- # For details on why this block works the way it does, see bug 619594.
- # (Note that we don't do this if Math::Random::Secure is installed,
- # because we don't need to.)
- my $counter = 0;
- $rand = sub {
- # If we regenerate the seed every 5 characters, our seed is roughly
- # as strong (in terms of bit size) as our randomly-generated
- # string itself.
- _do_srand() if ($counter % 5) == 0;
- $counter++;
- return int(rand $_[0]);
- };
- }
+ my $counter = 0;
+ # For details on why this block works the way it does, see bug 619594.
+ my $rand = sub {
+ # If we regenerate the seed every 5 characters, our seed is roughly
+ # as strong (in terms of bit size) as our randomly-generated
+ # string itself.
+ _do_srand() if ($counter % 5) == 0;
+ $counter++;
+ return int(rand $_[0]);
+ };
return join("", map{ ('0'..'9','a'..'z','A'..'Z')[$rand->(62)] }
(1..$size));
}
use Bugzilla::Template ();
use Bugzilla::Util ();
-# For PerlChildInitHandler
-eval { require Math::Random::Secure };
-
# This means that every httpd child will die after processing
# a CGI if it is taking up more than 70MB of RAM all by itself.
$Apache2::SizeLimit::MAX_UNSHARED_SIZE = 70000;
my $server = Apache2::ServerUtil->server;
my $conf = <<EOT;
# Make sure each httpd child receives a different random seed (bug 476622).
-# Math::Random::Secure has one srand that needs to be called for
-# every process, and Perl has another. (Various Perl modules still use
-# the built-in rand(), even though we only use Math::Random::Secure in
-# Bugzilla itself, so we need to srand() both of them.) However,
-# Math::Random::Secure may not be installed, so we call its srand in an
-# eval.
-PerlChildInitHandler "sub { eval { Math::Random::Secure::srand() }; srand(); }"
+PerlChildInitHandler "sub { srand(); }"
<Directory "$cgi_path">
AddHandler perl-script .cgi
# No need to PerlModule these because they're already defined in mod_perl.pl