From 068157dd2c038413cf410483297058c8ffb31f8a Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 23 Jan 2020 13:42:22 +0100 Subject: [PATCH] Added logging --- .../com.sun.mail.imap.protocol/IMAPSaslAuthenticator.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com.sun.mail.imap.protocol/IMAPSaslAuthenticator.java b/app/src/main/java/com.sun.mail.imap.protocol/IMAPSaslAuthenticator.java index a1a79fff0f..954a83f918 100644 --- a/app/src/main/java/com.sun.mail.imap.protocol/IMAPSaslAuthenticator.java +++ b/app/src/main/java/com.sun.mail.imap.protocol/IMAPSaslAuthenticator.java @@ -31,6 +31,7 @@ import java.util.List; import java.util.Properties; import eu.faircode.email.Helper; +import eu.faircode.email.Log; // https://github.com/javaee/javamail/blob/master/mail/src/main/java/com/sun/mail/imap/protocol/IMAPSaslAuthenticator.java public class IMAPSaslAuthenticator implements SaslAuthenticator { @@ -65,9 +66,11 @@ public class IMAPSaslAuthenticator implements SaslAuthenticator { boolean done = false; try { + Log.i("IMAP SASL command=AUTHENTICATE"); Argument args = new Argument(); args.writeAtom("CRAM-MD5"); tag = pr.writeCommand("AUTHENTICATE", args); + Log.i("IMAP SASL tag=" + tag); } catch (Exception ex) { r = Response.byeResponse(ex); done = true; @@ -76,10 +79,13 @@ public class IMAPSaslAuthenticator implements SaslAuthenticator { while (!done) { try { r = pr.readResponse(); + Log.i("IMAP SASL response=" + r); if (r.isContinuation()) { byte[] nonce = Base64.decode(r.getRest(), Base64.NO_WRAP); + Log.i("IMAP SASL nonce=" + new String(nonce)); String hmac = Helper.HMAC("MD5", 64, p.getBytes(), nonce); String hash = Base64.encodeToString((u + " " + hmac).getBytes(), Base64.NO_WRAP) + "\r\n"; + Log.i("IMAP SASL hash=" + hash); pr.getIMAPOutputStream().write(hash.getBytes()); pr.getIMAPOutputStream().flush(); } else if (r.isTagged() && r.getTag().equals(tag))