/[smecontribs]/rpms/smeserver-zabbix-server/contribs7/smeserver-zabbix-server-0.1-mysql_db_pass.patch
ViewVC logotype

Contents of /rpms/smeserver-zabbix-server/contribs7/smeserver-zabbix-server-0.1-mysql_db_pass.patch

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


Revision 1.1 - (show annotations) (download)
Mon Mar 2 23:30:44 2009 UTC (15 years, 9 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-zabbix-server-0_1-10_el4_sme, smeserver-zabbix-server-0_1-13_el4_sme, smeserver-zabbix-server-0_1-12_el4_sme, smeserver-zabbix-server-0_1-9_el4_sme, HEAD
Error occurred while calculating annotation data.
Initial import of smeserver-zabbix-server

1 diff -Nur -x '*.orig' -x '*.rej' smeserver-zabbix-server-0.1/root/etc/e-smith/db/configuration/migrate/zabbix-server-database mezzanine_patched_smeserver-zabbix-server-0.1/root/etc/e-smith/db/configuration/migrate/zabbix-server-database
2 --- smeserver-zabbix-server-0.1/root/etc/e-smith/db/configuration/migrate/zabbix-server-database 2009-02-02 21:01:58.000000000 +0100
3 +++ mezzanine_patched_smeserver-zabbix-server-0.1/root/etc/e-smith/db/configuration/migrate/zabbix-server-database 2009-02-11 09:40:44.000000000 +0100
4 @@ -1,11 +1,33 @@
5 {
6 - use MIME::Base64 qw(encode_base64);
7 + my $rec = $DB->get('zabbix-server')
8 + || $DB->new_record('zabbix-server', {type => 'service'});
9 + my $pw = $rec->prop('DbPassword');
10 + if (not $pw or length($pw) < 57)
11 + {
12 + use MIME::Base64 qw(encode_base64);
13
14 - my $rec = $DB->get('zabbix-server') || $DB->new_record('zabbix-server', {type => 'service'});
15 -
16 - my $pw = $rec->prop('DbPassword');
17 - return "" if $pw;
18 -
19 - $rec->set_prop('DbPassword', sprintf("%15.0f", int( (1000000000000000) * rand() )));
20 -}
21 + $pw = "not set due to error";
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 + $rec->set_prop('DbPassword', $pw);
43 + }
44 +}
45

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