Commit 25e72ee3 authored by Mark Andrews's avatar Mark Andrews
Browse files

use -q when calling dig, quote the zone's name when calling dig and dnssec-dsfromkey

parent 153dce26
......@@ -19,6 +19,9 @@ import argparse
import pprint
import os
def shellquote(s):
return "'" + s.replace("'", "'\\''") + "'"
############################################################################
# DSRR class:
# Delegation Signer (DS) resource record
......@@ -143,7 +146,7 @@ class DLVRR:
############################################################################
def checkds(zone, masterfile = None):
dslist=[]
fp=os.popen("%s +noall +answer -t ds %s" % (args.dig, zone))
fp=os.popen("%s +noall +answer -t ds -q %s" % (args.dig, shellquote(zone)))
for line in fp:
dslist.append(DSRR(line))
dslist = sorted(dslist, key=lambda ds: (ds.keyid, ds.keyalg, ds.hashalg))
......@@ -155,8 +158,9 @@ def checkds(zone, masterfile = None):
fp = os.popen("%s -f %s %s " %
(args.dsfromkey, masterfile, zone))
else:
fp = os.popen("%s +noall +answer -t dnskey %s | %s -f - %s" %
(args.dig, zone, args.dsfromkey, zone))
fp = os.popen("%s +noall +answer -t dnskey -q %s | %s -f - %s" %
(args.dig, shellquote(zone), args.dsfromkey,
shellquote(zone)))
for line in fp:
dsklist.append(DSRR(line))
......@@ -185,8 +189,8 @@ def checkds(zone, masterfile = None):
############################################################################
def checkdlv(zone, lookaside, masterfile = None):
dlvlist=[]
fp=os.popen("%s +noall +answer -t dlv %s.%s" %
(args.dig, zone, lookaside))
fp=os.popen("%s +noall +answer -t dlv -q %s" %
(args.dig, shellquote(zone + '.' + lookaside)))
for line in fp:
dlvlist.append(DLVRR(line, lookaside))
dlvlist = sorted(dlvlist,
......@@ -202,7 +206,8 @@ def checkdlv(zone, lookaside, masterfile = None):
(args.dsfromkey, masterfile, lookaside, zone))
else:
fp = os.popen("%s +noall +answer -t dnskey %s | %s -f - -l %s %s"
% (args.dig, zone, args.dsfromkey, lookaside, zone))
% (args.dig, shellquote(zone), args.dsfromkey,
shellquote(lookaside), shellquote(zone)))
for line in fp:
dlvklist.append(DLVRR(line, lookaside))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment