Commit fcef2aff authored by Chuck Lever's avatar Chuck Lever

SUNRPC: Hoist init_encode out of svc_authenticate()

Now that each ->accept method has been converted, the
svcxdr_init_encode() calls can be hoisted back up into the generic
RPC server code.
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
parent 72a1e53a
...@@ -1589,8 +1589,6 @@ svcauth_gss_accept(struct svc_rqst *rqstp) ...@@ -1589,8 +1589,6 @@ svcauth_gss_accept(struct svc_rqst *rqstp)
int ret; int ret;
struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id); struct sunrpc_net *sn = net_generic(SVC_NET(rqstp), sunrpc_net_id);
svcxdr_init_encode(rqstp);
rqstp->rq_auth_stat = rpc_autherr_badcred; rqstp->rq_auth_stat = rpc_autherr_badcred;
if (!svcdata) if (!svcdata)
svcdata = kmalloc(sizeof(*svcdata), GFP_KERNEL); svcdata = kmalloc(sizeof(*svcdata), GFP_KERNEL);
......
...@@ -1262,6 +1262,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *resv) ...@@ -1262,6 +1262,8 @@ svc_process_common(struct svc_rqst *rqstp, struct kvec *resv)
if (rqstp->rq_prog == progp->pg_prog) if (rqstp->rq_prog == progp->pg_prog)
break; break;
svcxdr_init_encode(rqstp);
/* /*
* Decode auth data, and add verifier to reply buffer. * Decode auth data, and add verifier to reply buffer.
* We do this before anything else in order to get a decent * We do this before anything else in order to get a decent
......
...@@ -772,7 +772,6 @@ svcauth_null_accept(struct svc_rqst *rqstp) ...@@ -772,7 +772,6 @@ svcauth_null_accept(struct svc_rqst *rqstp)
if (cred->cr_group_info == NULL) if (cred->cr_group_info == NULL)
return SVC_CLOSE; /* kmalloc failure - client must retry */ return SVC_CLOSE; /* kmalloc failure - client must retry */
svcxdr_init_encode(rqstp);
if (xdr_stream_encode_opaque_auth(&rqstp->rq_res_stream, if (xdr_stream_encode_opaque_auth(&rqstp->rq_res_stream,
RPC_AUTH_NULL, NULL, 0) < 0) RPC_AUTH_NULL, NULL, 0) < 0)
return SVC_CLOSE; return SVC_CLOSE;
...@@ -855,7 +854,6 @@ svcauth_tls_accept(struct svc_rqst *rqstp) ...@@ -855,7 +854,6 @@ svcauth_tls_accept(struct svc_rqst *rqstp)
if (cred->cr_group_info == NULL) if (cred->cr_group_info == NULL)
return SVC_CLOSE; return SVC_CLOSE;
svcxdr_init_encode(rqstp);
if (rqstp->rq_xprt->xpt_ops->xpo_start_tls) { if (rqstp->rq_xprt->xpt_ops->xpo_start_tls) {
p = xdr_reserve_space(&rqstp->rq_res_stream, XDR_UNIT * 2 + 8); p = xdr_reserve_space(&rqstp->rq_res_stream, XDR_UNIT * 2 + 8);
if (!p) if (!p)
...@@ -959,7 +957,6 @@ svcauth_unix_accept(struct svc_rqst *rqstp) ...@@ -959,7 +957,6 @@ svcauth_unix_accept(struct svc_rqst *rqstp)
return SVC_DENIED; return SVC_DENIED;
} }
svcxdr_init_encode(rqstp);
if (xdr_stream_encode_opaque_auth(&rqstp->rq_res_stream, if (xdr_stream_encode_opaque_auth(&rqstp->rq_res_stream,
RPC_AUTH_NULL, NULL, 0) < 0) RPC_AUTH_NULL, NULL, 0) < 0)
return SVC_CLOSE; return SVC_CLOSE;
......
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