| ... |
... |
@@ -19,6 +19,8 @@ import java.io.IOException; |
|
19
|
19
|
import java.io.InputStream;
|
|
20
|
20
|
import java.io.InputStreamReader;
|
|
21
|
21
|
import java.io.InterruptedIOException;
|
|
|
22
|
+import java.nio.file.Files;
|
|
|
23
|
+import java.nio.file.attribute.PosixFilePermissions;
|
|
22
|
24
|
import java.util.ArrayList;
|
|
23
|
25
|
import java.util.Arrays;
|
|
24
|
26
|
import java.util.HashMap;
|
| ... |
... |
@@ -100,7 +102,7 @@ public class TorAndroidIntegration implements BundleEventListener { |
|
100
|
102
|
/* package */ TorAndroidIntegration(Context context) {
|
|
101
|
103
|
mLibraryDir = context.getApplicationInfo().nativeLibraryDir;
|
|
102
|
104
|
mCacheDir = context.getCacheDir().getAbsolutePath();
|
|
103
|
|
- mIpcDirectory = mCacheDir + "/tor-private";
|
|
|
105
|
+ mIpcDirectory = new File(context.getFilesDir(), "tor-ipc").getAbsolutePath();
|
|
104
|
106
|
mDataDir = new File(context.getFilesDir(), "tor");
|
|
105
|
107
|
registerListener();
|
|
106
|
108
|
}
|
| ... |
... |
@@ -357,15 +359,8 @@ public class TorAndroidIntegration implements BundleEventListener { |
|
357
|
359
|
return;
|
|
358
|
360
|
}
|
|
359
|
361
|
try {
|
|
360
|
|
- // First remove the permissions for everybody...
|
|
361
|
|
- directory.setReadable(false, false);
|
|
362
|
|
- directory.setWritable(false, false);
|
|
363
|
|
- directory.setExecutable(false, false);
|
|
364
|
|
- // ... then add them back, but only for the owner.
|
|
365
|
|
- directory.setReadable(true, true);
|
|
366
|
|
- directory.setWritable(true, true);
|
|
367
|
|
- directory.setExecutable(true, true);
|
|
368
|
|
- } catch (SecurityException e) {
|
|
|
362
|
+ Files.setPosixFilePermissions(directory.toPath(), PosixFilePermissions.fromString("rwx------"));
|
|
|
363
|
+ } catch (IOException | SecurityException e) {
|
|
369
|
364
|
Log.e(TAG, "Could not set the permissions to the IPC directory.", e);
|
|
370
|
365
|
}
|
|
371
|
366
|
return;
|