Added debug option to disable PLAIN auth

pull/180/head
M66B 5 years ago
parent fa07db1653
commit c3cff6a6f4

@ -144,7 +144,8 @@ public class EmailService implements AutoCloseable {
boolean socks_enabled = prefs.getBoolean("socks_enabled", false); boolean socks_enabled = prefs.getBoolean("socks_enabled", false);
String socks_proxy = prefs.getString("socks_proxy", "localhost:9050"); String socks_proxy = prefs.getString("socks_proxy", "localhost:9050");
boolean sasl = prefs.getBoolean("sasl", true); boolean auth_plain = prefs.getBoolean("auth_plain", true);
boolean auth_sasl = prefs.getBoolean("auth_sasl", true);
// SOCKS proxy // SOCKS proxy
if (socks_enabled) { if (socks_enabled) {
@ -163,11 +164,10 @@ public class EmailService implements AutoCloseable {
properties.put("mail.event.scope", "folder"); properties.put("mail.event.scope", "folder");
properties.put("mail.event.executor", executor); properties.put("mail.event.executor", executor);
//properties.put("mail." + protocol + ".auth.login.disable", "true"); properties.put("mail." + protocol + ".auth.plain.disable", Boolean.toString(!auth_plain));
//properties.put("mail." + protocol + ".auth.plain.disable", "true");
properties.put("mail." + protocol + ".sasl.enable", "true"); properties.put("mail." + protocol + ".sasl.enable", "true");
if (sasl) { if (auth_sasl) {
properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5"); properties.put("mail." + protocol + ".sasl.mechanisms", "CRAM-MD5");
properties.put("mail." + protocol + ".sasl.realm", realm == null ? "" : realm); properties.put("mail." + protocol + ".sasl.realm", realm == null ? "" : realm);
} }

@ -77,7 +77,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private SwitchCompat swCrashReports; private SwitchCompat swCrashReports;
private TextView tvUuid; private TextView tvUuid;
private SwitchCompat swDebug; private SwitchCompat swDebug;
private SwitchCompat swSasl; private SwitchCompat swAuthPlain;
private SwitchCompat swAuthSasl;
private Button btnReset; private Button btnReset;
private SwitchCompat swCleanupAttachments; private SwitchCompat swCleanupAttachments;
private Button btnCleanup; private Button btnCleanup;
@ -95,7 +96,7 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
private final static String[] RESET_OPTIONS = new String[]{ private final static String[] RESET_OPTIONS = new String[]{
"shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates", "shortcuts", "fts", "english", "watchdog", "auto_optimize", "updates",
"experiments", "crash_reports", "debug", "sasl", "cleanup_attachments" "experiments", "crash_reports", "debug", "auth_plain", "auth_sasl", "cleanup_attachments"
}; };
private final static String[] RESET_QUESTIONS = new String[]{ private final static String[] RESET_QUESTIONS = new String[]{
@ -132,7 +133,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swCrashReports = view.findViewById(R.id.swCrashReports); swCrashReports = view.findViewById(R.id.swCrashReports);
tvUuid = view.findViewById(R.id.tvUuid); tvUuid = view.findViewById(R.id.tvUuid);
swDebug = view.findViewById(R.id.swDebug); swDebug = view.findViewById(R.id.swDebug);
swSasl = view.findViewById(R.id.swSasl); swAuthPlain = view.findViewById(R.id.swAuthPlain);
swAuthSasl = view.findViewById(R.id.swAuthSasl);
btnReset = view.findViewById(R.id.btnReset); btnReset = view.findViewById(R.id.btnReset);
swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments); swCleanupAttachments = view.findViewById(R.id.swCleanupAttachments);
btnCleanup = view.findViewById(R.id.btnCleanup); btnCleanup = view.findViewById(R.id.btnCleanup);
@ -279,11 +281,19 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
} }
}); });
swSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { swAuthPlain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override @Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("sasl", checked).apply(); prefs.edit().putBoolean("auth_plain", checked).apply();
ServiceSynchronize.reload(getContext(), -1L, false, "sasl=" + checked); ServiceSynchronize.reload(getContext(), -1L, false, "auth_plain=" + checked);
}
});
swAuthSasl.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("auth_sasl", checked).apply();
ServiceSynchronize.reload(getContext(), -1L, false, "auth_sasl=" + checked);
} }
}); });
@ -527,7 +537,8 @@ public class FragmentOptionsMisc extends FragmentBase implements SharedPreferenc
swCrashReports.setChecked(prefs.getBoolean("crash_reports", false)); swCrashReports.setChecked(prefs.getBoolean("crash_reports", false));
tvUuid.setText(prefs.getString("uuid", null)); tvUuid.setText(prefs.getString("uuid", null));
swDebug.setChecked(prefs.getBoolean("debug", false)); swDebug.setChecked(prefs.getBoolean("debug", false));
swSasl.setChecked(prefs.getBoolean("sasl", true)); swAuthPlain.setChecked(prefs.getBoolean("auth_plain", true));
swAuthSasl.setChecked(prefs.getBoolean("auth_sasl", true));
swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false)); swCleanupAttachments.setChecked(prefs.getBoolean("cleanup_attachments", false));
tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors())); tvProcessors.setText(getString(R.string.title_advanced_processors, Runtime.getRuntime().availableProcessors()));

@ -255,17 +255,29 @@
app:layout_constraintTop_toBottomOf="@id/swDebug" /> app:layout_constraintTop_toBottomOf="@id/swDebug" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSasl" android:id="@+id/swAuthPlain"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:checked="true" android:checked="true"
android:text="@string/title_advanced_sasl" android:text="@string/title_advanced_auth_plain"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvDebugHint" app:layout_constraintTop_toBottomOf="@id/tvDebugHint"
app:switchPadding="12dp" /> app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swAuthSasl"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:checked="true"
android:text="@string/title_advanced_auth_sasl"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swAuthPlain"
app:switchPadding="12dp" />
<Button <Button
android:id="@+id/btnReset" android:id="@+id/btnReset"
style="?android:attr/buttonStyleSmall" style="?android:attr/buttonStyleSmall"
@ -274,7 +286,7 @@
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:text="@string/title_setup_reset_questions" android:text="@string/title_setup_reset_questions"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSasl" /> app:layout_constraintTop_toBottomOf="@id/swAuthSasl" />
<androidx.appcompat.widget.SwitchCompat <androidx.appcompat.widget.SwitchCompat
android:id="@+id/swCleanupAttachments" android:id="@+id/swCleanupAttachments"
@ -408,6 +420,6 @@
android:id="@+id/grpDebug" android:id="@+id/grpDebug"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:constraint_referenced_ids="swSasl,tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" /> app:constraint_referenced_ids="swAuthPlain,swAuthSasl,tvProcessors,tvMemoryClass,tvStorageSpace,tvFingerprint,btnCharsets,btnCiphers" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx> </eu.faircode.email.ScrollViewEx>

@ -449,7 +449,8 @@
<string name="title_advanced_fts_indexed">%1$d / %2$d messages indexed (%3$s)</string> <string name="title_advanced_fts_indexed">%1$d / %2$d messages indexed (%3$s)</string>
<string name="title_advanced_english">Use US country settings</string> <string name="title_advanced_english">Use US country settings</string>
<string name="title_advanced_watchdog">Periodically check if FairEmail is still active</string> <string name="title_advanced_watchdog">Periodically check if FairEmail is still active</string>
<string name="title_advanced_sasl" translatable="false">CRAM-MD5</string> <string name="title_advanced_auth_plain" translatable="false">PLAIN</string>
<string name="title_advanced_auth_sasl" translatable="false">SASL</string>
<string name="title_advanced_optimize">Automatically optimize settings</string> <string name="title_advanced_optimize">Automatically optimize settings</string>
<string name="title_advanced_updates">Check for updates</string> <string name="title_advanced_updates">Check for updates</string>
<string name="title_advanced_experiments">Try experimental features</string> <string name="title_advanced_experiments">Try experimental features</string>

Loading…
Cancel
Save