From 9bdb6595175e615ee531e92d2d3a0d37dec70f85 Mon Sep 17 00:00:00 2001 From: "Thomas A. Hirsch" Date: Thu, 27 Apr 2023 18:41:29 +0200 Subject: [PATCH] Fixes #49: Converts the matched term to lower case before detecting the used mechanism. --- src/Model/Record.php | 2 +- tests/issue49/issue49-tests.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/issue49/issue49-tests.yml diff --git a/src/Model/Record.php b/src/Model/Record.php index 260b11e..4cce9ba 100644 --- a/src/Model/Record.php +++ b/src/Model/Record.php @@ -55,7 +55,7 @@ public function getTerms(): iterable } $cidr4 = array_key_exists('cidr4', $matches) && $matches['cidr4'] !== '' ? intval($matches['cidr4']) : null; $cidr6 = array_key_exists('cidr6', $matches) && $matches['cidr6'] !== '' ? intval($matches['cidr6']) : null; - switch($matches['term']) { + switch(strtolower($matches['term'])) { case Mechanism::ALL: yield new All($term, $matches['qualifier']); break; diff --git a/tests/issue49/issue49-tests.yml b/tests/issue49/issue49-tests.yml new file mode 100644 index 0000000..19843f3 --- /dev/null +++ b/tests/issue49/issue49-tests.yml @@ -0,0 +1,16 @@ +description: Issue 49 +tests: + include-permerror: + description: >- + Accept different upper and lower case mechanisms + helo: mail.example.net + host: 127.0.0.1 + mailfrom: postmaster@example.com + result: pass +zonedata: + example.com: + - SPF: 'v=spf1 iP4:127.0.0.1 ~aLL' + example.net: + - SPF: 'v=spf1 +All' + example.org: + - SPF: 'v=spf1 +IP4:127.0.0.1 -ALL'