1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-26 16:18:31 +00:00

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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=192781
2 changed files with 17 additions and 11 deletions

View File

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