ONC RPC authentication flavors — RFC 5531 §8.
This module implements the two flavors needed for NFSv3:
AUTH_NONE(flavor 0) — no credentials, no verifier.AUTH_SYS(flavor 1) — Unix-style identity: stamp, hostname, uid, gid, supplementary gid list. Surfaced to handlers as thet:sys/0struct so downstream code can apply POSIX permission checks.
RPCSEC_GSS / Kerberos is intentionally out of scope.
Each decode_*/1 consumes a <<flavor::32, body_var_opaque>> pair
off the wire. encode_* flips the same shape back out. Errors bubble
up as {:error, reason} tuples so the dispatcher can return
AUTH_BADCRED to the client.
Summary
Types
Decoded credential, per the supported flavors.
Functions
Numeric flavor for AUTH_NONE.
Numeric flavor for AUTH_SYS.
Decode an opaque_auth (flavor + variable opaque body) into a
credential struct. Used for both the call's credential and
verifier slots.
Encode an opaque_auth slot. The verifier on a successful reply is
almost always AUTH_NONE; only RPCSEC_GSS uses anything else.
Types
@type credential() :: Tahr.RPC.Auth.None.t() | Tahr.RPC.Auth.Sys.t()
Decoded credential, per the supported flavors.
Functions
@spec auth_none() :: 0
Numeric flavor for AUTH_NONE.
@spec auth_sys() :: 1
Numeric flavor for AUTH_SYS.
@spec decode_opaque_auth(binary()) :: {:ok, credential(), binary()} | {:error, term()}
Decode an opaque_auth (flavor + variable opaque body) into a
credential struct. Used for both the call's credential and
verifier slots.
@spec encode_opaque_auth(credential()) :: binary()
Encode an opaque_auth slot. The verifier on a successful reply is
almost always AUTH_NONE; only RPCSEC_GSS uses anything else.