summaryrefslogtreecommitdiffstats
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
commite384eae800c0d663ba8b68103771103d8e78c0f6 (patch)
treebf50a2c34a8f91e4b09f5ac4db175ecc066cf712
parente9c255fbe0172e9e9b0489054fed55d6142f8347 (diff)
downloadpw-darwin-e384eae800c0d663ba8b68103771103d8e78c0f6.tar.gz
pw-darwin-e384eae800c0d663ba8b68103771103d8e78c0f6.tar.zst
pw-darwin-e384eae800c0d663ba8b68103771103d8e78c0f6.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.
-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()");
}