SUNRPC: Add an XDR decoding helper for struct opaque_auth
authorChuck Lever <chuck.lever@oracle.com>
Mon, 2 Jan 2023 17:05:43 +0000 (12:05 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 20 Feb 2023 14:20:09 +0000 (09:20 -0500)
commit846b5756d7632523b5bfce78c163aa883aa9d587
tree3432b77773d3d57f0dd7b3fdfa55d410357b307e
parent1e9e177df3e36e93a37bafc3c610ed019e6f48e7
SUNRPC: Add an XDR decoding helper for struct opaque_auth

RFC 5531 defines the body of an RPC Call message like this:

struct call_body {
unsigned int rpcvers;
unsigned int prog;
unsigned int vers;
unsigned int proc;
opaque_auth cred;
opaque_auth verf;
/* procedure-specific parameters start here */
};

In the current server code, decoding a struct opaque_auth type is
open-coded in several places, and is thus difficult to harden
everywhere.

Introduce a helper for decoding an opaque_auth within the context
of a xdr_stream. This helper can be shared with all authentication
flavor implemenations, even on the client-side.

Done as part of hardening the server-side RPC header decoding paths.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/xdr.h
net/sunrpc/xdr.c