Skip to content

Commit

Permalink
Merge pull request #280 from ThomasWaldmann/fix-247
Browse files Browse the repository at this point in the history
fix crash on ShortHeader and other DNSException subclasses, fixes #247
  • Loading branch information
ThomasWaldmann committed Aug 27, 2016
2 parents 6ffc265 + 118d0d5 commit fbb781d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions nsupdate/main/dnstools.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def __str__(self):

Timeout = dns.resolver.Timeout
NoNameservers = dns.resolver.NoNameservers
DNSException = dns.exception.DNSException


class SameIpError(ValueError):
Expand Down
2 changes: 2 additions & 0 deletions nsupdate/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ def form_valid(self, form):
success, level, msg = False, messages.ERROR, 'Base domain does not exist.'
except dnstools.SameIpError:
success, level, msg = False, messages.ERROR, 'Host already exists in DNS.'
except dnstools.DNSException as e:
success, level, msg = False, messages.ERROR, 'DNSException [%s]' % str(e)
except socket.error as err:
success, level, msg = False, messages.ERROR, 'Communication to name server failed [%s]' % str(err)
else:
Expand Down

0 comments on commit fbb781d

Please sign in to comment.