set_matchpathcon_flags(3)
β¨ set_matchpathcon_flags(3) β¨
okay bestie, this is the set_matchpathcon_flags(3) page from the SELinux API docs and it's lowkey a whole vibe β it's three little functions that tweak how matchpathcon does its thing π
πΈ NAME πΈ
set_matchpathcon_flags, set_matchpathcon_invalidcon, set_matchpathcon_printf β these set flags that control the operation of matchpathcon or matchpathcon_index, and configure the behaviour of validity checking and error displaying. so like, the vibes-controller panel for your pathcon setup ποΈβ¨
π¦ SYNOPSIS π¦
#include <selinux/selinux.h>
void set_matchpathcon_flags(unsigned int flags);
void set_matchpathcon_invalidcon(int (*f)(const char *path, unsigned
lineno, char *context));
void set_matchpathcon_printf(void (*f)(const char *fmt, ...));
π DESCRIPTION π
π set_matchpathcon_flags()
this one sets the flags that control the operation of matchpathcon_init(3) and then, like, subsequently matchpathcon_index(3) or matchpathcon(3). she's the boss of the whole flow, no cap.
so if the MATCHPATHCON_BASEONLY flag is set, then only the base file contexts configuration file gets processed β not any dynamically generated entries, and not any local customizations either. literally just the base, nothing else, periodt. π
πΈ set_matchpathcon_invalidcon()
this sets the function used by matchpathcon_init(3) when it's checking the validity of a context inside the file contexts configuration.
if you don't set it, it defaults to a test based on security_check_context(3), which checks validity against the active policy on a SELinux system. iconic default behaviour honestly β¨
but you can set it to instead perform checking based on a binary policy file β for example using sepol_check_context(3), exactly like setfiles -c does. iykyk π₯
the function is also the one responsible for reporting any such error, and it may include the path and lineno in those error messages. so she's doing double duty β checking AND telling you what went wrong π
π§ set_matchpathcon_printf()
this sets the function used by matchpathcon_init(3) when displaying errors about the file contexts configuration.
if not set, it defaults to fprintf(stderr, fmt, ...). classic.
you can set this to redirect error reporting to a different destination β send those errors wherever you want, main character energy, you're in charge π«Ά
β RETURN VALUE β
Returns zero on success or -1 otherwise. that's it, that's the whole thing, short and sweet π
π SEE ALSO π
selinux(8)matchpathcon(3)matchpathcon_index(3)set_matchpathcon_invalidcon(3)set_matchpathcon_printf(3)freecon(3)setfilecon(3)setfscreatecon(3)
ngl the manpage header for this one is literally set_matchpathcon_flags(3) β it's from the SELinux API documentation. and shoutout to stephen.smalley.work@gmail.com who wrote this on 21 November 2009 π tysm for your service, bestie, we're obsessed πβ¨π¦πΈπ
π¦ 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 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 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