[libbluray-devel] JSM: deny setFactory() while BD-J is running. Create JSM after setting factories.

hpi1 git at videolan.org
Tue Mar 3 13:05:11 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Mar  3 09:38:30 2015 +0200| [7c36ea2cc0e57b960751f87fdd06eec881521daf] | committer: hpi1

JSM: deny setFactory() while BD-J is running. Create JSM after setting factories.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=7c36ea2cc0e57b960751f87fdd06eec881521daf
---

 .../bdj/java/org/videolan/BDJSecurityManager.java       |    5 +++++
 src/libbluray/bdj/java/org/videolan/Libbluray.java      |   15 ++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
index dfe2da6..effc157 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
@@ -81,6 +81,11 @@ class BDJSecurityManager extends SecurityManager {
         throw new SecurityException("exit denied");
     }
 
+    public void checkSetFactory() {
+        logger.error("setFactory() denied\n" + Logger.dumpStack());
+        throw new SecurityException("setFactory denied");
+    }
+
     public void checkRead(String file) {
         //super.checkRead(file);
         if (usingUdf) {
diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 7586b80..529f4a5 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -59,13 +59,6 @@ public class Libbluray {
             System.setProperty("bluray.vfs.root", discRoot);
         }
 
-        try {
-            System.setSecurityManager(new BDJSecurityManager(discRoot, persistentRoot, budaRoot));
-        } catch (Exception ex) {
-            System.err.println("System.setSecurityManager() failed: " + ex);
-            throw new SecurityException("Failed initializing SecurityManager");
-        }
-
             Libbluray.nativePointer = nativePointer;
             DiscManager.getDiscManager().setCurrentDisc(discID);
 
@@ -147,6 +140,13 @@ public class Libbluray {
             System.setProperty("bluray.network.connected", "YES");
 
             BDJSocketFactory.init();
+
+        try {
+            System.setSecurityManager(new BDJSecurityManager(discRoot, persistentRoot, budaRoot));
+        } catch (Exception ex) {
+            System.err.println("System.setSecurityManager() failed: " + ex);
+            throw new SecurityException("Failed initializing SecurityManager");
+        }
     }
 
     /* called only from native code */
@@ -159,6 +159,7 @@ public class Libbluray {
             BDJLoader.shutdown();
             BDJActionManager.shutdown();
 
+            /* all Xlet contexts (and threads) should be terminated now */
             try {
                 System.setSecurityManager(null);
             } catch (Exception ex) {



More information about the libbluray-devel mailing list