[PATCH] proposal to enforce correct system account creation in adduser and addgroup
Denys Vlasenko
vda.linux at googlemail.com
Wed Apr 22 03:04:33 UTC 2009
Sorry for the delay.
On Wednesday 15 April 2009 23:58, Tito wrote:
> Hi,
> this patch enforces correct system account creation in adduser and addgroup
> (or at least it mimics the behaviour on my box :-) ):
>
> 1) for both applets: if a specific id is requested the --system switch and
> min and max values are overriden and the range of valid
> id values is set between 0 and UINT_MAX
> 2) in adduser: if --system is set no interactive password is requested, users's group
> is set to "nogroup" (unless --ingroup is set) and user's shell to /bin/false
> (unless --shell is set).
> Support for --uid was added.
> 3) in addgroup: support for long options and --system was added.
> 4) usage.h: was updated to reflect the changes.
>
> Size increase is:
>
> scripts/bloat-o-meter busybox_old busybox_unstripped
> function old new delta
> adduser_main 642 753 +111
> addgroup_main 334 415 +81
> addgroup_longopts - 16 +16
> adduser_longopts 97 103 +6
> packed_usage 25278 25276 -2
> .rodata 122845 122817 -28
> ------------------------------------------------------------------------------
> (add/remove: 1/0 grow/shrink: 3/2 up/down: 214/-30) Total: 184 bytes
I'm concerned that it adds bloat, _unconditionally_.
Can you put not-so-critical features in a separate
CONFIG_FEATURE_xxx option (or reuse CONFIG_DESKTOP
if you think we already have too many of them)?
opt_complementary = "-1:?2";
- if (getopt32(argv, "g:", &group)) {
- gid = xatoul_range(group, 0, ((unsigned long)(gid_t)ULONG_MAX) >> 1);
+ getopt32(argv, "g:S", &group);
+ if (option_mask32 & OPT_GID) {
+ gid = xatoul_range(group, 0, UINT_MAX);
I bet this will be smaller:
opts = getopt32
if (opt & OPT_GID) ...
Also, you can use opt_complementary = "-1:?2:+g" and
getopt32(argv, "g:", &gid),
then getopt32 will do numeric parsing for you.
(gid _must_ be int or unsigned int for it to work).
--
vda
More information about the busybox
mailing list