Removing option "ONCE"

This commit is contained in:
anonTree1417 2020-04-01 18:39:39 +02:00
parent 4217db3e31
commit faaa4db88b
4 changed files with 10 additions and 18 deletions

View File

@ -39,7 +39,7 @@ public class PicassoService {
builder.downloader(new OkHttp3Downloader(okHttpClient.build())); builder.downloader(new OkHttp3Downloader(okHttpClient.build()));
builder.listener((picasso, uri, exception) -> { builder.listener((picasso, uri, exception) -> {
Log.e("PicassoService", Objects.requireNonNull(uri.toString())); // important!! //Log.e("PicassoService", Objects.requireNonNull(uri.toString()));
Log.e("PicassoService", exception.toString()); Log.e("PicassoService", exception.toString());
}); });

View File

@ -8,7 +8,6 @@ class MTMDecision {
final static int DECISION_INVALID = 0; final static int DECISION_INVALID = 0;
final static int DECISION_ABORT = 1; final static int DECISION_ABORT = 1;
final static int DECISION_ONCE = 2;
final static int DECISION_ALWAYS = 3; final static int DECISION_ALWAYS = 3;
int state = DECISION_INVALID; int state = DECISION_INVALID;

View File

@ -27,8 +27,7 @@ public class MemorizingActivity extends Activity {
builder.setMessage(cert); builder.setMessage(cert);
builder.setPositiveButton(R.string.mtm_decision_always, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ALWAYS)); builder.setPositiveButton(R.string.mtm_decision_always, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ALWAYS));
builder.setNeutralButton(R.string.mtm_decision_once, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ONCE)); builder.setNeutralButton(R.string.mtm_decision_abort, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ABORT));
builder.setNegativeButton(R.string.mtm_decision_abort, (dialog, which) -> onSendResult(decisionId, MTMDecision.DECISION_ABORT));
builder.setOnCancelListener(dialog -> onSendResult(decisionId, MTMDecision.DECISION_ABORT)); builder.setOnCancelListener(dialog -> onSendResult(decisionId, MTMDecision.DECISION_ABORT));
builder.create().show(); builder.create().show();

View File

@ -596,26 +596,20 @@ public class MemorizingTrustManager implements X509TrustManager {
private void interactCert(final X509Certificate[] chain, String authType, CertificateException cause) throws CertificateException { private void interactCert(final X509Certificate[] chain, String authType, CertificateException cause) throws CertificateException {
switch(interact(certChainMessage(chain, cause), R.string.mtm_accept_cert)) { if(interact(certChainMessage(chain, cause), R.string.mtm_accept_cert) == MTMDecision.DECISION_ALWAYS) {
case MTMDecision.DECISION_ALWAYS:
storeCert(chain[0]); // only store the server cert, not the whole chain storeCert(chain[0]); // only store the server cert, not the whole chain
case MTMDecision.DECISION_ONCE:
break;
default:
throw (cause);
} }
throw (cause);
} }
private boolean interactHostname(X509Certificate cert, String hostname) { private boolean interactHostname(X509Certificate cert, String hostname) {
switch(interact(hostNameMessage(cert, hostname), R.string.mtm_accept_servername)) { if(interact(hostNameMessage(cert, hostname), R.string.mtm_accept_servername) == MTMDecision.DECISION_ALWAYS) {
case MTMDecision.DECISION_ALWAYS:
storeCert(hostname, cert); storeCert(hostname, cert);
case MTMDecision.DECISION_ONCE:
return true;
default:
return false;
} }
return false;
} }
static void interactResult(int decisionId, int choice) { static void interactResult(int decisionId, int choice) {