summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/VpnProfile.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-06 18:13:09 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-06 18:13:09 +0200
commit7c020349d214a942293047954ce45aab04cc6420 (patch)
tree8cd65adb7b37b6c968f39112ba03c3fe5e2f5c3a /src/de/blinkt/openvpn/VpnProfile.java
parent581062c8b9629a5d52b555d13b573b12394fafda (diff)
Add ability to send the log (closes issue #9)
protect fd over unix socket
Diffstat (limited to 'src/de/blinkt/openvpn/VpnProfile.java')
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 572c0c2d..75f0235d 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -148,6 +148,13 @@ public class VpnProfile implements Serializable{
}
};
+ public static String openVpnEscape(String unescape) {
+ String escapedString = unescape.replace("\\", "\\\\");
+ escapedString = escapedString.replace("\"","\\\"");
+ escapedString = escapedString.replace("\n","\\n");
+ return '"' + escapedString + '"';
+ }
+
static final String OVPNCONFIGPKCS12 = "android.pkcs12";
@@ -231,22 +238,22 @@ public class VpnProfile implements Serializable{
case VpnProfile.TYPE_CERTIFICATES:
// Ca
cfg+="ca ";
- cfg+=mCaFilename;
+ cfg+=openVpnEscape(mCaFilename);
cfg+="\n";
// Client Cert + Key
cfg+="key ";
- cfg+=mClientKeyFilename;
+ cfg+=openVpnEscape(mClientKeyFilename);
cfg+="\n";
cfg+="cert ";
- cfg+=mClientCertFilename;
+ cfg+=openVpnEscape(mClientCertFilename);
cfg+="\n";
break;
case VpnProfile.TYPE_USERPASS_PKCS12:
cfg+="auth-user-pass\n";
case VpnProfile.TYPE_PKCS12:
cfg+="pkcs12 ";
- cfg+=mPKCS12Filename;
+ cfg+=openVpnEscape(mPKCS12Filename);
cfg+="\n";
cfg+="management-query-passwords\n";
break;
@@ -262,7 +269,7 @@ public class VpnProfile implements Serializable{
case VpnProfile.TYPE_USERPASS:
cfg+="auth-user-pass\n";
cfg+="management-query-passwords\n";
- cfg+="ca " + mCaFilename +"\n";
+ cfg+="ca " +openVpnEscape(mCaFilename) +"\n";
}
if(mUseLzo) {
@@ -274,7 +281,7 @@ public class VpnProfile implements Serializable{
cfg+="secret ";
else
cfg+="tls-auth ";
- cfg+=mTLSAuthFilename;
+ cfg+=openVpnEscape(mTLSAuthFilename);
cfg+=" ";
cfg+= mTLSAuthDirection;
cfg+="\n";