1 |
diff -Nur -x '*.orig' -x '*.rej' e-smith-nutUPS-1.2.0/root/etc/e-smith/db/configuration/migrate/nutPass mezzanine_patched_e-smith-nutUPS-1.2.0/root/etc/e-smith/db/configuration/migrate/nutPass |
2 |
--- e-smith-nutUPS-1.2.0/root/etc/e-smith/db/configuration/migrate/nutPass 2007-01-18 08:48:45.000000000 -0700 |
3 |
+++ mezzanine_patched_e-smith-nutUPS-1.2.0/root/etc/e-smith/db/configuration/migrate/nutPass 2007-01-18 08:48:27.000000000 -0700 |
4 |
@@ -2,51 +2,6 @@ |
5 |
use MIME::Base64 qw(encode_base64); |
6 |
|
7 |
my $nutrec = $DB->get('nut') || $DB->new_record('nut', {type => 'service'}); |
8 |
- my $master_pw = $nutrec->prop('MasterPass'); |
9 |
- if (not $master_pw) |
10 |
- { |
11 |
- $master_pw = "not set due to error"; |
12 |
- if ( open( RANDOM, "/dev/urandom" ) ) |
13 |
- { |
14 |
- my $buf; |
15 |
- if ( read( RANDOM, $buf, 57 ) != 57 ) |
16 |
- { |
17 |
- warn("Short read from /dev/random: $!"); |
18 |
- } |
19 |
- else |
20 |
- { |
21 |
- $master_pw = encode_base64($buf); |
22 |
- chomp $master_pw; |
23 |
- } |
24 |
- close RANDOM; |
25 |
- } |
26 |
- else |
27 |
- { |
28 |
- warn "Could not open /dev/urandom: $!"; |
29 |
- } |
30 |
- $nutrec->set_prop('MasterPass', $master_pw); |
31 |
- } |
32 |
- if (not $slave_pw) |
33 |
- { |
34 |
- $slave_pw = "not set due to error"; |
35 |
- if ( open( RANDOM, "/dev/urandom" ) ) |
36 |
- { |
37 |
- my $buf; |
38 |
- if ( read( RANDOM, $buf, 57 ) != 57 ) |
39 |
- { |
40 |
- warn("Short read from /dev/random: $!"); |
41 |
- } |
42 |
- else |
43 |
- { |
44 |
- $slave_pw = encode_base64($buf); |
45 |
- chomp $slave_pw; |
46 |
- } |
47 |
- close RANDOM; |
48 |
- } |
49 |
- else |
50 |
- { |
51 |
- warn "Could not open /dev/urandom: $!"; |
52 |
- } |
53 |
- $nutrec->set_prop('SlavePass', $slave_pw); |
54 |
- } |
55 |
+ $nutrec->set_prop('MasterPass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('MasterPass'); |
56 |
+ $nutrec->set_prop('SlavePass', sprintf("%15.0f", int( (1000000000000000) * rand() ))) if not $nutrec->prop('SlavePass'); |
57 |
} |