added config variable to allow non-tls connections

This commit is contained in:
Daniel Gultsch 2016-01-22 11:20:31 +01:00
parent 77c0fb0b2a
commit 40005cec1b
4 changed files with 7 additions and 5 deletions

View file

@ -12,7 +12,8 @@ public final class Config {
public static final String DOMAIN_LOCK = null; //only allow account creation for this domain public static final String DOMAIN_LOCK = null; //only allow account creation for this domain
public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox public static final boolean DISALLOW_REGISTRATION_IN_UI = false; //hide the register checkbox
public static final boolean HIDE_PGP_IN_UI = false; //some more consumer focused clients might want to disable OpenPGP public static final boolean HIDE_PGP_IN_UI = false; //some more consumer focused clients might want to disable OpenPGP
public static final boolean FORCE_ENCRYPTION = false; //disables ability to send unencrypted 1-on-1 public static final boolean FORCE_E2E_ENCRYPTION = false; //disables ability to send unencrypted 1-on-1
public static final boolean ALLOW_NON_TLS_CONNECTIONS = false; //very dangerous. you should have a good reason to set this to true
public static final boolean FORCE_ORBOT = false; // always use TOR public static final boolean FORCE_ORBOT = false; // always use TOR
public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false; public static final boolean HIDE_MESSAGE_TEXT_IN_NOTIFICATION = false;
public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification public static final boolean SHOW_CONNECTED_ACCOUNTS = false; //show number of connected accounts in foreground notification

View file

@ -626,7 +626,7 @@ public class Conversation extends AbstractEntity implements Blockable {
next = outgoing; next = outgoing;
} }
} }
if (Config.FORCE_ENCRYPTION && mode == MODE_SINGLE && next <= 0) { if (Config.FORCE_E2E_ENCRYPTION && mode == MODE_SINGLE && next <= 0) {
if (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact())) { if (axolotlService != null && axolotlService.isContactAxolotlCapable(getContact())) {
return Message.ENCRYPTION_AXOLOTL; return Message.ENCRYPTION_AXOLOTL;
} else { } else {

View file

@ -854,7 +854,7 @@ public class ConversationActivity extends XmppActivity
MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp); MenuItem pgp = popup.getMenu().findItem(R.id.encryption_choice_pgp);
MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl); MenuItem axolotl = popup.getMenu().findItem(R.id.encryption_choice_axolotl);
pgp.setVisible(!Config.HIDE_PGP_IN_UI && !Config.X509_VERIFICATION); pgp.setVisible(!Config.HIDE_PGP_IN_UI && !Config.X509_VERIFICATION);
none.setVisible(!Config.FORCE_ENCRYPTION); none.setVisible(!Config.FORCE_E2E_ENCRYPTION);
otr.setVisible(!Config.X509_VERIFICATION); otr.setVisible(!Config.X509_VERIFICATION);
if (conversation.getMode() == Conversation.MODE_MULTI) { if (conversation.getMode() == Conversation.MODE_MULTI) {
otr.setVisible(false); otr.setVisible(false);

View file

@ -727,7 +727,7 @@ public class XmppConnection implements Runnable {
if (this.streamFeatures.hasChild("starttls") && !features.encryptionEnabled) { if (this.streamFeatures.hasChild("starttls") && !features.encryptionEnabled) {
sendStartTLS(); sendStartTLS();
} else if (this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) { } else if (this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) {
if (features.encryptionEnabled) { if (features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS) {
sendRegistryRequest(); sendRegistryRequest();
} else { } else {
throw new IncompatibleServerException(); throw new IncompatibleServerException();
@ -737,7 +737,8 @@ public class XmppConnection implements Runnable {
changeStatus(Account.State.REGISTRATION_NOT_SUPPORTED); changeStatus(Account.State.REGISTRATION_NOT_SUPPORTED);
disconnect(true); disconnect(true);
} else if (this.streamFeatures.hasChild("mechanisms") } else if (this.streamFeatures.hasChild("mechanisms")
&& shouldAuthenticate && features.encryptionEnabled) { && shouldAuthenticate
&& (features.encryptionEnabled || Config.ALLOW_NON_TLS_CONNECTIONS)) {
final List<String> mechanisms = extractMechanisms(streamFeatures final List<String> mechanisms = extractMechanisms(streamFeatures
.findChild("mechanisms")); .findChild("mechanisms"));
final Element auth = new Element("auth"); final Element auth = new Element("auth");