A little capture here :) There are also some bionic binaries

http://defy.tanguy.tk/busybox/pictures/groups.png


2011/6/20 Tanguy Pruvot <[email protected]>:
> From e76c1e9268c7bb28598ff1dbc36b0ca7e1729abb Mon Sep 17 00:00:00 2001
> From: Tanguy Pruvot <[email protected]>
> Date: Mon, 20 Jun 2011 16:07:31 +0200
> Subject: [PATCH] implement groups applet (v2)
>
> Signed-off-by: Tanguy Pruvot <[email protected]>
> ---
>  coreutils/Config.src  |    7 +++++++
>  coreutils/Kbuild.src  |    1 +
>  coreutils/groups.c    |   40 ++++++++++++++++++++++++++++++++++++++++
>  include/applets.src.h |    1 +
>  4 files changed, 49 insertions(+), 0 deletions(-)
>  create mode 100644 coreutils/groups.c
>
> diff --git a/coreutils/Config.src b/coreutils/Config.src
> index 1843e8b..a234b38 100644
> --- a/coreutils/Config.src
> +++ b/coreutils/Config.src
> @@ -269,6 +269,13 @@ config FEATURE_FANCY_HEAD
>        help
>          This enables the head options (-c, -q, and -v).
>
> +config GROUPS
> +       bool "groups"
> +       default y
> +       depends on ID
> +       help
> +         Print the group names associated with the current user id
> +
>  config HOSTID
>        bool "hostid"
>        default y
> diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
> index 6a41c83..361f3e6 100644
> --- a/coreutils/Kbuild.src
> +++ b/coreutils/Kbuild.src
> @@ -44,6 +44,7 @@ lib-$(CONFIG_LN)        += ln.o
>  lib-$(CONFIG_LOGNAME)   += logname.o
>  lib-$(CONFIG_LS)        += ls.o
>  lib-$(CONFIG_FTPD)      += ls.o
> +lib-$(CONFIG_GROUPS)    += groups.o
>  lib-$(CONFIG_MD5SUM)    += md5_sha1_sum.o
>  lib-$(CONFIG_MKDIR)     += mkdir.o
>  lib-$(CONFIG_MKFIFO)    += mkfifo.o
> diff --git a/coreutils/groups.c b/coreutils/groups.c
> new file mode 100644
> index 0000000..ab07ee2
> --- /dev/null
> +++ b/coreutils/groups.c
> @@ -0,0 +1,40 @@
> +/* vi: set sw=4 ts=4: */
> +/*
> + * Mini groups implementation for busybox
> + *
> + * Copyright (C) 2011 Tanguy Pruvot <[email protected]>.
> + *
> + * Licensed under GPLv2 or later, see file LICENSE in this source tree.
> + */
> +
> +/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
> +
> +//usage:#define groups_trivial_usage
> +//usage:       ""
> +//usage:#define groups_full_usage "\n\n"
> +//usage:       "Print the group names associated with the current user id"
> +
> +#include "libbb.h"
> +
> +extern int id_main(int argc, char **argv);
> +
> +int groups_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
> +int groups_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
> +{
> +       char *id_argv[3];
> +       int ret;
> +
> +       if (argv[1])
> +               bb_show_usage();
> +
> +       id_argv[0] = xstrdup("id");
> +       id_argv[1] = xstrdup("-Gn");
> +       id_argv[2] = 0;
> +
> +       ret = id_main(2, id_argv);
> +
> +       free(id_argv[1]);
> +       free(id_argv[0]);
> +
> +       return ret;
> +}
> diff --git a/include/applets.src.h b/include/applets.src.h
> index 133f376..c3775fb 100644
> --- a/include/applets.src.h
> +++ b/include/applets.src.h
> @@ -170,6 +170,7 @@ IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN,
> BB_SUID_DROP))
>  IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
>  IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
>  IF_GETTY(APPLET(getty, BB_DIR_SBIN, BB_SUID_DROP))
> +IF_GROUPS(APPLET_NOEXEC(groups, groups, BB_DIR_USR_BIN, BB_SUID_DROP, 
> groups))
>  IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
>  IF_GZIP(APPLET(gzip, BB_DIR_BIN, BB_SUID_DROP))
>  IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
> --
> 1.7.5.3
>
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to