Commit a602c44f authored by Alexander Kruppa's avatar Alexander Kruppa

Print warning for refused conneciton even with empty whitelist

Derp
parent 6a064504
......@@ -113,13 +113,12 @@ class FixedHTTPServer(http.server.HTTPServer):
If no whitelist is defined, always denies.
"""
if self.whitelist is None:
return False
# Use ipmask() to convert dotted string form of address to integer
addr = self.ipmask(client_address[0])[0]
for iprange in self.whitelist:
if addr & iprange[1] == iprange[0]:
return True
if not self.whitelist is None:
# Use ipmask() to convert dotted string form of address to integer
addr = self.ipmask(client_address[0])[0]
for iprange in self.whitelist:
if addr & iprange[1] == iprange[0]:
return True
self.logger.warning("Connection from IP address %s rejected - "
"not in server.whitelist", client_address[0])
return False
......
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