if we get an invalid ip address string with an update (e.g. via myip=... param), return result code 'dnserr'

note: I did not find a better matching result code, seems like dyndns2 api is rather incomplete. :-(
This commit is contained in:
Thomas Waldmann 2014-01-21 14:21:35 +01:00
parent 0b21532bd6
commit 5d2ee03e02

View File

@ -282,7 +282,12 @@ def _update(host, hostname, ipaddr, ssl=False, logger=None):
ipaddr = str(ipaddr) # bug in dnspython: crashes if ipaddr is unicode, wants a str!
# https://github.com/rthalley/dnspython/issues/41
# TODO: reproduce and submit traceback to issue 41
kind = check_ip(ipaddr, ('ipv4', 'ipv6'))
try:
kind = check_ip(ipaddr, ('ipv4', 'ipv6'))
except ValueError:
# invalid ip address string
return Response('dnserr') # there should be a better response code for this
host.poke(kind, ssl)
try:
update(hostname, ipaddr)