allowCount = 0;
denyCount = 0;
j = 0;
while (j < aces.length)
{
ACE ace = aces[j++];
if ((ace.getAccessMask() & ACE.FILE_READ_DATA) != 0)
{
if (ace.isAllow())
allowCount++;
else
denyCount++;
}
}
shareAllowAcls = new String[allowCount];
shareDenyAcls = new String[denyCount+1];
j = 0;
allowCount = 0;
denyCount = 0;
shareDenyAcls[denyCount++] = defaultAuthorityDenyToken;
while (j < aces.length)
{
ACE ace = aces[j++];
if ((ace.getAccessMask() & ACE.FILE_READ_DATA) != 0)
{
if (ace.isAllow())
shareAllowAcls[allowCount++] = useSIDs ? ace.getSID().toString() : ace.getSID().getAccountName();
else
shareDenyAcls[denyCount++] = useSIDs ? ace.getSID().toString() : ace.getSID().getAccountName();
}
}
}
}
else
{
shareAllowAcls = forcedShareAcls;
if (forcedShareAcls.length == 0)
shareDenyAcls = new String[0];
else
shareDenyAcls = new String[]{defaultAuthorityDenyToken};
}
java.util.Arrays.sort(shareAllowAcls);
java.util.Arrays.sort(shareDenyAcls);
// Stuff the acls into the description string.
packList(description,shareAllowAcls,'+');
packList(description,shareDenyAcls,'+');
}
else
description.append('-');
if (forcedacls!=null)
{
description.append("+");
if (forcedacls.length==0)
{
aces = getFileSecurity(file, useSIDs);
if (aces == null)
{
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("JCIFS: Document has no ACL for '"+getFileCanonicalPath(file)+"'");
// Document is "public", meaning we want S-1-1-0 and the deny token
allowAcls = new String[]{"S-1-1-0"};
denyAcls = new String[]{defaultAuthorityDenyToken};
}
else
{
if (Logging.connectors.isDebugEnabled())
Logging.connectors.debug("JCIFS: Found "+Integer.toString(aces.length)+" document access tokens for '"+getFileCanonicalPath(file)+"'");
// We are interested in the read permission, and take
// a keen interest in allow/deny
allowCount = 0;
denyCount = 0;
j = 0;
while (j < aces.length)
{
ACE ace = aces[j++];
if ((ace.getAccessMask() & ACE.FILE_READ_DATA) != 0)
{
if (ace.isAllow())
allowCount++;
else
denyCount++;
}
}
allowAcls = new String[allowCount];
denyAcls = new String[denyCount+1];
j = 0;
allowCount = 0;
denyCount = 0;
denyAcls[denyCount++] = defaultAuthorityDenyToken;
while (j < aces.length)
{
ACE ace = aces[j++];
if ((ace.getAccessMask() & ACE.FILE_READ_DATA) != 0)
{
if (ace.isAllow())
allowAcls[allowCount++] = useSIDs ? ace.getSID().toString() : ace.getSID().getAccountName();
else
denyAcls[denyCount++] = useSIDs ? ace.getSID().toString() : ace.getSID().getAccountName();
}
}
}
}
else