Fix the handling of NFSv4 Illegal Operation number to conform

to RFC3530 (the operation number in the reply must be set to
the value for OP_ILLEGAL). Also cleaned up some indentation.

Approved by:	kib (mentor)
This commit is contained in:
Rick Macklem 2009-05-26 01:16:09 +00:00
parent 415670e4c2
commit 9183a2a33e
2 changed files with 17 additions and 11 deletions

View File

@ -235,6 +235,9 @@
*/
#define NFSV4OP_NOPS 40
/* Quirky case if the illegal op code */
#define NFSV4OP_OPILLEGAL 10044
/*
* Fake NFSV4OP_xxx used for nfsstat. Start at NFSV4OP_NOPS.
*/

View File

@ -639,13 +639,16 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
for (i = 0; i < numops; i++) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
NFSM_BUILD(repp, u_int32_t *, 2 * NFSX_UNSIGNED);
*repp++ = *tl;
*repp = *tl;
op = fxdr_unsigned(int, *tl);
if (op < NFSV4OP_ACCESS || op >= NFSV4OP_NOPS) {
nd->nd_repstat = NFSERR_OPILLEGAL;
*repp = nfsd_errmap(nd);
retops++;
break;
nd->nd_repstat = NFSERR_OPILLEGAL;
*repp++ = txdr_unsigned(NFSV4OP_OPILLEGAL);
*repp = nfsd_errmap(nd);
retops++;
break;
} else {
repp++;
}
/*
@ -682,12 +685,12 @@ nfsrvd_compound(struct nfsrv_descript *nd, int isdgram,
nd->nd_repstat = NFSERR_RESOURCE;
*repp = nfsd_errmap(nd);
if (op == NFSV4OP_SETATTR) {
/*
* Setattr replies require a bitmap.
* even for errors like these.
*/
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
*tl = 0;
/*
* Setattr replies require a bitmap.
* even for errors like these.
*/
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
*tl = 0;
}
retops++;
break;