summaryrefslogtreecommitdiff
path: root/src/de/blinkt/openvpn/OpenVpnService.java
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-04-21 18:36:35 +0200
committerArne Schwabe <arne@rfc2549.org>2012-04-21 18:36:35 +0200
commit488a41cc60636298581c2b44b4706b259fc98a36 (patch)
treeba247a01a310ca7b68343e655e0d7b550597de46 /src/de/blinkt/openvpn/OpenVpnService.java
parent89369d1e8651514ad295b11e6e1f5ee00a402168 (diff)
wip
Diffstat (limited to 'src/de/blinkt/openvpn/OpenVpnService.java')
-rw-r--r--src/de/blinkt/openvpn/OpenVpnService.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/de/blinkt/openvpn/OpenVpnService.java b/src/de/blinkt/openvpn/OpenVpnService.java
index e8174bcb..4aad9318 100644
--- a/src/de/blinkt/openvpn/OpenVpnService.java
+++ b/src/de/blinkt/openvpn/OpenVpnService.java
@@ -117,13 +117,34 @@ public class OpenVpnService extends VpnService implements Handler.Callback, Runn
}
}
+ if(intent.hasExtra(prefix +".USERNAME"))
+ {
+ try {
+ String user = managmentEscape(intent.getStringExtra(prefix +".USERNAME"));
+ String pw = managmentEscape(intent.getStringExtra(prefix +".PASSWORD"));
+ Thread.sleep(3000);
+
+
+ managmentCommand("username 'Auth' " + user+ "\n" +
+ "password 'Auth' " + pw + "\n");
+ } catch (InterruptedException e) {
+ }
+ }
return START_STICKY;
}
- @Override
+ private String managmentEscape(String unescape) {
+ String escapedString = unescape.replace("\\", "\\\\");
+ escapedString = escapedString.replace("\"","\\\"");
+ escapedString = escapedString.replace("\n","\\n");
+ return '"' + escapedString + '"';
+ }
+
+
+ @Override
public void onDestroy() {
if (mThread != null) {
managmentCommand("signal SIGINT\n");