Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/loginutils/addgroup.c
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (7 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/loginutils/addgroup.c
r3232 r3621 10 10 * 11 11 */ 12 //config:config ADDGROUP 13 //config: bool "addgroup" 14 //config: default y 15 //config: help 16 //config: Utility for creating a new group account. 17 //config: 18 //config:config FEATURE_ADDGROUP_LONG_OPTIONS 19 //config: bool "Enable long options" 20 //config: default y 21 //config: depends on ADDGROUP && LONG_OPTS 22 //config: help 23 //config: Support long options for the addgroup applet. 24 //config: 25 //config:config FEATURE_ADDUSER_TO_GROUP 26 //config: bool "Support for adding users to groups" 27 //config: default y 28 //config: depends on ADDGROUP 29 //config: help 30 //config: If called with two non-option arguments, 31 //config: addgroup will add an existing user to an 32 //config: existing group. 33 34 //applet:IF_ADDGROUP(APPLET(addgroup, BB_DIR_USR_SBIN, BB_SUID_DROP)) 35 36 //kbuild:lib-$(CONFIG_ADDGROUP) += addgroup.o 12 37 13 38 //usage:#define addgroup_trivial_usage 14 //usage: "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"39 //usage: "[-g GID] [-S] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP" 15 40 //usage:#define addgroup_full_usage "\n\n" 16 //usage: "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n"41 //usage: "Add a group" IF_FEATURE_ADDUSER_TO_GROUP(" or add a user to a group") "\n" 17 42 //usage: "\n -g GID Group id" 18 43 //usage: "\n -S Create a system group" … … 23 48 #error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config 24 49 #endif 50 #if CONFIG_LAST_ID < CONFIG_LAST_SYSTEM_ID 51 #error Bad LAST_ID or LAST_SYSTEM_ID in .config 52 #endif 25 53 26 54 #define OPT_GID (1 << 0) 27 55 #define OPT_SYSTEM_ACCOUNT (1 << 1) 28 56 29 /* We assume GID_T_MAX == INT_MAX */30 57 static void xgroup_study(struct group *g) 31 58 { 32 unsigned max = INT_MAX;59 unsigned max = CONFIG_LAST_ID; 33 60 34 61 /* Make sure gr_name is unused */ … … 47 74 } else { 48 75 g->gr_gid = CONFIG_LAST_SYSTEM_ID + 1; 49 max = 64999;50 76 } 51 77 } … … 126 152 { 127 153 unsigned opts; 128 unsigned gid = 0;154 const char *gid = "0"; 129 155 130 156 /* need to be root */ … … 140 166 * addgroup user group 141 167 * Check for min, max and missing args */ 142 opt_complementary = "-1:?2 :g+";168 opt_complementary = "-1:?2"; 143 169 opts = getopt32(argv, "g:S", &gid); 144 170 /* move past the commandline options */ … … 176 202 { 177 203 die_if_bad_username(argv[0]); 178 new_group(argv[0], gid);204 new_group(argv[0], xatou_range(gid, 0, CONFIG_LAST_ID)); 179 205 } 180 206 /* Reached only on success */
Note:
See TracChangeset
for help on using the changeset viewer.