aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4xdr.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-11-05 16:01:48 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-11-07 19:40:05 -0500
commit12fc3e92d4b18b4e99af624586e1696479ff36ce (patch)
treec3e43c4389da8bbbf8de90f044773fc236edfc9c /fs/nfsd/nfs4xdr.c
parent57725155dc1b8c78b7a96886d5cdc69dc89e9c54 (diff)
nfsd4: backchannel should use client-provided security flavor
For now this only adds support for AUTH_NULL. (Previously we assumed AUTH_UNIX.) We'll also need AUTH_GSS, which is trickier. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r--fs/nfsd/nfs4xdr.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d7e7c110246e..406d0c4620f6 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -425,7 +425,7 @@ nfsd4_decode_access(struct nfsd4_compoundargs *argp, struct nfsd4_access *access
425static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_cb_sec *cbs) 425static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_cb_sec *cbs)
426{ 426{
427 DECODE_HEAD; 427 DECODE_HEAD;
428 u32 dummy; 428 u32 dummy, uid, gid;
429 char *machine_name; 429 char *machine_name;
430 int i; 430 int i;
431 int nr_secflavs; 431 int nr_secflavs;
@@ -433,12 +433,15 @@ static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_
433 /* callback_sec_params4 */ 433 /* callback_sec_params4 */
434 READ_BUF(4); 434 READ_BUF(4);
435 READ32(nr_secflavs); 435 READ32(nr_secflavs);
436 cbs->flavor = (u32)(-1);
436 for (i = 0; i < nr_secflavs; ++i) { 437 for (i = 0; i < nr_secflavs; ++i) {
437 READ_BUF(4); 438 READ_BUF(4);
438 READ32(dummy); 439 READ32(dummy);
439 switch (dummy) { 440 switch (dummy) {
440 case RPC_AUTH_NULL: 441 case RPC_AUTH_NULL:
441 /* Nothing to read */ 442 /* Nothing to read */
443 if (cbs->flavor == (u32)(-1))
444 cbs->flavor = RPC_AUTH_NULL;
442 break; 445 break;
443 case RPC_AUTH_UNIX: 446 case RPC_AUTH_UNIX:
444 READ_BUF(8); 447 READ_BUF(8);
@@ -452,13 +455,18 @@ static __be32 nfsd4_decode_cb_sec(struct nfsd4_compoundargs *argp, struct nfsd4_
452 455
453 /* uid, gid */ 456 /* uid, gid */
454 READ_BUF(8); 457 READ_BUF(8);
455 READ32(cbs->uid); 458 READ32(uid);
456 READ32(cbs->gid); 459 READ32(gid);
457 460
458 /* more gids */ 461 /* more gids */
459 READ_BUF(4); 462 READ_BUF(4);
460 READ32(dummy); 463 READ32(dummy);
461 READ_BUF(dummy * 4); 464 READ_BUF(dummy * 4);
465 if (cbs->flavor == (u32)(-1)) {
466 cbs->uid = uid;
467 cbs->gid = gid;
468 cbs->flavor = RPC_AUTH_UNIX;
469 }
462 break; 470 break;
463 case RPC_AUTH_GSS: 471 case RPC_AUTH_GSS:
464 dprintk("RPC_AUTH_GSS callback secflavor " 472 dprintk("RPC_AUTH_GSS callback secflavor "