summaryrefslogtreecommitdiffstats
path: root/pw/pwupd.c
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2012-12-26 18:28:17 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2012-12-26 18:28:17 +0000
commite8d40660fcad4c4bae334a2a7592616fa484ef3c (patch)
tree812af0d044e9dae30bc80b6b4f23593bca1bc595 /pw/pwupd.c
parent228ea4032d5eee849fa8b83e5e136b3edd92e29f (diff)
downloadpw-darwin-e8d40660fcad4c4bae334a2a7592616fa484ef3c.tar.gz
pw-darwin-e8d40660fcad4c4bae334a2a7592616fa484ef3c.tar.zst
pw-darwin-e8d40660fcad4c4bae334a2a7592616fa484ef3c.zip
In case of the deletion of a user those whole database has to be regenerated,
otherwise the user planned to be deleted remain in the pwd.db while removed from the plain text password file.
Diffstat (limited to 'pw/pwupd.c')
-rw-r--r--pw/pwupd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/pw/pwupd.c b/pw/pwupd.c
index 0f2df7a..22662db 100644
--- a/pw/pwupd.c
+++ b/pw/pwupd.c
@@ -146,7 +146,11 @@ pw_update(struct passwd * pwd, char const * user)
pw_fini();
err(1, "pw_copy()");
}
- if (pw_mkdb(user) == -1) {
+ /*
+ * in case of deletion of a user, the whole database
+ * needs to be regenerated
+ */
+ if (pw_mkdb(pw != NULL ? user : NULL) == -1) {
pw_fini();
err(1, "pw_mkdb()");
}