From f80fe38e3608ea32eb3da08be30b894510e5b35d Mon Sep 17 00:00:00 2001 From: Alexander Sagen Date: Fri, 26 Apr 2024 19:35:44 +0200 Subject: [PATCH] Ip\Cidr: Set SPF to if not explicitly specified --- composer.json | 2 +- src/ip/cidr.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index a447bba..aa02c05 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "alexrsagen/obie", - "version": "1.6.8", + "version": "1.6.9", "type": "framework", "description": "Obie is a simple PHP framework. It aims to provide basic services needed for any web app.", "keywords": ["framework", "php", "http", "template", "view", "router", "routing", "model", "models", "session", "sessions"], diff --git a/src/ip/cidr.php b/src/ip/cidr.php index a7c3ecb..c40553f 100644 --- a/src/ip/cidr.php +++ b/src/ip/cidr.php @@ -157,6 +157,16 @@ public static function fromSpf1RecordLookup(string $dns_name, int &$max_dns_look $record = Spf1::decode($txt_record['txt']); if (!$record) continue; + // set to ($dns_name) if not explicitly specified + foreach ($record->directives as $directive) { + if (strlen($directive->value) === 0 && in_array($directive->mechanism, [ + Spf1::MECHANISM_A, + Spf1::MECHANISM_MX, + ])) { + $directive->value = $dns_name; + } + } + return static::fromSpf1Record($record, $max_dns_lookup, $max_dns_mx_host_lookup); }