OSDN Git Service

[DO NOT MERGE] Add permission check to setAllowOnlyVpnForUids
authorRubin Xu <rubinxu@google.com>
Thu, 11 Jan 2018 10:59:19 +0000 (10:59 +0000)
committerJP Sugarbroad <jpsugar@google.com>
Thu, 15 Mar 2018 19:53:27 +0000 (12:53 -0700)
Bug: 63000005
Test: runtest frameworks-net -c com.android.server.connectivity.VpnTest
Test: cts-tradefed run cts-dev -m CtsDevicePolicyManagerTestCases -t com.android.cts.devicepolicy.MixedDeviceOwnerTest#testAlwaysOnVpnLockDown
Change-Id: Ia1a82ee73d8617f3124032986fe6c09c14bf7752
(cherry picked from commit 41d8bf1fedbd71b86579fff8d581491f36beb241)

services/core/java/com/android/server/NetworkManagementService.java

index bdbd066..44031cf 100644 (file)
@@ -1864,6 +1864,8 @@ public class NetworkManagementService extends INetworkManagementService.Stub
     @Override
     public void setAllowOnlyVpnForUids(boolean add, UidRange[] uidRanges)
             throws ServiceSpecificException {
+        mContext.enforceCallingOrSelfPermission(CONNECTIVITY_INTERNAL, TAG);
+
         try {
             mNetdService.networkRejectNonSecureVpn(add, uidRanges);
         } catch (ServiceSpecificException e) {