Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8db9189 authored by Benedict Wong's avatar Benedict Wong
Browse files

Re-enable checks for MANAGE_IPSEC_TUNNELS

This patch ensures that creation and modification of IPsec tunnels
requires the MANAGE_IPSEC_TUNNELS appop.

Bug: 115685048
Test: IpSecManagerTunnelTest fails without appops set
Change-Id: I6c60a2573ca521717877f36e28a392b0d3b62754
parent ee570a61
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -1488,14 +1488,11 @@ public class IpSecService extends IIpSecService.Stub {
        }
    }

    private static final String TUNNEL_OP = "STOPSHIP"; // = AppOpsManager.OP_MANAGE_IPSEC_TUNNELS;
    private static final String TUNNEL_OP = AppOpsManager.OPSTR_MANAGE_IPSEC_TUNNELS;

    private void enforceTunnelPermissions(String callingPackage) {
        checkNotNull(callingPackage, "Null calling package cannot create IpSec tunnels");
        if (false) { // STOPSHIP if this line is present
            switch (getAppOpsManager().noteOp(
                        TUNNEL_OP,
                        Binder.getCallingUid(), callingPackage)) {
        switch (getAppOpsManager().noteOp(TUNNEL_OP, Binder.getCallingUid(), callingPackage)) {
            case AppOpsManager.MODE_DEFAULT:
                mContext.enforceCallingOrSelfPermission(
                        android.Manifest.permission.MANAGE_IPSEC_TUNNELS, "IpSecService");
@@ -1506,7 +1503,6 @@ public class IpSecService extends IIpSecService.Stub {
                throw new SecurityException("Request to ignore AppOps for non-legacy API");
        }
    }
    }

    private void createOrUpdateTransform(
            IpSecConfig c, int resourceId, SpiRecord spiRecord, EncapSocketRecord socketRecord)