summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2016-02-18 13:54:08 +0100
committerArne Schwabe <arne@rfc2549.org>2016-02-18 13:55:29 +0100
commitdb5f46e1ce191d1b8a635f5e62f63370753cf020 (patch)
tree3cd300a7bd762f5301b6be12a0c30e8e37a2c989 /main
parent5c217e6d58163a930a720195e3e708f784ca527e (diff)
Fix error reporting on missing certificates
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/VpnProfile.java16
-rwxr-xr-xmain/src/main/res/values/strings.xml5
2 files changed, 18 insertions, 3 deletions
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</%s>\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 @@
<string name="opentun_no_ipaddr">Refusing to open tun device without IP information</string>
<string name="menu_import">Import Profile from ovpn file</string>
<string name="menu_import_short">Import</string>
- <string name="import_content_resolve_error">Could not read Profile to import</string>
+ <string name="import_content_resolve_error">Could not read profile to import</string>
<string name="error_reading_config_file">Error reading config file</string>
<string name="add_profile">add Profile</string>
<string name="import_could_not_open">Could not find file %1$s mentioned in the imported config file</string>
@@ -400,4 +400,7 @@
<string name="pw_request_dialog_prompt">Please enter the password for profile %1$s</string>
<string name="menu_use_inline_data">Use inline data</string>
<string name="export_config_chooser_title">Export configuration file</string>
+ <string name="missing_tlsauth">tls-auth file is missing</string>
+ <string name="missing_certificates">Missing user certificate or user certifcate key file</string>
+ <string name="missing_ca_certificate">Missing CA certificate</string>
</resources>