/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Windows implementation of AclFileAttributeView.
*/
extends AbstractAclFileAttributeView
{
/**
* typedef struct _SECURITY_DESCRIPTOR {
* BYTE Revision;
* BYTE Sbz1;
* SECURITY_DESCRIPTOR_CONTROL Control;
* PSID Owner;
* PSID Group;
* PACL Sacl;
* PACL Dacl;
* } SECURITY_DESCRIPTOR;
*/
private final boolean followLinks;
this.followLinks = followLinks;
}
// permision check
boolean checkRead,
boolean checkWrite)
{
if (checkRead)
if (checkWrite)
}
}
// invokes GetFileSecurity to get requested security information
throws IOException
{
// invoke get to buffer size
int size = 0;
try {
} catch (WindowsException x) {
}
assert size > 0;
// allocate buffer and re-invoke to get security information
try {
for (;;) {
return buffer;
// buffer was insufficient
}
} catch (WindowsException x) {
return null;
}
}
throws IOException
{
checkAccess(file, true, false);
// GetFileSecurity does not follow links so when following links we
// need the final target
try {
// get the address of the SID
if (sidAddress == 0L)
throw new IOException("no owner");
} catch (WindowsException x) {
return null;
} finally {
}
}
throws IOException
{
checkAccess(file, true, false);
// GetFileSecurity does not follow links so when following links we
// need the final target
// ALLOW and DENY entries in DACL;
// AUDIT entries in SACL (ignore for now as it requires privileges)
try {
} finally {
}
}
throws IOException
{
throw new NullPointerException("'owner' is null");
throw new ProviderMismatchException();
// permission check
checkAccess(file, false, true);
// SetFileSecurity does not follow links so when following links we
// need the final target
// ConvertStringSidToSid allocates memory for SID so must invoke
// LocalFree to free it when we are done
long pOwner = 0L;
try {
} catch (WindowsException x) {
+ ": " + x.errorString());
}
// Allocate buffer for security descriptor, initialize it, set
// owner information and update the file.
try {
try {
// may need SeRestorePrivilege to set the owner
try {
} finally {
}
} catch (WindowsException x) {
} finally {
}
} finally {
}
}
checkAccess(file, false, true);
// SetFileSecurity does not follow links so when following links we
// need the final target
try {
} catch (WindowsException x) {
} finally {
}
}
}