/*
* 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.
*/
/**
* Solaris implementation of AclFileAttributeView with native support for
* NFSv4 ACLs on ZFS.
*/
extends AbstractAclFileAttributeView
{
// Maximum number of entries allowed in an ACL
/**
* typedef struct ace {
* uid_t a_who;
* uint32_t a_access_mask;
* uint16_t a_flags;
* uint16_t a_type;
* } ace_t;
*/
private final boolean followLinks;
this.followLinks = followLinks;
}
/**
* Permission checks to access file
*/
boolean checkRead,
boolean checkWrite)
{
if (checkRead)
if (checkWrite)
file.checkWrite();
}
}
/**
* Encode the ACL to the given buffer
*/
int flags = 0;
// map UserPrincipal to uid and flags
throw new ProviderMismatchException();
int uid;
uid = -1;
flags |= ACE_EVERYONE;
else
throw new AssertionError("Unable to map special identifier");
} else {
} else {
}
}
// map ACE type
int type;
case ALLOW:
break;
case DENY:
break;
case AUDIT:
break;
case ALARM:
break;
default:
throw new AssertionError("Unable to map ACE type");
}
// map permissions
int mask = 0;
mask |= ACE_READ_DATA;
mask |= ACE_WRITE_DATA;
mask |= ACE_APPEND_DATA;
mask |= ACE_EXECUTE;
mask |= ACE_DELETE_CHILD;
mask |= ACE_DELETE;
mask |= ACE_READ_ACL;
mask |= ACE_WRITE_ACL;
mask |= ACE_WRITE_OWNER;
mask |= ACE_SYNCHRONIZE;
// FIXME - it would be desirable to know here if the file is a
// directory or not. Solaris returns EINVAL if an ACE has a directory
// -only flag and the file is not a directory.
offset += SIZEOF_ACE_T;
}
}
/**
* Decode the buffer, returning an ACL
*/
for (int i=0; i<n; i++) {
// map uid and flags to UserPrincipal
} else {
}
switch (type) {
break;
break;
break;
break;
default:
assert false;
}
// build the ACL entry and add it to the list
}
return acl;
}
// Retrns true if NFSv4 ACLs not enabled on file system
try {
if (enabled == _ACL_ACE_ENABLED)
return true;
} catch (UnixException x) {
}
return false;
}
throws IOException
{
// permission check
checkAccess(file, true, false);
// open file (will fail if file is a link and not following links)
try {
try {
// read ACL and decode it
assert n >= 0;
} catch (UnixException x) {
}
return null; // keep compiler happy
} finally {
}
} finally {
}
}
// permission check
checkAccess(file, false, true);
// open file (will fail if file is a link and not following links)
try {
// SECURITY: need to copy list as can change during processing
try {
} catch (UnixException x) {
}
throw new IOException("ACL must contain at least 3 entries");
} finally {
}
} finally {
}
}
throws IOException
{
checkAccess(file, true, false);
try {
} catch (UnixException x) {
return null; // keep compile happy
}
}
checkAccess(file, true, false);
throw new ProviderMismatchException();
throw new IOException("'owner' parameter is a group");
try {
if (followLinks) {
} else {
}
} catch (UnixException x) {
}
}
}