[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] more changes for executing binaries from libs/jni folder



commit 6b0b0fa069d6fcbf95cb4b0125b1f34128479ef3
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Fri Dec 27 12:30:20 2013 -0500

    more changes for executing binaries from libs/jni folder
---
 .../android/service/TorBinaryInstaller.java         |   19 ++++---------------
 src/org/torproject/android/service/TorService.java  |   19 ++++++++++---------
 .../android/service/TorServiceConstants.java        |    6 +++---
 3 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/src/org/torproject/android/service/TorBinaryInstaller.java b/src/org/torproject/android/service/TorBinaryInstaller.java
index 6a6ca8a..cf6bc47 100644
--- a/src/org/torproject/android/service/TorBinaryInstaller.java
+++ b/src/org/torproject/android/service/TorBinaryInstaller.java
@@ -48,11 +48,6 @@ public class TorBinaryInstaller implements TorServiceConstants {
 		InputStream is;
         File outFile;
         
-        
-		is = context.getResources().openRawResource(R.raw.tor);			
-		outFile = new File(installFolder, TOR_BINARY_ASSET_KEY);
-		streamToFile(is, outFile, false, true);
-			
 		is = context.getResources().openRawResource(R.raw.torrc);
 		outFile = new File(installFolder, TORRC_ASSET_KEY);
 		streamToFile(is,outFile, false, false);
@@ -61,24 +56,17 @@ public class TorBinaryInstaller implements TorServiceConstants {
 		outFile = new File(installFolder, TORRC_TETHER_KEY);
 		streamToFile(is, outFile, false, false);
 
-		is = context.getResources().openRawResource(R.raw.privoxy);
-		outFile = new File(installFolder, PRIVOXY_ASSET_KEY);
-		streamToFile(is,outFile, false, false);
-
 		is = context.getResources().openRawResource(R.raw.privoxy_config);
 		outFile = new File(installFolder, PRIVOXYCONFIG_ASSET_KEY);
 		streamToFile(is,outFile, false, false);
 	
-		is = context.getResources().openRawResource(R.raw.obfsproxy);
-		outFile = new File(installFolder, OBFSPROXY_ASSET_KEY);
-		streamToFile(is,outFile, false, false);
-	
 		return true;
 	}
 	
 	/*
 	 * Extract the Tor binary from the APK file using ZIP
 	 */
+	/*
 	public boolean installGeoIP () throws IOException, FileNotFoundException
 	{
 		
@@ -90,7 +78,7 @@ public class TorBinaryInstaller implements TorServiceConstants {
 		streamToFile(is, outFile, false, true);
 	
 		return true;
-	}
+	}*/
 	
 	/*
 	private static void copyAssetFile(Context ctx, String asset, File file) throws IOException, InterruptedException
@@ -248,6 +236,7 @@ public class TorBinaryInstaller implements TorServiceConstants {
      * @param showErrors indicates if errors should be alerted
 	 * @return false if the binary files could not be installed
 	 */
+	/*
 	public static boolean assertIpTablesBinaries(Context ctx, boolean showErrors) throws Exception {
 		boolean changed = false;
 		
@@ -256,7 +245,7 @@ public class TorBinaryInstaller implements TorServiceConstants {
 		copyRawFile(ctx, R.raw.iptables, file, CHMOD_EXEC, false);
 				
 		return true;
-	}
+	}*/
 	
 
 }
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 69b46fd..9116767 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -86,6 +86,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
    //   private String appHome;
     private File appBinHome;
     private File appCacheHome;
+    private File appLibsHome;
     
     private File fileTor;
     private File filePrivoxy;
@@ -528,10 +529,11 @@ public class TorService extends Service implements TorServiceConstants, TorConst
     	
     	appBinHome = getDir("bin",Application.MODE_PRIVATE);
     	appCacheHome = getDir("data",Application.MODE_PRIVATE);
+    	appLibsHome = new File(getApplicationInfo().nativeLibraryDir);
     	
-    	fileTor = new File(appBinHome, TOR_BINARY_ASSET_KEY);
-		filePrivoxy = new File(appBinHome, PRIVOXY_ASSET_KEY);
-		fileObfsProxy = new File(appBinHome, OBFSPROXY_ASSET_KEY);
+    	fileTor = new File(appLibsHome, TOR_BINARY_ASSET_KEY);
+		filePrivoxy = new File(appLibsHome, PRIVOXY_ASSET_KEY);
+		fileObfsProxy = new File(appLibsHome, OBFSPROXY_ASSET_KEY);
 
 		
     }
@@ -541,9 +543,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
     	
 		SharedPreferences prefs =getSharedPrefs(getApplicationContext());
 
-    	//check and install iptables
-    	TorBinaryInstaller.assertIpTablesBinaries(this, true);
-
     	initTorPaths();
 		
     	String currTorBinary = prefs.getString(TorServiceConstants.PREF_BINARY_TOR_VERSION_INSTALLED, null);
@@ -1707,13 +1706,15 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 	        {
 		        if (!fileGeoIP.exists())
 		        {
-		        	TorBinaryInstaller installer = new TorBinaryInstaller(this, appBinHome); 
-					boolean success = installer.installGeoIP();	
+		        	//TorBinaryInstaller installer = new TorBinaryInstaller(this, appBinHome); 
+					//boolean success = installer.installGeoIP();
+		        	
+		        	//TODO get GEOIP add-on here
 		        }
 		        
 		        mBinder.updateConfiguration("GeoIPFile", fileGeoIP.getAbsolutePath(), false);
 	        }
-	        catch (IOException e)
+	        catch (Exception e)
 	        {
 	       	  showToolbarNotification (getString(R.string.error_installing_binares),ERROR_NOTIFY_ID,R.drawable.ic_stat_tor, Notification.FLAG_ONGOING_EVENT);
 
diff --git a/src/org/torproject/android/service/TorServiceConstants.java b/src/org/torproject/android/service/TorServiceConstants.java
index 50cc4d9..7739eb1 100644
--- a/src/org/torproject/android/service/TorServiceConstants.java
+++ b/src/org/torproject/android/service/TorServiceConstants.java
@@ -12,7 +12,7 @@ public interface TorServiceConstants {
 	//home directory of Android application
 	
 	//name of the tor C binary
-	public final static String TOR_BINARY_ASSET_KEY = "tor";	
+	public final static String TOR_BINARY_ASSET_KEY = "libtor.so";	
 	
 	//torrc (tor config file)
 	public final static String TORRC_ASSET_KEY = "torrc";
@@ -24,7 +24,7 @@ public interface TorServiceConstants {
 //	public final static String TOR_COMMAND_LINE_ARGS = "-f " + TORRC_INSTALL_PATH  + " || exit\n";
 		
 	//privoxy
-	public final static String PRIVOXY_ASSET_KEY = "privoxy";
+	public final static String PRIVOXY_ASSET_KEY = "libprivoxy.so";
 	
 	//privoxy.config
 	public final static String PRIVOXYCONFIG_ASSET_KEY = "privoxy.config";
@@ -82,7 +82,7 @@ public interface TorServiceConstants {
     public static final String PREF_BINARY_PRIVOXY_VERSION_INSTALLED = "BINARY_PRIVOXY_VERSION_INTALLED";
     
     //obfsproxy 
-    public static final String OBFSPROXY_ASSET_KEY = "obfsproxy";
+    public static final String OBFSPROXY_ASSET_KEY = "libobfsproxy.so";
     
 	public static final int MESSAGE_TRAFFIC_COUNT = 5;
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits