[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r22498: {projects} fixed TorBinaryInstaller issue on Android OS 2.2/Froyo. Now (projects/android/trunk/Orbot/src/org/torproject/android/service)
Author: n8fr8
Date: 2010-06-09 20:14:03 +0000 (Wed, 09 Jun 2010)
New Revision: 22498
Modified:
projects/android/trunk/Orbot/src/org/torproject/android/service/TorBinaryInstaller.java
projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java
projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java
Log:
fixed TorBinaryInstaller issue on Android OS 2.2/Froyo. Now looks for APK file with incremented path name -1 -2 -3 etc
Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorBinaryInstaller.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorBinaryInstaller.java 2010-06-09 16:07:56 UTC (rev 22497)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorBinaryInstaller.java 2010-06-09 20:14:03 UTC (rev 22498)
@@ -45,7 +45,20 @@
try
{
- ZipFile zip = new ZipFile(APK_PATH);
+
+ String apkPath = APK_PATH;
+
+ int apkIdx = 1;
+
+ while (!new File(apkPath).exists())
+ {
+ apkPath = APK_PATH_BASE + '-' + (apkIdx++) + ".apk";
+
+ Log.i(TAG,"Could not find APK. Trying new path: " + apkPath);
+ }
+
+
+ ZipFile zip = new ZipFile(apkPath);
ZipEntry zipen = zip.getEntry(TOR_BINARY_ZIP_KEY);
streamToFile(zip.getInputStream(zipen),TOR_BINARY_INSTALL_PATH);
Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java 2010-06-09 16:07:56 UTC (rev 22497)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorServiceConstants.java 2010-06-09 20:14:03 UTC (rev 22498)
@@ -50,9 +50,10 @@
//path of the installed APK file
public final static String APK_PATH = "/data/app/org.torproject.android.apk";
+ public final static String APK_PATH_BASE = "/data/app/org.torproject.android";
+
-
public final static int FILE_WRITE_BUFFER_SIZE = 2048;
//HTTP Proxy server port
Modified: projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java
===================================================================
--- projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java 2010-06-09 16:07:56 UTC (rev 22497)
+++ projects/android/trunk/Orbot/src/org/torproject/android/service/TorTransProxy.java 2010-06-09 20:14:03 UTC (rev 22498)
@@ -16,10 +16,13 @@
private final static String CMD_NAT_FLUSH = "iptables -t nat -F || exit\n";
private final static String CMD_DNS_PROXYING_ADD = "iptables -t nat -A PREROUTING -p udp --dport 53 -j DNAT --to 127.0.0.1:5400 || exit\n";
- private final static String CMD_DNS_PROXYING_DELETE = "iptables -t nat -D PREROUTING -p udp --dport 53 -j DNAT --to 127.0.0.1:5400 || exit\n";
-
+
+ //private final static String CMD_DNS_PROXYING_DELETE = "iptables -t nat -D PREROUTING -p udp --dport 53 -j DNAT --to 127.0.0.1:5400 || exit\n";
+ // - just calling a system wide flush of iptables rules
+
private final static String IPTABLES_ADD = " -A ";
- private final static String IPTABLES_DELETE = " -D ";
+
+ //private final static String IPTABLES_DELETE = " -D "; //not deleting manually anymore - just calling a system wide flush of iptables rules
private final static String IPTABLES_DROP_ALL = " -j DROP ";
private static boolean hasRoot = false;
@@ -121,7 +124,7 @@
script.append(command);
script.append("OUTPUT -p udp -m owner --uid-owner ");
script.append(apps[i].getUid());
- script.append(" -j DNAT --to 127.0.0.1:9040");
+ script.append(" -j DROP"); //drop all UDP packets as Tor won't handle them
script.append(" || exit\n");
}
}