diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2006-09-27 01:28:46 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-28 21:01:20 -0400 |
commit | 7699431301b189fca7ccbb64fe54e5a5170f8497 (patch) | |
tree | 4c20c5121776984cb054de3e0759cbeae860de3a /net/sunrpc/svcauth_unix.c | |
parent | 13d8eaa06abfeb708b60fa64203a20db033088b3 (diff) |
[SUNRPC]: svc_{get,put}nl()
* add svc_getnl():
Take network-endian value from buffer, convert to host-endian
and return it.
* add svc_putnl():
Take host-endian value, convert to network-endian and put it
into a buffer.
* annotate svc_getu32()/svc_putu32() as dealing with network-endian.
* convert to svc_getnl(), svc_putnl().
[AV: in large part it's a carved-up Alexey's patch]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 22 |
1 files changed, 11 insertions, 11 deletions
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 | ||