Guard the SSID with NETWORK_SETTINGS
Bug: 77865258
Test: manual
Change-Id: I01d4ec7366382d42847c823ae6056222a012c504
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 079d815..5afb0a6 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1402,7 +1402,7 @@
NetworkCapabilities nc, int callerPid, int callerUid) {
final NetworkCapabilities newNc = new NetworkCapabilities(nc);
if (!checkSettingsPermission(callerPid, callerUid)) newNc.setUids(null);
- if (!checkNetworkStackPermission(callerPid, callerUid)) newNc.setSSID(null);
+ if (!checkSettingsPermission(callerPid, callerUid)) newNc.setSSID(null);
return newNc;
}
@@ -1662,11 +1662,6 @@
android.Manifest.permission.NETWORK_SETTINGS, pid, uid);
}
- private boolean checkNetworkStackPermission(int pid, int uid) {
- return PERMISSION_GRANTED == mContext.checkPermission(
- android.Manifest.permission.NETWORK_STACK, pid, uid);
- }
-
private void enforceTetherAccessPermission() {
mContext.enforceCallingOrSelfPermission(
android.Manifest.permission.ACCESS_NETWORK_STATE,
@@ -4247,7 +4242,7 @@
// calling app has permission to do so.
private void ensureSufficientPermissionsForRequest(NetworkCapabilities nc,
int callerPid, int callerUid) {
- if (null != nc.getSSID() && !checkNetworkStackPermission(callerPid, callerUid)) {
+ if (null != nc.getSSID() && !checkSettingsPermission(callerPid, callerUid)) {
throw new SecurityException("Insufficient permissions to request a specific SSID");
}
}