Struct 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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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>

Source§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.