matchmediacon(3)
π matchmediacon β SELinux API documentation π
okay so bestie, we're diving into matchmediacon(3) from the SELinux API documentation and honestly? it's giving β¨niche but usefulβ¨. stick with me.
πΈ NAME πΈ
matchmediacon β bestie, this one grabs the default SELinux security context for the mediatype you hand it, straight outta the policy. no cap. π
β¨ SYNOPSIS β¨
#include <selinux/selinux.h>
int matchmediacon(const char *media, char **con);
π¦ DESCRIPTION π¦
so here's the vibe: matchmediacon() takes the media type you pass in and matches it against the media contexts configuration, then sets the security context con to point at whatever context comes out the other side. like a lil matchmaking service but for media types and contexts πβ¨
π note bestie, this part matters: the caller must free the returned security contextconusingfreecon(3). don't be the person who leaks it, i'm literally begging π
π RETURN VALUE π
returns 0 on success, or -1 otherwise. that's it, that's the whole thing. periodt. π
π Files π
/etc/selinux/{POLICYTYPE}/contexts/files/mediaβ yeah that's the one, that's where the media contexts config lives π
π SEE ALSO π
mwah π this page was brought to you by dwalsh@redhat.com, dated 15 November 2004, living under the matchmediacon(3) era of the SELinux API documentation. iconic behavior, honestly. slay π«Άβ¨
π¦ where this page comes from
- alpine 3.24: libselinux-doc 3.10-r1 Β· Public-Domain
- centos-stream 10: libselinux-devel 3.11-3.el10 Β· LicenseRef-Fedora-Public-Domain
- centos-stream 9: libselinux-devel 3.6-5.el9 Β· Public Domain
- centos-stream 9: libselinux-devel 3.6-5.el9 Β· Public Domain
- debian bookworm: libselinux1-dev 3.4-1+b6
- debian trixie: libselinux1-dev 3.8.1-1 Β· LicenseRef-public-domain
- fedora 43: libselinux-devel 3.9-5.fc43 Β· LicenseRef-Fedora-Public-Domain
- fedora 43: libselinux-devel 3.9-5.fc43 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.10-1.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.10-1.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.11-2.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.11-2.fc44 Β· LicenseRef-Fedora-Public-Domain
- nixos 26.05: libselinux 3.10
- nixpkgs unstable: libselinux 3.11
- opensuse-leap 16.0: libselinux-devel 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: libselinux-devel 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: libselinux-devel 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- opensuse-leap 16.0: libselinux-devel 3.8.1-160000.4.1 Β· SUSE-Public-Domain
- ubuntu jammy: libselinux1-dev 3.3-1build2
- ubuntu noble: libselinux1-dev 3.5-2ubuntu2 Β· LicenseRef-public-domain
- ubuntu noble: libselinux1-dev 3.5-2ubuntu2.1 Β· LicenseRef-public-domain
- ubuntu questing: libselinux1-dev 3.8.1-1build1
- ubuntu resolute: libselinux-dev 3.9-4build1 Β· LicenseRef-public-domain
- ubuntu stonking: libselinux-dev 3.11-2.1 Β· LicenseRef-public-domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms