]> git.ipfire.org Git - thirdparty/coreutils.git/commit
cp, mv, install: add SELinux support, but unlike with the Red Hat
authorJim Meyering <jim@meyering.net>
Sat, 20 Jan 2007 15:10:43 +0000 (16:10 +0100)
committerJim Meyering <jim@meyering.net>
Sun, 18 Mar 2007 17:15:06 +0000 (18:15 +0100)
commit795c052e334b63e9ed9c5f07051a598b2d3f7b3d
tree453d3841f5bc178fba4f1c3f753a190acf370d1e
parent09ef5a443f3234b9a9da4c6ad884a978301cef3e
cp, mv, install: add SELinux support, but unlike with the Red Hat

patch, mv and cp do not provide the "-Z context" option.
* src/copy.c: Include <selinux/selinux.h>.
(restore_default_fscreatecon): New function.
(copy_reg): Make cp --preserve=context work for existing destination.
(copy_internal): Likewise for new destinations.
* src/copy.h (cp_options) [preserve_security_context]: New member.
* src/cp.c: Include <selinux/selinux.h>.
(selinux_enabled): New global.
(usage): Mention new --preserve=context option.
(PRESERVE_CONTEXT): Define/use.
(decode_preserve_arg): Handle PRESERVE_CONTEXT.
(main): Remove an obsolete comment.
If --preserve=context is specified on a system without SELinux
enabled, give a diagnostic and fail.
* src/mv.c: Include <selinux/selinux.h>.
Set x->preserve_security_context if SELinux is enabled.
* src/install.c: Accept new "-Z, --context=C" option.
Accept --preserve-context option (but not -P option).
Accept alternate spelling: --preserve_context, for now.
Include <selinux/selinux.h> and "quotearg.h".
(selinux_enabled, use_default_selinux_context): New globals.
(PRESERVE_CONTEXT_OPTION): Define.
(cp_option_init): Default: do not preserve security context.
(setdefaultfilecon): New function.
(main): Honor new options.
* src/Makefile.am (mv_LDADD, cp_LDADD, ginstall_LDADD):
Add $(LIB_SELINUX).
ChangeLog-selinux
src/Makefile.am
src/copy.c
src/copy.h
src/cp.c
src/install.c
src/mv.c