[busybox:00367] Re: [PATCH 3/6] busybox -- SELinux option support for coreutils

Yuichi Nakamura ynakam at hitachisoft.jp
Fri Feb 9 01:48:53 PST 2007


On Thu, 8 Feb 2007 23:53:43 +0100
Denis Vlasenko wrote:
> On Thursday 08 February 2007 07:54, Yuichi Nakamura wrote:
> > [3/6] busybox-coreutils-03-mk.patch
> >  - -Z option support for mkdir, mkfifo, mknod. 
> >     By -Z, security context for created file can be set.
> > 
> > Signed-off-by: Yoshinori Sato <ysato at users.sourceforge.jp>
> 
> 
> +#if ENABLE_SELINUX
> +	security_context_t scontext = NULL;
> +#endif
>  
>  #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS
>  	applet_long_options = mkdir_long_options;
>  #endif
> -	opt = getopt32(argc, argv, "m:p", &smode);
> +	opt = getopt32(argc, argv, "m:p" USE_SELINUX("Z:"), &smode USE_SELINUX(,&scontext));
>  	if (opt & 1) {
>  		mode = 0777;
>  		if (!bb_parse_mode(smode, &mode)) {
> @@ -50,6 +61,15 @@
>  	}
>  	if (opt & 2)
>  		flags |= FILEUTILS_RECUR;
> +#if ENABLE_SELINUX
> +	if(opt & 4) {
> +		selinux_or_die();
> +		if (setfscreatecon(scontext)) {
> +			bb_error_msg_and_die ("Sorry, cannot set default context "
> +					      "to %s.\n", scontext);
> 
> Initializing scontext to NULL is useless code. bb_error_msg_and_die
> has useless "Sorry" (with wrong capitalization: "mkdir: Sorry...")
> and useless ".\n" at the end.
Fixed.

> 
> Sorry guys, I would be really happy if these patches get
> a little bit prettier...
Thank you :-)

> --
> vda
> 


-- 
Yuichi Nakamura
Hitachi Software Engineering Co., Ltd.
SELinux Policy Editor: http://seedit.sourceforge.net/



-------------- next part --------------
A non-text attachment was scrubbed...
Name: busybox-coreutils-mk-03.v2.patch
Type: application/octet-stream
Size: 2213 bytes
Desc: not available
Url : http://busybox.net/lists/busybox/attachments/20070209/292c4424/attachment-0001.obj 


More information about the busybox mailing list