summaryrefslogtreecommitdiff
path: root/app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java')
-rw-r--r--app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
index 5fa2ab9e..e3c60854 100644
--- a/app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
+++ b/app/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
@@ -1,3 +1,8 @@
+/*
+ * Copyright (c) 2012-2014 Arne Schwabe
+ * Distributed under the GNU GPL v2. For full terms see the file doc/LICENSE.txt
+ */
+
package de.blinkt.openvpn.core;
import android.util.Log;
@@ -25,6 +30,7 @@ import de.blinkt.openvpn.core.VpnStatus.LogItem;
public class OpenVPNThread implements Runnable {
private static final String DUMP_PATH_STRING = "Dump path: ";
+ private static final String BROKEN_PIE_SUPPORT = "/data/data/de.blinkt.openvpn/cache/pievpn[1]: syntax error:";
private static final String TAG = "OpenVPN";
public static final int M_FATAL = (1 << 4);
public static final int M_NONFATAL = (1 << 5);
@@ -36,8 +42,9 @@ public class OpenVPNThread implements Runnable {
private OpenVPNService mService;
private String mDumpPath;
private Map<String, String> mProcessEnv;
+ private boolean mBrokenPie=false;
- public OpenVPNThread(OpenVPNService service,String[] argv, Map<String,String> processEnv, String nativelibdir)
+ public OpenVPNThread(OpenVPNService service,String[] argv, Map<String,String> processEnv, String nativelibdir)
{
mArgv = argv;
mNativeDir = nativelibdir;
@@ -68,8 +75,22 @@ public class OpenVPNThread implements Runnable {
} catch (InterruptedException ie) {
VpnStatus.logError("InterruptedException: " + ie.getLocalizedMessage());
}
- if( exitvalue != 0)
- VpnStatus.logError("Process exited with exit value " + exitvalue);
+ if( exitvalue != 0) {
+ VpnStatus.logError("Process exited with exit value " + exitvalue);
+ if (mBrokenPie) {
+ String[] noPieArgv = VpnProfile.replacePieWithNoPie(mArgv);
+
+ // We are already noPIE, nothing to gain
+ if (!noPieArgv.equals(mArgv)) {
+ mArgv = noPieArgv;
+ VpnStatus.logInfo("PIE Version could not be executed. Trying no PIE version");
+ run();
+ return;
+ }
+
+ }
+
+ }
VpnStatus.updateStateString("NOPROCESS", "No process running.", R.string.state_noprocess, ConnectionStatus.LEVEL_NOTCONNECTED);
if(mDumpPath!=null) {
@@ -123,6 +144,9 @@ public class OpenVPNThread implements Runnable {
if (logline.startsWith(DUMP_PATH_STRING))
mDumpPath = logline.substring(DUMP_PATH_STRING.length());
+
+ if (logline.startsWith(BROKEN_PIE_SUPPORT))
+ mBrokenPie = true;
// 1380308330.240114 18000002 Send to HTTP proxy: 'X-Online-Host: bla.blabla.com'