Skip to content

Commit

Permalink
HPCC-29246 Check isAbsolute before calling getRelativePath
Browse files Browse the repository at this point in the history
Signed-off-by: wangkx <[email protected]>
  • Loading branch information
wangkx committed Jul 14, 2023
1 parent ab4aaa7 commit 3f26ad0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions esp/smc/SMCLib/TpCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,17 @@ static SecAccessFlags getDropZoneScopePermissions(IEspContext& context, const IP
throw makeStringException(ECLWATCH_INVALID_CLUSTER_NAME, "getDropZoneScopePermissions(): DropZone path must be specified.");

//If the dropZonePath is an absolute path, change it to a relative path.
const char* relativePath = getRelativePath(dropZonePath, dropZone->queryProp("@prefix"));
if (nullptr == relativePath)
throw makeStringExceptionV(-1, "Invalid DropZone path %s.", dropZonePath);
if (isAbsolutePath(dropZonePath))
{
const char* relativePath = getRelativePath(dropZonePath, dropZone->queryProp("@prefix"));
if (nullptr == relativePath)
throw makeStringExceptionV(-1, "Invalid DropZone path %s.", dropZonePath);
dropZonePath = relativePath;
}

Owned<IUserDescriptor> userDesc = createUserDescriptor();
userDesc->set(context.queryUserId(), context.queryPassword(), context.querySignature());
return queryDistributedFileDirectory().getDropZoneScopePermissions(dropZone->queryProp("@name"), relativePath, userDesc);
return queryDistributedFileDirectory().getDropZoneScopePermissions(dropZone->queryProp("@name"), dropZonePath, userDesc);
}

extern TPWRAPPER_API SecAccessFlags getDZPathScopePermissions(IEspContext& context, const char* dropZoneName, const char* dropZonePath, const char* dropZoneHost)
Expand Down

0 comments on commit 3f26ad0

Please sign in to comment.