If a new shadow entry is created, the passwd entry's password hash is
moved into shadow file and replaced with an "x". If this happens, update
the passwd file as well, otherwise the "x" is not written to disk.
Resolves: https://github.com/shadow-maint/shadow/issues/1580
Reproducer (as root):
```
BASE=$(mktemp -d)
mkdir -p $BASE/etc
useradd -P $BASE user
touch $BASE/etc/shadow
usermod -P $BASE -e 0 user
cat $BASE/etc/passwd
```
Incorrect output (before):
```
user:!:1000:1000::/home/user:/bin/bash
```
Correct output (after):
```
user:x:1000:1000::/home/user:/bin/bash
```
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
}
if (lflg || uflg || gflg || cflg || dflg || sflg || pflg
- || Lflg || Uflg) {
+ || Lflg || Uflg || spwd == &spent) {
if (pw_update (&pwent) == 0) {
fprintf (stderr,
_("%s: failed to prepare the new %s entry '%s'\n"),