Commit d3a25ecf authored by Alexandre's avatar Alexandre
Browse files

Remove trailing spaces

parent 07f36dbf
......@@ -65,11 +65,11 @@ def error(msg=None):
msg = "Unknown error"
if monitoring:
print("%s: %s" % (url, msg))
sys.exit(STATE_CRITICAL)
sys.exit(STATE_CRITICAL)
else:
print(msg,file=sys.stderr)
sys.exit(1)
def usage(msg=None):
if msg:
print(msg,file=sys.stderr)
......@@ -154,7 +154,7 @@ def validate_hostname(hostname, cert):
base_i = netaddr.IPAddress(base)
except netaddr.core.AddrFormatError:
continue # Ignore broken IP addresses in certificates. Are we too liberal?
if host_i == base_i:
if host_i == base_i:
return True
else:
pass # Ignore unknown alternative name types. May be
......@@ -176,9 +176,9 @@ class Connection:
self.server = server
self.servername = servername
if self.servername is not None:
check = self.servername
self.check = self.servername
else:
check = self.server
self.check = self.server
self.dot = dot
if not self.dot:
self.post = post
......@@ -301,11 +301,11 @@ def do_test(connection, qname, qtype=rtype):
message = dns.message.make_query(qname, dns.rdatatype.from_text(qtype), use_edns=True, want_dnssec=True)
size = None
if connection.dot:
messagew = message.to_wire()
messagew = message.to_wire()
length = len(messagew)
id = message.id
n = connection.session.send(length.to_bytes(2, byteorder='big') + messagew)
buf = connection.session.recv(2)
buf = connection.session.recv(2)
received = int.from_bytes(buf, byteorder='big')
buf = connection.session.recv(received)
response = dns.message.from_wire(buf)
......@@ -342,7 +342,7 @@ def do_test(connection, qname, qtype=rtype):
# application/dns-message but who knows?
response = "ERROR Not proper DNS data, trailing junk \"%s\"" % body
ok = False
except dns.name.BadLabelType: # Not DNS.
except dns.name.BadLabelType: # Not DNS.
response = "ERROR Not proper DNS data (wrong path in the URL?) \"%s\"" % body[:100]
ok = False
else:
......@@ -356,7 +356,7 @@ def do_test(connection, qname, qtype=rtype):
response = body
buffer.close()
return (rcode, response, size)
# Main program
me = os.path.basename(sys.argv[0])
monitoring = (me == "check_doh" or me == "check_dot")
......@@ -409,7 +409,7 @@ if not monitoring:
sys.exit(1)
if dot and (post or head):
usage("POST or HEAD makes non sense for DoT")
sys.exit(1)
sys.exit(1)
if ifile is None and (len(args) != 2 and len(args) != 3):
usage("Wrong number of arguments")
sys.exit(1)
......@@ -430,7 +430,7 @@ else: # Monitoring plugin
if option == "-H":
host = value
elif option == "-V":
vhostname = value
vhostname = value
elif option == "-n":
name = value
elif option == "-t":
......@@ -477,13 +477,13 @@ else: # Monitoring plugin
url = "https://%s/" % host
else:
connectTo = host
url = "https://%s/" % vhostname
url = "https://%s/" % vhostname
if path is not None:
if path.startswith("/"):
path = path[1:]
url += path
ok = True
start = time.time()
start = time.time()
try:
if dot and vhostname is not None:
extracheck = vhostname
......@@ -561,4 +561,4 @@ else:
sys.exit(1)
else:
sys.exit(STATE_CRITICAL)
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