mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-24 02:37:05 +00:00
make it possible to use subnet addresses for axfr (#1616)
it is sometimes needed to be able to set axfr to more than just one ip address. This can be done with multiple xfr: in the secondary dns input but if you need to add an entire subnet segment (xxx.xxx.xxx.0/yy) then it will not work. With this patch it is now possible to use a subnet as input for xfr the same way as if it was an ip address.
This commit is contained in:
parent
08021ea19f
commit
c7377e602d
@ -903,8 +903,12 @@ def set_secondary_dns(hostnames, env):
|
|||||||
else:
|
else:
|
||||||
# Validate IP address.
|
# Validate IP address.
|
||||||
try:
|
try:
|
||||||
v = ipaddress.ip_address(item[4:]) # raises a ValueError if there's a problem
|
if "/" in item[4:]:
|
||||||
if not isinstance(v, ipaddress.IPv4Address): raise ValueError("That's an IPv6 address.")
|
v = ipaddress.ip_network(item[4:] # raises a ValueError if there's a problem
|
||||||
|
if not isinstance(v, ipaddress.IPv4Network): raise ValueError("That's an IPv6 subnet.")
|
||||||
|
else:
|
||||||
|
v = ipaddress.ip_address(item[4:]) # raises a ValueError if there's a problem
|
||||||
|
if not isinstance(v, ipaddress.IPv4Address): raise ValueError("That's an IPv6 address.")
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise ValueError("'%s' is not an IPv4 address." % item[4:])
|
raise ValueError("'%s' is not an IPv4 address." % item[4:])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user