pub struct ContextRestore<'labeler, T: BackEnd> { /* private fields */ }
Expand description
Restore file(s) default SELinux security contexts.
Implementations§
Source§impl<'labeler, T> ContextRestore<'labeler, T>where
T: BackEnd,
impl<'labeler, T> ContextRestore<'labeler, T>where
T: BackEnd,
Sourcepub fn with_labeler(labeler: &'labeler mut Labeler<T>) -> Self
pub fn with_labeler(labeler: &'labeler mut Labeler<T>) -> Self
Set a labeling handle for relabeling.
See: selinux_restorecon_set_sehandle()
.
Sourcepub fn labeler(&self) -> Option<&&'labeler mut Labeler<T>>
pub fn labeler(&self) -> Option<&&'labeler mut Labeler<T>>
Get the labeling handle to be used for relabeling.
Sourcepub fn set_alternative_root_path(
&mut self,
path: impl AsRef<Path>,
) -> Result<()>
pub fn set_alternative_root_path( &mut self, path: impl AsRef<Path>, ) -> Result<()>
Set an alternate root path for relabeling.
See: selinux_restorecon_set_alt_rootpath()
.
Sourcepub fn add_exclude_list<P>(
&mut self,
exclusion_patterns: impl IntoIterator<Item = P>,
) -> Result<()>
pub fn add_exclude_list<P>( &mut self, exclusion_patterns: impl IntoIterator<Item = P>, ) -> Result<()>
Add to the list of directories to be excluded from relabeling.
See: selinux_restorecon_set_exclude_list()
.
Sourcepub fn restore_context_of_file_system_entry(
self,
path: impl AsRef<Path>,
threads_count: usize,
flags: RestoreFlags,
) -> Result<Option<u64>>
pub fn restore_context_of_file_system_entry( self, path: impl AsRef<Path>, threads_count: usize, flags: RestoreFlags, ) -> Result<Option<u64>>
Restore file(s) default SELinux security contexts.
If threads_count
is zero, then:
- If
selinux_restorecon_parallel()
is supported bylibselinux
(version 3.4 or later), then this operation will use as many threads as the number of online processor cores present. - Otherwise, this operation will run in one thread.
When this method succeeds:
- If
flags
includesRestoreFlags::COUNT_ERRORS
, then this returnsOk(Some(N))
whereN
is the number of errors that were ignored while walking the file system tree specified bypath
. - Otherwise,
Ok(None)
is returned.
See: selinux_restorecon()
, selinux_restorecon_parallel()
.
Sourcepub fn manage_security_sehash_xattr_entries(
dir_path: impl AsRef<Path>,
flags: XAttrFlags,
) -> Result<DirectoryXAttributesIter>
pub fn manage_security_sehash_xattr_entries( dir_path: impl AsRef<Path>, flags: XAttrFlags, ) -> Result<DirectoryXAttributesIter>
Manage default security.sehash
extended attribute entries added by
selinux_restorecon()
, setfiles()
or restorecon()
.
See: selinux_restorecon_xattr()
.
Trait Implementations§
Auto Trait Implementations§
impl<'labeler, T> Freeze for ContextRestore<'labeler, T>
impl<'labeler, T> RefUnwindSafe for ContextRestore<'labeler, T>where
T: RefUnwindSafe,
impl<'labeler, T> !Send for ContextRestore<'labeler, T>
impl<'labeler, T> !Sync for ContextRestore<'labeler, T>
impl<'labeler, T> Unpin for ContextRestore<'labeler, T>
impl<'labeler, T> !UnwindSafe for ContextRestore<'labeler, T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more