diff options
author | Steven Liu <steveliu@google.com> | 2020-08-06 14:04:58 -0700 |
---|---|---|
committer | Steven Liu <steveliu@google.com> | 2020-08-06 19:53:37 -0700 |
commit | 653590862adc4555d583576fef81b82d4ece4949 (patch) | |
tree | fbce58ff365a4ee635379d6d459600fbf69c4598 /service | |
parent | 80f2cb5148fe0a21572082bffa4ea26c5835e3c4 (diff) |
NullPointerException on authentication of SIM based EAP
Handle EAP-SIM/AKA/AKAP authentication renew with right WifiCofniguration.
Bug: 162940297
Test: atest com.android.server.wifi
Change-Id: I95cc201644b4c9c276b77d3bbc361e553c005586
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 3f6ef8601..0fc9cb355 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -5815,15 +5815,20 @@ public class ClientModeImpl extends StateMachine { } void handleGsmAuthRequest(SimAuthRequestData requestData) { + WifiConfiguration requestingWifiConfiguration = null; if (mTargetWifiConfiguration != null && mTargetWifiConfiguration.networkId == requestData.networkId) { + requestingWifiConfiguration = mTargetWifiConfiguration; logd("id matches targetWifiConfiguration"); } else if (mLastNetworkId != WifiConfiguration.INVALID_NETWORK_ID && mLastNetworkId == requestData.networkId) { + requestingWifiConfiguration = getCurrentWifiConfiguration(); logd("id matches currentWifiConfiguration"); - } else { - logd("id does not match targetWifiConfiguration"); + } + + if (requestingWifiConfiguration == null) { + logd("GsmAuthRequest received with null target/current WifiConfiguration."); return; } @@ -5840,15 +5845,15 @@ public class ClientModeImpl extends StateMachine { * [SRES][Cipher Key Kc] */ String response = mWifiCarrierInfoManager - .getGsmSimAuthResponse(requestData.data, mTargetWifiConfiguration); + .getGsmSimAuthResponse(requestData.data, requestingWifiConfiguration); if (response == null) { // In case of failure, issue may be due to sim type, retry as No.2 case response = mWifiCarrierInfoManager - .getGsmSimpleSimAuthResponse(requestData.data, mTargetWifiConfiguration); + .getGsmSimpleSimAuthResponse(requestData.data, requestingWifiConfiguration); if (response == null) { // In case of failure, issue may be due to sim type, retry as No.3 case response = mWifiCarrierInfoManager.getGsmSimpleSimNoLengthAuthResponse( - requestData.data, mTargetWifiConfiguration); + requestData.data, requestingWifiConfiguration); } } if (response == null || response.length() == 0) { @@ -5861,20 +5866,25 @@ public class ClientModeImpl extends StateMachine { } void handle3GAuthRequest(SimAuthRequestData requestData) { + WifiConfiguration requestingWifiConfiguration = null; if (mTargetWifiConfiguration != null && mTargetWifiConfiguration.networkId == requestData.networkId) { + requestingWifiConfiguration = mTargetWifiConfiguration; logd("id matches targetWifiConfiguration"); } else if (mLastNetworkId != WifiConfiguration.INVALID_NETWORK_ID && mLastNetworkId == requestData.networkId) { + requestingWifiConfiguration = getCurrentWifiConfiguration(); logd("id matches currentWifiConfiguration"); - } else { - logd("id does not match targetWifiConfiguration"); + } + + if (requestingWifiConfiguration == null) { + logd("3GAuthRequest received with null target/current WifiConfiguration."); return; } SimAuthResponseData response = mWifiCarrierInfoManager - .get3GAuthResponse(requestData, mTargetWifiConfiguration); + .get3GAuthResponse(requestData, requestingWifiConfiguration); if (response != null) { mWifiNative.simAuthResponse( mInterfaceName, response.type, response.response); |