mirror of https://github.com/M66B/FairEmail.git
Added BIMI/DMARC pct check
This commit is contained in:
parent
3a6f9e9fc4
commit
1ae779b151
|
@ -338,10 +338,15 @@ public class Bimi {
|
||||||
Log.i("BIMI got TXT " + records[0].name);
|
Log.i("BIMI got TXT " + records[0].name);
|
||||||
|
|
||||||
Map<String, String> dmarc = MessageHelper.getKeyValues(records[0].name);
|
Map<String, String> dmarc = MessageHelper.getKeyValues(records[0].name);
|
||||||
String policy = dmarc.get("p");
|
|
||||||
if (policy == null ||
|
String p = dmarc.get("p");
|
||||||
!DMARC_POLICIES.contains(policy.toLowerCase(Locale.ROOT)))
|
if (p == null ||
|
||||||
throw new IllegalArgumentException("DMARC invalid policy=" + policy);
|
!DMARC_POLICIES.contains(p.toLowerCase(Locale.ROOT)))
|
||||||
|
throw new IllegalArgumentException("DMARC invalid p=" + p);
|
||||||
|
|
||||||
|
String pct = dmarc.get("pct");
|
||||||
|
if (!TextUtils.isEmpty(pct) && !"100".equals(pct))
|
||||||
|
throw new IllegalArgumentException("DMARC invalid pct=" + p);
|
||||||
|
|
||||||
verified = true;
|
verified = true;
|
||||||
} catch (MalformedURLException ex) {
|
} catch (MalformedURLException ex) {
|
||||||
|
|
Loading…
Reference in New Issue