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: u32Credential stamp used by the RPC request.
machine_name: StringCaller machine name.
uid: u32Caller uid.
gid: u32Caller primary gid.
gids: Vec<u32>Caller supplementary gids.
Implementations§
Source§impl AuthSys
impl AuthSys
Sourcepub fn new(
machine_name: impl Into<String>,
uid: u32,
gid: u32,
gids: Vec<u32>,
) -> Self
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.
Sourcepub fn current() -> Self
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?
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
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}