From f97e14bf30624fd5b95571399b4a74f353ed2da4 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 25 Nov 2014 11:14:17 +0100 Subject: Fix multiple connection definitions with tls-remote check --HG-- extra : rebase_source : 6bde5fa992982adfef2b82bb058cb13d55825f8f --- main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 2 +- .../blinkt/openvpn/fragments/Settings_Authentication.java | 13 +++++++++---- main/src/main/res/values/strings.xml | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index b2246b8c..4b483b8f 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -438,7 +438,7 @@ public class VpnProfile implements Serializable { if (mAuthenticationType != TYPE_STATICKEYS) { if (mCheckRemoteCN) { if (mRemoteCN == null || mRemoteCN.equals("")) - cfg += "verify-x509-name " + mServerName + " name\n"; + cfg += "verify-x509-name " + mConnections[0].mServerName + " name\n"; else switch (mX509AuthType) { diff --git a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java index a286a688..270b4ddf 100644 --- a/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java +++ b/main/src/main/java/de/blinkt/openvpn/fragments/Settings_Authentication.java @@ -135,10 +135,15 @@ public class Settings_Authentication extends OpenVpnPreferencesFragment implemen @SuppressWarnings("unchecked") String dn = ((Pair) newValue).second; - if ("".equals(dn)) - preference.setSummary(getX509String(VpnProfile.X509_VERIFY_TLSREMOTE_RDN, mProfile.mServerName)); - else - preference.setSummary(getX509String(authtype,dn)); + if ("".equals(dn)) { + if (mProfile.mConnections.length > 0) { + preference.setSummary(getX509String(VpnProfile.X509_VERIFY_TLSREMOTE_RDN, mProfile.mConnections[0].mServerName)); + } else { + preference.setSummary(R.string.no_remote_defined); + } + } else { + preference.setSummary(getX509String(authtype, dn)); + } } else if (preference == mCipher || preference == mAuth) { preference.setSummary((CharSequence) newValue); diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index aeb03712..b692541d 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -345,5 +345,6 @@ Advanced Settings Payload options TLS Settings + No remote defined -- cgit v1.2.3