diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-11-30 11:35:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-11-30 11:35:00 +0000 |
commit | a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5 (patch) | |
tree | 23ca265db4ca4c3299c2812f685302445040032b /perl-install/any.pm | |
parent | b6d2621f3a4a327d23d5a16247df839fca62dfec (diff) | |
download | drakx-backup-do-not-use-a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5.tar drakx-backup-do-not-use-a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5.tar.gz drakx-backup-do-not-use-a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5.tar.bz2 drakx-backup-do-not-use-a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5.tar.xz drakx-backup-do-not-use-a5a0520e0bfca8ab6be9fa83dd453c9a4e8c94c5.zip |
- move some functions from any.pm to authentication.pm
- create authentication::ask_root_password_and_authentication() out of install_steps_interactive::setRootPassword()
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r-- | perl-install/any.pm | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm index b1dcbb78c..0099ecf92 100644 --- a/perl-install/any.pm +++ b/perl-install/any.pm @@ -71,9 +71,10 @@ sub create_user { run_program::rooted($::prefix, 'groupadd', '-g', $gid, $u->{name}); } } + require authentication; run_program::rooted($::prefix, 'adduser', - '-p', user_crypted_passwd($u, $isMD5), + '-p', authentication::user_crypted_passwd($u, $isMD5), if_($uid, '-u', $uid), if_($gid, '-g', $gid), $u->{name}); } @@ -470,17 +471,6 @@ You can create additional entries or change the existing ones."), [ { } } -my @etc_pass_fields = qw(name pw uid gid realname home shell); -sub unpack_passwd { - my ($l) = @_; - my %l; @l{@etc_pass_fields} = split ':', chomp_($l); - \%l; -} -sub pack_passwd { - my ($l) = @_; - join(':', @$l{@etc_pass_fields}) . "\n"; -} - sub get_autologin() { my %desktop = getVarsFromSh("$::prefix/etc/sysconfig/desktop"); my $desktop = $desktop{DESKTOP} || 'KDE'; @@ -826,37 +816,6 @@ sub selectCountry { $locale->{country} = $other || !@best ? $ext_country : $country; } -sub user_crypted_passwd { - my ($u, $isMD5) = @_; - $u->{password} ? &crypt($u->{password}, $isMD5) : $u->{pw} || ''; -} - -sub set_root_passwd { - my ($superuser, $authentication) = @_; - $superuser->{name} = 'root'; - write_passwd_user($superuser, $authentication->{md5}); - delete $superuser->{name}; -} - -sub write_passwd_user { - my ($u, $isMD5) = @_; - - $u->{pw} = user_crypted_passwd($u, $isMD5); - $u->{shell} ||= '/bin/bash'; - - substInFile { - my $l = unpack_passwd($_); - if ($l->{name} eq $u->{name}) { - add2hash_($u, $l); - $_ = pack_passwd($u); - $u = {}; - } - if (eof && $u->{name}) { - $_ .= pack_passwd($u); - } - } "$::prefix/etc/passwd"; -} - sub set_login_serial_console { my ($port, $speed) = @_; |