]> git.ipfire.org Git - thirdparty/systemd.git/commit
selinux: accept the fact that getxyzcon() can return success and NULL
authorLennart Poettering <lennart@poettering.net>
Wed, 7 Dec 2022 14:20:15 +0000 (15:20 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 7 Dec 2022 14:25:37 +0000 (15:25 +0100)
commitaf614e45c3efb49e37c4b1507ccc4e450119c089
tree06f4f960200dd4ee65926a1094c214326bdcb316
parent42f8b6a80878e688b821adfb315c0a1f0a7076ce
selinux: accept the fact that getxyzcon() can return success and NULL

Inspired by #25664: let's check explicitly for NULL everywhere we do one
of those getXYZcon() calls.

We usually turn this into EOPNOTSUPP, as when selinux is off (which is
supposed to be the only case this can happen according to selinux docs)
we otherwise return EOPNOTSUPP in that case.

Note that in most cases we have an explicit mac_selinux_use() call
beforehand, hence this should mostly not be triggerable codepaths.
src/core/selinux-access.c
src/shared/selinux-util.c