Struct onc_rpc::auth::AuthUnixParams
source · 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 moresource§impl<T> Debug for AuthUnixParams<T>
impl<T> Debug for AuthUnixParams<T>
source§impl<T> PartialEq for AuthUnixParams<T>
impl<T> PartialEq for AuthUnixParams<T>
source§fn eq(&self, other: &AuthUnixParams<T>) -> bool
fn eq(&self, other: &AuthUnixParams<T>) -> bool
self
and other
values to be equal, and is used
by ==
.