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 context con using freecon(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