Added auth results signer

pull/215/head
M66B 7 months ago
parent bce1420a4e
commit 6019218e18

@ -3505,12 +3505,12 @@ class Core {
message.identity = (identity == null ? null : identity.id);
boolean fromSelf = message.fromSelf(identity);
List<String> signers = new ArrayList<>();
if (native_dkim &&
!fromSelf &&
!EntityFolder.isOutgoing(folder.type) &&
!BuildConfig.PLAY_STORE_RELEASE) {
List<String> signers = helper.verifyDKIM(context);
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
signers.addAll(helper.verifyDKIM(context));
message.dkim = !signers.isEmpty();
if (message.dkim) {
boolean aligned = helper.isAligned(context, signers, message.return_path, message.smtp_from, message.from);
@ -3521,6 +3521,11 @@ class Core {
}
}
String signer = helper.getSigner(authentication);
if (signer != null)
signers.add(0, signer);
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
if (message.size == null && message.total != null)
message.size = message.total;
@ -4666,12 +4671,12 @@ class Core {
message.identity = (identity == null ? null : identity.id);
boolean fromSelf = message.fromSelf(identity);
List<String> signers = new ArrayList<>();
if (native_dkim &&
!fromSelf &&
!EntityFolder.isOutgoing(folder.type) &&
!BuildConfig.PLAY_STORE_RELEASE) {
List<String> signers = helper.verifyDKIM(context);
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
signers.addAll(helper.verifyDKIM(context));
message.dkim = !signers.isEmpty();
if (message.dkim) {
boolean aligned = helper.isAligned(context, signers, message.return_path, message.smtp_from, message.from);
@ -4682,6 +4687,11 @@ class Core {
}
}
String signer = helper.getSigner(authentication);
if (signer != null)
signers.add(0, signer);
message.signedby = (signers.isEmpty() ? null : TextUtils.join(",", signers));
// Borrow reply name from sender name
if (message.from != null && message.from.length == 1 &&
message.reply != null && message.reply.length == 1) {

@ -2233,6 +2233,28 @@ public class MessageHelper {
return mailfrom;
}
String getSigner(String[] headers) {
if (headers == null || headers.length == 0)
return null;
int semi = headers[0].indexOf(';');
if (semi < 0)
return null;
String signer = headers[0].substring(0, semi).trim();
if (signer.toLowerCase(Locale.ROOT).startsWith("i=")) {
int semi2 = headers[0].indexOf(';', semi + 1);
if (semi2 < 0)
return null;
signer = headers[0].substring(semi + 1, semi2).trim();
}
if (TextUtils.isEmpty(signer))
signer = null;
return signer;
}
boolean getSPF() throws MessagingException {
ensureHeaders();

Loading…
Cancel
Save