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

Commit f5116d01 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Apply DISALLOW_CONFIG_VPN restriction to VPN.

Bug: 16008760
Change-Id: I299d5f32d9b09c3abcc32f3e889a0187880621df
parent 1e1f2e89
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ public class Vpn extends BaseNetworkStateTracker {
        try {
            // Restricted users are not allowed to create VPNs, they are tied to Owner
            UserInfo user = mgr.getUserInfo(mUserId);
            if (user.isRestricted()) {
            if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
                throw new SecurityException("Restricted users cannot establish VPNs");
            }

@@ -722,6 +722,11 @@ public class Vpn extends BaseNetworkStateTracker {
        if (!keyStore.isUnlocked()) {
            throw new IllegalStateException("KeyStore isn't unlocked");
        }
        UserManager mgr = UserManager.get(mContext);
        UserInfo user = mgr.getUserInfo(mUserId);
        if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
            throw new SecurityException("Restricted users cannot establish VPNs");
        }

        final RouteInfo ipv4DefaultRoute = findIPv4DefaultRoute(egress);
        final String gateway = ipv4DefaultRoute.getGateway().getHostAddress();