shevek / libspf2

Implementation of the Sender Policy Framework for SMTP authorization
http://www.libspf2.net/
37 stars 32 forks source link

Don't alter DNS resolution behaviour when debugging #27

Open nomis opened 6 years ago

nomis commented 6 years ago

If the debug level is > 1, SPF_dns_resolv_lookup was outputting the other sections of the DNS response. While this information may be useful, the number of records returned was influenced by whatever the last section was.

For if the last section (e.g. ADDITIONAL) had no records then a NO_DATA response is returned.

There's a lot of additional parsing and error handling that may occur when processing other sections of the response, so just skip the non-ANSWER sections even when debugging instead of attempting to distinguish between real errors and errors occurring in debug output.