summaryrefslogtreecommitdiffstats
path: root/src/junit
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-21 03:45:07 +0200
committerSven Gothel <[email protected]>2013-06-21 03:45:07 +0200
commiteb842815498f5926828b49c48fffce22fc9586a2 (patch)
treeb3aac763bb16890f7f3b3c69b5cdec3febf654f2 /src/junit
parent19bef683d38f4ce7b0dcb5c516244c6f87504e41 (diff)
Security: Tighten DynamicLinker*, NativeLibrary and DynamicLibraryBundle access (2)
- Completes 23341a2df2d2ea36784a16fa1db8bc7385351a12 - Replace 'DynamicLinker' interface w/ well documented one - All DynamicLinker methods are now considered secure, i.e.: - open/lookup and close utilize reference counting on handle via a hash map. - lookupSymbol(..) and close(..) impl. validate the passed library handle whether it's retrieved via open*. This is the fast path, not that expensive. - lookupSymbolGlobal(..) performs Check acccess of 'new RuntimePermission("loadLibrary.*")' if SecurityManager is installed. This is the slow path. - DynamicLibraryBundleInfo now reflects the security requirements, i.e. whether priviledged access is needed.
Diffstat (limited to 'src/junit')
-rw-r--r--src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
index c47e2df..306e8d8 100644
--- a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
+++ b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
@@ -134,7 +134,7 @@ public class TestSecIOUtil01 extends JunitTracer {
testTempDirImpl(false);
}
- private void testOpenLibraryImpl(boolean global) {
+ private NativeLibrary openLibraryImpl(boolean global) {
final ClassLoader cl = getClass().getClassLoader();
System.err.println("CL "+cl);
@@ -171,8 +171,9 @@ public class TestSecIOUtil01 extends JunitTracer {
System.err.println("Untrusted Library Dir1 (abs): "+libDir1);
final String absLib = libDir1 + "natives/" + libBaseName;
Exception se0 = null;
+ NativeLibrary nlib = null;
try {
- NativeLibrary nlib = NativeLibrary.open(absLib, cl);
+ nlib = NativeLibrary.open(absLib, cl);
System.err.println("NativeLibrary: "+nlib);
} catch (SecurityException e) {
se0 = e;
@@ -189,10 +190,14 @@ public class TestSecIOUtil01 extends JunitTracer {
} else {
Assert.assertNotNull("SecurityException not thrown on loading native library", se0);
}
+ return nlib;
}
public void testOpenLibrary() {
- testOpenLibraryImpl(true);
+ NativeLibrary nlib = openLibraryImpl(true);
+ if( null != nlib ) {
+ nlib.close();
+ }
}
public static void main(String args[]) throws IOException {