WifiConfigController: set ca_path and ca_cert to null if unused
am: d147f0090c
* commit 'd147f0090ce28e1ad70f7a9b582dec91161139e8':
WifiConfigController: set ca_path and ca_cert to null if unused
This commit is contained in:
@@ -535,30 +535,43 @@ public class WifiConfigController implements TextWatcher,
|
|||||||
config.enterpriseConfig.setPhase2Method(phase2Method);
|
config.enterpriseConfig.setPhase2Method(phase2Method);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
String caCert = (String) mEapCaCertSpinner.getSelectedItem();
|
String caCert = (String) mEapCaCertSpinner.getSelectedItem();
|
||||||
|
config.enterpriseConfig.setCaCertificateAliases(null);
|
||||||
|
config.enterpriseConfig.setCaPath(null);
|
||||||
|
config.enterpriseConfig.setDomainSuffixMatch(mEapDomainView.getText().toString());
|
||||||
if (caCert.equals(mUnspecifiedCertString)
|
if (caCert.equals(mUnspecifiedCertString)
|
||||||
|| caCert.equals(mDoNotValidateEapServerString)) {
|
|| caCert.equals(mDoNotValidateEapServerString)) {
|
||||||
// Note: |caCert| should not be able to take the value |unspecifiedCert|,
|
// ca_cert already set to null, so do nothing.
|
||||||
// since we prevent such configurations from being saved.
|
} else if (caCert.equals(mUseSystemCertsString)) {
|
||||||
config.enterpriseConfig.setCaCertificateAliases(null);
|
config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH);
|
||||||
} else {
|
} else if (caCert.equals(mMultipleCertSetString)) {
|
||||||
config.enterpriseConfig.setDomainSuffixMatch(
|
if (mAccessPoint != null) {
|
||||||
mEapDomainView.getText().toString());
|
if (!mAccessPoint.isSaved()) {
|
||||||
if (caCert.equals(mUseSystemCertsString)) {
|
Log.e(TAG, "Multiple certs can only be set "
|
||||||
config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH);
|
+ "when editing saved network");
|
||||||
} else if (caCert.equals(mMultipleCertSetString)) {
|
|
||||||
if (mAccessPoint != null) {
|
|
||||||
if (!mAccessPoint.isSaved()) {
|
|
||||||
Log.e(TAG, "Multiple certs can only be set "
|
|
||||||
+ "when editing saved network");
|
|
||||||
}
|
|
||||||
config.enterpriseConfig.setCaCertificateAliases(
|
|
||||||
mAccessPoint.getConfig().enterpriseConfig
|
|
||||||
.getCaCertificateAliases());
|
|
||||||
}
|
}
|
||||||
} else {
|
config.enterpriseConfig.setCaCertificateAliases(
|
||||||
config.enterpriseConfig.setCaCertificateAliases(new String[] {caCert});
|
mAccessPoint
|
||||||
|
.getConfig()
|
||||||
|
.enterpriseConfig
|
||||||
|
.getCaCertificateAliases());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
config.enterpriseConfig.setCaCertificateAliases(new String[] {caCert});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ca_cert or ca_path should not both be non-null, since we only intend to let
|
||||||
|
// the use either their own certificate, or the system certificates, not both.
|
||||||
|
// The variable that is not used must explicitly be set to null, so that a
|
||||||
|
// previously-set value on a saved configuration will be erased on an update.
|
||||||
|
if (config.enterpriseConfig.getCaCertificateAliases() != null
|
||||||
|
&& config.enterpriseConfig.getCaPath() != null) {
|
||||||
|
Log.e(TAG, "ca_cert ("
|
||||||
|
+ config.enterpriseConfig.getCaCertificateAliases()
|
||||||
|
+ ") and ca_path ("
|
||||||
|
+ config.enterpriseConfig.getCaPath()
|
||||||
|
+ ") should not both be non-null");
|
||||||
}
|
}
|
||||||
|
|
||||||
String clientCert = (String) mEapUserCertSpinner.getSelectedItem();
|
String clientCert = (String) mEapUserCertSpinner.getSelectedItem();
|
||||||
|
Reference in New Issue
Block a user