Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing lowercase qtype to DNSLookup_dnspython() always results in empty list #32

Closed
hrkokw opened this issue Sep 14, 2021 · 3 comments
Closed

Comments

@hrkokw
Copy link

hrkokw commented Sep 14, 2021

Hi,

When DNSLookup_dnspython() is called with qtype option including lowercase letter, empty list is always returned as if there's no record, regardless of the actual server response.

dnspython accepts both upper/lowercase rdtype and internally normalizes to uppercase.
I suppose letting DNSLookup_dnspython() behave alike would be the best fix.

This one-line patch works well in my environment:

--- a/spf.py
+++ b/spf.py
@@ -120,6 +120,7 @@ def DNSLookup_pydns(name, qtype, strict=True, timeout=20):
 def DNSLookup_dnspython(name, qtype, tcpfallback=True, timeout=30):
     retVal = []
     try:
+        qtype = qtype.upper()
         # FIXME: how to disable TCP fallback in dnspython if not tcpfallback?
         dns_version = dns.version.MAJOR+dns.version.MINOR/100
         if dns_version<1.16:

Thanks.

@sdgathman
Copy link
Owner

You are calling the DNSLookup api to allow your app to work with any of several libraries (like pyspf does)? In that case, maybe I should split off "anydns" to provide just that unified/simplified API, and require that in pyspf.

@hrkokw
Copy link
Author

hrkokw commented Sep 21, 2021

Ah, no, I've just found this issue when debugging spf-engine, which doesn't work correctly in dnspython-enabled environment because of the way it calls DNSLookup:

rDNSResults = spf.DNSLookup (_get_rdns_lookup(ip), 'ptr', timeout=configData.get('Whitelist_Lookup_Time'))
# => empty, always

I wondered to which report this issue but finally I came here.

Thanks.

@sdgathman
Copy link
Owner

0858adb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants