diff options
-rw-r--r-- | perl-install/any.pm | 6 | ||||
-rw-r--r-- | perl-install/authentication.pm | 14 |
2 files changed, 11 insertions, 9 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index f51f98cbf..d74f3f99b 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -48,7 +48,7 @@ sub alloc_user_faces { } sub create_user { - my ($u, $isMD5) = @_; + my ($u, $authentication) = @_; my @existing = stat("$::prefix/home/$u->{name}"); @@ -72,7 +72,7 @@ sub create_user { my $symlink_home_from = $u->{rename_from} && (getpwnam($u->{rename_from}))[7]; run_program::raw({ root => $::prefix, sensitive_arguments => 1 }, ($u->{rename_from} ? 'usermod' : 'adduser'), - '-p', authentication::user_crypted_passwd($u, $isMD5), + '-p', authentication::user_crypted_passwd($u, $authentication), if_($uid, '-u', $uid), if_($gid, '-g', $gid), if_($u->{realname}, '-c', $u->{realname}), if_($u->{home}, '-d', $u->{home}, if_($u->{rename_from}, '-m')), @@ -97,7 +97,7 @@ sub add_users { alloc_user_faces($users); foreach (@$users) { - create_user($_, $authentication->{md5}); + create_user($_, $authentication); run_program::rooted($::prefix, "usermod", "-G", join(",", @{$_->{groups}}), $_->{name}) if !is_empty_array_ref($_->{groups}); addKdmIcon($_->{name}, delete $_->{auto_icon} || $_->{icon}); } diff --git a/perl-install/authentication.pm b/perl-install/authentication.pm index 48a7829e7..11a878bbe 100644 --- a/perl-install/authentication.pm +++ b/perl-install/authentication.pm @@ -259,8 +259,9 @@ sub check_given_password { sub get() { my $system_auth = cat_("/etc/pam.d/system-auth"); - my $authentication = { - md5 => to_bool($system_auth =~ /md5/), shadow => to_bool($system_auth =~ /shadow/), + my $authentication = { + md5 => to_bool($system_auth =~ /md5/), + shadow => to_bool($system_auth =~ /shadow/), }; my @pam_kinds = get_pam_authentication_kinds(); @@ -815,7 +816,8 @@ sub salt { } sub user_crypted_passwd { - my ($u, $isMD5) = @_; + my ($u, $authentication) = @_; + my $isMD5 = $authentication->{md5}; if ($u->{password}) { require utf8; utf8::encode($u->{password}); #- we don't want perl to do "smart" things in crypt() @@ -829,14 +831,14 @@ sub user_crypted_passwd { sub set_root_passwd { my ($superuser, $authentication) = @_; $superuser->{name} = 'root'; - write_passwd_user($superuser, $authentication->{md5}); + write_passwd_user($superuser, $authentication); delete $superuser->{name}; } sub write_passwd_user { - my ($u, $isMD5) = @_; + my ($u, $authentication) = @_; - $u->{pw} = user_crypted_passwd($u, $isMD5); + $u->{pw} = user_crypted_passwd($u, $authentication); $u->{shell} ||= '/bin/bash'; substInFile { |