summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2001-01-10 14:01:55 +0000
committerPascal Rigaux <pixel@mandriva.com>2001-01-10 14:01:55 +0000
commit0c4440409357dafaf742896053f0165402ec9e6b (patch)
tree5df34f04d566e37ca1ed6c43b7226f420dd81a9b
parent83263c66be6f300c953db84b7ddc4005e1ce385b (diff)
downloaddrakx-0c4440409357dafaf742896053f0165402ec9e6b.tar
drakx-0c4440409357dafaf742896053f0165402ec9e6b.tar.gz
drakx-0c4440409357dafaf742896053f0165402ec9e6b.tar.bz2
drakx-0c4440409357dafaf742896053f0165402ec9e6b.tar.xz
drakx-0c4440409357dafaf742896053f0165402ec9e6b.zip
(addUser): use any::pack_passwd
(setRootPassword): use any::unpack_passwd and any::pack_passwd
-rw-r--r--perl-install/install_steps.pm11
1 files changed, 4 insertions, 7 deletions
diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm
index 197f2c563..27bfcf1ac 100644
--- a/perl-install/install_steps.pm
+++ b/perl-install/install_steps.pm
@@ -551,8 +551,7 @@ sub configurePrinter {
}
#------------------------------------------------------------------------------
-my @etc_pass_fields = qw(name pw uid gid realname home shell);
-sub setRootPassword($) {
+sub setRootPassword {
my ($o) = @_;
my $p = $o->{prefix};
my $u = $o->{superuser} ||= {};
@@ -565,10 +564,8 @@ sub setRootPassword($) {
open F, "> $f" or die "failed to write file $f: $!\n";
foreach (@lines) {
if (/^root:/) {
- chomp;
- my %l; @l{@etc_pass_fields} = split ':';
- add2hash($u, \%l);
- $_ = join(':', @$u{@etc_pass_fields}) . "\n";
+ add2hash($u, any::unpack_passwd($_));
+ $_ = any::pack_passwd($_);
}
print F $_;
}
@@ -607,7 +604,7 @@ sub addUser($) {
local *F;
open F, ">> $p/etc/passwd" or die "can't append to passwd file: $!";
- print F join(':', @$_{@etc_pass_fields}), "\n" foreach @l;
+ print F any::pack_passwd($_) foreach @l;
open F, ">> $p/etc/group" or die "can't append to group file: $!";
print F "$_->{name}:x:$_->{gid}:\n" foreach @l;