diff options
author | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 18:13:09 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2012-05-06 18:13:09 +0200 |
commit | ef4fd36f5d38e82ba6165be2468d985d62f1d32f (patch) | |
tree | 8cd65adb7b37b6c968f39112ba03c3fe5e2f5c3a /src/de/blinkt/openvpn/VpnProfile.java | |
parent | ec7e6b920257e52a24f9fc56150c05f3bbc6da7d (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.java | 19 |
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"; |