pub struct AuthUnixParams<T>{ /* private fields */ }
Expand description
AuthUnixParams
represents the structures referred to as both AUTH_UNIX
and AUTH_SYS
in the various RFCs, used to identify the client as a Unix
user.
The structure is implemented as specified in APPENDIX A
of
RFC1831.
The client-provided machine name is limited to, at most, 16 bytes. If
additional group IDs (AuthUnixParams::gids()
) are provided, the protocol
allows for at most 16 values.
These values are trivial to forge and provide no actual security.
Implementations§
Source§impl<T> AuthUnixParams<T>
impl<T> AuthUnixParams<T>
Sourcepub fn new(
stamp: u32,
machine_name: T,
uid: u32,
gid: u32,
gids: impl IntoIterator<Item = u32>,
) -> Self
pub fn new( stamp: u32, machine_name: T, uid: u32, gid: u32, gids: impl IntoIterator<Item = u32>, ) -> Self
Initialise a new AuthUnixParams
instance containing the specified unix
account identifiers.
§Panics
Panics if the machine name exceeds 16 bytes, or gids
contains more
than 16 elements.
Sourcepub fn serialise_into<W: Write>(&self, buf: W) -> Result<(), Error>
pub fn serialise_into<W: Write>(&self, buf: W) -> Result<(), Error>
Serialises this AuthUnixParams
into buf
, advancing the cursor
position by AuthUnixParams::serialised_len()
bytes.
Sourcepub fn machine_name(&self) -> &[u8] ⓘ
pub fn machine_name(&self) -> &[u8] ⓘ
The hostname of the caller’s machine.
Sourcepub fn machine_name_str(&self) -> &str
pub fn machine_name_str(&self) -> &str
The hostname of the caller’s machine as a reference to a UTF8 string.
# Panics
If the machine name cannot be expressed as a valid UTF8 string, this method panics.
Sourcepub fn gids(&self) -> Option<&[u32]>
pub fn gids(&self) -> Option<&[u32]>
Returns a copy of the gids
array, a set of Unix group IDs the caller
is a member of.
Sourcepub fn serialised_len(&self) -> u32
pub fn serialised_len(&self) -> u32
Returns the on-wire length of this message once serialised, including the message header.
Trait Implementations§
Source§impl<T> Clone for AuthUnixParams<T>
impl<T> Clone for AuthUnixParams<T>
Source§fn clone(&self) -> AuthUnixParams<T>
fn clone(&self) -> AuthUnixParams<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more