summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnManagementThread.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
commitef4fd36f5d38e82ba6165be2468d985d62f1d32f (patch)
tree8cd65adb7b37b6c968f39112ba03c3fe5e2f5c3a /src/de/blinkt/openvpn/OpenVpnManagementThread.java
parentec7e6b920257e52a24f9fc56150c05f3bbc6da7d (diff)
Add ability to send the log (closes issue #9)
protect fd over unix socket
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnManagementThread.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnManagementThread.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
index 2bae9e5e..4162d315 100644
--- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
@@ -31,14 +31,6 @@ public class OpenVpnManagementThread implements Runnable {
}
- private String managmentEscape(String unescape) {
- String escapedString = unescape.replace("\\", "\\\\");
- escapedString = escapedString.replace("\"","\\\"");
- escapedString = escapedString.replace("\n","\\n");
- return '"' + escapedString + '"';
- }
-
-
public void managmentCommand(String cmd) {
try {
mSocket.getOutputStream().write(cmd.getBytes());
@@ -177,7 +169,7 @@ public class OpenVpnManagementThread implements Runnable {
pw = mProfile.getPasswordPrivateKey();
} else if (needed.equals("Auth")) {
String usercmd = String.format("username '%s' %s\n",
- needed, managmentEscape(mProfile.mUsername));
+ needed, VpnProfile.openVpnEscape(mProfile.mUsername));
managmentCommand(usercmd);
pw = mProfile.getPasswordAuth();
} else if (needed.equals("PROTECTFD")) {
@@ -187,7 +179,7 @@ public class OpenVpnManagementThread implements Runnable {
response="needok";
}
if(pw!=null) {
- String cmd = String.format("%s '%s' %s\n",response, needed, managmentEscape(pw));
+ String cmd = String.format("%s '%s' %s\n",response, needed, VpnProfile.openVpnEscape(pw));
managmentCommand(cmd);
}