Skip to content

Commit

Permalink
HPCC-29480 Move traceName code
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 853a042 commit 361f43f
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions dali/dfu/dfurun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -594,21 +594,17 @@ class CDFUengine: public CInterface, implements IDFUengine
if (write)
auditflags |= DALI_LDAP_WRITE_WANTED;

StringBuffer traceName;
fd->getTraceName(traceName);
if (traceName.length() > 255)
{
traceName.setLength(255);
traceName.append("...");
}
SecAccessFlags perm = queryDistributedFileDirectory().getFDescPermissions(fd,user,auditflags);
if (write)
if ((write && !HASWRITEPERMISSION(perm)) || (!write && !HASREADPERMISSION(perm)))
{
if (!HASWRITEPERMISSION(perm))
throw makeStringExceptionV(DFSERR_CreateAccessDenied,"Create permission denied for physical file(s): %s",traceName.str());
StringBuffer traceName;
fd->getTraceName(traceName);
elideString(traceName, 255);
if (write)
throw makeStringExceptionV(DFSERR_CreateAccessDenied, "Create permission denied for physical file(s): %s",traceName.str());
else
throw makeStringExceptionV(DFSERR_LookupAccessDenied, "Lookup permission denied for physical file(s): %s",traceName.str());
}
else if (!HASREADPERMISSION(perm))
throw makeStringExceptionV(DFSERR_LookupAccessDenied,"Lookup permission denied for physical file(s): %s",traceName.str());
}

void checkForeignFilePermissions(IConstDFUfileSpec *fSpec,IFileDescriptor *fd,IUserDescriptor *user,bool write)
Expand Down

0 comments on commit 361f43f

Please sign in to comment.