aboutsummaryrefslogtreecommitdiff
path: root/loginutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2015-03-12 15:30:46 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2015-03-12 15:30:46 +0100
commit936c8809caea5705e26e5d7e06ea3895c28fffd8 (patch)
tree2ac8561231d4d5da36213e7b2b25ce70319c9c75 /loginutils
parent748fb60f274b1ba40aa6ed4c4582185aae8f68f7 (diff)
downloadbusybox-936c8809caea5705e26e5d7e06ea3895c28fffd8.tar.gz
deluser: also remove user from /etc/group
function old new delta update_passwd 1270 1470 +200 deluser_main 310 332 +22 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/deluser.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index 01a9386bc..110cd6310 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -114,16 +114,22 @@ int deluser_main(int argc, char **argv)
}
} while (ENABLE_FEATURE_SHADOWPASSWDS && pfile);
- if (ENABLE_DELGROUP && do_deluser > 0) {
- /* "deluser USER" also should try to delete
- * same-named group. IOW: do "delgroup USER"
- */
+ if (do_deluser > 0) {
+ /* Delete user from all groups */
+ if (update_passwd(bb_path_group_file, NULL, NULL, name) == -1)
+ return EXIT_FAILURE;
+
+ if (ENABLE_DELGROUP) {
+ /* "deluser USER" also should try to delete
+ * same-named group. IOW: do "delgroup USER"
+ */
// On debian deluser is a perl script that calls userdel.
// From man userdel:
// If USERGROUPS_ENAB is defined to yes in /etc/login.defs, userdel will
// delete the group with the same name as the user.
- do_deluser = -1;
- goto do_delgroup;
+ do_deluser = -1;
+ goto do_delgroup;
+ }
}
return EXIT_SUCCESS;
}