am 868d4c34: am 95023066: DO NOT MERGE Sanitize WifiConfigs

* commit '868d4c341034de6e2ebb6c1a247488b00d17c78d':
  DO NOT MERGE Sanitize WifiConfigs
This commit is contained in:
Robert Greenwalt
2014-02-25 10:12:35 -08:00
committed by Android Git Automerger
4 changed files with 79 additions and 1 deletions

View File

@@ -35,6 +35,7 @@ import android.net.wifi.WifiWatchdogStateMachine;
import android.net.DhcpInfo;
import android.net.DhcpResults;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.NetworkUtils;
import android.net.RouteInfo;
import android.os.Binder;
@@ -470,6 +471,17 @@ public final class WifiService extends IWifiManager.Stub {
*/
public int addOrUpdateNetwork(WifiConfiguration config) {
enforceChangePermission();
// Until we have better UI so the user knows what's up we can't support undisplayable
// things (it's a security hole). Even when we can support it we probably need
// to lock down who can modify what. TODO - remove this when addOrUpdateNetwork
// restricts callers AND when the UI in settings lets users view the data AND
// when the VPN code is immune to specific routes.
if (config != null) {
LinkProperties lp = config.linkProperties;
if (lp == null || lp.equals(WifiConfiguration.stripUndisplayableConfig(lp)) == false) {
return -1;
}
}
if (mWifiStateMachineChannel != null) {
return mWifiStateMachine.syncAddOrUpdateNetwork(mWifiStateMachineChannel, config);
} else {