nfs4: Fix removing nodes other than NF4DIR or NF4REG
This commit is contained in:
@@ -241,8 +241,11 @@ Inode::Remove(const char* name, FileType type)
|
|||||||
AttrValue attr;
|
AttrValue attr;
|
||||||
attr.fAttribute = FATTR4_TYPE;
|
attr.fAttribute = FATTR4_TYPE;
|
||||||
attr.fFreePointer = false;
|
attr.fFreePointer = false;
|
||||||
attr.fData.fValue32 = type;
|
attr.fData.fValue32 = NF4DIR;
|
||||||
req.Verify(&attr, 1);
|
if (type == NF4DIR)
|
||||||
|
req.Verify(&attr, 1);
|
||||||
|
else
|
||||||
|
req.Nverify(&attr, 1);
|
||||||
|
|
||||||
req.PutFH(fHandle);
|
req.PutFH(fHandle);
|
||||||
req.Remove(name);
|
req.Remove(name);
|
||||||
@@ -259,8 +262,12 @@ Inode::Remove(const char* name, FileType type)
|
|||||||
reply.PutFH();
|
reply.PutFH();
|
||||||
reply.LookUp();
|
reply.LookUp();
|
||||||
|
|
||||||
result = reply.Verify();
|
if (type == NF4DIR)
|
||||||
if (result == NFS4ERR_NOT_SAME && type == NF4REG)
|
result = reply.Verify();
|
||||||
|
else
|
||||||
|
result = reply.Nverify();
|
||||||
|
|
||||||
|
if (result == NFS4ERR_SAME && type != NF4DIR)
|
||||||
return B_IS_A_DIRECTORY;
|
return B_IS_A_DIRECTORY;
|
||||||
if (result == NFS4ERR_NOT_SAME && type == NF4DIR)
|
if (result == NFS4ERR_NOT_SAME && type == NF4DIR)
|
||||||
return B_NOT_A_DIRECTORY;
|
return B_NOT_A_DIRECTORY;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ enum Opcode {
|
|||||||
OpLink = 11,
|
OpLink = 11,
|
||||||
OpLookUp = 15,
|
OpLookUp = 15,
|
||||||
OpLookUpUp = 16,
|
OpLookUpUp = 16,
|
||||||
|
OpNverify = 17,
|
||||||
OpOpen = 18,
|
OpOpen = 18,
|
||||||
OpOpenConfirm = 20,
|
OpOpenConfirm = 20,
|
||||||
OpPutFH = 22,
|
OpPutFH = 22,
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ public:
|
|||||||
status_t Link();
|
status_t Link();
|
||||||
inline status_t LookUp();
|
inline status_t LookUp();
|
||||||
inline status_t LookUpUp();
|
inline status_t LookUpUp();
|
||||||
|
inline status_t Nverify();
|
||||||
status_t Open(uint32* id, uint32* seq, bool* confirm);
|
status_t Open(uint32* id, uint32* seq, bool* confirm);
|
||||||
status_t OpenConfirm(uint32* stateSeq);
|
status_t OpenConfirm(uint32* stateSeq);
|
||||||
inline status_t PutFH();
|
inline status_t PutFH();
|
||||||
@@ -150,6 +151,13 @@ ReplyInterpreter::LookUpUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline status_t
|
||||||
|
ReplyInterpreter::Nverify()
|
||||||
|
{
|
||||||
|
return _OperationError(OpNverify);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline status_t
|
inline status_t
|
||||||
ReplyInterpreter::PutFH()
|
ReplyInterpreter::PutFH()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -197,6 +197,23 @@ RequestBuilder::LookUpUp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
RequestBuilder::Nverify(AttrValue* attr, uint32 count)
|
||||||
|
{
|
||||||
|
if (fProcedure != ProcCompound)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
if (fRequest == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
fRequest->Stream().AddUInt(OpNverify);
|
||||||
|
_EncodeAttrs(fRequest->Stream(), attr, count);
|
||||||
|
|
||||||
|
fOpCount++;
|
||||||
|
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
RequestBuilder::Open(OpenClaim claim, uint32 seq, uint32 access, uint64 id,
|
RequestBuilder::Open(OpenClaim claim, uint32 seq, uint32 access, uint64 id,
|
||||||
OpenCreate oc, uint64 ownerId, const char* name, AttrValue* attr,
|
OpenCreate oc, uint64 ownerId, const char* name, AttrValue* attr,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ public:
|
|||||||
status_t Link(const char* name);
|
status_t Link(const char* name);
|
||||||
status_t LookUp(const char* name);
|
status_t LookUp(const char* name);
|
||||||
status_t LookUpUp();
|
status_t LookUpUp();
|
||||||
|
status_t Nverify(AttrValue* attr, uint32 count);
|
||||||
status_t Open(OpenClaim claim, uint32 seq,
|
status_t Open(OpenClaim claim, uint32 seq,
|
||||||
uint32 access, uint64 id, OpenCreate oc,
|
uint32 access, uint64 id, OpenCreate oc,
|
||||||
uint64 ownerId, const char* name,
|
uint64 ownerId, const char* name,
|
||||||
|
|||||||
Reference in New Issue
Block a user