public class RestrictiveFilePermissionsTest extends BaseJDBCTestCase
Modifier and Type | Field and Description |
---|---|
private static java.lang.Class<?> |
aclEntryClz |
private static java.lang.Class<?> |
aclFileAttributeViewClz |
(package private) static java.lang.String |
backupDir |
(package private) static java.lang.String |
dbName |
(package private) static java.lang.String |
dbName2 |
(package private) static java.lang.String |
derbyDotLog |
(package private) static java.lang.String |
exportFileName |
(package private) static java.lang.String |
exportFileName2 |
(package private) static java.lang.String |
exportLobFileName |
private static java.lang.Class<?> |
filesClz |
private static java.lang.reflect.Method |
get |
private static java.lang.reflect.Method |
getAcl |
private static java.lang.reflect.Method |
getFileAttributeView |
private static java.lang.reflect.Method |
getName |
private static java.lang.reflect.Method |
getOwner |
private static java.lang.reflect.Field |
GROUP_EXECUTE |
private static java.lang.reflect.Field |
GROUP_READ |
private static java.lang.reflect.Field |
GROUP_WRITE |
(package private) static java.lang.String |
home |
private static boolean |
initialized |
private static java.lang.Class<?> |
linkOptionArrayClz |
private static java.lang.Class<?> |
linkOptionClz |
static int |
NEGATIVE |
private static java.lang.reflect.Field |
OTHERS_EXECUTE |
private static java.lang.reflect.Field |
OTHERS_READ |
private static java.lang.reflect.Field |
OTHERS_WRITE |
private static java.lang.Class<?> |
pathClz |
private static java.lang.Class<?> |
pathsClz |
private static java.lang.reflect.Method |
permissionsAcl |
private static java.lang.reflect.Method |
permissionsPosix |
static int |
POSITIVE |
private static java.lang.Class<?> |
posixFileAttributesClz |
private static java.lang.Class<?> |
posixFileAttributeViewClz |
private static java.lang.Class<?> |
posixFilePermissionClz |
private static java.lang.reflect.Method |
principal |
private static java.lang.reflect.Method |
readAttributes |
private static java.lang.Class<?> |
stringArrayClz |
(package private) static boolean |
supportsLaxTesting |
static int |
UNKNOWN |
private static java.util.Set<java.lang.Object> |
unwantedPermissions |
private static java.lang.Class<?> |
userPrincipalClz |
DEFAULT_DB_DIR, DERBY_LOG, ERRORSTACKTRACEFILE
Constructor and Description |
---|
RestrictiveFilePermissionsTest(java.lang.String name) |
Modifier and Type | Method and Description |
---|---|
private static boolean |
checkAccessToOwner(java.io.File file,
boolean doContents,
int expectedOutcome)
Same as
checkAccessToOwner , but
if doContents is true, also check files directly contained in
this file qua directory (not recursively). |
static void |
checkAccessToOwner(java.io.File file,
int expectedOutcome)
Check that the file has access only for the owner.
|
void |
doTestCliServerIsRestrictive() |
void |
dotestEmbeddedIsLax() |
void |
doTestNonCliServerIsLax() |
void |
setUp() |
static junit.framework.Test |
suite() |
void |
testBackupRestoreFiles() |
void |
testConglomsAfterCompress() |
void |
testDbDirectory() |
void |
testDerbyDotLog() |
void |
testExportedFiles() |
void |
testJarFiles() |
void |
testLockFiles() |
void |
testLogDirAndLogFiles() |
void |
testSeg0AndConglomerates() |
void |
testServiceProperties() |
void |
testTmpDirectory() |
void |
testTruncateTable() |
assertCallError, assertCheckTable, assertCommitError, assertCompileError, assertEquals, assertEquals, assertEquals, assertEquivalentDataType, assertErrorCode, assertGetIntError, assertNextError, assertPreparedStatementError, assertResults, assertResults, assertSQLExceptionEquals, assertSQLState, assertSQLState, assertStatementError, assertStatementError, assertStatementError, assertStatementError, assertStatementErrorUnordered, assertTableRowCount, assertUpdateCount, assertUpdateCount, assertWarning, chattyPrepare, chattyPrepareCall, checkAllConsistency, checkEstimatedRowCount, closeStatement, commit, createStatement, createStatement, createStatement, dropTable, dropTable, dropView, dropView, dumpRs, dumpRs, emptyStatementCache, executeQuery, expectCompilationError, expectCompilationError, expectExecutionError, getClientTransactionID, getConnection, getDatabaseProperty, getLastSQLException, goodStatement, goodUpdate, initializeConnection, openConnection, openDefaultConnection, openDefaultConnection, openDefaultConnection, openUserConnection, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, rollback, runBare, runBareOverridable, runScript, runScript, runSQLCommands, setAutoCommit, tearDown, usingDB2Client, usingDerbyNetClient, usingEmbedded
alarm, assertDirectoryDeleted, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertExecJavaCmdAsExpected, assertLaunchedJUnitTestMethod, assertLaunchedJUnitTestMethod, assertSameNullness, assertSecurityManager, assertThrowableEquals, currentDirectory, execJavaCmd, execJavaCmd, fail, getClassVersionMajor, getEmmaJar, getFailureFolder, getFilesWith, getJavaExecutableName, getSystemProperty, getTestConfiguration, getTestResource, hasInterruptibleIO, isCVM, isIBMJVM, isJ9Platform, isJava5, isJava7, isPhoneME, isPlatform, isSunJVM, isWindowsPlatform, newAssertionFailedError, openTestResource, println, printStackTrace, readProcessOutput, removeDirectory, removeDirectory, removeFiles, removeSystemProperty, runsWithEmma, runsWithJaCoCo, setSystemErr, setSystemOut, setSystemProperty, sleep, sleepAtLeastOneTick, traceit
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, countTestCases, createResult, fail, fail, failNotEquals, failNotSame, failSame, format, getName, run, run, runTest, setName, toString
static final java.lang.String dbName
static final java.lang.String dbName2
static final java.lang.String exportFileName
static final java.lang.String exportFileName2
static final java.lang.String exportLobFileName
static final java.lang.String backupDir
static final java.lang.String derbyDotLog
static java.lang.String home
static boolean supportsLaxTesting
public static final int NEGATIVE
public static final int POSITIVE
public static final int UNKNOWN
private static boolean initialized
private static java.lang.Class<?> filesClz
private static java.lang.Class<?> pathClz
private static java.lang.Class<?> pathsClz
private static java.lang.Class<?> aclEntryClz
private static java.lang.Class<?> aclFileAttributeViewClz
private static java.lang.Class<?> posixFileAttributeViewClz
private static java.lang.Class<?> posixFileAttributesClz
private static java.lang.Class<?> posixFilePermissionClz
private static java.lang.Class<?> userPrincipalClz
private static java.lang.Class<?> linkOptionArrayClz
private static java.lang.Class<?> linkOptionClz
private static java.lang.Class<?> stringArrayClz
private static java.lang.reflect.Method get
private static java.lang.reflect.Method getFileAttributeView
private static java.lang.reflect.Method getOwner
private static java.lang.reflect.Method getAcl
private static java.lang.reflect.Method principal
private static java.lang.reflect.Method getName
private static java.lang.reflect.Method permissionsAcl
private static java.lang.reflect.Method permissionsPosix
private static java.lang.reflect.Method readAttributes
private static java.lang.reflect.Field GROUP_EXECUTE
private static java.lang.reflect.Field GROUP_READ
private static java.lang.reflect.Field GROUP_WRITE
private static java.lang.reflect.Field OTHERS_EXECUTE
private static java.lang.reflect.Field OTHERS_READ
private static java.lang.reflect.Field OTHERS_WRITE
private static java.util.Set<java.lang.Object> unwantedPermissions
public RestrictiveFilePermissionsTest(java.lang.String name)
public static junit.framework.Test suite() throws java.lang.Exception
java.lang.Exception
public void setUp() throws java.lang.Exception
setUp
in class junit.framework.TestCase
java.lang.Exception
public void testDerbyDotLog() throws java.lang.Exception
java.lang.Exception
public void testDbDirectory() throws java.lang.Exception
java.lang.Exception
public void testServiceProperties() throws java.lang.Exception
java.lang.Exception
public void testTmpDirectory() throws java.lang.Exception
java.lang.Exception
public void testLockFiles() throws java.lang.Exception
java.lang.Exception
public void testSeg0AndConglomerates() throws java.lang.Exception
java.lang.Exception
public void testLogDirAndLogFiles() throws java.lang.Exception
java.lang.Exception
public void testExportedFiles() throws java.lang.Exception
java.lang.Exception
public void testConglomsAfterCompress() throws java.lang.Exception
java.lang.Exception
public void testTruncateTable() throws java.lang.Exception
java.lang.Exception
public void testBackupRestoreFiles() throws java.lang.Exception
java.lang.Exception
public void testJarFiles() throws java.lang.Exception
java.lang.Exception
public void doTestCliServerIsRestrictive() throws java.lang.Exception
java.lang.Exception
public void doTestNonCliServerIsLax() throws java.lang.Exception
java.lang.Exception
public void dotestEmbeddedIsLax() throws java.lang.Exception
java.lang.Exception
public static void checkAccessToOwner(java.io.File file, int expectedOutcome) throws java.lang.Exception
java.io.File
API only lets us check if
this process has access.
In this sense this testing code is asymmetric to the implementation in
Derby: Java 6 can be used to restrict accesses in Java 6 on Unix, but
we have no way in Java of checking the results in a portable way. So, if
we do not have at least Java 7, this method will be a no-op.file
- (or directory) for which we want to check permissionsexpectedOutcome
- NEGATIVE or POSITIVEjava.lang.Exception
checkAccessToOwner(File, boolean, int)
private static boolean checkAccessToOwner(java.io.File file, boolean doContents, int expectedOutcome) throws java.lang.Exception
checkAccessToOwner
, but
if doContents
is true, also check files directly contained in
this file qua directory (not recursively).file
- ((or directory) for which we want to check permissionsdoContents
- if a directory, an error to call with true if notexpectedOutcome
- NEGATIVE, POSITIVE or UNKNOWNjava.lang.Exception
Apache Derby V10.11 Internals - Copyright © 2004,2014 The Apache Software Foundation. All Rights Reserved.