summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorNicolas Prevot <nprevot@google.com>2015-01-06 15:43:05 +0000
committerNicolas Prevot <nprevot@google.com>2015-05-06 02:10:07 +0100
commit95778ffc58979d19ff9f4aaed396a6eca49cf698 (patch)
tree418e716416e94d493f2427ee92f7c82cc9992fa1 /services
parentd5fb9cac87d65d59e9d2c0fa4242fb6eeb4edf6d (diff)
downloadframeworks_base-95778ffc58979d19ff9f4aaed396a6eca49cf698.zip
frameworks_base-95778ffc58979d19ff9f4aaed396a6eca49cf698.tar.gz
frameworks_base-95778ffc58979d19ff9f4aaed396a6eca49cf698.tar.bz2
Fetch DISALLOW_CONFIG_VPN for the current user.
The code did not specify the user in which to fetch the value of the restriction DISALLOW_CONFIG_VPN. Since it was called from the vpn service which lives in user 0, it would always fetch the value for user 0. BUG: 18902920 Change-Id: I89419976a8edcaa86ac8e545c64d10818cd42ddd
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index a07591c9..ac55292 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -488,7 +488,8 @@ public class Vpn {
try {
// Restricted users are not allowed to create VPNs, they are tied to Owner
UserInfo user = mgr.getUserInfo(mUserHandle);
- if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
+ if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
+ new UserHandle(mUserHandle))) {
throw new SecurityException("Restricted users cannot establish VPNs");
}
@@ -896,7 +897,8 @@ public class Vpn {
}
UserManager mgr = UserManager.get(mContext);
UserInfo user = mgr.getUserInfo(mUserHandle);
- if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN)) {
+ if (user.isRestricted() || mgr.hasUserRestriction(UserManager.DISALLOW_CONFIG_VPN,
+ new UserHandle(mUserHandle))) {
throw new SecurityException("Restricted users cannot establish VPNs");
}