avoid invalid IP address crash, fixes #394

This commit is contained in:
Thomas Waldmann 2018-11-18 20:48:26 +01:00
parent 0064f1491d
commit b8a3e3a2c7

View File

@ -343,7 +343,8 @@ def _update_or_delete(host, ipaddr, secure=False, logger=None, _delete=False):
ipaddr = str(ipaddr)
kind = check_ip(ipaddr, ('ipv4', 'ipv6'))
rdtype = 'A' if kind == 'ipv4' else 'AAAA'
except (ValueError, UnicodeError):
IPNetwork(ipaddr) # raise AddrFormatError here if there is an issue with ipaddr, see #394
except (ValueError, UnicodeError, AddrFormatError):
# invalid ip address string
# some people manage to even give a non-ascii string instead of an ip addr
msg = '%s - received bad ip address: %r' % (fqdn, ipaddr)