libostree: write selinux xattr when on non-selinux systems
authorMichael Vogt <michael.vogt@gmail.com>
Wed, 31 Jan 2024 17:02:24 +0000 (18:02 +0100)
committerMichael Vogt <michael.vogt@gmail.com>
Thu, 8 Feb 2024 14:51:41 +0000 (15:51 +0100)
commit092a2b736dc8bf70b790d13622288dd6afe8c539
tree0f77a653f51f4c2e793e6b5068bef0ae12a6133d
parentda892140657bfb67d475f80395af97af96b1b6af
libostree: write selinux xattr when on non-selinux systems

Currently when writing data for selinux systems on a non-selinux
system there will be no labels. This is because
`ostree_sepolicy_setfscreatecon()` just returns TRUE on non-selinux
systems and xattr writing for `security.seliux` is filtered out.

This patches uses the suggestion of Colin Walters (thanks!) from
https://github.com/ostreedev/ostree/issues/2804 and detects if
the host has selinux enabled and if not just skips filtering the
xattrs for selinux.
src/libostree/ostree-repo-checkout.c
src/libostree/ostree-sepolicy.c
src/libostree/ostree-sepolicy.h