Add config option to control the functionality to delete a group
with the same name as a user being deleted.
---
 loginutils/deluser.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/loginutils/deluser.c b/loginutils/deluser.c
index 8e7df737c..a089eafa3 100644
--- a/loginutils/deluser.c
+++ b/loginutils/deluser.c
@@ -27,6 +27,15 @@
 //config:      help
 //config:      If called with two non-option arguments, deluser
 //config:      or delgroup will remove an user from a specified group.
+//config:
+//config:config FEATURE_DEL_SAMENAMED_GROUP
+//config:      bool "Support removing group with same name as user"
+//config:      default y
+//config:      depends on DELGROUP
+//config:      help
+//config:      If enabled, deluser will delete a group with same name as the 
user
+//config:      when the user is deleted (no matter if other users are part of 
the group).
+
 
 //                   APPLET_NOEXEC:name      main     location         
suid_type     help
 //applet:IF_DELUSER( APPLET_NOEXEC(deluser,  deluser, BB_DIR_USR_SBIN, 
BB_SUID_DROP, deluser))
@@ -149,7 +158,7 @@ int deluser_main(int argc, char **argv)
                        if (update_passwd(bb_path_group_file, NULL, NULL, name) 
== -1)
                                return EXIT_FAILURE;
 
-                       if (ENABLE_DELGROUP) {
+                       if (ENABLE_DELGROUP && 
ENABLE_FEATURE_DEL_SAMENAMED_GROUP) {
                                /* "deluser USER" also should try to delete
                                 * same-named group. IOW: do "delgroup USER"
                                 */
-- 
2.34.1

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to