commit 4fea84cc5fc3a5f026e0265e0e66281fc713e8d5 Author: Juan Ezquerro LLanes juan@paynopain.com Date: Thu Nov 17 16:21:28 2016 +0100
allow managed backups field --- .../java/org/torproject/android/OrbotMainActivity.java | 15 ++++++++++++--- .../org/torproject/android/ui/hs/database/HSDatabase.java | 1 + app/src/main/res/layout/dialog_hs_data.xml | 8 ++++++++ app/src/main/res/values/strings.xml | 1 + 4 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/org/torproject/android/OrbotMainActivity.java b/app/src/main/java/org/torproject/android/OrbotMainActivity.java index 2e17f39..f5f6227 100644 --- a/app/src/main/java/org/torproject/android/OrbotMainActivity.java +++ b/app/src/main/java/org/torproject/android/OrbotMainActivity.java @@ -572,7 +572,7 @@ public class OrbotMainActivity extends AppCompatActivity stopVpnService(); } - private void enableHiddenServicePort (String hsName, int hsPort, int hsRemotePort, boolean getGey) throws RemoteException, InterruptedException + private void enableHiddenServicePort (String hsName, int hsPort, int hsRemotePort, boolean allowBackups) throws RemoteException, InterruptedException { String onionHostname = null;
@@ -593,6 +593,15 @@ public class OrbotMainActivity extends AppCompatActivity Cursor row = cr.query(HSContentProvider.CONTENT_URI, mProjection, "port=" + mHsPort, null, null);
if(row == null) { + /* + * For security reasons: + * + * Allow managed backups option can only be set to a arbitrary true or false value when a service is created + * Subsequently an application can only change this value to false via Intent service + * Modifying this value to true again can only be performed by the user through the Orbot interface + * + */ + fields.put("allow_managed_backups", allowBackups); cr.insert(HSContentProvider.CONTENT_URI, fields); } else { onionHostname = row.getString(row.getColumnIndex(HSContentProvider.HiddenService.DOMAIN)); @@ -665,7 +674,7 @@ public class OrbotMainActivity extends AppCompatActivity final int hiddenServicePort = getIntent().getIntExtra("hs_port", -1); final int hiddenServiceRemotePort = getIntent().getIntExtra("hs_onion_port", -1); final String hiddenServiceName = getIntent().getStringExtra("hs_name"); - final boolean getHiddenServiceKey = getIntent().getBooleanExtra("hs_get_key",false); + final boolean hiddenServiceAllowBackups = getIntent().getBooleanExtra("hs_allow_namaged_backup",false);
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() { @@ -676,7 +685,7 @@ public class OrbotMainActivity extends AppCompatActivity try { enableHiddenServicePort ( hiddenServiceName, hiddenServicePort, - hiddenServiceRemotePort, getHiddenServiceKey + hiddenServiceRemotePort, hiddenServiceAllowBackups ); } catch (RemoteException e) { // TODO Auto-generated catch block diff --git a/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java b/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java index cafa7ed..07e5c1b 100644 --- a/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java +++ b/app/src/main/java/org/torproject/android/ui/hs/database/HSDatabase.java @@ -16,6 +16,7 @@ public class HSDatabase extends SQLiteOpenHelper { "name TEXT, " + "domain TEXT, " + "onion_port INTEGER, " + + "allow_managed_backups INTEGER DEFAULT 0, " + "port INTEGER);";
public HSDatabase(Context context) { diff --git a/app/src/main/res/layout/dialog_hs_data.xml b/app/src/main/res/layout/dialog_hs_data.xml index 05d52fe..dd83148 100644 --- a/app/src/main/res/layout/dialog_hs_data.xml +++ b/app/src/main/res/layout/dialog_hs_data.xml @@ -53,6 +53,13 @@ android:id="@+id/hsOnionPort" android:inputType="number" />
+ <CheckBox + android:text="@string/allow_managed_backup" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:id="@+id/allow_managed_backup" + android:layout_weight="1" /> + <LinearLayout android:orientation="horizontal" android:layout_width="match_parent" @@ -73,6 +80,7 @@ android:id="@+id/HSDialogSave" android:layout_weight="1" style="@style/Widget.AppCompat.Button.Borderless.Colored" /> + </LinearLayout>
</LinearLayout> \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ea01787..7f534fe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -339,4 +339,5 @@ <string name="onion_port">Onion Port</string> <string name="name">Name</string> <string name="invalid_port">Invalid Port</string> + <string name="allow_managed_backup">Allow managed backups</string> </resources>
tor-commits@lists.torproject.org