load_pk_from_dns fails when response contains quotes
Bug #1812834 reported by
Cyril N.
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
When loading the data from the DNS TXT entry (xxx._domainkey
My suggestion is to remove the quotes at the beginning and end of the DNS response when they are quotes:
```
def load_pk_
s = dnsfunc(name)
if not s:
raise KeyFormatError(
try:
if type(s) is str:
s = s.encode('ascii')
if s[0:1] == b'"':
s = s[1:]
if s[-1:] == b'"':
s = s[0:-1]
pub = parse_tag_value(s)
except InvalidTagValueList as e:
raise KeyFormatError(e)
# ... next of the function
```
To post a comment you must log in.
Can you give an example of a domain that does this?
On Tuesday, January 22, 2019 09:50:24 AM you wrote: .domain. tld), if that result contains surounding quotes, from_dns( name, dnsfunc=get_txt): "missing public key: %s"%name)
> Public bug reported:
>
> When loading the data from the DNS TXT entry
> (xxx._domainkey
> the DKIM test fails, even if everything else is correct.
>
> My suggestion is to remove the quotes at the beginning and end of the
> DNS response when they are quotes:
>
>
> ```
> def load_pk_
> s = dnsfunc(name)
> if not s:
> raise KeyFormatError(
> try:
> if type(s) is str:
> s = s.encode('ascii')
>
> if s[0:1] == b'"':
> s = s[1:]
> if s[-1:] == b'"':
> s = s[0:-1]
>
> pub = parse_tag_value(s)
> except InvalidTagValueList as e:
> raise KeyFormatError(e)
>
> # ... next of the function
> ```
>
> ** Affects: dkimpy
> Importance: Undecided
> Status: New