|
|
@ -1016,31 +1016,39 @@ public class MessageHelper {
|
|
|
|
return getAddressHeader("Disposition-Notification-To");
|
|
|
|
return getAddressHeader("Disposition-Notification-To");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String getAuthentication() throws MessagingException {
|
|
|
|
String[] getAuthentication() throws MessagingException {
|
|
|
|
ensureMessage(false);
|
|
|
|
ensureMessage(false);
|
|
|
|
|
|
|
|
|
|
|
|
String header = imessage.getHeader("Authentication-Results", null);
|
|
|
|
String[] headers = imessage.getHeader("Authentication-Results");
|
|
|
|
return (header == null ? null : MimeUtility.unfold(header));
|
|
|
|
if (headers == null)
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < headers.length; i++)
|
|
|
|
|
|
|
|
headers[i] = MimeUtility.unfold(headers[i]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return headers;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Boolean getAuthentication(String type, String header) {
|
|
|
|
static Boolean getAuthentication(String type, String[] headers) {
|
|
|
|
if (header == null)
|
|
|
|
if (headers == null)
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
// https://tools.ietf.org/html/rfc7601
|
|
|
|
// https://tools.ietf.org/html/rfc7601
|
|
|
|
Boolean result = null;
|
|
|
|
Boolean result = null;
|
|
|
|
String[] part = header.split(";");
|
|
|
|
for (String header : headers) {
|
|
|
|
for (int i = 1; i < part.length; i++) {
|
|
|
|
String[] part = header.split(";");
|
|
|
|
String[] kv = part[i].split("=");
|
|
|
|
for (int i = 1; i < part.length; i++) {
|
|
|
|
if (kv.length > 1) {
|
|
|
|
String[] kv = part[i].split("=");
|
|
|
|
String key = kv[0].trim();
|
|
|
|
if (kv.length > 1) {
|
|
|
|
String[] val = kv[1].trim().split(" ");
|
|
|
|
String key = kv[0].trim();
|
|
|
|
if (val.length > 0 && type.equals(key)) {
|
|
|
|
String[] val = kv[1].trim().split(" ");
|
|
|
|
if ("fail".equals(val[0]))
|
|
|
|
if (val.length > 0 && type.equals(key)) {
|
|
|
|
result = false;
|
|
|
|
if ("fail".equals(val[0]))
|
|
|
|
else if ("pass".equals(val[0]))
|
|
|
|
result = false;
|
|
|
|
if (result == null)
|
|
|
|
else if ("pass".equals(val[0]))
|
|
|
|
result = true;
|
|
|
|
if (result == null)
|
|
|
|
|
|
|
|
result = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|