Function fuse::server::parse_selinux_xattr
source · fn parse_selinux_xattr(buf: &[u8]) -> Result<Option<&CStr>>
Expand description
Parses the value of the desired attribute from the FUSE request input and returns it as an
Ok(CStr)
. Returns Ok(None)
if buf
is empty or appears to be a valid request extension that
does not contain any security context information.
§Arguments
buf
- a byte array that contains the contents following any expected byte string parameters of the FUSE request from the server. It begins with a structSecctxHeader
, and then the subsequent entry is a structSecctx
followed by a nul-terminated string with the xattribute name and then another nul-terminated string with the value for that xattr.
§Errors
Error::InvalidHeaderLength
- indicates that there is an inconsistency between the size of the data read frombuf
and the statedsize
of theSecctxHeader
, the respectiveSecctx
struct, orbuf
itself.Error::DecodeMessage
- indicates that the expected structs cannot be read frombuf
.Error::MissingParameter
- indicates that either a security contextname
orvalue
is missing from a security context entry.