Skip to main content

AuthSys

Struct AuthSys 

Source
pub struct AuthSys {
    pub stamp: u32,
    pub machine_name: String,
    pub uid: u32,
    pub gid: u32,
    pub gids: Vec<u32>,
}
Expand description

AUTH_SYS credential used for ONC RPC calls.

AUTH_SYS carries a machine name, uid, primary gid, and supplementary gids. It is the default authentication flavor for the high-level clients. It is not cryptographically secure; deployments that require Kerberos/RPCSEC_GSS need support outside the current high-level API.

Fields§

§stamp: u32

Credential stamp used by the RPC request.

§machine_name: String

Caller machine name.

§uid: u32

Caller uid.

§gid: u32

Caller primary gid.

§gids: Vec<u32>

Caller supplementary gids.

Implementations§

Source§

impl AuthSys

Source

pub fn new( machine_name: impl Into<String>, uid: u32, gid: u32, gids: Vec<u32>, ) -> Self

Builds an AUTH_SYS credential from explicit identity fields.

At encode time the supplementary group list is limited by AUTH_SYS_MAX_GROUPS.

Source

pub fn current() -> Self

Builds an AUTH_SYS credential from the current process identity.

On Unix this reads the current uid, primary gid, and supplementary groups. On unsupported platforms the platform shims provide the best available values.

Examples found in repository?
examples/v3_cookbook.rs (line 52)
50fn connect(target: &str) -> nfs::Result<Client> {
51    ClientBuilder::from_target(target)?
52        .auth_sys(AuthSys::current())
53        .timeout(Some(Duration::from_secs(10)))
54        .io_size(128 * 1024)
55        .dir_size(64 * 1024)
56        .max_dir_entries(4096)
57        .retry_policy(RetryPolicy::new(
58            4,
59            Duration::from_millis(50),
60            Duration::from_secs(2),
61        ))
62        .connect()
63}
More examples
Hide additional examples
examples/v4_cookbook.rs (line 53)
50fn connect(host: &str) -> nfs::Result<Client> {
51    let process_id = std::process::id();
52    Client::builder(host.to_owned())
53        .auth_sys(AuthSys::current())
54        .timeout(Some(Duration::from_secs(10)))
55        .port(2049)
56        .owner_id(format!("nfs-rs:v4-cookbook:{host}:{process_id}").into_bytes())
57        .open_owner(format!("nfs-rs:v4-open-owner:{process_id}").into_bytes())
58        .io_size(128 * 1024)
59        .dir_size(64 * 1024)
60        .max_dir_entries(4096)
61        .retry_policy(RetryPolicy::new(
62            4,
63            Duration::from_millis(50),
64            Duration::from_secs(2),
65        ))
66        .connect()
67}

Trait Implementations§

Source§

impl Clone for AuthSys

Source§

fn clone(&self) -> AuthSys

Returns a duplicate 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 Debug for AuthSys

Source§

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

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

impl Default for AuthSys

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for AuthSys

Source§

fn eq(&self, other: &AuthSys) -> 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 Eq for AuthSys

Source§

impl StructuralPartialEq for AuthSys

Auto Trait Implementations§

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.