diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 558692d7e465..eeb1cce96649 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -1147,6 +1147,25 @@ out: | |||
1147 | return ret; | 1147 | return ret; |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | u32 * | ||
1151 | svcauth_gss_prepare_to_wrap(struct xdr_buf *resbuf, struct gss_svc_data *gsd) | ||
1152 | { | ||
1153 | u32 *p; | ||
1154 | |||
1155 | p = gsd->body_start; | ||
1156 | gsd->body_start = NULL; | ||
1157 | /* move accept_stat to right place: */ | ||
1158 | memcpy(p, p + 2, 4); | ||
1159 | /* Don't wrap in failure case: */ | ||
1160 | /* Counting on not getting here if call was not even accepted! */ | ||
1161 | if (*p != rpc_success) { | ||
1162 | resbuf->head[0].iov_len -= 2 * 4; | ||
1163 | return NULL; | ||
1164 | } | ||
1165 | p++; | ||
1166 | return p; | ||
1167 | } | ||
1168 | |||
1150 | static inline int | 1169 | static inline int |
1151 | svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | 1170 | svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) |
1152 | { | 1171 | { |
@@ -1160,17 +1179,9 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | |||
1160 | int integ_offset, integ_len; | 1179 | int integ_offset, integ_len; |
1161 | int stat = -EINVAL; | 1180 | int stat = -EINVAL; |
1162 | 1181 | ||
1163 | p = gsd->body_start; | 1182 | p = svcauth_gss_prepare_to_wrap(resbuf, gsd); |
1164 | gsd->body_start = NULL; | 1183 | if (p == NULL) |
1165 | /* move accept_stat to right place: */ | ||
1166 | memcpy(p, p + 2, 4); | ||
1167 | /* Don't wrap in failure case: */ | ||
1168 | /* Counting on not getting here if call was not even accepted! */ | ||
1169 | if (*p != rpc_success) { | ||
1170 | resbuf->head[0].iov_len -= 2 * 4; | ||
1171 | goto out; | 1184 | goto out; |
1172 | } | ||
1173 | p++; | ||
1174 | integ_offset = (u8 *)(p + 1) - (u8 *)resbuf->head[0].iov_base; | 1185 | integ_offset = (u8 *)(p + 1) - (u8 *)resbuf->head[0].iov_base; |
1175 | integ_len = resbuf->len - integ_offset; | 1186 | integ_len = resbuf->len - integ_offset; |
1176 | BUG_ON(integ_len % 4); | 1187 | BUG_ON(integ_len % 4); |
@@ -1222,17 +1233,9 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) | |||
1222 | int offset; | 1233 | int offset; |
1223 | int pad; | 1234 | int pad; |
1224 | 1235 | ||
1225 | p = gsd->body_start; | 1236 | p = svcauth_gss_prepare_to_wrap(resbuf, gsd); |
1226 | gsd->body_start = NULL; | 1237 | if (p == NULL) |
1227 | /* move accept_stat to right place: */ | ||
1228 | memcpy(p, p + 2, 4); | ||
1229 | /* Don't wrap in failure case: */ | ||
1230 | /* Counting on not getting here if call was not even accepted! */ | ||
1231 | if (*p != rpc_success) { | ||
1232 | resbuf->head[0].iov_len -= 2 * 4; | ||
1233 | return 0; | 1238 | return 0; |
1234 | } | ||
1235 | p++; | ||
1236 | len = p++; | 1239 | len = p++; |
1237 | offset = (u8 *)p - (u8 *)resbuf->head[0].iov_base; | 1240 | offset = (u8 *)p - (u8 *)resbuf->head[0].iov_base; |
1238 | *p++ = htonl(gc->gc_seq); | 1241 | *p++ = htonl(gc->gc_seq); |