diff options
author | Christophe Fergeau <cfergeau@mandriva.com> | 2010-02-10 13:47:51 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@mandriva.com> | 2010-02-10 13:47:51 +0000 |
commit | e725c284becc41ffddc8b0187cbc7834d1f338df (patch) | |
tree | 470e1a7a11fec8f723673ab46faf80cd2c52b571 /perl-install | |
parent | 0be4924c06e200153e0bfd56897070748a6eb47f (diff) | |
download | drakx-e725c284becc41ffddc8b0187cbc7834d1f338df.tar drakx-e725c284becc41ffddc8b0187cbc7834d1f338df.tar.gz drakx-e725c284becc41ffddc8b0187cbc7834d1f338df.tar.bz2 drakx-e725c284becc41ffddc8b0187cbc7834d1f338df.tar.xz drakx-e725c284becc41ffddc8b0187cbc7834d1f338df.zip |
rework detection of already crypted grub passwords
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/bootloader.pm | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/perl-install/bootloader.pm b/perl-install/bootloader.pm index 37f7722ca..c7944a377 100644 --- a/perl-install/bootloader.pm +++ b/perl-install/bootloader.pm @@ -325,7 +325,7 @@ sub _parse_grub_menu_lst() { sub is_already_crypted { my ($password) = @_; - $password =~ /^\$1\$/; # CHECKME: EMPIRIC + $password =~ /^--md5 (.*)/; } sub read_grub_menu_lst { @@ -336,9 +336,6 @@ sub read_grub_menu_lst { foreach my $keyword (grep { $_ ne 'entries' } keys %b) { $b{$keyword} = $b{$keyword} eq '' ? 1 : grub2file($b{$keyword}, $grub2dev, $fstab, \%b); } - if ($b{password} =~ /^--md5 (.*)/) { - $b{password} = $1; - } #- sanitize foreach my $e (@{$b{entries}}) { @@ -1743,14 +1740,16 @@ sub write_grub { { my @conf; - push @conf, $format->(grep { defined $bootloader->{$_} } qw(timeout)); - push @conf, $format->(grep { $bootloader->{$_} } qw(color serial shade terminal viewport background foreground)); - if (my $pw = $bootloader->{password}) { - $pw = crypt_grub_password($pw) if !is_already_crypted($pw); - $bootloader->{'password --md5'} = $pw; - push @conf, $format->('password --md5'); + if ($bootloader->{password}) { + if (!is_already_crypted($bootloader->{password})) { + my $encrypted = crypt_grub_password($bootloader->{password}); + $bootloader->{password} = "--md5 $encrypted"; + } } + push @conf, $format->(grep { defined $bootloader->{$_} } qw(timeout)); + push @conf, $format->(grep { $bootloader->{$_} } qw(color password serial shade terminal viewport background foreground)); + push @conf, map { $_ . ' ' . $file2grub->($bootloader->{$_}) } grep { $bootloader->{$_} } qw(gfxmenu); eval { |