onc_rpc_client/lib.rs
1//! ONC RPC version 2 -- [RFC 5531], with a runtime-agnostic transport layer.
2//!
3//! Every NFS version rides on ONC RPC. A call names a (program, version,
4//! procedure) triple and carries a credential; the reply either accepts the
5//! call and returns results, or rejects it with a reason. This crate provides
6//! that machinery once, so the per-version protocol crates only have to
7//! describe their own wire types and procedure numbers.
8//!
9//! The portmapper (program 100000) and rpcbind v3/v4 clients have been
10//! extracted to the `onc_rpcbind` crate -- they are a specific RPC
11//! service, not part of the RPC machinery itself.
12//!
13//! # What a security tool needs that a filesystem client does not
14//!
15//! Two behaviours here differ from a conventional RPC client, deliberately:
16//!
17//! * **AUTH_SYS is unauthenticated, and this crate leans into that.** The
18//! credential is a plain struct asserting a UID, GID, and group list
19//! (RFC 5531 sec. 14). Nothing signs it. [`RpcClient`] therefore allows its
20//! credential to be replaced on an established connection, so one TCP
21//! session can issue calls under many identities without re-handshaking.
22//! * **`PROG_MISMATCH` preserves the server's version range.** A server
23//! rejecting a call reports the lowest and highest versions it supports.
24//! That is a free version-enumeration oracle, so
25//! [`RpcError::ProgMismatch`] carries the range rather than discarding it.
26//!
27//! # Layout
28//!
29//! | Module | Contents |
30//! |--------|----------|
31//! | [`rpc`] | RPC v2 message types and the generic [`RpcClient`] |
32//! | [`transport`] | The [`RpcTransport`] seam, a direct implementation, and the tokio backend |
33//! | [`auth`] | AUTH_SYS credentials (RFC 5531 sec. 14) |
34//!
35//! [RFC 5531]: https://www.rfc-editor.org/rfc/rfc5531
36
37pub mod auth;
38#[cfg(feature = "auth-dh")]
39pub mod auth_dh;
40pub mod rpc;
41pub mod transport;
42
43mod error;
44
45pub use auth::{AuthDesCred, AuthDesVerf, AuthFlavor, AuthSys};
46pub use error::RpcError;
47pub use rpc::RpcClient;
48pub use transport::{DirectTransport, RpcTransport};