summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-18 16:32:00 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-08-18 17:12:56 +0200
commit6dc5db3850a2ef5d01e871ec36f1d31457fc64da (patch)
tree4ec5eacd0f85e9a56bf1cfceae97ac43ed651d5e /nixos/modules
parent773595540bd3a52476a7c84799e374d086d1c648 (diff)
downloadnixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar.gz
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar.bz2
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar.lz
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar.xz
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.tar.zst
nixlib-6dc5db3850a2ef5d01e871ec36f1d31457fc64da.zip
Fix setting an empty password
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/config/update-users-groups.pl4
1 files changed, 2 insertions, 2 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index 2b9bfb764a8b..197b65e27c4b 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -211,7 +211,7 @@ foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
     my ($name, $password, @rest) = split(':', $line, -9);
     my $u = $usersOut{$name};;
     next if !defined $u;
-    $password = $u->{hashedPassword} if $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
+    $password = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
     push @shadowNew, join(":", $name, $password, @rest) . "\n";
     $shadowSeen{$name} = 1;
 }
@@ -219,7 +219,7 @@ foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
 foreach my $u (values %usersOut) {
     next if defined $shadowSeen{$u->{name}};
     my $password = "!";
-    $password = $u->{hashedPassword} if $u->{hashedPassword};
+    $password = $u->{hashedPassword} if defined $u->{hashedPassword};
     # FIXME: set correct value for sp_lstchg.
     push @shadowNew, join(":", $u->{name}, $password, "1::::::") . "\n";
 }