SPF ip-records have an optional prefix appended

This commit is contained in:
keykey7 2023-01-11 21:32:00 +01:00
parent 1b488aed5b
commit d213dae57c
No known key found for this signature in database
GPG Key ID: 6D678D663CE5E207
1 changed files with 4 additions and 2 deletions

View File

@ -272,9 +272,11 @@ public class ActivityDmarc extends ActivityBase {
ip = ip.toLowerCase(Locale.ROOT);
if (ip.startsWith("ip4:") || ip.startsWith("ip6:")) {
String[] net = ip.substring(4).split("/");
if (net.length != 2)
if (net.length > 2)
continue;
Integer prefix = Helper.parseInt(net[1]);
Integer prefix = ip.startsWith("ip4:") ? 32 : 64;
if (net.length == 2)
prefix = Helper.parseInt(net[1]);
if (prefix == null)
continue;
if (ConnectionHelper.inSubnet(text, net[0], prefix)) {