You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Dan Switzer (Jira)" <se...@james.apache.org> on 2024/09/10 14:54:00 UTC

[jira] [Created] (JSPF-113) AsynchronousSPFExecutor hangs when SPF record is truncated because of too many lookups

Dan Switzer created JSPF-113:
--------------------------------

             Summary: AsynchronousSPFExecutor hangs when SPF record is truncated because of too many lookups
                 Key: JSPF-113
                 URL: https://issues.apache.org/jira/browse/JSPF-113
             Project: James jSPF
          Issue Type: Bug
            Reporter: Dan Switzer


While testing v1.0.6, I ran into a bug that will cause the AsynchronousSPFExecutor to hang when it reads in an SPF record that has too many DNS lookups, so the record ends up truncated.

You can see this behavior with the following code:
{code:java}
DefaultSPF spf = new DefaultSPF();
SPFResult res = spf.checkSPF("170.146.224.15", "from@arcofmc.org", "arcofmc.org");
System.out.println(res.getResult());{code}
When this code is run, the `res.getResult()` command will end up hanging because a {{org.xbill.DNS.WireParseException}} exception ends up being thrown and the DNSResponse is never completed.

I've put together a pull request which has a test case and a bug fix:
[https://github.com/apache/james-jspf/pull/25]

However, I'm pretty sure there are some other {{dnsjava}} exceptions that could cause similar issues, so it would probably be wise to have a stronger check for connection exceptions in {{{}dnsjava{}}}.

Also, since the unit test example uses a real DNS example, it could break if they ever fix their SPF record. I tried to find an example of a domain name that is malfconfigured for the purpose of testing, but could not find any options. The better option would be to add in a mock local DNS server that could be used for testing with, but I thought that might not be desired.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org