diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-01-02 18:05:43 +0100 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-02-20 15:20:09 +0100 |
commit | 846b5756d7632523b5bfce78c163aa883aa9d587 (patch) | |
tree | 3432b77773d3d57f0dd7b3fdfa55d410357b307e /include | |
parent | SUNRPC: Move svcxdr_init_decode() into ->accept methods (diff) | |
download | linux-846b5756d7632523b5bfce78c163aa883aa9d587.tar.xz linux-846b5756d7632523b5bfce78c163aa883aa9d587.zip |
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>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sunrpc/xdr.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index f84e2a1358e1..8b5c9d0cdcb5 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h @@ -346,6 +346,9 @@ ssize_t xdr_stream_decode_string(struct xdr_stream *xdr, char *str, size_t size); ssize_t xdr_stream_decode_string_dup(struct xdr_stream *xdr, char **str, size_t maxlen, gfp_t gfp_flags); +ssize_t xdr_stream_decode_opaque_auth(struct xdr_stream *xdr, u32 *flavor, + void **body, unsigned int *body_len); + /** * xdr_align_size - Calculate padded size of an object * @n: Size of an object being XDR encoded (in bytes) |