summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArne Schwabe <arne@rfc2549.org>2012-05-09 17:57:40 +0200
committerArne Schwabe <arne@rfc2549.org>2012-05-09 17:57:40 +0200
commitbebf2a9428e369a4963956ec752db27c457d9f6b (patch)
treea46475895895944a79b3452a1805ae31a7f40f4e
parent224be050299691f2ca35d79f69aaf39d92fdbeaa (diff)
Only try to write minivpn once per program lifetime.
Remove debug logging
-rw-r--r--lzo/Android.mk14
-rw-r--r--openvpn/src/openvpn/init.c2
-rw-r--r--res/layout/faq.xml15
-rw-r--r--res/values/strings.xml1
-rw-r--r--src/de/blinkt/openvpn/LaunchVPN.java13
-rw-r--r--src/de/blinkt/openvpn/OpenVPNThread.java14
-rw-r--r--src/de/blinkt/openvpn/OpenVpnManagementThread.java19
-rw-r--r--src/de/blinkt/openvpn/VpnProfile.java8
8 files changed, 52 insertions, 34 deletions
diff --git a/lzo/Android.mk b/lzo/Android.mk
index 4354fc8f..004be5fb 100644
--- a/lzo/Android.mk
+++ b/lzo/Android.mk
@@ -87,11 +87,11 @@ include $(BUILD_STATIC_LIBRARY)
# dynamic library
# =====================================================
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES:= $(common_SRC_FILES)
-LOCAL_C_INCLUDES:= $(common_C_INCLUDES)
-LOCAL_MODULE := liblzo
-LOCAL_PRELINK_MODULE:= false
-LOCAL_MODULE_TAGS := optional
-include $(BUILD_SHARED_LIBRARY)
+# include $(CLEAR_VARS)
+# LOCAL_SRC_FILES:= $(common_SRC_FILES)
+# LOCAL_C_INCLUDES:= $(common_C_INCLUDES)
+# LOCAL_MODULE := liblzo
+# LOCAL_PRELINK_MODULE:= false
+# LOCAL_MODULE_TAGS := optional
+# include $(BUILD_SHARED_LIBRARY)
diff --git a/openvpn/src/openvpn/init.c b/openvpn/src/openvpn/init.c
index cc94b818..17e4f4af 100644
--- a/openvpn/src/openvpn/init.c
+++ b/openvpn/src/openvpn/init.c
@@ -2475,7 +2475,7 @@ do_option_warnings (struct context *c)
{
const struct options *o = &c->options;
-#if 1 /* JYFIXME -- port warning */
+#if 0 /* JYFIXME -- port warning */
if (!o->ce.port_option_used && (o->ce.local_port == OPENVPN_PORT && o->ce.remote_port == OPENVPN_PORT))
msg (M_WARN, "IMPORTANT: OpenVPN's default port number is now %d, based on an official port number assignment by IANA. OpenVPN 2.0-beta16 and earlier used 5000 as the default port.",
OPENVPN_PORT);
diff --git a/res/layout/faq.xml b/res/layout/faq.xml
index 6504afcf..a05cc6df 100644
--- a/res/layout/faq.xml
+++ b/res/layout/faq.xml
@@ -18,13 +18,12 @@
<TextView
style="@style/faqhead"
- android:text="@string/copying_log_entries" />
+ android:text="@string/faq_shortcut" />
<TextView
style="@style/faqitem"
- android:text="@string/faq_copying"/>
-
-
+ android:text="@string/faq_howto_shortcut" />
+
<TextView
style="@style/faqhead"
android:text="@string/tap_mode" />
@@ -35,14 +34,12 @@
<TextView
style="@style/faqhead"
- android:text="@string/faq_shortcut" />
+ android:text="@string/copying_log_entries" />
<TextView
style="@style/faqitem"
- android:text="@string/faq_howto_shortcut" />
-
-
-
+ android:text="@string/faq_copying" />
+
<TextView
style="@style/faqhead"
android:text="@string/tap_mode" />
diff --git a/res/values/strings.xml b/res/values/strings.xml
index dcf33197..90009e8c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -184,4 +184,5 @@
<string name="faq_copying">To copy a single log entry press and and hold on the log entry. To copy/send the whole log use the Send Log option. Use the hardware menu button if not visible in the gui.</string>
<string name="faq_shortcut">Shortcut to start</string>
<string name="faq_howto_shortcut">You can place a shortcut to start OpenVPN on your desktop. Depending on your homescreen program you have to add a shortcut or a widget.</string>
+ <string name="no_vpn_support_image">Your image does not support the VPNService API,sorry :(</string>
</resources>
diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java
index 17313cd5..858c8d38 100644
--- a/src/de/blinkt/openvpn/LaunchVPN.java
+++ b/src/de/blinkt/openvpn/LaunchVPN.java
@@ -78,6 +78,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
private ProfileManager mPM;
private VpnProfile mSelectedProfile;
+ static boolean minivpnwritten=false;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -210,6 +212,8 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
}
private boolean writeMiniVPN() {
+ if(minivpnwritten)
+ return true;
try {
InputStream mvpn = getAssets().open("minivpn");
File mvpnout = new File(getCacheDir(),"minivpn");
@@ -227,7 +231,7 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
if(!mvpnout.setExecutable(true))
return false;
-
+ minivpnwritten=true;
return true;
} catch (IOException e) {
e.printStackTrace();
@@ -321,8 +325,10 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
// Start the query
try {
startActivityForResult(intent, START_VPN_PROFILE);
- } catch (ActivityNotFoundException ane){
- Toast.makeText(this, "Your image does not support the VPNService API,sorry :(", Toast.LENGTH_LONG).show();
+ } catch (ActivityNotFoundException ane) {
+ // Shame on you Sony! At least one user reported that
+ // an official Sony Xperia Arc S image triggers this exception
+ Toast.makeText(this, R.string.no_vpn_support_image, Toast.LENGTH_LONG).show();
}
} else {
onActivityResult(START_VPN_PROFILE, Activity.RESULT_OK, null);
@@ -341,7 +347,6 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener {
Intent startLW = new Intent(getBaseContext(),LogWindow.class);
startActivity(startLW);
- OpenVPN.logMessage(0, "", "Writing minivpn binary");
if(!writeMiniVPN()) {
OpenVPN.logMessage(0, "", "Error writing minivpn binary");
return;
diff --git a/src/de/blinkt/openvpn/OpenVPNThread.java b/src/de/blinkt/openvpn/OpenVPNThread.java
index d4d4cd64..008598e4 100644
--- a/src/de/blinkt/openvpn/OpenVPNThread.java
+++ b/src/de/blinkt/openvpn/OpenVPNThread.java
@@ -44,7 +44,7 @@ public class OpenVPNThread implements Runnable {
// Log argv
- OpenVPN.logMessage(0, "argv:" , Arrays.toString(mArgv));
+ //OpenVPN.logMessage(0, "argv:" , Arrays.toString(mArgv));
startOpenVPNThreadArgs(mArgv);
@@ -77,7 +77,17 @@ public class OpenVPNThread implements Runnable {
ProcessBuilder pb = new ProcessBuilder(argvlist);
// Hack O rama
- pb.environment().put("LD_LIBRARY_PATH", "/data/data/de.blinkt.openvpn/lib");
+
+ // Hack until I find a good way to get the real library path
+ String applibpath = argv[0].replace("/cache/minivpn", "/lib");
+
+ String lbpath = pb.environment().get("LD_LIBRARY_PATH");
+ if(lbpath==null)
+ lbpath = applibpath;
+ else
+ lbpath = lbpath + ":" + applibpath;
+
+ pb.environment().put("LD_LIBRARY_PATH", lbpath);
pb.redirectErrorStream(true);
try {
mProcess = pb.start();
diff --git a/src/de/blinkt/openvpn/OpenVpnManagementThread.java b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
index 18d543f1..bc2b0e13 100644
--- a/src/de/blinkt/openvpn/OpenVpnManagementThread.java
+++ b/src/de/blinkt/openvpn/OpenVpnManagementThread.java
@@ -33,7 +33,7 @@ public class OpenVpnManagementThread implements Runnable {
}
public void managmentCommand(String cmd) {
- Log.d("openvpn", "mgmt cmd" + mSocket + " " +cmd + " " );
+ //Log.d("openvpn", "mgmt cmd" + mSocket + " " +cmd + " " );
try {
mSocket.getOutputStream().write(cmd.getBytes());
mSocket.getOutputStream().flush();
@@ -144,21 +144,24 @@ public class OpenVpnManagementThread implements Runnable {
String argument = parts[1];
- if(cmd.equals("INFO"))
- logStatusMessage(command);
- else if (cmd.equals("PASSWORD")) {
+ if(cmd.equals("INFO")) {
+ // Ignore greeting from mgmt
+ //logStatusMessage(command);
+ }else if (cmd.equals("PASSWORD")) {
processPWCommand(argument);
} else if (cmd.equals("HOLD")) {
managmentCommand("hold release\n");
- managmentCommand("log on\n");
- managmentCommand("bytecount 13\n");
+ //managmentCommand("log on\n");
} else if (cmd.equals("NEED-OK")) {
processNeedCommand(argument);
} else if (cmd.equals("LOG")) {
- OpenVPN.logMessage(0, "", command);
+ String[] args = argument.split(",",3);
+ // 0 unix time stamp
+ // 1 log level N,I,E etc.
+ // 2 log message
+ OpenVPN.logMessage(0, "", args[2]);
} else {
OpenVPN.logMessage(0, "MGMT:", "Got unrecognized command" + command);
- managmentCommand("log 1\n");
Log.i(TAG, "Got unrecognized command" + command);
}
} else if (command.startsWith("SUCCESS:")) {
diff --git a/src/de/blinkt/openvpn/VpnProfile.java b/src/de/blinkt/openvpn/VpnProfile.java
index 227df5ba..26cf50bd 100644
--- a/src/de/blinkt/openvpn/VpnProfile.java
+++ b/src/de/blinkt/openvpn/VpnProfile.java
@@ -137,8 +137,6 @@ public class VpnProfile implements Serializable{
cfg+=cacheDir.getAbsolutePath();
cfg+="\n\n";
- cfg+="# Silences script security warning\n";
- cfg+="script-security 0\n\n";
boolean useTLSClient = (mAuthenticationType != TYPE_STATICKEYS);
@@ -350,7 +348,11 @@ public class VpnProfile implements Serializable{
args.add("--config");
args.add(cacheDir.getAbsolutePath() + "/" + OVPNCONFIGFILE);
-
+ // Silences script security warning
+
+ args.add("script-security");
+ args.add("0");
+
return (String[]) args.toArray(new String[args.size()]);
}