VpnSettings: use the real passwords instead of dummy strings.
Change-Id: Ib14350364740efe5529fa9ee264c69f91c06a538
This commit is contained in:
@@ -36,17 +36,6 @@ import android.widget.Spinner;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListener {
|
class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListener {
|
||||||
private static final String DUMMY = "\r";
|
|
||||||
|
|
||||||
private static String getDummy(String secret) {
|
|
||||||
return secret.isEmpty() ? "" : DUMMY;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String getSecret(String oldSecret, TextView view) {
|
|
||||||
String newSecret = view.getText().toString();
|
|
||||||
return DUMMY.equals(newSecret) ? oldSecret : newSecret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final KeyStore mKeyStore = KeyStore.getInstance();
|
private final KeyStore mKeyStore = KeyStore.getInstance();
|
||||||
private final DialogInterface.OnClickListener mListener;
|
private final DialogInterface.OnClickListener mListener;
|
||||||
private final VpnProfile mProfile;
|
private final VpnProfile mProfile;
|
||||||
@@ -107,13 +96,13 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
mType.setSelection(mProfile.type);
|
mType.setSelection(mProfile.type);
|
||||||
mServer.setText(mProfile.server);
|
mServer.setText(mProfile.server);
|
||||||
mUsername.setText(mProfile.username);
|
mUsername.setText(mProfile.username);
|
||||||
mPassword.setText(getDummy(mProfile.password));
|
mPassword.setText(mProfile.password);
|
||||||
mSearchDomains.setText(mProfile.searchDomains);
|
mSearchDomains.setText(mProfile.searchDomains);
|
||||||
mRoutes.setText(mProfile.routes);
|
mRoutes.setText(mProfile.routes);
|
||||||
mMppe.setChecked(mProfile.mppe);
|
mMppe.setChecked(mProfile.mppe);
|
||||||
mL2tpSecret.setText(getDummy(mProfile.l2tpSecret));
|
mL2tpSecret.setText(mProfile.l2tpSecret);
|
||||||
mIpsecIdentifier.setText(mProfile.ipsecIdentifier);
|
mIpsecIdentifier.setText(mProfile.ipsecIdentifier);
|
||||||
mIpsecSecret.setText(getDummy(mProfile.ipsecSecret));
|
mIpsecSecret.setText(mProfile.ipsecSecret);
|
||||||
loadCertificates(mIpsecUserCert, Credentials.USER_CERTIFICATE,
|
loadCertificates(mIpsecUserCert, Credentials.USER_CERTIFICATE,
|
||||||
0, mProfile.ipsecUserCert);
|
0, mProfile.ipsecUserCert);
|
||||||
loadCertificates(mIpsecCaCert, Credentials.CA_CERTIFICATE,
|
loadCertificates(mIpsecCaCert, Credentials.CA_CERTIFICATE,
|
||||||
@@ -288,7 +277,7 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
profile.type = mType.getSelectedItemPosition();
|
profile.type = mType.getSelectedItemPosition();
|
||||||
profile.server = mServer.getText().toString().trim();
|
profile.server = mServer.getText().toString().trim();
|
||||||
profile.username = mUsername.getText().toString();
|
profile.username = mUsername.getText().toString();
|
||||||
profile.password = getSecret(mProfile.password, mPassword);
|
profile.password = mPassword.getText().toString();
|
||||||
profile.searchDomains = mSearchDomains.getText().toString().trim();
|
profile.searchDomains = mSearchDomains.getText().toString().trim();
|
||||||
profile.routes = mRoutes.getText().toString().trim();
|
profile.routes = mRoutes.getText().toString().trim();
|
||||||
|
|
||||||
@@ -298,16 +287,16 @@ class VpnDialog extends AlertDialog implements TextWatcher, OnItemSelectedListen
|
|||||||
profile.mppe = mMppe.isChecked();
|
profile.mppe = mMppe.isChecked();
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
case VpnProfile.TYPE_L2TP_IPSEC_PSK:
|
||||||
profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
|
profile.l2tpSecret = mL2tpSecret.getText().toString();
|
||||||
profile.ipsecSecret = getSecret(mProfile.ipsecSecret, mIpsecSecret);
|
profile.ipsecSecret = mIpsecSecret.getText().toString();
|
||||||
break;
|
break;
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
case VpnProfile.TYPE_IPSEC_XAUTH_PSK:
|
||||||
profile.ipsecIdentifier = mIpsecIdentifier.getText().toString();
|
profile.ipsecIdentifier = mIpsecIdentifier.getText().toString();
|
||||||
profile.ipsecSecret = getSecret(mProfile.ipsecSecret, mIpsecSecret);
|
profile.ipsecSecret = mIpsecSecret.getText().toString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
case VpnProfile.TYPE_L2TP_IPSEC_RSA:
|
||||||
profile.l2tpSecret = getSecret(mProfile.l2tpSecret, mL2tpSecret);
|
profile.l2tpSecret = mL2tpSecret.getText().toString();
|
||||||
// fall through
|
// fall through
|
||||||
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
case VpnProfile.TYPE_IPSEC_XAUTH_RSA:
|
||||||
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
|
if (mIpsecUserCert.getSelectedItemPosition() != 0) {
|
||||||
|
Reference in New Issue
Block a user