summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRebecca Silberstein <silberst@google.com>2017-03-14 17:57:46 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-14 17:57:47 +0000
commite65f63b6758b2c310a17263fab622adf798e47cd (patch)
tree6ee2beb45efcf6df86ddf43e9997e570411ff04c /service
parentc6b2bac85c9cabb01058169279e238168a47d405 (diff)
parent5c5e8b347d32f7bf5bb1e6f40b1e350f1e9fb0f3 (diff)
Merge "WifiServiceImpl: protect Settings softap config"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiServiceImpl.java21
1 files changed, 19 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java
index e57e465e3..19eaf5218 100644
--- a/service/java/com/android/server/wifi/WifiServiceImpl.java
+++ b/service/java/com/android/server/wifi/WifiServiceImpl.java
@@ -687,22 +687,39 @@ public class WifiServiceImpl extends IWifiManager.Stub {
/**
* see {@link WifiManager#getWifiApConfiguration()}
* @return soft access point configuration
+ * @throws SecurityException if the caller does not have permission to retrieve the softap
+ * config
*/
@Override
public WifiConfiguration getWifiApConfiguration() {
enforceAccessPermission();
- mLog.trace("getWifiApConfiguration uid=%").c(Binder.getCallingUid()).flush();
+ int uid = Binder.getCallingUid();
+ // only allow Settings UI to get the saved SoftApConfig
+ if (!mWifiPermissionsUtil.checkConfigOverridePermission(uid)) {
+ // random apps should not be allowed to read the user specified config
+ throw new SecurityException("App not allowed to read or update stored WiFi Ap config "
+ + "(uid = " + uid + ")");
+ }
+ mLog.trace("getWifiApConfiguration uid=%").c(uid).flush();
return mWifiStateMachine.syncGetWifiApConfiguration();
}
/**
* see {@link WifiManager#setWifiApConfiguration(WifiConfiguration)}
* @param wifiConfig WifiConfiguration details for soft access point
+ * @throws SecurityException if the caller does not have permission to write the sotap config
*/
@Override
public void setWifiApConfiguration(WifiConfiguration wifiConfig) {
enforceChangePermission();
- mLog.trace("setWifiApConfiguration uid=%").c(Binder.getCallingUid()).flush();
+ int uid = Binder.getCallingUid();
+ // only allow Settings UI to write the stored SoftApConfig
+ if (!mWifiPermissionsUtil.checkConfigOverridePermission(uid)) {
+ // random apps should not be allowed to read the user specified config
+ throw new SecurityException("App not allowed to read or update stored WiFi AP config "
+ + "(uid = " + uid + ")");
+ }
+ mLog.trace("setWifiApConfiguration uid=%").c(uid).flush();
if (wifiConfig == null)
return;
if (isValid(wifiConfig)) {