summaryrefslogtreecommitdiffstats
path: root/perl-install/authentication.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2008-08-22 15:55:21 +0000
committerPascal Rigaux <pixel@mandriva.com>2008-08-22 15:55:21 +0000
commitcb332379273b831b0f6355940dd41202f2e0d2fb (patch)
tree0a285d7cc62e4bd12e865ef6961160b794b73720 /perl-install/authentication.pm
parent78c35fcaf183be19aafecb3a5415fbbfa6cd1eb4 (diff)
downloaddrakx-cb332379273b831b0f6355940dd41202f2e0d2fb.tar
drakx-cb332379273b831b0f6355940dd41202f2e0d2fb.tar.gz
drakx-cb332379273b831b0f6355940dd41202f2e0d2fb.tar.bz2
drakx-cb332379273b831b0f6355940dd41202f2e0d2fb.tar.xz
drakx-cb332379273b831b0f6355940dd41202f2e0d2fb.zip
- handle blowfish password encryption and use it by default (#42426)
Diffstat (limited to 'perl-install/authentication.pm')
-rw-r--r--perl-install/authentication.pm6
1 files changed, 4 insertions, 2 deletions
diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm
index 72656d447..886b45d15 100644
--- a/perl-install/authentication.pm
+++ b/perl-install/authentication.pm
@@ -260,6 +260,7 @@ sub check_given_password {
sub get() {
my $system_auth = cat_("/etc/pam.d/system-auth");
my $authentication = {
+ blowfish => to_bool($system_auth =~ /\$2a\$/),
md5 => to_bool($system_auth =~ /md5/),
shadow => to_bool($system_auth =~ /shadow/),
};
@@ -817,12 +818,13 @@ sub salt {
sub user_crypted_passwd {
my ($u, $authentication) = @_;
- my $isMD5 = !$authentication || $authentication->{md5};
if ($u->{password}) {
require utf8;
utf8::encode($u->{password}); #- we don't want perl to do "smart" things in crypt()
- crypt($u->{password}, $isMD5 ? '$1$' . salt(8) : salt(2));
+ crypt($u->{password},
+ !$authentication || $authentication->{blowfish} ? '$2a$08$' . salt(60) :
+ $authentication->{md5} ? '$1$' . salt(8) : salt(2));
} else {
$u->{pw} || '';
}