|
17 | 17 | #include <linux/sunrpc/gss_api.h>
|
18 | 18 | #include <linux/spinlock.h>
|
19 | 19 |
|
| 20 | +#include <trace/events/sunrpc.h> |
| 21 | + |
20 | 22 | #define RPC_CREDCACHE_DEFAULT_HASHBITS (4)
|
21 | 23 | struct rpc_cred_cache {
|
22 | 24 | struct hlist_head *hashtable;
|
@@ -773,14 +775,6 @@ int rpcauth_marshcred(struct rpc_task *task, struct xdr_stream *xdr)
|
773 | 775 | return ops->crmarshal(task, xdr);
|
774 | 776 | }
|
775 | 777 |
|
776 |
| -__be32 * |
777 |
| -rpcauth_checkverf(struct rpc_task *task, __be32 *p) |
778 |
| -{ |
779 |
| - struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
780 |
| - |
781 |
| - return cred->cr_ops->crvalidate(task, p); |
782 |
| -} |
783 |
| - |
784 | 778 | /**
|
785 | 779 | * rpcauth_wrap_req_encode - XDR encode the RPC procedure
|
786 | 780 | * @task: controlling RPC task
|
@@ -814,27 +808,52 @@ int rpcauth_wrap_req(struct rpc_task *task, struct xdr_stream *xdr)
|
814 | 808 | return ops->crwrap_req(task, xdr);
|
815 | 809 | }
|
816 | 810 |
|
817 |
| -static int |
818 |
| -rpcauth_unwrap_req_decode(kxdrdproc_t decode, struct rpc_rqst *rqstp, |
819 |
| - __be32 *data, void *obj) |
| 811 | +/** |
| 812 | + * rpcauth_checkverf - Validate verifier in RPC Reply header |
| 813 | + * @task: controlling RPC task |
| 814 | + * @xdr: xdr_stream containing RPC Reply header |
| 815 | + * |
| 816 | + * On success, @xdr is updated to point past the verifier and |
| 817 | + * zero is returned. Otherwise, @xdr is in an undefined state |
| 818 | + * and a negative errno is returned. |
| 819 | + */ |
| 820 | +int |
| 821 | +rpcauth_checkverf(struct rpc_task *task, struct xdr_stream *xdr) |
820 | 822 | {
|
821 |
| - struct xdr_stream xdr; |
| 823 | + const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops; |
822 | 824 |
|
823 |
| - xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, data, rqstp); |
824 |
| - return decode(rqstp, &xdr, obj); |
| 825 | + return ops->crvalidate(task, xdr); |
825 | 826 | }
|
826 | 827 |
|
| 828 | +/** |
| 829 | + * rpcauth_unwrap_resp_decode - Invoke XDR decode function |
| 830 | + * @task: controlling RPC task |
| 831 | + * @xdr: stream where the Reply message resides |
| 832 | + * |
| 833 | + * Returns zero on success; otherwise a negative errno is returned. |
| 834 | + */ |
827 | 835 | int
|
828 |
| -rpcauth_unwrap_resp(struct rpc_task *task, kxdrdproc_t decode, void *rqstp, |
829 |
| - __be32 *data, void *obj) |
| 836 | +rpcauth_unwrap_resp_decode(struct rpc_task *task, struct xdr_stream *xdr) |
830 | 837 | {
|
831 |
| - struct rpc_cred *cred = task->tk_rqstp->rq_cred; |
| 838 | + kxdrdproc_t decode = task->tk_msg.rpc_proc->p_decode; |
| 839 | + |
| 840 | + return decode(task->tk_rqstp, xdr, task->tk_msg.rpc_resp); |
| 841 | +} |
| 842 | +EXPORT_SYMBOL_GPL(rpcauth_unwrap_resp_decode); |
| 843 | + |
| 844 | +/** |
| 845 | + * rpcauth_unwrap_resp - Invoke unwrap and decode function for the cred |
| 846 | + * @task: controlling RPC task |
| 847 | + * @xdr: stream where the Reply message resides |
| 848 | + * |
| 849 | + * Returns zero on success; otherwise a negative errno is returned. |
| 850 | + */ |
| 851 | +int |
| 852 | +rpcauth_unwrap_resp(struct rpc_task *task, struct xdr_stream *xdr) |
| 853 | +{ |
| 854 | + const struct rpc_credops *ops = task->tk_rqstp->rq_cred->cr_ops; |
832 | 855 |
|
833 |
| - if (cred->cr_ops->crunwrap_resp) |
834 |
| - return cred->cr_ops->crunwrap_resp(task, decode, rqstp, |
835 |
| - data, obj); |
836 |
| - /* By default, we decode the arguments normally. */ |
837 |
| - return rpcauth_unwrap_req_decode(decode, rqstp, data, obj); |
| 856 | + return ops->crunwrap_resp(task, xdr); |
838 | 857 | }
|
839 | 858 |
|
840 | 859 | bool
|
|
0 commit comments