[libbluray-devel] JSM: allow reading BD-J specific system properties

hpi1 git at videolan.org
Mon Mar 23 10:04:54 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Mar 23 10:58:46 2015 +0200| [4f2a6f6109af2a42e024b882cee12177844b1897] | committer: hpi1

JSM: allow reading BD-J specific system properties

Use system policy to check all other property permissions.

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

 .../bdj/java/org/videolan/BDJSecurityManager.java  |   22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
index 9e7a08f..6b1e37e 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
@@ -22,6 +22,7 @@ package org.videolan;
 
 import java.io.FilePermission;
 import java.io.File;
+import java.util.PropertyPermission;
 import java.security.AccessController;
 import java.security.Permission;
 import java.security.PrivilegedAction;
@@ -77,6 +78,27 @@ final class BDJSecurityManager extends SecurityManager {
             }
         }
 
+        else if (perm instanceof PropertyPermission) {
+            // allow read
+            if (perm.getActions().equals("read")) {
+                String prop = perm.getName();
+                if (prop.startsWith("bluray.") || prop.startsWith("dvb.") || prop.startsWith("mhp.")) {
+                    //logger.info(perm + " granted");
+                    return;
+                }
+                if (prop.startsWith("user.dir")) {
+                    //logger.info(perm + " granted\n" + Logger.dumpStack());
+                    return;
+                }
+            }
+            try {
+                super.checkPermission(perm);
+            } catch (Exception e) {
+                logger.error(perm + " denied by system");
+                deny(perm);
+            }
+        }
+
         /*
         try {
             java.security.AccessController.checkPermission(perm);



More information about the libbluray-devel mailing list