Use PIE Tor binary on API version 16+.

This commit is contained in:
akwizgran
2015-03-23 11:03:00 +00:00
parent 0be467f4f5
commit 10924709d0
3 changed files with 12 additions and 4 deletions

View File

@@ -7,7 +7,6 @@
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="20"
android:maxSdkVersion="20"
/>
<uses-feature android:name="android.hardware.bluetooth" />

Binary file not shown.

View File

@@ -226,7 +226,7 @@ class TorPlugin implements DuplexPlugin, EventHandler {
copy(in, out);
// Make the Tor binary executable
if(!setExecutable(torFile)) {
LOG.warning("Could not make Tor executable");
LOG.warning("Could not make Tor binary executable");
return false;
}
return true;
@@ -266,14 +266,23 @@ class TorPlugin implements DuplexPlugin, EventHandler {
}
private InputStream getTorInputStream() throws IOException {
InputStream in = appContext.getResources().getAssets().open("tor.zip");
String filename;
if(Build.VERSION.SDK_INT >= 16) {
LOG.info("Installing PIE Tor binary");
filename = "tor-pie.zip";
} else {
LOG.info("Installing non-PIE Tor binary");
filename = "tor.zip";
}
InputStream in = appContext.getResources().getAssets().open(filename);
ZipInputStream zin = new ZipInputStream(in);
if(zin.getNextEntry() == null) throw new IOException();
return zin;
}
private InputStream getGeoIpInputStream() throws IOException {
InputStream in = appContext.getResources().getAssets().open("geoip.zip");
String filename = "geoip.zip";
InputStream in = appContext.getResources().getAssets().open(filename);
ZipInputStream zin = new ZipInputStream(in);
if(zin.getNextEntry() == null) throw new IOException();
return zin;