Skip to content

Commit

Permalink
nfs4: check for invalid attribute prior VERIFY/NFERIVY
Browse files Browse the repository at this point in the history
fixes: 7aee3bc

Motivation:
as FATTR4_RDATTR_ERROR must be used in a context of READDIR operation
only, the VERIFY/NVERIFY operations must check that FATTR4_RDATTR_ERROR is
not set.

Modification:
check for invalid attribute prior VERIFY/NFERIVY operations start to
compare attributes.

Result:
better spec compliance.

Acked-by: Paul Millar
Target: master, 0.18
  • Loading branch information
kofemann committed Feb 8, 2019
1 parent 20f598a commit 7c7714d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/org/dcache/nfs/v4/OperationNVERIFY.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2015 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -46,6 +46,10 @@ public void process(CompoundContext context, nfs_resop4 result) throws IOExcepti

final NVERIFY4res res = result.opnverify;

if (_args.opnverify.obj_attributes.attrmask.isSet(nfs4_prot.FATTR4_RDATTR_ERROR)) {
throw new InvalException("RDATTR_ERROR can be used with readdir only");
}

fattr4 currentAttr = OperationGETATTR.getAttributes(_args.opnverify.obj_attributes.attrmask,
context.getFs(),
context.currentInode(), context);
Expand All @@ -54,10 +58,6 @@ public void process(CompoundContext context, nfs_resop4 result) throws IOExcepti
throw new AttrNotSuppException("check for not supported attribute");
}

if (_args.opnverify.obj_attributes.attrmask.isSet(nfs4_prot.FATTR4_RDATTR_ERROR)) {
throw new InvalException("RDATTR_ERROR can be used with readdir only");
}

res.status = nfsstat.NFSERR_SAME;

for (int i = 0; i < _args.opnverify.obj_attributes.attr_vals.value.length; i++) {
Expand Down
11 changes: 6 additions & 5 deletions core/src/main/java/org/dcache/nfs/v4/OperationVERIFY.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2009 - 2015 Deutsches Elektronen-Synchroton,
* Copyright (c) 2009 - 2019 Deutsches Elektronen-Synchroton,
* Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY
*
* This library is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -58,6 +58,11 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
*/

if (!_args.opverify.obj_attributes.attrmask.isEmpty()) {

if (_args.opverify.obj_attributes.attrmask.isSet(nfs4_prot.FATTR4_RDATTR_ERROR)) {
throw new InvalException("RDATTR_ERROR can be used with readdir only");
}

fattr4 currentAttr = OperationGETATTR.getAttributes(_args.opverify.obj_attributes.attrmask,
context.getFs(),
context.currentInode(), context);
Expand All @@ -66,10 +71,6 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
throw new AttrNotSuppException("check for not supported attribute");
}

if (_args.opverify.obj_attributes.attrmask.isSet(nfs4_prot.FATTR4_RDATTR_ERROR)) {
throw new InvalException("RDATTR_ERROR can be used with readdir only");
}

if (Arrays.equals(_args.opverify.obj_attributes.attr_vals.value, currentAttr.attr_vals.value)) {
res.status = nfsstat.NFS_OK;
} else {
Expand Down

0 comments on commit 7c7714d

Please sign in to comment.