diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2015-03-12 15:30:46 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2015-03-12 15:30:46 +0100 |
commit | 936c8809caea5705e26e5d7e06ea3895c28fffd8 (patch) | |
tree | 2ac8561231d4d5da36213e7b2b25ce70319c9c75 /loginutils/deluser.c | |
parent | 748fb60f274b1ba40aa6ed4c4582185aae8f68f7 (diff) | |
download | busybox-w32-936c8809caea5705e26e5d7e06ea3895c28fffd8.tar.gz busybox-w32-936c8809caea5705e26e5d7e06ea3895c28fffd8.tar.bz2 busybox-w32-936c8809caea5705e26e5d7e06ea3895c28fffd8.zip |
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/deluser.c')
-rw-r--r-- | loginutils/deluser.c | 18 |
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) | |||
114 | } | 114 | } |
115 | } while (ENABLE_FEATURE_SHADOWPASSWDS && pfile); | 115 | } while (ENABLE_FEATURE_SHADOWPASSWDS && pfile); |
116 | 116 | ||
117 | if (ENABLE_DELGROUP && do_deluser > 0) { | 117 | if (do_deluser > 0) { |
118 | /* "deluser USER" also should try to delete | 118 | /* Delete user from all groups */ |
119 | * same-named group. IOW: do "delgroup USER" | 119 | if (update_passwd(bb_path_group_file, NULL, NULL, name) == -1) |
120 | */ | 120 | return EXIT_FAILURE; |
121 | |||
122 | if (ENABLE_DELGROUP) { | ||
123 | /* "deluser USER" also should try to delete | ||
124 | * same-named group. IOW: do "delgroup USER" | ||
125 | */ | ||
121 | // On debian deluser is a perl script that calls userdel. | 126 | // On debian deluser is a perl script that calls userdel. |
122 | // From man userdel: | 127 | // From man userdel: |
123 | // If USERGROUPS_ENAB is defined to yes in /etc/login.defs, userdel will | 128 | // If USERGROUPS_ENAB is defined to yes in /etc/login.defs, userdel will |
124 | // delete the group with the same name as the user. | 129 | // delete the group with the same name as the user. |
125 | do_deluser = -1; | 130 | do_deluser = -1; |
126 | goto do_delgroup; | 131 | goto do_delgroup; |
132 | } | ||
127 | } | 133 | } |
128 | return EXIT_SUCCESS; | 134 | return EXIT_SUCCESS; |
129 | } | 135 | } |