Skip to content

Commit

Permalink
Ip\Cidr: Set SPF <target-name> to <domain> if not explicitly specified
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrsagen committed Apr 26, 2024
1 parent a7a148d commit f80fe38
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -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"],
Expand Down
10 changes: 10 additions & 0 deletions src/ip/cidr.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 <target-name> to <domain> ($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);
}

Expand Down

0 comments on commit f80fe38

Please sign in to comment.