diff options
Diffstat (limited to 'net/sunrpc/auth_gss/svcauth_gss.c')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 94217ec9e2dd..638c0b576203 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; |
@@ -620,17 +620,17 @@ svc_safe_getnetobj(struct kvec *argv, struct xdr_netobj *o) | |||
620 | static inline int | 620 | static inline int |
621 | svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) | 621 | svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) |
622 | { | 622 | { |
623 | u32 *p; | 623 | u8 *p; |
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) |
631 | return -1; | 631 | return -1; |
632 | memcpy(p, o->data, o->len); | 632 | memcpy(p, o->data, o->len); |
633 | memset((u8 *)p + o->len, 0, round_up_to_quad(o->len) - o->len); | 633 | memset(p + o->len, 0, round_up_to_quad(o->len) - o->len); |
634 | return 0; | 634 | return 0; |
635 | } | 635 | } |
636 | 636 | ||
@@ -640,7 +640,7 @@ svc_safe_putnetobj(struct kvec *resv, struct xdr_netobj *o) | |||
640 | */ | 640 | */ |
641 | static int | 641 | static int |
642 | gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | 642 | gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, |
643 | u32 *rpcstart, struct rpc_gss_wire_cred *gc, u32 *authp) | 643 | __be32 *rpcstart, struct rpc_gss_wire_cred *gc, __be32 *authp) |
644 | { | 644 | { |
645 | struct gss_ctx *ctx_id = rsci->mechctx; | 645 | struct gss_ctx *ctx_id = rsci->mechctx; |
646 | struct xdr_buf rpchdr; | 646 | struct xdr_buf rpchdr; |
@@ -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)) |
@@ -687,9 +687,9 @@ gss_verify_header(struct svc_rqst *rqstp, struct rsc *rsci, | |||
687 | static int | 687 | static int |
688 | gss_write_null_verf(struct svc_rqst *rqstp) | 688 | gss_write_null_verf(struct svc_rqst *rqstp) |
689 | { | 689 | { |
690 | u32 *p; | 690 | __be32 *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; |
@@ -701,14 +701,14 @@ gss_write_null_verf(struct svc_rqst *rqstp) | |||
701 | static int | 701 | static int |
702 | gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq) | 702 | gss_write_verf(struct svc_rqst *rqstp, struct gss_ctx *ctx_id, u32 seq) |
703 | { | 703 | { |
704 | u32 xdr_seq; | 704 | __be32 xdr_seq; |
705 | u32 maj_stat; | 705 | u32 maj_stat; |
706 | struct xdr_buf verf_data; | 706 | struct xdr_buf verf_data; |
707 | struct xdr_netobj mic; | 707 | struct xdr_netobj mic; |
708 | u32 *p; | 708 | __be32 *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; |
@@ -782,7 +782,7 @@ EXPORT_SYMBOL(svcauth_gss_register_pseudoflavor); | |||
782 | static inline int | 782 | static inline int |
783 | read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj) | 783 | read_u32_from_xdr_buf(struct xdr_buf *buf, int base, u32 *obj) |
784 | { | 784 | { |
785 | u32 raw; | 785 | __be32 raw; |
786 | int status; | 786 | int status; |
787 | 787 | ||
788 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); | 788 | status = read_bytes_from_xdr_buf(buf, base, &raw, sizeof(*obj)); |
@@ -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 | } |
@@ -905,7 +905,7 @@ struct gss_svc_data { | |||
905 | struct rpc_gss_wire_cred clcred; | 905 | struct rpc_gss_wire_cred clcred; |
906 | /* pointer to the beginning of the procedure-specific results, | 906 | /* pointer to the beginning of the procedure-specific results, |
907 | * which may be encrypted/checksummed in svcauth_gss_release: */ | 907 | * which may be encrypted/checksummed in svcauth_gss_release: */ |
908 | u32 *body_start; | 908 | __be32 *body_start; |
909 | struct rsc *rsci; | 909 | struct rsc *rsci; |
910 | }; | 910 | }; |
911 | 911 | ||
@@ -946,7 +946,7 @@ gss_write_init_verf(struct svc_rqst *rqstp, struct rsi *rsip) | |||
946 | * response here and return SVC_COMPLETE. | 946 | * response here and return SVC_COMPLETE. |
947 | */ | 947 | */ |
948 | static int | 948 | static int |
949 | svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | 949 | svcauth_gss_accept(struct svc_rqst *rqstp, __be32 *authp) |
950 | { | 950 | { |
951 | struct kvec *argv = &rqstp->rq_arg.head[0]; | 951 | struct kvec *argv = &rqstp->rq_arg.head[0]; |
952 | struct kvec *resv = &rqstp->rq_res.head[0]; | 952 | struct kvec *resv = &rqstp->rq_res.head[0]; |
@@ -956,8 +956,8 @@ svcauth_gss_accept(struct svc_rqst *rqstp, u32 *authp) | |||
956 | struct rpc_gss_wire_cred *gc; | 956 | struct rpc_gss_wire_cred *gc; |
957 | struct rsc *rsci = NULL; | 957 | struct rsc *rsci = NULL; |
958 | struct rsi *rsip, rsikey; | 958 | struct rsi *rsip, rsikey; |
959 | u32 *rpcstart; | 959 | __be32 *rpcstart; |
960 | u32 *reject_stat = resv->iov_base + resv->iov_len; | 960 | __be32 *reject_stat = resv->iov_base + resv->iov_len; |
961 | int ret; | 961 | int ret; |
962 | 962 | ||
963 | dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len); | 963 | dprintk("RPC: svcauth_gss: argv->iov_len = %zd\n",argv->iov_len); |
@@ -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; |
@@ -1156,7 +1156,7 @@ svcauth_gss_wrap_resp_integ(struct svc_rqst *rqstp) | |||
1156 | struct xdr_buf integ_buf; | 1156 | struct xdr_buf integ_buf; |
1157 | struct xdr_netobj mic; | 1157 | struct xdr_netobj mic; |
1158 | struct kvec *resv; | 1158 | struct kvec *resv; |
1159 | u32 *p; | 1159 | __be32 *p; |
1160 | int integ_offset, integ_len; | 1160 | int integ_offset, integ_len; |
1161 | int stat = -EINVAL; | 1161 | int stat = -EINVAL; |
1162 | 1162 | ||
@@ -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; |
@@ -1219,8 +1219,8 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) | |||
1219 | struct rpc_gss_wire_cred *gc = &gsd->clcred; | 1219 | struct rpc_gss_wire_cred *gc = &gsd->clcred; |
1220 | struct xdr_buf *resbuf = &rqstp->rq_res; | 1220 | struct xdr_buf *resbuf = &rqstp->rq_res; |
1221 | struct page **inpages = NULL; | 1221 | struct page **inpages = NULL; |
1222 | u32 *p; | 1222 | __be32 *p, *len; |
1223 | int offset, *len; | 1223 | int offset; |
1224 | int pad; | 1224 | int pad; |
1225 | 1225 | ||
1226 | p = gsd->body_start; | 1226 | p = gsd->body_start; |
@@ -1264,7 +1264,7 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp) | |||
1264 | return -ENOMEM; | 1264 | return -ENOMEM; |
1265 | *len = htonl(resbuf->len - offset); | 1265 | *len = htonl(resbuf->len - offset); |
1266 | pad = 3 - ((resbuf->len - offset - 1)&3); | 1266 | pad = 3 - ((resbuf->len - offset - 1)&3); |
1267 | p = (u32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len); | 1267 | p = (__be32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len); |
1268 | memset(p, 0, pad); | 1268 | memset(p, 0, pad); |
1269 | resbuf->tail[0].iov_len += pad; | 1269 | resbuf->tail[0].iov_len += pad; |
1270 | resbuf->len += pad; | 1270 | resbuf->len += pad; |