[libbluray-devel] TitleContextImpl: add security manager checks

hpi1 git at videolan.org
Tue Apr 7 13:30:08 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Apr  7 14:18:16 2015 +0300| [479c17e07b7dbdeb920f3a4c38304944e36ec86a] | committer: hpi1

TitleContextImpl: add security manager checks

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

 .../org/bluray/ti/selection/TitleContextImpl.java  |   22 ++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java b/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
index 4cc2562..a1b786b 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/selection/TitleContextImpl.java
@@ -29,10 +29,12 @@ import javax.tv.service.selection.NormalContentEvent;
 import javax.tv.service.selection.PresentationChangedEvent;
 import javax.tv.service.selection.PresentationTerminatedEvent;
 import javax.tv.service.selection.SelectionFailedEvent;
+import javax.tv.service.selection.SelectPermission;
 import javax.tv.service.selection.ServiceContentHandler;
 import javax.tv.service.selection.ServiceContextDestroyedEvent;
 import javax.tv.service.selection.ServiceContextEvent;
 import javax.tv.service.selection.ServiceContextListener;
+import javax.tv.service.selection.ServiceContextPermission;
 
 import org.bluray.ti.Title;
 import org.bluray.ti.TitleImpl;
@@ -47,6 +49,11 @@ public class TitleContextImpl implements TitleContext {
     }
 
     public ServiceContentHandler[] getServiceContentHandlers() throws SecurityException {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ServiceContextPermission("getServiceContentHandlers", "own"));
+        }
+
         if (state == STATE_DESTROYED)
             throw new IllegalStateException();
         if (state == STATE_STOPPED)
@@ -60,6 +67,11 @@ public class TitleContextImpl implements TitleContext {
     }
 
     public void start(Title title, boolean restart) throws SecurityException {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new SelectPermission(title.getLocator(), "own"));
+        }
+
         if (state == STATE_DESTROYED)
             throw new IllegalStateException();
         TitleStartAction action = new TitleStartAction(this, (TitleImpl)title);
@@ -80,6 +92,11 @@ public class TitleContextImpl implements TitleContext {
     }
 
     public void stop() throws SecurityException {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ServiceContextPermission("stop", "own"));
+        }
+
         if (state == STATE_DESTROYED)
             throw new IllegalStateException();
         TitleStopAction action = new TitleStopAction(this);
@@ -88,6 +105,11 @@ public class TitleContextImpl implements TitleContext {
     }
 
     public void destroy() throws SecurityException {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            sm.checkPermission(new ServiceContextPermission("stop", "own"));
+        }
+
         if (state != STATE_DESTROYED) {
             state = STATE_DESTROYED;
             TitleStopAction action = new TitleStopAction(this);



More information about the libbluray-devel mailing list