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

Annotation of /rpms/smeserver-bugzilla/contribs7/smeserver-bugzilla-0.1-strong-pwd.patch

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


Revision 1.1 - (hide annotations) (download)
Fri Mar 5 18:02:39 2010 UTC (14 years, 9 months ago) by snetram
Branch: MAIN
CVS Tags: smeserver-bugzilla-0_1-5_el4_sme, smeserver-bugzilla-0_1-4, HEAD
* Fri Mar 6 2010 Jonathan Martens <smeserver-contribs@snetram.nl>
- Create strong password

1 snetram 1.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