Struct onc_rpc::auth::AuthUnixParams

source ·
pub struct AuthUnixParams<T>
where T: AsRef<[u8]>,
{ /* 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>
where T: AsRef<[u8]>,

source

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.

source

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.

source

pub fn stamp(&self) -> u32

An arbitrary ID generated by the caller.

source

pub fn machine_name(&self) -> &[u8]

The hostname of the caller’s machine.

source

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.

source

pub fn uid(&self) -> u32

The caller’s Unix user ID.

source

pub fn gid(&self) -> u32

The caller’s primary Unix group ID.

source

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.

source

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>
where T: AsRef<[u8]> + Clone,

source§

fn clone(&self) -> AuthUnixParams<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<T> Debug for AuthUnixParams<T>
where T: AsRef<[u8]> + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> PartialEq for AuthUnixParams<T>
where T: AsRef<[u8]> + PartialEq,

source§

fn eq(&self, other: &AuthUnixParams<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl TryFrom<Bytes> for AuthUnixParams<Bytes>

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(v: Bytes) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl<T> StructuralPartialEq for AuthUnixParams<T>
where T: AsRef<[u8]>,

Auto Trait Implementations§

§

impl<T> Freeze for AuthUnixParams<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for AuthUnixParams<T>
where T: RefUnwindSafe,

§

impl<T> Send for AuthUnixParams<T>
where T: Send,

§

impl<T> Sync for AuthUnixParams<T>
where T: Sync,

§

impl<T> Unpin for AuthUnixParams<T>
where T: Unpin,

§

impl<T> UnwindSafe for AuthUnixParams<T>
where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.