[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [orbot/master] bug fix
commit 9ffb0b3915bae780b38dba223b7495d72663b7ff
Author: arrase <arrase@xxxxxxxxx>
Date: Mon Nov 28 01:04:32 2016 +0100
bug fix
---
.../main/java/org/torproject/android/OrbotMainActivity.java | 13 ++++++-------
.../android/ui/hiddenservices/backup/BackupUtils.java | 8 ++++++--
2 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
index 40d67c4..8e03f56 100644
--- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java
+++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java
@@ -597,7 +597,12 @@ public class OrbotMainActivity extends AppCompatActivity
if (onionHostname == null || onionHostname.length() < 1) {
- requestTorRereadConfig();
+ if (hsKeyPath != null) {
+ BackupUtils hsutils = new BackupUtils(getApplicationContext());
+ hsutils.restoreKeyBackup(hsPort, hsKeyPath);
+ }
+
+ startTor();
new Thread() {
@@ -631,12 +636,6 @@ public class OrbotMainActivity extends AppCompatActivity
nResult.putExtra("hs_host", hostname);
- if (hsKeyPath != null) {
- BackupUtils hsutils = new BackupUtils(getApplicationContext());
- hsutils.restoreKeyBackup(hsPort, hsKeyPath);
- requestTorRereadConfig();
- }
-
if (backupToPackage != null && backupToPackage.length() > 0) {
String servicePath = getFilesDir() + "/" + TorServiceConstants.HIDDEN_SERVICES_DIR + "/hs" + hsPort;
File hidden_service_key = new File(servicePath, "private_key");
diff --git a/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java b/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java
index dbaf7e3..5a1185c 100644
--- a/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java
+++ b/app/src/main/java/org/torproject/android/ui/hiddenservices/backup/BackupUtils.java
@@ -211,12 +211,16 @@ public class BackupUtils {
}
public void restoreKeyBackup(int hsPort, Uri hsKeyPath) {
- String keyFilePath = mHSBasePath + "/hs" + hsPort + "/private_key";
+
+ File serviceDir = new File(mHSBasePath, "hs" + hsPort);
+
+ if (!serviceDir.isDirectory())
+ serviceDir.mkdirs();
try {
ParcelFileDescriptor mInputPFD = mContext.getContentResolver().openFileDescriptor(hsKeyPath, "r");
InputStream fileStream = new FileInputStream(mInputPFD.getFileDescriptor());
- OutputStream file = new FileOutputStream(keyFilePath);
+ OutputStream file = new FileOutputStream(serviceDir.getAbsolutePath() + "/private_key");
byte[] buffer = new byte[1024];
int length;
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits