Skip to content

Commit

Permalink
HPCC-30581 Improve invalid remote usage error of legacy DFS
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Oct 20, 2023
1 parent 9cab6fd commit 6aa7548
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions dali/base/dadfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ class DECL_EXCEPTION CDFS_Exception: implements IDFS_Exception, public CInterfac
return str.append(": Storage plane missing: ").append(errstr);
case DFSERR_PhysicalCompressedPartInvalid:
return str.append(": Compressed part is not in the valid format: ").append(errstr);
case DFSERR_InvalidRemoteFileContext:
return str.append(": Lookup of remote files must use wsdfs::lookup - file: ").append(errstr);
}
return str.append("Unknown DFS Exception");
}
Expand Down Expand Up @@ -8247,6 +8249,11 @@ IDistributedFile *CDistributedFileDirectory::dolookup(CDfsLogicalFileName &_logi

IDistributedFile *CDistributedFileDirectory::lookup(CDfsLogicalFileName &logicalname, IUserDescriptor *user, AccessMode accessMode, bool hold, bool lockSuperOwner, IDistributedFileTransaction *transaction, bool privilegedUser, unsigned timeout)
{
if (logicalname.isRemote())
{
PrintStackReport(); // to help locate contexts it was called in
throw new CDFS_Exception(DFSERR_InvalidRemoteFileContext, logicalname.get());
}
Owned <IDistributedFile>distributedFile = dolookup(logicalname, user, accessMode, hold, lockSuperOwner, transaction, timeout);
// Restricted access is currently designed to stop users viewing sensitive information. It is not designed to stop users deleting or overwriting existing restricted files
if (!isWrite(accessMode) && distributedFile && distributedFile->isRestrictedAccess() && !privilegedUser)
Expand Down
3 changes: 2 additions & 1 deletion dali/base/dadfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,8 @@ enum DistributedFileSystemError
DFSERR_RestrictedFileAccessDenied,
DFSERR_EmptyStoragePlane,
DFSERR_MissingStoragePlane,
DFSERR_PhysicalCompressedPartInvalid
DFSERR_PhysicalCompressedPartInvalid,
DFSERR_InvalidRemoteFileContext
};


Expand Down

0 comments on commit 6aa7548

Please sign in to comment.