1 /* vi: set sw=4 ts=4: */
3 * deluser/delgroup implementation for busybox
5 * Copyright (C) 1999 by Lineo, inc. and John Beppu
6 * Copyright (C) 1999,2000,2001 by John Beppu <beppu@codepoet.org>
7 * Copyright (C) 2007 by Tito Ragusa <farmatito@tiscali.it>
9 * Licensed under GPL version 2, see file LICENSE in this tarball for details.
14 int deluser_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
15 int deluser_main(int argc, char **argv)
18 && (!ENABLE_FEATURE_DEL_USER_FROM_GROUP
19 || applet_name[3] != 'g'
26 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root);
28 if (ENABLE_DELUSER && applet_name[3] == 'u') {
30 if (update_passwd(bb_path_passwd_file, argv[1], NULL, NULL) < 0)
32 if (ENABLE_FEATURE_SHADOWPASSWDS)
33 if (update_passwd(bb_path_shadow_file, argv[1], NULL, NULL) < 0)
35 } else if (ENABLE_DELGROUP) {
37 if (!ENABLE_FEATURE_DEL_USER_FROM_GROUP || argc != 3) {
39 if (update_passwd(bb_path_group_file, argv[1], NULL, NULL) < 0)
41 if (ENABLE_FEATURE_SHADOWPASSWDS)
42 if (update_passwd(bb_path_gshadow_file, argv[1], NULL, NULL) < 0)
45 /* delgroup USER GROUP */
46 if (update_passwd(bb_path_group_file, argv[2], NULL, argv[1]) < 0)
48 if (ENABLE_FEATURE_SHADOWPASSWDS)
49 if (update_passwd(bb_path_gshadow_file, argv[2], NULL, argv[1]) < 0)