Commit 7b135c65 authored by Chuck Lever's avatar Chuck Lever

SUNRPC: Rename automatic variables in svcauth_gss_wrap_resp_priv()

Clean up variable names to match the other unwrap and wrap
functions.

Additionally, the explicit type cast on @gsd in unnecessary; and
@resbuf is renamed to match the variable naming in the unwrap
functions.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 7702378a
...@@ -1817,24 +1817,35 @@ static int svcauth_gss_wrap_integ(struct svc_rqst *rqstp) ...@@ -1817,24 +1817,35 @@ static int svcauth_gss_wrap_integ(struct svc_rqst *rqstp)
return -EINVAL; return -EINVAL;
} }
static inline int /*
svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) * 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 svcauth_gss_wrap_priv(struct svc_rqst *rqstp)
{ {
struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data; struct gss_svc_data *gsd = rqstp->rq_auth_data;
struct rpc_gss_wire_cred *gc = &gsd->clcred; struct rpc_gss_wire_cred *gc = &gsd->clcred;
struct xdr_buf *resbuf = &rqstp->rq_res; struct xdr_buf *buf = &rqstp->rq_res;
struct page **inpages = NULL; struct page **inpages = NULL;
__be32 *p, *len; __be32 *p, *lenp;
int offset; int offset;
int pad; int pad;
p = svcauth_gss_prepare_to_wrap(resbuf, gsd); p = svcauth_gss_prepare_to_wrap(buf, gsd);
if (p == NULL) if (p == NULL)
return 0; return 0;
len = p++; lenp = p++;
offset = (u8 *)p - (u8 *)resbuf->head[0].iov_base; offset = (u8 *)p - (u8 *)buf->head[0].iov_base;
*p++ = htonl(gc->gc_seq); *p++ = htonl(gc->gc_seq);
inpages = resbuf->pages; inpages = buf->pages;
/* XXX: Would be better to write some xdr helper functions for /* XXX: Would be better to write some xdr helper functions for
* nfs{2,3,4}xdr.c that place the data right, instead of copying: */ * nfs{2,3,4}xdr.c that place the data right, instead of copying: */
...@@ -1845,19 +1856,19 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) ...@@ -1845,19 +1856,19 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
* there is RPC_MAX_AUTH_SIZE slack space available in * there is RPC_MAX_AUTH_SIZE slack space available in
* both the head and tail. * both the head and tail.
*/ */
if (resbuf->tail[0].iov_base) { if (buf->tail[0].iov_base) {
if (resbuf->tail[0].iov_base >= if (buf->tail[0].iov_base >=
resbuf->head[0].iov_base + PAGE_SIZE) buf->head[0].iov_base + PAGE_SIZE)
return -EINVAL; return -EINVAL;
if (resbuf->tail[0].iov_base < resbuf->head[0].iov_base) if (buf->tail[0].iov_base < buf->head[0].iov_base)
return -EINVAL; return -EINVAL;
if (resbuf->tail[0].iov_len + resbuf->head[0].iov_len if (buf->tail[0].iov_len + buf->head[0].iov_len
+ 2 * RPC_MAX_AUTH_SIZE > PAGE_SIZE) + 2 * RPC_MAX_AUTH_SIZE > PAGE_SIZE)
return -ENOMEM; return -ENOMEM;
memmove(resbuf->tail[0].iov_base + RPC_MAX_AUTH_SIZE, memmove(buf->tail[0].iov_base + RPC_MAX_AUTH_SIZE,
resbuf->tail[0].iov_base, buf->tail[0].iov_base,
resbuf->tail[0].iov_len); buf->tail[0].iov_len);
resbuf->tail[0].iov_base += RPC_MAX_AUTH_SIZE; buf->tail[0].iov_base += RPC_MAX_AUTH_SIZE;
} }
/* /*
* If there is no current tail data, make sure there is * If there is no current tail data, make sure there is
...@@ -1866,21 +1877,22 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) ...@@ -1866,21 +1877,22 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
* is RPC_MAX_AUTH_SIZE slack space available in both the * is RPC_MAX_AUTH_SIZE slack space available in both the
* head and tail. * head and tail.
*/ */
if (resbuf->tail[0].iov_base == NULL) { if (!buf->tail[0].iov_base) {
if (resbuf->head[0].iov_len + 2*RPC_MAX_AUTH_SIZE > PAGE_SIZE) if (buf->head[0].iov_len + 2 * RPC_MAX_AUTH_SIZE > PAGE_SIZE)
return -ENOMEM; return -ENOMEM;
resbuf->tail[0].iov_base = resbuf->head[0].iov_base buf->tail[0].iov_base = buf->head[0].iov_base
+ resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE; + buf->head[0].iov_len + RPC_MAX_AUTH_SIZE;
resbuf->tail[0].iov_len = 0; buf->tail[0].iov_len = 0;
} }
if (gss_wrap(gsd->rsci->mechctx, offset, resbuf, inpages)) if (gss_wrap(gsd->rsci->mechctx, offset, buf, inpages))
return -ENOMEM; return -ENOMEM;
*len = htonl(resbuf->len - offset); *lenp = htonl(buf->len - offset);
pad = 3 - ((resbuf->len - offset - 1)&3); pad = 3 - ((buf->len - offset - 1) & 3);
p = (__be32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len); p = (__be32 *)(buf->tail[0].iov_base + buf->tail[0].iov_len);
memset(p, 0, pad); memset(p, 0, pad);
resbuf->tail[0].iov_len += pad; buf->tail[0].iov_len += pad;
resbuf->len += pad; buf->len += pad;
return 0; return 0;
} }
...@@ -1922,7 +1934,7 @@ svcauth_gss_release(struct svc_rqst *rqstp) ...@@ -1922,7 +1934,7 @@ svcauth_gss_release(struct svc_rqst *rqstp)
goto out_err; goto out_err;
break; break;
case RPC_GSS_SVC_PRIVACY: case RPC_GSS_SVC_PRIVACY:
stat = svcauth_gss_wrap_resp_priv(rqstp); stat = svcauth_gss_wrap_priv(rqstp);
if (stat) if (stat)
goto out_err; goto out_err;
break; break;
......
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