Created attachment 9024 [details]
'dns zonedump' command for samba-tool (patch against 4.0.6)
The format used for samba-tool's 'dns query' subcommand has several shortcomings:
1. It's rather unlike what most administrators expect (i.e., a BIND-like output)
2. It doesn't show child records, which means the command is not a valid substitute for the lack of AXFR support in internal DNS
This has been discussed on the mailing list back in April, the last message in the thread called for a 'zonedump' subcommand to be added, which would output a BIND-like flat view of a zone: <https://lists.samba.org/archive/samba-technical/2013-April/091421.html>. It seems the idea didn't get implemented, though.
As the current format wasn't very useful for my own needs, I made a ugly hack to dns.py, adding a 'zonedump' command which dumps the zone recursively; I'm attaching the resulting patch to this report. It's certainly far from being good code (not to mention it's not very idiomatic: I'm a PHP programmer by trade, and not well versed in the Python vernacular) but it appears to solve my specific problem.
I don't know if BIND-like output is what we'd want now, as BIND flat-file support is very deprecated, and that's what it would be used for?
But the awkwardness complaint stands. Probably we'd prefer JSON output.