coreutils/m4
Paul Eggert 3aaa42deaa maint: port from matchpathcon to selabel_lookup
Ubuntu 20.10 is using a newer version of libselinux that
complains that matchpathcon is obsolete.  Rewrite the code
that it uses the recommended selabel_lookup instead.
* m4/jm-macros.m4 (coreutils_MACROS): Do not check for
matchpathcon_init_prefix, as it is no longer used.
* src/copy.c (set_file_security_ctx): Omit process_local arg,
as it is equivalent to !x->set_security_context.  All callers changed.
* src/copy.h (struct cp_options): set_security_context is now of
type struct selabel_handle *, not bool.  All uses changed.
* src/cp.c, src/install.c, src/mkdir.c, src/mkfifo.c, src/mknod.c:
* src/mv.c: Include selinux/label.h.
(main): Use selabel_open for set_security context.
* src/install.c (matchpathcon_init_prefix): Remove; now unused.
(get_labeling_handle): New static function.
(setdefaultfilecon, main): Use it.
(setdefaultfilecon): Do something regardless of
ENABLE_MATCHPATHCON, which seems to be a revenant macro.
(setdefaultfilecon): Use selabel_lookup instead of the obsolescent
matchpathcon.  Report an error unless it fails due to ENOENT.
* src/local.mk (src_ginstall_CPPFLAGS): Remove.
* src/selinux.c: Include selinux/label.h
Do not include die.h, error.h, canonicalize.h.
(defaultcon, restorecon_private, restorecon):
New arg HANDLE.  All callers changed.
Use selabel_lookup rather than matchpathcon.
(restorecon_private, restorecon): Don’t lose track of errno.
* src/selinux.c, src/selinux.h:
(restorecon): Don’t call ‘error’; that’s the caller’s job.
Use HAVE_SELINUX_LABEL_H, not HAVE_SELINUX_SELINUX_H,
in case there is some weird system with the former but not the latter.
* src/selinux.h (struct selinux_handle): Add forward decl.
2020-11-21 18:41:25 -08:00
..
boottime.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00
check-decl.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00
include-exclude-prog.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00
jm-macros.m4 maint: port from matchpathcon to selabel_lookup 2020-11-21 18:41:25 -08:00
prereq.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00
stat-prog.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00
xattr.m4 maint: update all copyright year number ranges 2020-01-01 14:16:56 +00:00