selinux_r...ult_handle(3)

✨ NAME ✨

selinux_restorecon_default_handle β€” bestie, this one sets the default parameters for selinux_restorecon(3) πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <selinux/restorecon.h>
#include <selinux/label.h>

struct selabel_handle *selinux_restorecon_default_handle(void);

πŸ’… DESCRIPTION πŸ’…

okay so. selinux_restorecon_default_handle() sets the default parameters for selinux_restorecon(3) by calling selabel_open(3) with the SELABEL_OPT_DIGEST option and literally nothing else. That one option is the whole vibe. ✨

What it does for you: it turns on a digest being calculated on the currently loaded policy file_contexts(5) set of files β€” exactly like it's described in the NOTES section of selinux_restorecon(3). no cap, go read that section, it's giving lore.

Calling selinux_restorecon_default_handle() is optional, but if you do use it, then you should call selinux_restorecon_set_sehandle(3) with the handle it hands back, so that handle actually gets set for use by selinux_restorecon(3). like, you can't just hold the handle and do nothing with it, that's not the move 🫢

And why is it optional, you ask? because selinux_restorecon(3) will automatically call this one and selinux_restorecon_set_sehandle(3) all on its own β€” provided a handle has not already been set. for example, by selinux_restorecon_set_sehandle(3) being used to set customised selabel_open(3) parameters. so if you already did the custom thing, it respects that and doesn't step on your toes. iconic behaviour honestly πŸ‘‘


🌸 RETURN VALUE 🌸

  • On success: a non-NULL handle value comes back to you. slay. πŸ’–
  • On error: NULL is returned, and errno is set appropriately. 😭

πŸ¦‹ SEE ALSO πŸ¦‹


mwah, that's the whole page bestie β€” brought to you by Security Enhanced Linux, dated 20 Oct 2015, chilling in manual section 3 of the SELinux API documentation. go forth and restore those contexts, you absolute main character πŸ’…πŸŒˆ

πŸ“¦ where this page comes from