[libbluray-devel] [Git][videolan/libbluray][master] 4 commits: BDJSecurityManager: deny SocketPermission if networking is disabled
Petri Hintukainen
gitlab at videolan.org
Wed Jul 29 19:51:43 CEST 2020
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
b902da84 by hpi1 at 2020-07-29T20:48:50+03:00
BDJSecurityManager: deny SocketPermission if networking is disabled
- - - - -
2f38d002 by hpi1 at 2020-07-29T20:48:50+03:00
BDJSecurityManager: Add check for SocketPermission("listen,resolve")
- - - - -
083d159a by hpi1 at 2020-07-29T20:48:50+03:00
BDJSecurityMAnager: Add check for NetPermission("getNetworkInformation")
- - - - -
39304f38 by hpi1 at 2020-07-29T20:48:50+03:00
Fix missing unlock in error path
- - - - -
2 changed files:
- src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
- src/libbluray/bluray.c
Changes:
=====================================
src/libbluray/bdj/java/org/videolan/BDJSecurityManager.java
=====================================
@@ -85,6 +85,13 @@ final class BDJSecurityManager extends SecurityManager {
throw new SecurityException("denied " + perm);
}
+ private void checkNet(Permission perm) {
+ String enable = System.getProperty("bluray.network.connected");
+ if (enable != null && enable.equals("YES"))
+ return;
+ deny(perm);
+ }
+
public void checkPermission(Permission perm) {
if (perm instanceof RuntimePermission) {
if (perm.implies(new RuntimePermission("createSecurityManager"))) {
@@ -164,6 +171,17 @@ final class BDJSecurityManager extends SecurityManager {
/* Networking */
else if (perm instanceof java.net.SocketPermission) {
if (new java.net.SocketPermission("*", "connect,resolve").implies(perm)) {
+ checkNet(perm);
+ return;
+ }
+ if (new java.net.SocketPermission("*", "listen,resolve").implies(perm)) {
+ checkNet(perm);
+ return;
+ }
+ }
+ else if (perm instanceof java.net.NetPermission) {
+ if (new java.net.NetPermission("*", "getNetworkInformation").implies(perm)) {
+ checkNet(perm);
return;
}
}
=====================================
src/libbluray/bluray.c
=====================================
@@ -1218,10 +1218,8 @@ int bd_bdj_seek(BLURAY *bd, int playitem, int playmark, int64_t time)
return 1;
}
-int bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup)
+static int _bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup)
{
- bd_mutex_lock(&bd->mutex);
-
if (bd->title) {
BD_DEBUG(DBG_BLURAY | DBG_CRIT, "bd_set_virtual_package() failed: playlist is playing\n");
return -1;
@@ -1239,11 +1237,18 @@ int bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup)
/* TODO: reload all cached information, update disc info, notify app */
- bd_mutex_unlock(&bd->mutex);
-
return 0;
}
+int bd_set_virtual_package(BLURAY *bd, const char *vp_path, int psr_init_backup)
+{
+ int ret;
+ bd_mutex_lock(&bd->mutex);
+ ret = _bd_set_virtual_package(bd, vp_path, psr_init_backup);
+ bd_mutex_unlock(&bd->mutex);
+ return ret;
+}
+
BD_DISC *bd_get_disc(BLURAY *bd)
{
return bd ? bd->disc : NULL;
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/76b073b8b0701cb817a6bc093494b0acbebb0b04...39304f38eeb0926ecb96ec40013bf275d175e3ce
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/76b073b8b0701cb817a6bc093494b0acbebb0b04...39304f38eeb0926ecb96ec40013bf275d175e3ce
You're receiving this email because of your account on code.videolan.org.
More information about the libbluray-devel
mailing list