about summary refs log tree commit diff
path: root/nixos/modules/config
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-08-25 23:42:31 -0400
committerMatthew Bauer <mjbauer95@gmail.com>2019-08-25 23:42:31 -0400
commitfc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e (patch)
tree613218b7cbf5a475e52335d8f860d91015ca5250 /nixos/modules/config
parent3f4144c30a6351dd79b177328ec4dea03e2ce45f (diff)
downloadnixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar.gz
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar.bz2
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar.lz
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar.xz
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.tar.zst
nixlib-fc565c1b9d59a4a1b96d8ead859d3ea6f03a7d0e.zip
nixos/update-users-groups.pl: chomp hashedPassword
We don’t want any trailing whitespace, otherwise we mess up the
formating of the shadow file. Some things like readFile may have the
trailing new line.

Fixes #66745
Diffstat (limited to 'nixos/modules/config')
-rw-r--r--nixos/modules/config/update-users-groups.pl1
1 files changed, 1 insertions, 0 deletions
diff --git a/nixos/modules/config/update-users-groups.pl b/nixos/modules/config/update-users-groups.pl
index ef5e6346f02e..59cea51c611b 100644
--- a/nixos/modules/config/update-users-groups.pl
+++ b/nixos/modules/config/update-users-groups.pl
@@ -267,6 +267,7 @@ foreach my $line (-f "/etc/shadow" ? read_file("/etc/shadow") : ()) {
     next if !defined $u;
     $hashedPassword = "!" if !$spec->{mutableUsers};
     $hashedPassword = $u->{hashedPassword} if defined $u->{hashedPassword} && !$spec->{mutableUsers}; # FIXME
+    chomp $hashedPassword;
     push @shadowNew, join(":", $name, $hashedPassword, @rest) . "\n";
     $shadowSeen{$name} = 1;
 }