Apply DISALLOW_CONFIG_VPN restriction to VPN.
Bug: 16008760 Change-Id: I299d5f32d9b09c3abcc32f3e889a0187880621df
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user