diff options
-rw-r--r-- | include/linux/sunrpc/svc.h | 31 | ||||
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 52 | ||||
-rw-r--r-- | net/sunrpc/svc.c | 44 | ||||
-rw-r--r-- | net/sunrpc/svcauth.c | 2 | ||||
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 22 |
5 files changed, 84 insertions, 67 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index 7b27c09b5604..5df1d319f5d5 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h | |||
@@ -78,28 +78,45 @@ struct svc_serv { | |||
78 | */ | 78 | */ |
79 | #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) | 79 | #define RPCSVC_MAXPAGES ((RPCSVC_MAXPAYLOAD+PAGE_SIZE-1)/PAGE_SIZE + 2) |
80 | 80 | ||
81 | static inline u32 svc_getu32(struct kvec *iov) | 81 | static inline u32 svc_getnl(struct kvec *iov) |
82 | { | 82 | { |
83 | u32 val, *vp; | 83 | __be32 val, *vp; |
84 | vp = iov->iov_base; | 84 | vp = iov->iov_base; |
85 | val = *vp++; | 85 | val = *vp++; |
86 | iov->iov_base = (void*)vp; | 86 | iov->iov_base = (void*)vp; |
87 | iov->iov_len -= sizeof(u32); | 87 | iov->iov_len -= sizeof(__be32); |
88 | return ntohl(val); | ||
89 | } | ||
90 | |||
91 | static inline void svc_putnl(struct kvec *iov, u32 val) | ||
92 | { | ||
93 | __be32 *vp = iov->iov_base + iov->iov_len; | ||
94 | *vp = htonl(val); | ||
95 | iov->iov_len += sizeof(__be32); | ||
96 | } | ||
97 | |||
98 | static inline __be32 svc_getu32(struct kvec *iov) | ||
99 | { | ||
100 | __be32 val, *vp; | ||
101 | vp = iov->iov_base; | ||
102 | val = *vp++; | ||
103 | iov->iov_base = (void*)vp; | ||
104 | iov->iov_len -= sizeof(__be32); | ||
88 | return val; | 105 | return val; |
89 | } | 106 | } |
90 | 107 | ||
91 | static inline void svc_ungetu32(struct kvec *iov) | 108 | static inline void svc_ungetu32(struct kvec *iov) |
92 | { | 109 | { |
93 | u32 *vp = (u32 *)iov->iov_base; | 110 | __be32 *vp = (__be32 *)iov->iov_base; |
94 | iov->iov_base = (void *)(vp - 1); | 111 | iov->iov_base = (void *)(vp - 1); |
95 | iov->iov_len += sizeof(*vp); | 112 | iov->iov_len += sizeof(*vp); |
96 | } | 113 | } |
97 | 114 | ||
98 | static inline void svc_putu32(struct kvec *iov, u32 val) | 115 | static inline void svc_putu32(struct kvec *iov, __be32 val) |
99 | { | 116 | { |
100 | u32 *vp = iov->iov_base + iov->iov_len; | 117 | __be32 *vp = iov->iov_base + iov->iov_len; |
101 | *vp = val; | 118 | *vp = val; |
102 | iov->iov_len += sizeof(u32); | 119 | iov->iov_len += sizeof(__be32); |
103 | } | 120 | } |
104 | 121 | ||
105 | 122 | ||
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 94217ec9e2dd..cd3d77ca3a31 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
@@ -607,7 +607,7 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o) | |||
607 | 607 | ||
608 | if (argv->iov_len < 4) | 608 | if (argv->iov_len < 4) |
609 | return -1; | 609 | return -1; |
610 | o->len = ntohl(svc_getu32(argv)); | 610 | o->len = svc_getnl(argv); |
611 | l = round_up_to_quad(o->len); | 611 | l = round_up_to_quad(o->len); |
612 | if (argv->iov_len < l) | 612 | if (argv->iov_len < l) |
613 | return -1; | 613 | return -1; |
@@ -624,7 +624,7 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) | |||
624 | 624 | ||
625 | if (resv->iov_len + 4 > PAGE_SIZE) | 625 | if (resv->iov_len + 4 > PAGE_SIZE) |
626 | return -1; | 626 | return -1; |
627 | svc_putu32(resv, htonl(o->len)); | 627 | svc_putnl(resv, o->len); |
628 | p = resv->iov_base + resv->iov_len; | 628 | p = resv->iov_base + resv->iov_len; |
629 | resv->iov_len += round_up_to_quad(o->len); | 629 | resv->iov_len += round_up_to_quad(o->len); |
630 | if (resv->iov_len > PAGE_SIZE) | 630 | if (resv->iov_len > PAGE_SIZE) |
@@ -657,7 +657,7 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | |||
657 | *authp = rpc_autherr_badverf; | 657 | *authp = rpc_autherr_badverf; |
658 | if (argv->iov_len < 4) | 658 | if (argv->iov_len < 4) |
659 | return SVC_DENIED; | 659 | return SVC_DENIED; |
660 | flavor = ntohl(svc_getu32(argv)); | 660 | flavor = svc_getnl(argv); |
661 | if (flavor != RPC_AUTH_GSS) | 661 | if (flavor != RPC_AUTH_GSS) |
662 | return SVC_DENIED; | 662 | return SVC_DENIED; |
663 | if (svc_safe_getnetobj(argv, &checksum)) | 663 | if (svc_safe_getnetobj(argv, &checksum)) |
@@ -689,7 +689,7 @@ gss_write_null_verf(struct svc_rqst *rqstp) | |||
689 | { | 689 | { |
690 | u32 *p; | 690 | u32 *p; |
691 | 691 | ||
692 | svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_NULL)); | 692 | svc_putnl(rqstp->rq_res.head, RPC_AUTH_NULL); |
693 | p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len; | 693 | p = rqstp->rq_res.head->iov_base + rqstp->rq_res.head->iov_len; |
694 | /* don't really need to check if head->iov_len > PAGE_SIZE ... */ | 694 | /* don't really need to check if head->iov_len > PAGE_SIZE ... */ |
695 | *p++ = 0; | 695 | *p++ = 0; |
@@ -708,7 +708,7 @@ gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq) | |||
708 | u32 *p; | 708 | u32 *p; |
709 | struct kvec iov; | 709 | struct kvec iov; |
710 | 710 | ||
711 | svc_putu32(rqstp->rq_res.head, htonl(RPC_AUTH_GSS)); | 711 | svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS); |
712 | xdr_seq = htonl(seq); | 712 | xdr_seq = htonl(seq); |
713 | 713 | ||
714 | iov.iov_base = &xdr_seq; | 714 | iov.iov_base = &xdr_seq; |
@@ -805,7 +805,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx) | |||
805 | struct xdr_netobj mic; | 805 | struct xdr_netobj mic; |
806 | struct xdr_buf integ_buf; | 806 | struct xdr_buf integ_buf; |
807 | 807 | ||
808 | integ_len = ntohl(svc_getu32(&buf->head[0])); | 808 | integ_len = svc_getnl(&buf->head[0]); |
809 | if (integ_len & 3) | 809 | if (integ_len & 3) |
810 | goto out; | 810 | goto out; |
811 | if (integ_len > buf->len) | 811 | if (integ_len > buf->len) |
@@ -825,7 +825,7 @@ unwrap_integ_data(struct xdr_buf *buf, u32 seq, struct gss_ctx *ctx) | |||
825 | maj_stat = gss_verify_mic(ctx, &integ_buf, &mic); | 825 | maj_stat = gss_verify_mic(ctx, &integ_buf, &mic); |
826 | if (maj_stat != GSS_S_COMPLETE) | 826 | if (maj_stat != GSS_S_COMPLETE) |
827 | goto out; | 827 | goto out; |
828 | if (ntohl(svc_getu32(&buf->head[0])) != seq) | 828 | if (svc_getnl(&buf->head[0]) != seq) |
829 | goto out; | 829 | goto out; |
830 | stat = 0; | 830 | stat = 0; |
831 | out: | 831 | out: |
@@ -857,7 +857,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs | |||
857 | 857 | ||
858 | rqstp->rq_sendfile_ok = 0; | 858 | rqstp->rq_sendfile_ok = 0; |
859 | 859 | ||
860 | priv_len = ntohl(svc_getu32(&buf->head[0])); | 860 | priv_len = svc_getnl(&buf->head[0]); |
861 | if (rqstp->rq_deferred) { | 861 | if (rqstp->rq_deferred) { |
862 | /* Already decrypted last time through! The sequence number | 862 | /* Already decrypted last time through! The sequence number |
863 | * check at out_seq is unnecessary but harmless: */ | 863 | * check at out_seq is unnecessary but harmless: */ |
@@ -895,7 +895,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs | |||
895 | if (maj_stat != GSS_S_COMPLETE) | 895 | if (maj_stat != GSS_S_COMPLETE) |
896 | return -EINVAL; | 896 | return -EINVAL; |
897 | out_seq: | 897 | out_seq: |
898 | if (ntohl(svc_getu32(&buf->head[0])) != seq) | 898 | if (svc_getnl(&buf->head[0]) != seq) |
899 | return -EINVAL; | 899 | return -EINVAL; |
900 | return 0; | 900 | return 0; |
901 | } | 901 | } |
@@ -985,12 +985,12 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
985 | 985 | ||
986 | if (argv->iov_len < 5 * 4) | 986 | if (argv->iov_len < 5 * 4) |
987 | goto auth_err; | 987 | goto auth_err; |
988 | crlen = ntohl(svc_getu32(argv)); | 988 | crlen = svc_getnl(argv); |
989 | if (ntohl(svc_getu32(argv)) != RPC_GSS_VERSION) | 989 | if (svc_getnl(argv) != RPC_GSS_VERSION) |
990 | goto auth_err; | 990 | goto auth_err; |
991 | gc->gc_proc = ntohl(svc_getu32(argv)); | 991 | gc->gc_proc = svc_getnl(argv); |
992 | gc->gc_seq = ntohl(svc_getu32(argv)); | 992 | gc->gc_seq = svc_getnl(argv); |
993 | gc->gc_svc = ntohl(svc_getu32(argv)); | 993 | gc->gc_svc = svc_getnl(argv); |
994 | if (svc_safe_getnetobj(argv, &gc->gc_ctx)) | 994 | if (svc_safe_getnetobj(argv, &gc->gc_ctx)) |
995 | goto auth_err; | 995 | goto auth_err; |
996 | if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4) | 996 | if (crlen != round_up_to_quad(gc->gc_ctx.len) + 5 * 4) |
@@ -1016,9 +1016,9 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1016 | case RPC_GSS_PROC_CONTINUE_INIT: | 1016 | case RPC_GSS_PROC_CONTINUE_INIT: |
1017 | if (argv->iov_len < 2 * 4) | 1017 | if (argv->iov_len < 2 * 4) |
1018 | goto auth_err; | 1018 | goto auth_err; |
1019 | if (ntohl(svc_getu32(argv)) != RPC_AUTH_NULL) | 1019 | if (svc_getnl(argv) != RPC_AUTH_NULL) |
1020 | goto auth_err; | 1020 | goto auth_err; |
1021 | if (ntohl(svc_getu32(argv)) != 0) | 1021 | if (svc_getnl(argv) != 0) |
1022 | goto auth_err; | 1022 | goto auth_err; |
1023 | break; | 1023 | break; |
1024 | case RPC_GSS_PROC_DATA: | 1024 | case RPC_GSS_PROC_DATA: |
@@ -1076,14 +1076,14 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1076 | goto drop; | 1076 | goto drop; |
1077 | if (resv->iov_len + 4 > PAGE_SIZE) | 1077 | if (resv->iov_len + 4 > PAGE_SIZE) |
1078 | goto drop; | 1078 | goto drop; |
1079 | svc_putu32(resv, rpc_success); | 1079 | svc_putnl(resv, RPC_SUCCESS); |
1080 | if (svc_safe_putnetobj(resv, &rsip->out_handle)) | 1080 | if (svc_safe_putnetobj(resv, &rsip->out_handle)) |
1081 | goto drop; | 1081 | goto drop; |
1082 | if (resv->iov_len + 3 * 4 > PAGE_SIZE) | 1082 | if (resv->iov_len + 3 * 4 > PAGE_SIZE) |
1083 | goto drop; | 1083 | goto drop; |
1084 | svc_putu32(resv, htonl(rsip->major_status)); | 1084 | svc_putnl(resv, rsip->major_status); |
1085 | svc_putu32(resv, htonl(rsip->minor_status)); | 1085 | svc_putnl(resv, rsip->minor_status); |
1086 | svc_putu32(resv, htonl(GSS_SEQ_WIN)); | 1086 | svc_putnl(resv, GSS_SEQ_WIN); |
1087 | if (svc_safe_putnetobj(resv, &rsip->out_token)) | 1087 | if (svc_safe_putnetobj(resv, &rsip->out_token)) |
1088 | goto drop; | 1088 | goto drop; |
1089 | rqstp->rq_client = NULL; | 1089 | rqstp->rq_client = NULL; |
@@ -1093,7 +1093,7 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1093 | set_bit(CACHE_NEGATIVE, &rsci->h.flags); | 1093 | set_bit(CACHE_NEGATIVE, &rsci->h.flags); |
1094 | if (resv->iov_len + 4 > PAGE_SIZE) | 1094 | if (resv->iov_len + 4 > PAGE_SIZE) |
1095 | goto drop; | 1095 | goto drop; |
1096 | svc_putu32(resv, rpc_success); | 1096 | svc_putnl(resv, RPC_SUCCESS); |
1097 | goto complete; | 1097 | goto complete; |
1098 | case RPC_GSS_PROC_DATA: | 1098 | case RPC_GSS_PROC_DATA: |
1099 | *authp = rpcsec_gsserr_ctxproblem; | 1099 | *authp = rpcsec_gsserr_ctxproblem; |
@@ -1111,8 +1111,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1111 | goto auth_err; | 1111 | goto auth_err; |
1112 | /* placeholders for length and seq. number: */ | 1112 | /* placeholders for length and seq. number: */ |
1113 | svcdata->body_start = resv->iov_base + resv->iov_len; | 1113 | svcdata->body_start = resv->iov_base + resv->iov_len; |
1114 | svc_putu32(resv, 0); | 1114 | svc_putnl(resv, 0); |
1115 | svc_putu32(resv, 0); | 1115 | svc_putnl(resv, 0); |
1116 | break; | 1116 | break; |
1117 | case RPC_GSS_SVC_PRIVACY: | 1117 | case RPC_GSS_SVC_PRIVACY: |
1118 | if (unwrap_priv_data(rqstp, &rqstp->rq_arg, | 1118 | if (unwrap_priv_data(rqstp, &rqstp->rq_arg, |
@@ -1120,8 +1120,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
1120 | goto auth_err; | 1120 | goto auth_err; |
1121 | /* placeholders for length and seq. number: */ | 1121 | /* placeholders for length and seq. number: */ |
1122 | svcdata->body_start = resv->iov_base + resv->iov_len; | 1122 | svcdata->body_start = resv->iov_base + resv->iov_len; |
1123 | svc_putu32(resv, 0); | 1123 | svc_putnl(resv, 0); |
1124 | svc_putu32(resv, 0); | 1124 | svc_putnl(resv, 0); |
1125 | break; | 1125 | break; |
1126 | default: | 1126 | default: |
1127 | goto auth_err; | 1127 | goto auth_err; |
@@ -1199,7 +1199,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | |||
1199 | mic.data = (u8 *)resv->iov_base + resv->iov_len + 4; | 1199 | mic.data = (u8 *)resv->iov_base + resv->iov_len + 4; |
1200 | if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic)) | 1200 | if (gss_get_mic(gsd->rsci->mechctx, &integ_buf, &mic)) |
1201 | goto out_err; | 1201 | goto out_err; |
1202 | svc_putu32(resv, htonl(mic.len)); | 1202 | svc_putnl(resv, mic.len); |
1203 | memset(mic.data + mic.len, 0, | 1203 | memset(mic.data + mic.len, 0, |
1204 | round_up_to_quad(mic.len) - mic.len); | 1204 | round_up_to_quad(mic.len) - mic.len); |
1205 | resv->iov_len += XDR_QUADLEN(mic.len) << 2; | 1205 | resv->iov_len += XDR_QUADLEN(mic.len) << 2; |
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c index b76a227dd3ad..6589e1ad47fa 100644 --- a/net/sunrpc/svc.c +++ b/net/sunrpc/svc.c | |||
@@ -284,16 +284,16 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
284 | rqstp->rq_sendfile_ok = 1; | 284 | rqstp->rq_sendfile_ok = 1; |
285 | /* tcp needs a space for the record length... */ | 285 | /* tcp needs a space for the record length... */ |
286 | if (rqstp->rq_prot == IPPROTO_TCP) | 286 | if (rqstp->rq_prot == IPPROTO_TCP) |
287 | svc_putu32(resv, 0); | 287 | svc_putnl(resv, 0); |
288 | 288 | ||
289 | rqstp->rq_xid = svc_getu32(argv); | 289 | rqstp->rq_xid = svc_getu32(argv); |
290 | svc_putu32(resv, rqstp->rq_xid); | 290 | svc_putu32(resv, rqstp->rq_xid); |
291 | 291 | ||
292 | dir = ntohl(svc_getu32(argv)); | 292 | dir = svc_getnl(argv); |
293 | vers = ntohl(svc_getu32(argv)); | 293 | vers = svc_getnl(argv); |
294 | 294 | ||
295 | /* First words of reply: */ | 295 | /* First words of reply: */ |
296 | svc_putu32(resv, xdr_one); /* REPLY */ | 296 | svc_putnl(resv, 1); /* REPLY */ |
297 | 297 | ||
298 | if (dir != 0) /* direction != CALL */ | 298 | if (dir != 0) /* direction != CALL */ |
299 | goto err_bad_dir; | 299 | goto err_bad_dir; |
@@ -303,11 +303,11 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
303 | /* Save position in case we later decide to reject: */ | 303 | /* Save position in case we later decide to reject: */ |
304 | accept_statp = resv->iov_base + resv->iov_len; | 304 | accept_statp = resv->iov_base + resv->iov_len; |
305 | 305 | ||
306 | svc_putu32(resv, xdr_zero); /* ACCEPT */ | 306 | svc_putnl(resv, 0); /* ACCEPT */ |
307 | 307 | ||
308 | rqstp->rq_prog = prog = ntohl(svc_getu32(argv)); /* program number */ | 308 | rqstp->rq_prog = prog = svc_getnl(argv); /* program number */ |
309 | rqstp->rq_vers = vers = ntohl(svc_getu32(argv)); /* version number */ | 309 | rqstp->rq_vers = vers = svc_getnl(argv); /* version number */ |
310 | rqstp->rq_proc = proc = ntohl(svc_getu32(argv)); /* procedure number */ | 310 | rqstp->rq_proc = proc = svc_getnl(argv); /* procedure number */ |
311 | 311 | ||
312 | progp = serv->sv_program; | 312 | progp = serv->sv_program; |
313 | 313 | ||
@@ -361,7 +361,7 @@ svc_process(struct svc_serv *serv, struct svc_rqst *rqstp) | |||
361 | 361 | ||
362 | /* Build the reply header. */ | 362 | /* Build the reply header. */ |
363 | statp = resv->iov_base +resv->iov_len; | 363 | statp = resv->iov_base +resv->iov_len; |
364 | svc_putu32(resv, rpc_success); /* RPC_SUCCESS */ | 364 | svc_putnl(resv, RPC_SUCCESS); |
365 | 365 | ||
366 | /* Bump per-procedure stats counter */ | 366 | /* Bump per-procedure stats counter */ |
367 | procp->pc_count++; | 367 | procp->pc_count++; |
@@ -439,10 +439,10 @@ err_bad_dir: | |||
439 | 439 | ||
440 | err_bad_rpc: | 440 | err_bad_rpc: |
441 | serv->sv_stats->rpcbadfmt++; | 441 | serv->sv_stats->rpcbadfmt++; |
442 | svc_putu32(resv, xdr_one); /* REJECT */ | 442 | svc_putnl(resv, 1); /* REJECT */ |
443 | svc_putu32(resv, xdr_zero); /* RPC_MISMATCH */ | 443 | svc_putnl(resv, 0); /* RPC_MISMATCH */ |
444 | svc_putu32(resv, xdr_two); /* Only RPCv2 supported */ | 444 | svc_putnl(resv, 2); /* Only RPCv2 supported */ |
445 | svc_putu32(resv, xdr_two); | 445 | svc_putnl(resv, 2); |
446 | goto sendit; | 446 | goto sendit; |
447 | 447 | ||
448 | err_bad_auth: | 448 | err_bad_auth: |
@@ -450,15 +450,15 @@ err_bad_auth: | |||
450 | serv->sv_stats->rpcbadauth++; | 450 | serv->sv_stats->rpcbadauth++; |
451 | /* Restore write pointer to location of accept status: */ | 451 | /* Restore write pointer to location of accept status: */ |
452 | xdr_ressize_check(rqstp, accept_statp); | 452 | xdr_ressize_check(rqstp, accept_statp); |
453 | svc_putu32(resv, xdr_one); /* REJECT */ | 453 | svc_putnl(resv, 1); /* REJECT */ |
454 | svc_putu32(resv, xdr_one); /* AUTH_ERROR */ | 454 | svc_putnl(resv, 1); /* AUTH_ERROR */ |
455 | svc_putu32(resv, auth_stat); /* status */ | 455 | svc_putnl(resv, ntohl(auth_stat)); /* status */ |
456 | goto sendit; | 456 | goto sendit; |
457 | 457 | ||
458 | err_bad_prog: | 458 | err_bad_prog: |
459 | dprintk("svc: unknown program %d\n", prog); | 459 | dprintk("svc: unknown program %d\n", prog); |
460 | serv->sv_stats->rpcbadfmt++; | 460 | serv->sv_stats->rpcbadfmt++; |
461 | svc_putu32(resv, rpc_prog_unavail); | 461 | svc_putnl(resv, RPC_PROG_UNAVAIL); |
462 | goto sendit; | 462 | goto sendit; |
463 | 463 | ||
464 | err_bad_vers: | 464 | err_bad_vers: |
@@ -466,9 +466,9 @@ err_bad_vers: | |||
466 | printk("svc: unknown version (%d)\n", vers); | 466 | printk("svc: unknown version (%d)\n", vers); |
467 | #endif | 467 | #endif |
468 | serv->sv_stats->rpcbadfmt++; | 468 | serv->sv_stats->rpcbadfmt++; |
469 | svc_putu32(resv, rpc_prog_mismatch); | 469 | svc_putnl(resv, RPC_PROG_MISMATCH); |
470 | svc_putu32(resv, htonl(progp->pg_lovers)); | 470 | svc_putnl(resv, progp->pg_lovers); |
471 | svc_putu32(resv, htonl(progp->pg_hivers)); | 471 | svc_putnl(resv, progp->pg_hivers); |
472 | goto sendit; | 472 | goto sendit; |
473 | 473 | ||
474 | err_bad_proc: | 474 | err_bad_proc: |
@@ -476,7 +476,7 @@ err_bad_proc: | |||
476 | printk("svc: unknown procedure (%d)\n", proc); | 476 | printk("svc: unknown procedure (%d)\n", proc); |
477 | #endif | 477 | #endif |
478 | serv->sv_stats->rpcbadfmt++; | 478 | serv->sv_stats->rpcbadfmt++; |
479 | svc_putu32(resv, rpc_proc_unavail); | 479 | svc_putnl(resv, RPC_PROC_UNAVAIL); |
480 | goto sendit; | 480 | goto sendit; |
481 | 481 | ||
482 | err_garbage: | 482 | err_garbage: |
@@ -486,6 +486,6 @@ err_garbage: | |||
486 | rpc_stat = rpc_garbage_args; | 486 | rpc_stat = rpc_garbage_args; |
487 | err_bad: | 487 | err_bad: |
488 | serv->sv_stats->rpcbadfmt++; | 488 | serv->sv_stats->rpcbadfmt++; |
489 | svc_putu32(resv, rpc_stat); | 489 | svc_putnl(resv, ntohl(rpc_stat)); |
490 | goto sendit; | 490 | goto sendit; |
491 | } | 491 | } |
diff --git a/net/sunrpc/svcauth.c b/net/sunrpc/svcauth.c index 5b28c6176806..3f4d1f622de8 100644 --- a/net/sunrpc/svcauth.c +++ b/net/sunrpc/svcauth.c | |||
@@ -42,7 +42,7 @@ svc_authenticate(struct svc_rqst *rqstp, u32 *authp) | |||
42 | 42 | ||
43 | *authp = rpc_auth_ok; | 43 | *authp = rpc_auth_ok; |
44 | 44 | ||
45 | flavor = ntohl(svc_getu32(&rqstp->rq_arg.head[0])); | 45 | flavor = svc_getnl(&rqstp->rq_arg.head[0]); |
46 | 46 | ||
47 | dprintk("svc: svc_authenticate (%d)\n", flavor); | 47 | dprintk("svc: svc_authenticate (%d)\n", flavor); |
48 | 48 | ||
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index 7e5707e2d6b6..27f443b44af8 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -427,7 +427,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp) | |||
427 | *authp = rpc_autherr_badcred; | 427 | *authp = rpc_autherr_badcred; |
428 | return SVC_DENIED; | 428 | return SVC_DENIED; |
429 | } | 429 | } |
430 | if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) { | 430 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
431 | dprintk("svc: bad null verf\n"); | 431 | dprintk("svc: bad null verf\n"); |
432 | *authp = rpc_autherr_badverf; | 432 | *authp = rpc_autherr_badverf; |
433 | return SVC_DENIED; | 433 | return SVC_DENIED; |
@@ -441,8 +441,8 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp) | |||
441 | return SVC_DROP; /* kmalloc failure - client must retry */ | 441 | return SVC_DROP; /* kmalloc failure - client must retry */ |
442 | 442 | ||
443 | /* Put NULL verifier */ | 443 | /* Put NULL verifier */ |
444 | svc_putu32(resv, RPC_AUTH_NULL); | 444 | svc_putnl(resv, RPC_AUTH_NULL); |
445 | svc_putu32(resv, 0); | 445 | svc_putnl(resv, 0); |
446 | 446 | ||
447 | return SVC_OK; | 447 | return SVC_OK; |
448 | } | 448 | } |
@@ -488,31 +488,31 @@ svcauth_unix_accept(struct svc_rqst *rqstp, u32 *authp) | |||
488 | 488 | ||
489 | svc_getu32(argv); /* length */ | 489 | svc_getu32(argv); /* length */ |
490 | svc_getu32(argv); /* time stamp */ | 490 | svc_getu32(argv); /* time stamp */ |
491 | slen = XDR_QUADLEN(ntohl(svc_getu32(argv))); /* machname length */ | 491 | slen = XDR_QUADLEN(svc_getnl(argv)); /* machname length */ |
492 | if (slen > 64 || (len -= (slen + 3)*4) < 0) | 492 | if (slen > 64 || (len -= (slen + 3)*4) < 0) |
493 | goto badcred; | 493 | goto badcred; |
494 | argv->iov_base = (void*)((u32*)argv->iov_base + slen); /* skip machname */ | 494 | argv->iov_base = (void*)((u32*)argv->iov_base + slen); /* skip machname */ |
495 | argv->iov_len -= slen*4; | 495 | argv->iov_len -= slen*4; |
496 | 496 | ||
497 | cred->cr_uid = ntohl(svc_getu32(argv)); /* uid */ | 497 | cred->cr_uid = svc_getnl(argv); /* uid */ |
498 | cred->cr_gid = ntohl(svc_getu32(argv)); /* gid */ | 498 | cred->cr_gid = svc_getnl(argv); /* gid */ |
499 | slen = ntohl(svc_getu32(argv)); /* gids length */ | 499 | slen = svc_getnl(argv); /* gids length */ |
500 | if (slen > 16 || (len -= (slen + 2)*4) < 0) | 500 | if (slen > 16 || (len -= (slen + 2)*4) < 0) |
501 | goto badcred; | 501 | goto badcred; |
502 | cred->cr_group_info = groups_alloc(slen); | 502 | cred->cr_group_info = groups_alloc(slen); |
503 | if (cred->cr_group_info == NULL) | 503 | if (cred->cr_group_info == NULL) |
504 | return SVC_DROP; | 504 | return SVC_DROP; |
505 | for (i = 0; i < slen; i++) | 505 | for (i = 0; i < slen; i++) |
506 | GROUP_AT(cred->cr_group_info, i) = ntohl(svc_getu32(argv)); | 506 | GROUP_AT(cred->cr_group_info, i) = svc_getnl(argv); |
507 | 507 | ||
508 | if (svc_getu32(argv) != RPC_AUTH_NULL || svc_getu32(argv) != 0) { | 508 | if (svc_getu32(argv) != htonl(RPC_AUTH_NULL) || svc_getu32(argv) != 0) { |
509 | *authp = rpc_autherr_badverf; | 509 | *authp = rpc_autherr_badverf; |
510 | return SVC_DENIED; | 510 | return SVC_DENIED; |
511 | } | 511 | } |
512 | 512 | ||
513 | /* Put NULL verifier */ | 513 | /* Put NULL verifier */ |
514 | svc_putu32(resv, RPC_AUTH_NULL); | 514 | svc_putnl(resv, RPC_AUTH_NULL); |
515 | svc_putu32(resv, 0); | 515 | svc_putnl(resv, 0); |
516 | 516 | ||
517 | return SVC_OK; | 517 | return SVC_OK; |
518 | 518 | ||