From db5f46e1ce191d1b8a635f5e62f63370753cf020 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 18 Feb 2016 13:54:08 +0100 Subject: Fix error reporting on missing certificates --- main/src/main/java/de/blinkt/openvpn/VpnProfile.java | 16 ++++++++++++++-- main/src/main/res/values/strings.xml | 5 ++++- 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'main') diff --git a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java index f52a0ad7..5ef95b6e 100644 --- a/main/src/main/java/de/blinkt/openvpn/VpnProfile.java +++ b/main/src/main/java/de/blinkt/openvpn/VpnProfile.java @@ -559,8 +559,7 @@ public class VpnProfile implements Serializable, Cloneable { //! Put inline data inline and other data as normal escaped filename public static String insertFileData(String cfgentry, String filedata) { if (filedata == null) { - // TODO: generate good error - return String.format("%s %s\n", cfgentry, "missing"); + return String.format("%s %s\n", cfgentry, "file missing in config profile"); } else if (isEmbedded(filedata)) { String dataWithOutHeader = getEmbeddedContent(filedata); return String.format(Locale.ENGLISH, "<%s>\n%s\n\n", cfgentry, dataWithOutHeader, cfgentry); @@ -858,6 +857,19 @@ public class VpnProfile implements Serializable, Cloneable { } + if (mUseTLSAuth && TextUtils.isEmpty(mTLSAuthFilename)) + return R.string.missing_tlsauth; + + if ((mAuthenticationType == TYPE_USERPASS_CERTIFICATES || mAuthenticationType == TYPE_CERTIFICATES) + && (TextUtils.isEmpty(mClientCertFilename) || TextUtils.isEmpty(mClientKeyFilename))) + return R.string.missing_certificates; + + if (!(mAuthenticationType == TYPE_KEYSTORE || mAuthenticationType == TYPE_USERPASS_KEYSTORE) + && TextUtils.isEmpty(mCaFilename)) + return R.string.missing_ca_certificate; + + + boolean noRemoteEnabled = true; for (Connection c : mConnections) if (c.mEnabled) diff --git a/main/src/main/res/values/strings.xml b/main/src/main/res/values/strings.xml index c41a0759..3e21e981 100755 --- a/main/src/main/res/values/strings.xml +++ b/main/src/main/res/values/strings.xml @@ -136,7 +136,7 @@ Refusing to open tun device without IP information Import Profile from ovpn file Import - Could not read Profile to import + Could not read profile to import Error reading config file add Profile Could not find file %1$s mentioned in the imported config file @@ -400,4 +400,7 @@ Please enter the password for profile %1$s Use inline data Export configuration file + tls-auth file is missing + Missing user certificate or user certifcate key file + Missing CA certificate -- cgit v1.2.3