/[smecontribs]/rpms/smeserver-bugzilla/contribs10/smeserver-bugzilla-0.1-strong-pwd.patch
ViewVC logotype

Contents of /rpms/smeserver-bugzilla/contribs10/smeserver-bugzilla-0.1-strong-pwd.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Mon May 23 19:06:45 2022 UTC (23 months, 3 weeks ago) by jpp
Branch: MAIN
CVS Tags: smeserver-bugzilla-1_0-4_el7_sme, smeserver-bugzilla-1_0-7_el7_sme, smeserver-bugzilla-1_0-5_el7_sme, smeserver-bugzilla-1_0-6_el7_sme, HEAD
Initial import

1 diff -up smeserver-bugzilla-0.1/root/etc/e-smith/db/configuration/migrate/80bugzilla.strong-pwd smeserver-bugzilla-0.1/root/etc/e-smith/db/configuration/migrate/80bugzilla
2 --- smeserver-bugzilla-0.1/root/etc/e-smith/db/configuration/migrate/80bugzilla.strong-pwd 2010-03-05 18:24:27.000000000 +0100
3 +++ smeserver-bugzilla-0.1/root/etc/e-smith/db/configuration/migrate/80bugzilla 2010-03-05 18:54:17.000000000 +0100
4 @@ -1,9 +1,9 @@
5 {
6 use MIME::Base64 qw(encode_base64);
7
8 - my $service;
9 - my $rec;
10 - my $pw;
11 + my $service;
12 + my $rec;
13 + my $pw;
14
15 # Enable InnoDB (needed for Bugzilla)
16 $service = 'mysqld';
17 @@ -19,5 +19,27 @@
18 $pw = $rec->prop('DbPassword');
19 return "" if $pw;
20
21 - $rec->set_prop('DbPassword', sprintf("%.15s", MIME::Base64::encode(int( (1000000000000000) * rand() ))));
22 + if ( open( RANDOM, "/dev/urandom" ) )
23 + {
24 + my $buf;
25 + # 57 bytes is a full line of Base64 coding, and contains
26 + # 456 bits of randomness - given a perfectly random /dev/random
27 + if ( read( RANDOM, $buf, 57 ) != 57 )
28 + {
29 + warn("Short read from /dev/random: $!");
30 + }
31 + else
32 + {
33 + $pw = encode_base64($buf);
34 + chomp $pw;
35 + }
36 + close RANDOM;
37 + }
38 + else
39 + {
40 + warn "Could not open /dev/urandom: $!";
41 + }
42 +
43 + $rec->set_prop('DbPassword', $pw);
44 +
45 }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed