spfcheck : manage the FAIL if a minus is set in part

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@6031 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2020-08-21 09:36:26 +00:00
parent 283109bef4
commit 5997150c43
2 changed files with 55 additions and 2 deletions

View File

@@ -113,6 +113,12 @@ class spfcheck
if ($ipaddresses->ipInNetwork ($ip, $ipToTest, $mask))
{
$this->matchRule = "$key/$part";
if ($part{0} === "-")
return "FAIL";
if ($part{0} === "~")
return "SOFTFAIL";
if ($part{0} === "?")
return "NEUTRAL";
return "PASS";
}
}
@@ -133,6 +139,9 @@ class spfcheck
$this->matchRule = "$this->catchAllDomain/$this->catchAll";
return "NEUTRAL";
}
throw new \Exception (sprintf (dgettext ("domframework",
"SFPCheck : Can not determine the SPF result with params '%s' and '%s'"),
$domain, $ip), 403 );
}
// }}}
@@ -258,6 +267,14 @@ class spfcheck
if (stripos ($part, "redirect=") === 0)
// {{{
{
if ($sign !== "")
{
$this->errors[$domain][$sign.$part] =
sprintf (dgettext ("domframework",
"Invalid redirect set for domain '%s' : can not be signed"),
$domain);
continue;
}
$ext = substr ($part, 9);
if (! is_string ($ext) || trim ($ext) === "")
{
@@ -273,6 +290,14 @@ class spfcheck
elseif (stripos ($part, "include:") === 0)
// {{{
{
if ($sign !== "")
{
$this->errors[$domain][$sign.$part] =
sprintf (dgettext ("domframework",
"Invalid include set for domain '%s' : can not be signed"),
$domain);
continue;
}
$ext = substr ($part, 8);
if (! is_string ($ext) || trim ($ext) === "")
{
@@ -450,7 +475,7 @@ class spfcheck
$domain);
}
$localAll = $part;
$this->catchAll = $part;
$this->catchAll = $sign.$part;
$this->catchAllDomain = $domain;
}
// }}}