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", "f...@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-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to