summaryrefslogtreecommitdiff
path: root/src/se/leap/openvpn/OpenVpnManagementThread.java
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2013-12-04 17:24:42 +0100
committerParménides GV <parmegv@sdf.org>2013-12-04 17:24:42 +0100
commit90732260daaba438f49e510ed987284bcb419f4d (patch)
treeee30a40be65e993a9f886b47fd57d41717bf4222 /src/se/leap/openvpn/OpenVpnManagementThread.java
parentdc417fbfc67d8edaad58effde3a6a73fbeeab1da (diff)
parentd004c5535c75540600d6670e86300872651fc7bf (diff)
Merge branch 'bug/fix-switch-provider' into develop
Diffstat (limited to 'src/se/leap/openvpn/OpenVpnManagementThread.java')
-rw-r--r--src/se/leap/openvpn/OpenVpnManagementThread.java25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/se/leap/openvpn/OpenVpnManagementThread.java b/src/se/leap/openvpn/OpenVpnManagementThread.java
index 78ce5a2b..287de58e 100644
--- a/src/se/leap/openvpn/OpenVpnManagementThread.java
+++ b/src/se/leap/openvpn/OpenVpnManagementThread.java
@@ -19,7 +19,6 @@ import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import se.leap.bitmaskclient.R;
-
import android.content.SharedPreferences;
import android.net.LocalServerSocket;
import android.net.LocalSocket;
@@ -177,11 +176,12 @@ public class OpenVpnManagementThread implements Runnable {
private void processCommand(String command) {
+ Log.d(TAG, "processCommand: " + command);
+
if (command.startsWith(">") && command.contains(":")) {
String[] parts = command.split(":",2);
String cmd = parts[0].substring(1);
String argument = parts[1];
-
if(cmd.equals("INFO")) {
// Ignore greeting from mgmt
//logStatusMessage(command);
@@ -195,6 +195,8 @@ public class OpenVpnManagementThread implements Runnable {
processByteCount(argument);
} else if (cmd.equals("STATE")) {
processState(argument);
+ } else if (cmd.equals("FATAL")){
+ processState(","+cmd+","); //handles FATAL as state
} else if (cmd.equals("PROXY")) {
processProxyCMD(argument);
} else if (cmd.equals("LOG")) {
@@ -209,8 +211,11 @@ public class OpenVpnManagementThread implements Runnable {
OpenVPN.logMessage(0, "MGMT:", "Got unrecognized command" + command);
Log.i(TAG, "Got unrecognized command" + command);
}
- } else if (command.startsWith("SUCCESS:")) {
- // ignore
+ } else if (command.startsWith("SUCCESS:")) { //Fixes bug LEAP #4565
+ if (command.equals("SUCCESS: signal SIGINT thrown")){
+ Log.d(TAG, "SUCCESS: signal SIGINT thrown");
+ processState(",EXITING,SIGINT,,");
+ }
} else {
Log.i(TAG, "Got unrecognized line from managment" + command);
OpenVPN.logMessage(0, "MGMT:", "Got unrecognized line from management:" + command);
@@ -272,11 +277,17 @@ public class OpenVpnManagementThread implements Runnable {
private void processState(String argument) {
String[] args = argument.split(",",3);
String currentstate = args[1];
- Log.d("OpenVPN log", argument);
- if(args[2].equals(",,"))
+ if(args[2].equals(",,")){
OpenVPN.updateStateString(currentstate,"");
- else
+ }
+ else if (args[2].endsWith(",,")){ //fixes LEAP Bug #4546
+ args[2] = (String) args[2].subSequence(0, args[2].length()-2);
+ Log.d(TAG, "processState() STATE: "+ currentstate + " msg: " + args[2]);
+ OpenVPN.updateStateString(currentstate,args[2]);
+ }
+ else{
OpenVPN.updateStateString(currentstate,args[2]);
+ }
}
private static int repeated_byte_counts = 0;