am e42ce676: am ebf23a8d: am 74acf23a: am 3c417fbf: Merge "DO NOT MERGE Sanitize WifiConfigs" into jb-mr1-dev

* commit 'e42ce676f54742f2d47c26adaa90407c2cb8cec8':
  DO NOT MERGE Sanitize WifiConfigs
This commit is contained in:
Robert Greenwalt
2014-04-07 19:54:13 +00:00
committed by Android Git Automerger
4 changed files with 78 additions and 0 deletions

View File

@@ -43,6 +43,7 @@ import android.net.wifi.WpsInfo;
import android.net.wifi.WpsResult;
import android.net.ConnectivityManager;
import android.net.DhcpInfo;
import android.net.LinkProperties;
import android.net.NetworkInfo;
import android.net.NetworkInfo.State;
import android.net.NetworkInfo.DetailedState;
@@ -762,6 +763,17 @@ public 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 {