Double quotes being added to return answers

W.C.A. Wijngaards wouter at nlnetlabs.nl
Wed Sep 7 07:04:22 UTC 2016


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Brad,

Unbound internally deals with TXT records in wireformat, double quotes
are not added or removed.  I think the quotes you see are because of
multiple string sections in the TXT wireformat (each gets printed with
quotes around them).

The python .append function takes a text string and converts it to
wireformat.  I think the lack of quotes in there makes the parser use
whitespace to separate strings?  Try the append with quotes around
your content:  "%s %d IN TXT \"%s\""  (if that is valid python to
escape with \").

Best regards, Wouter

On 06/09/16 19:33, Brad Bendy via Unbound-users wrote:
> Hi,
> 
> We have the Python module setup to do lookups and return answers, 
> looks like everything is working except on a TXT record, unbound
> is double quoting each group of text and this not a valid SPF entry
> for example.
> 
> "v=spf1" "include:_spf.mydom.com" "include:_spf.otherdom.com"
> "~all" instead of just one set of quotes around the entire string.
> 
> That's what im getting returned, on the python/unbound side we have
> a simple msg.answer.append setup:
> 
> msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_TXT, RR_CLASS_IN, 
> PKT_QR | PKT_AA)
> 
> 
> msg.answer.append("%s %d IN TXT %s" % 
> (qstate.qinfo.qname_str,txt['ttl'],str(txt['content'])))
> 
> The txt['content'] source has no double quotes. I have tried
> enclosing it in double quotes as well, same behavior. Python does
> not appear to be adding the quotes, it's something on the unbound
> side from what i can tell.
> 
> I did some searching and I can't find anyone else who has seen
> this issue, so not sure what else to try.
> 
> Any pointers would be great.
> 
> Thanks!
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXz7vwAAoJEJ9vHC1+BF+NelQQAKT75Rjvscf4GV4ZH1fzJArV
ASltb3isAI+9mxb3jmfff4RGgtgAYeHhYvttJnwR/H1V7r84XMW0RQQEBgOEB9qW
4kMeZihDnfCbF/rSbGMVKFn6FTqX8j1gkwetWWxmhq3rMM7kNpkanpSakj74M8LO
PSERlfuTFlY3n5WqOseL0/FN2PjVjE7J5O2qXDjHz0Q9YLITiUJnuBXF4d93ibt2
giLpQoRf2Vd02fT7/30dgjux0Ao6mUj+rcPkIfG1FgcTsinol4mLsEe/YLwwADCX
/HAeIF6F7REvi1oOasq35vCSLJvdOBLlqUwDs/yt4ZrmoAhSKx3cUTfu82u4/CQE
aG2IaoKqL2EKBC2FVL31IgPJc7+Bhucr74djmtNVmhkTlNBG+aRNIRrKjg9yW4GP
4ORpY+QlLl8Du5qlhAFkVlht9S8O41YLf9Bd1BKzDzqv5Y/zeminL1Gu/elp1Bg8
UFuqjvav7IPysZNUbphxA6lqdIXSG404lDZSVd7Q9dXorf6lTzXZD3g7iL6PxC5g
yB500sybMab0e1EsB22dVgikcJqw9C3tVtSVWabX7AcpVm2DJEfomxDkMb3ArpK3
dMx/ssFlWGOEA0OMQzeAndHmn3z0pGiFK0QsgUrMzy287BV/faUrxzB6x7Dy5QXX
NTNkTXEs532wVmpscieZ
=ei+X
-----END PGP SIGNATURE-----



More information about the Unbound-users mailing list