Loading services/core/java/com/android/server/IpSecService.java +15 −11 Original line number Original line Diff line number Diff line Loading @@ -1481,10 +1481,13 @@ public class IpSecService extends IIpSecService.Stub { } } } } private static final String TUNNEL_OP = "STOPSHIP"; // = AppOpsManager.OP_MANAGE_IPSEC_TUNNELS; private void enforceTunnelPermissions(String callingPackage) { private void enforceTunnelPermissions(String callingPackage) { checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels"); checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels"); if (false) { // STOPSHIP if this line is present switch (getAppOpsManager().noteOp( switch (getAppOpsManager().noteOp( AppOpsManager.OP_MANAGE_IPSEC_TUNNELS, TUNNEL_OP, Binder.getCallingUid(), callingPackage)) { Binder.getCallingUid(), callingPackage)) { case AppOpsManager.MODE_DEFAULT: case AppOpsManager.MODE_DEFAULT: mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( Loading @@ -1496,6 +1499,7 @@ public class IpSecService extends IIpSecService.Stub { throw new SecurityException("Request to ignore AppOps for non-legacy API"); throw new SecurityException("Request to ignore AppOps for non-legacy API"); } } } } } private void createOrUpdateTransform( private void createOrUpdateTransform( IpSecConfig c, int resourceId, SpiRecord spiRecord, EncapSocketRecord socketRecord) IpSecConfig c, int resourceId, SpiRecord spiRecord, EncapSocketRecord socketRecord) Loading tests/net/java/com/android/server/IpSecServiceParameterizedTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collection; import org.junit.Before; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized; Loading Loading @@ -592,6 +593,7 @@ public class IpSecServiceParameterizedTest { } } } } @Ignore @Test @Test public void testAddTunnelFailsForBadPackageName() throws Exception { public void testAddTunnelFailsForBadPackageName() throws Exception { try { try { Loading Loading
services/core/java/com/android/server/IpSecService.java +15 −11 Original line number Original line Diff line number Diff line Loading @@ -1481,10 +1481,13 @@ public class IpSecService extends IIpSecService.Stub { } } } } private static final String TUNNEL_OP = "STOPSHIP"; // = AppOpsManager.OP_MANAGE_IPSEC_TUNNELS; private void enforceTunnelPermissions(String callingPackage) { private void enforceTunnelPermissions(String callingPackage) { checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels"); checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels"); if (false) { // STOPSHIP if this line is present switch (getAppOpsManager().noteOp( switch (getAppOpsManager().noteOp( AppOpsManager.OP_MANAGE_IPSEC_TUNNELS, TUNNEL_OP, Binder.getCallingUid(), callingPackage)) { Binder.getCallingUid(), callingPackage)) { case AppOpsManager.MODE_DEFAULT: case AppOpsManager.MODE_DEFAULT: mContext.enforceCallingOrSelfPermission( mContext.enforceCallingOrSelfPermission( Loading @@ -1496,6 +1499,7 @@ public class IpSecService extends IIpSecService.Stub { throw new SecurityException("Request to ignore AppOps for non-legacy API"); throw new SecurityException("Request to ignore AppOps for non-legacy API"); } } } } } private void createOrUpdateTransform( private void createOrUpdateTransform( IpSecConfig c, int resourceId, SpiRecord spiRecord, EncapSocketRecord socketRecord) IpSecConfig c, int resourceId, SpiRecord spiRecord, EncapSocketRecord socketRecord) Loading
tests/net/java/com/android/server/IpSecServiceParameterizedTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.Collection; import org.junit.Before; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized; Loading Loading @@ -592,6 +593,7 @@ public class IpSecServiceParameterizedTest { } } } } @Ignore @Test @Test public void testAddTunnelFailsForBadPackageName() throws Exception { public void testAddTunnelFailsForBadPackageName() throws Exception { try { try { Loading