summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pw/pwupd.c
diff options
context:
space:
mode:
authorbapt <bapt@FreeBSD.org>2012-12-26 18:28:17 +0000
committerbapt <bapt@FreeBSD.org>2012-12-26 18:28:17 +0000
commit13dabd466a14c3ee7b3daebcffa9207bd79c8e48 (patch)
tree48099666354dc2bef2e389bce321e8c86084110d /usr.sbin/pw/pwupd.c
parentd1e0080a5ef8d493131ae801cbc3ab257dd761b9 (diff)
downloadFreeBSD-src-13dabd466a14c3ee7b3daebcffa9207bd79c8e48.zip
FreeBSD-src-13dabd466a14c3ee7b3daebcffa9207bd79c8e48.tar.gz
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 'usr.sbin/pw/pwupd.c')
-rw-r--r--usr.sbin/pw/pwupd.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pw/pwupd.c b/usr.sbin/pw/pwupd.c
index 0f2df7a..22662db 100644
--- a/usr.sbin/pw/pwupd.c
+++ b/usr.sbin/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()");
}
OpenPOWER on IntegriCloud