diff options
author | J. Bruce Fields <bfields@fieldses.org> | 2005-10-13 16:54:53 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2005-10-19 02:19:44 -0400 |
commit | 24b2605becc10ca63c4c30808fa59a8abbf68727 (patch) | |
tree | 64634bf6a5427f9a7253c9cb5b4d55550ef8b18d /net/sunrpc | |
parent | f3680312a737355ddf35c1b68af25e384d7ef0a8 (diff) |
RPCSEC_GSS: cleanup au_rslack calculation
Various xdr encode routines use au_rslack to guess where the reply argument
will end up, so we can set up the xdr_buf to recieve data into the right place
for zero copy.
Currently we calculate the au_rslack estimate when we check the verifier.
Normally this only depends on the verifier size. In the integrity case we add
a few bytes to allow for a length and sequence number.
It's a bit simpler to calculate only the verifier size when we check the
verifier, and delay the full calculation till we unwrap.
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index d2b08f16c257..dc95b797ca65 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -886,8 +886,6 @@ static u32 * | |||
886 | gss_validate(struct rpc_task *task, u32 *p) | 886 | gss_validate(struct rpc_task *task, u32 *p) |
887 | { | 887 | { |
888 | struct rpc_cred *cred = task->tk_msg.rpc_cred; | 888 | struct rpc_cred *cred = task->tk_msg.rpc_cred; |
889 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | ||
890 | gc_base); | ||
891 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 889 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
892 | u32 seq, qop_state; | 890 | u32 seq, qop_state; |
893 | struct kvec iov; | 891 | struct kvec iov; |
@@ -915,18 +913,9 @@ gss_validate(struct rpc_task *task, u32 *p) | |||
915 | cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; | 913 | cred->cr_flags &= ~RPCAUTH_CRED_UPTODATE; |
916 | if (maj_stat) | 914 | if (maj_stat) |
917 | goto out_bad; | 915 | goto out_bad; |
918 | switch (gss_cred->gc_service) { | 916 | /* We leave it to unwrap to calculate au_rslack. For now we just |
919 | case RPC_GSS_SVC_NONE: | 917 | * calculate the length of the verifier: */ |
920 | /* verifier data, flavor, length: */ | 918 | task->tk_auth->au_verfsize = XDR_QUADLEN(len) + 2; |
921 | task->tk_auth->au_rslack = XDR_QUADLEN(len) + 2; | ||
922 | break; | ||
923 | case RPC_GSS_SVC_INTEGRITY: | ||
924 | /* verifier data, flavor, length, length, sequence number: */ | ||
925 | task->tk_auth->au_rslack = XDR_QUADLEN(len) + 4; | ||
926 | break; | ||
927 | case RPC_GSS_SVC_PRIVACY: | ||
928 | goto out_bad; | ||
929 | } | ||
930 | gss_put_ctx(ctx); | 919 | gss_put_ctx(ctx); |
931 | dprintk("RPC: %4u GSS gss_validate: gss_verify_mic succeeded.\n", | 920 | dprintk("RPC: %4u GSS gss_validate: gss_verify_mic succeeded.\n", |
932 | task->tk_pid); | 921 | task->tk_pid); |
@@ -1067,6 +1056,7 @@ gss_unwrap_resp(struct rpc_task *task, | |||
1067 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, | 1056 | struct gss_cred *gss_cred = container_of(cred, struct gss_cred, |
1068 | gc_base); | 1057 | gc_base); |
1069 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); | 1058 | struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred); |
1059 | u32 *savedp = p; | ||
1070 | int status = -EIO; | 1060 | int status = -EIO; |
1071 | 1061 | ||
1072 | if (ctx->gc_proc != RPC_GSS_PROC_DATA) | 1062 | if (ctx->gc_proc != RPC_GSS_PROC_DATA) |
@@ -1082,6 +1072,8 @@ gss_unwrap_resp(struct rpc_task *task, | |||
1082 | case RPC_GSS_SVC_PRIVACY: | 1072 | case RPC_GSS_SVC_PRIVACY: |
1083 | break; | 1073 | break; |
1084 | } | 1074 | } |
1075 | /* take into account extra slack for integrity and privacy cases: */ | ||
1076 | task->tk_auth->au_rslack = task->tk_auth->au_verfsize + (p - savedp); | ||
1085 | out_decode: | 1077 | out_decode: |
1086 | status = decode(rqstp, p, obj); | 1078 | status = decode(rqstp, p, obj); |
1087 | out: | 1079 | out: |