summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-06-06 14:51:19 -0700
committerRoshan Pius <rpius@google.com>2017-06-06 23:39:10 +0000
commiteb6343516fb91c3f7651e5979e047306aaf04554 (patch)
tree37215411a74ac5bd95f9acd711adc5b61428098e /service
parent2d02c0b588eb19935ad87b8dae9d6a9839e667c2 (diff)
WifiConfigurationUtil: Ignore masked passwords
This is the case of apps retrieving WifiConfiguration from WifiManager API's and passing it back to use for a network update. This is already ignored in WifiConfigManager's update handling. Bug: 62385845 Test: Unit tests Test: Able to force connection to existing saved PSK network. Change-Id: I0277dcca401335db21ad0f360f044e9634956829
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiConfigurationUtil.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigurationUtil.java b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
index 5b20fd0b1..3ff4d73fd 100644
--- a/service/java/com/android/server/wifi/WifiConfigurationUtil.java
+++ b/service/java/com/android/server/wifi/WifiConfigurationUtil.java
@@ -55,6 +55,8 @@ public class WifiConfigurationUtil {
private static final int PSK_ASCII_MIN_LEN = 8 + ENCLOSING_QUTOES_LEN;
private static final int PSK_ASCII_MAX_LEN = 63 + ENCLOSING_QUTOES_LEN;
private static final int PSK_HEX_LEN = 128;
+ @VisibleForTesting
+ public static final String PASSWORD_MASK = "*";
/**
* Check whether a network configuration is visible to a user or any of its managed profiles.
@@ -300,6 +302,10 @@ public class WifiConfigurationUtil {
Log.e(TAG, "validatePsk failed: empty string");
return false;
}
+ // The app returned back the masked password, let it thru. WifiConfigManager will handle it.
+ if (psk.equals(PASSWORD_MASK)) {
+ return true;
+ }
if (psk.startsWith("\"")) {
// ASCII PSK string
if (psk.length() < PSK_ASCII_MIN_LEN) {