Commit f4a59e82 authored by Chuck Lever's avatar Chuck Lever

SUNRPC: Rename automatic variables in unwrap_priv_data()

Clean up: To help orient readers, name the stack variables to match
the XDR field names.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent b68e4c5c
...@@ -993,16 +993,28 @@ fix_priv_head(struct xdr_buf *buf, int pad) ...@@ -993,16 +993,28 @@ fix_priv_head(struct xdr_buf *buf, int pad)
} }
} }
/*
* RFC 2203, Section 5.3.2.3
*
* struct rpc_gss_priv_data {
* opaque databody_priv<>
* };
*
* struct rpc_gss_data_t {
* unsigned int seq_num;
* proc_req_arg_t arg;
* };
*/
static int static int
unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx) svcauth_gss_unwrap_priv(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq,
struct gss_ctx *ctx)
{ {
u32 priv_len, maj_stat; u32 len, seq_num, maj_stat;
int pad, remaining_len, offset; int pad, remaining_len, offset;
u32 rseqno;
clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags); clear_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
priv_len = svc_getnl(&buf->head[0]); len = svc_getnl(&buf->head[0]);
if (rqstp->rq_deferred) { if (rqstp->rq_deferred) {
/* Already decrypted last time through! The sequence number /* Already decrypted last time through! The sequence number
* check at out_seq is unnecessary but harmless: */ * check at out_seq is unnecessary but harmless: */
...@@ -1012,14 +1024,14 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs ...@@ -1012,14 +1024,14 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
* request to the end, where head[0].iov_len is just the bytes * request to the end, where head[0].iov_len is just the bytes
* not yet read from the head, so these two values are different: */ * not yet read from the head, so these two values are different: */
remaining_len = total_buf_len(buf); remaining_len = total_buf_len(buf);
if (priv_len > remaining_len) if (len > remaining_len)
goto unwrap_failed; goto unwrap_failed;
pad = remaining_len - priv_len; pad = remaining_len - len;
buf->len -= pad; buf->len -= pad;
fix_priv_head(buf, pad); fix_priv_head(buf, pad);
maj_stat = gss_unwrap(ctx, 0, priv_len, buf); maj_stat = gss_unwrap(ctx, 0, len, buf);
pad = priv_len - buf->len; pad = len - buf->len;
/* The upper layers assume the buffer is aligned on 4-byte boundaries. /* The upper layers assume the buffer is aligned on 4-byte boundaries.
* In the krb5p case, at least, the data ends up offset, so we need to * In the krb5p case, at least, the data ends up offset, so we need to
* move it around. */ * move it around. */
...@@ -1035,8 +1047,8 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs ...@@ -1035,8 +1047,8 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
if (maj_stat != GSS_S_COMPLETE) if (maj_stat != GSS_S_COMPLETE)
goto bad_unwrap; goto bad_unwrap;
out_seq: out_seq:
rseqno = svc_getnl(&buf->head[0]); seq_num = svc_getnl(&buf->head[0]);
if (rseqno != seq) if (seq_num != seq)
goto bad_seqno; goto bad_seqno;
return 0; return 0;
...@@ -1044,7 +1056,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs ...@@ -1044,7 +1056,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
trace_rpcgss_svc_unwrap_failed(rqstp); trace_rpcgss_svc_unwrap_failed(rqstp);
return -EINVAL; return -EINVAL;
bad_seqno: bad_seqno:
trace_rpcgss_svc_seqno_bad(rqstp, seq, rseqno); trace_rpcgss_svc_seqno_bad(rqstp, seq, seq_num);
return -EINVAL; return -EINVAL;
bad_unwrap: bad_unwrap:
trace_rpcgss_svc_unwrap(rqstp, maj_stat); trace_rpcgss_svc_unwrap(rqstp, maj_stat);
...@@ -1677,8 +1689,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp) ...@@ -1677,8 +1689,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp)
/* placeholders for length and seq. number: */ /* placeholders for length and seq. number: */
svc_putnl(resv, 0); svc_putnl(resv, 0);
svc_putnl(resv, 0); svc_putnl(resv, 0);
if (unwrap_priv_data(rqstp, &rqstp->rq_arg, if (svcauth_gss_unwrap_priv(rqstp, &rqstp->rq_arg,
gc->gc_seq, rsci->mechctx)) gc->gc_seq, rsci->mechctx))
goto garbage_args; goto garbage_args;
rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE * 2; rqstp->rq_auth_slack = RPC_MAX_AUTH_SIZE * 2;
svcxdr_init_decode(rqstp); svcxdr_init_decode(rqstp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment