summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorSteven Liu <steveliu@google.com>2019-08-23 15:20:15 -0700
committerSteven Liu <steveliu@google.com>2019-08-28 10:13:41 -0700
commit07969aeeab3a0caebef26d1b2921d53845101f56 (patch)
tree2ae4d2abce3eab21c009d641b9af7a81eed513ba /service
parent07ba9343d2142ee08bffa4febb1e7813d10d7774 (diff)
Change system language, passpoint R2 failed to connect
The comparing of friendly names from AP are mismatched with subject names from OSU server certificate. it shouldn't use system default locale, the languages and names broadcasted by AP should be used. Bug: 139854572 Test: Change the device language to Chinese, connect to passpoint network; unit test. Change-Id: I7ac6dbc00c3701010d9643df46ac78a5de665876
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/hotspot2/OsuServerConnection.java20
-rw-r--r--service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java2
2 files changed, 10 insertions, 12 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/OsuServerConnection.java b/service/java/com/android/server/wifi/hotspot2/OsuServerConnection.java
index 94f584f72..92560932c 100644
--- a/service/java/com/android/server/wifi/hotspot2/OsuServerConnection.java
+++ b/service/java/com/android/server/wifi/hotspot2/OsuServerConnection.java
@@ -188,27 +188,25 @@ public class OsuServerConnection {
* Validates the service provider by comparing its identities found in OSU Server cert
* to the friendlyName obtained from ANQP exchange that is displayed to the user.
*
- * @param locale a {@link Locale} object used for matching the friendly name in
- * subjectAltName section of the certificate along with
- * {@param friendlyName}.
- * @param friendlyName a string of the friendly name used for finding the same name in
- * subjectAltName section of the certificate.
+ * @param friendlyNames the friendly names used for finding the same name in
+ * subjectAltName section of the certificate, which is a map of language
+ * codes from ISO-639 and names.
* @return boolean true if friendlyName shows up as one of the identities in the cert
*/
- public boolean validateProvider(Locale locale,
- String friendlyName) {
+ public boolean validateProvider(
+ Map<String, String> friendlyNames) {
- if (locale == null || TextUtils.isEmpty(friendlyName)) {
+ if (friendlyNames.size() == 0) {
return false;
}
for (Pair<Locale, String> identity : ServiceProviderVerifier.getProviderNames(
mTrustManager.getProviderCert())) {
- if (identity.first == null) continue;
+ if (identity.first == null || TextUtils.isEmpty(identity.second)) continue;
// Compare the language code for ISO-639.
- if (identity.first.getISO3Language().equals(locale.getISO3Language()) &&
- TextUtils.equals(identity.second, friendlyName)) {
+ if (TextUtils.equals(identity.second,
+ friendlyNames.get(identity.first.getISO3Language()))) {
if (mVerboseLoggingEnabled) {
Log.v(TAG, "OSU certificate is valid for "
+ identity.first.getISO3Language() + "/" + identity.second);
diff --git a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
index bdd035fe4..137d9fa19 100644
--- a/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
+++ b/service/java/com/android/server/wifi/hotspot2/PasspointProvisioner.java
@@ -366,7 +366,7 @@ public class PasspointProvisioner {
return;
}
if (!mOsuServerConnection.validateProvider(
- Locale.getDefault(), mOsuProvider.getFriendlyName())) {
+ mOsuProvider.getFriendlyNameList())) {
Log.e(TAG,
"OSU Server certificate does not have the one matched with the selected "
+ "Service Name: "