[PATCH 7/8] busybox -- SELinux option support for coreutils: ver3

KaiGai Kohei kaigai at kaigai.gr.jp
Mon Feb 26 17:40:22 UTC 2007


Hi, Denis.

Thanks for your reviews.

Denis Vlasenko wrote:
> On Friday 23 February 2007 09:48, Yuichi Nakamura wrote:
>> [7/8] busybox-coreutils-07-chcon.v3.patch
>>  - chcon - change security context of file. 
>>
>> Signed-off-by: KaiGai Kohei <kaigai at kaigai.gr.jp>
> 
> +#define OPT_QUIET              (1<<3)  /* 'f' */
> +#define OPT_REFERENCE          (1<<4)  /* '\n' */
> +#define OPT_USER               (1<<5)  /* 'u' */
> 
> ...
> 
> 
> +       {"quiet",       0,      NULL,   'f'},
> +       {"reference",   1,      NULL,   '\n' }, /* no short option */
> +       {"user",        1,      NULL,   'u' },
> +       {"role",        1,      NULL,   'r' },
> +       {"type",        1,      NULL,   't' },
> +       {"range",       1,      NULL,   'l' },
> +       {"verbose",     0,      NULL,   'v' },
> +       {NULL,          0,      NULL,   0 },
> +};
> +#endif
> +
> +int chcon_main(int argc, char *argv[]);
> +int chcon_main(int argc, char *argv[])
> +{
> +       char *reference_file;
> +       char **target_files;
> +       int i, opts, errors = 0;
> +
> +#ifdef CONFIG_FEATURE_CHCON_LONG_OPTIONS
> +       applet_long_options = chcon_options;
> +#endif
> +       opt_complementary = "-1"  /* at least 1 param */
> +               ":q--v:v--q";     /* 'verbose' and 'quiet' are exclusive */
> +       opts = getopt32(argc, argv, "Rchf\n:u:r:t:l:v",
> +                       &reference_file, &user, &role, &type, &range);
> +       if (opts & OPT_REFERENCE) {
> +               if (opts & OPT_COMPONENT_SPECIFIED)
> +                       bb_error_msg_and_die("conflicting security context specifiers given");
> 
> 
> Again see wget.c how to not pass '\n' to getopt32.
> 
> You can make OPT_REFERENCE and OPT_COMPONENT_SPECIFIED
> exclusive by using suitable opt_complementary.

OK, fixed.

* '\n' was replaced by '0xff'
* Checks for exclusive options were added. chcon applet will will abort
   if --reference and '-u','-r','-t','-l' are appeared concurrently,

Thanks,
-- 
KaiGai Kohei <kaigai at kaigai.gr.jp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-coreutils-chcon-07.v4.patch
Type: text/x-patch
Size: 6357 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20070227/3c22b222/attachment-0002.bin 


More information about the busybox mailing list