authorizaton: fix static type checks
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
parent
8266376f46
commit
4bed314b0a
|
@ -172,7 +172,6 @@ class Authorization:
|
||||||
self.trusted_domains: List[str] = []
|
self.trusted_domains: List[str] = []
|
||||||
for val in config.getlist('trusted_clients', []):
|
for val in config.getlist('trusted_clients', []):
|
||||||
# Check IP address
|
# Check IP address
|
||||||
tc: Union[IPAddr, IPNetwork]
|
|
||||||
try:
|
try:
|
||||||
tc = ipaddress.ip_address(val)
|
tc = ipaddress.ip_address(val)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
|
@ -182,7 +181,7 @@ class Authorization:
|
||||||
continue
|
continue
|
||||||
# Check ip network
|
# Check ip network
|
||||||
try:
|
try:
|
||||||
tc = ipaddress.ip_network(val)
|
tn = ipaddress.ip_network(val)
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
if "has host bits set" in str(e):
|
if "has host bits set" in str(e):
|
||||||
self.server.add_warning(
|
self.server.add_warning(
|
||||||
|
@ -191,7 +190,7 @@ class Authorization:
|
||||||
continue
|
continue
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
self.trusted_ranges.append(tc)
|
self.trusted_ranges.append(tn)
|
||||||
continue
|
continue
|
||||||
# Check hostname
|
# Check hostname
|
||||||
match = re.match(r"([a-z0-9]+(-[a-z0-9]+)*\.?)+[a-z]{2,}$", val)
|
match = re.match(r"([a-z0-9]+(-[a-z0-9]+)*\.?)+[a-z]{2,}$", val)
|
||||||
|
|
Loading…
Reference in New Issue