re-fix root domain record via dyndns by providing @.domain.tld as hostname

This commit is contained in:
Armin Leuprecht
2016-10-13 23:55:44 +02:00
parent bf7924bb99
commit 624bbc09f9
2 changed files with 8 additions and 2 deletions

View File

@@ -992,6 +992,12 @@ class Record(object):
jdata = self.get_record_data(domain)
jrecords = jdata['records']
if self.name.startswith('@'):
self.name = '.'.join(self.name.split('.')[1:])
allowed = ['A', 'AAAA']
else:
allowed = app.config['RECORDS_ALLOW_EDIT']
for jr in jrecords:
if jr['name'] == self.name and jr['type'] == self.type:
self.name = jr['name']

View File

@@ -762,19 +762,19 @@ def dyndns_update():
domain = None
domain_segments = hostname.split('.')
for index in range(len(domain_segments)):
domain_segments.pop(0)
full_domain = '.'.join(domain_segments)
potential_domain = Domain.query.filter(Domain.name == full_domain).first()
if potential_domain in domains:
domain = potential_domain
break
domain_segments.pop(0)
if not domain:
history = History(msg="DynDNS update: attempted update of %s but it does not exist for this user" % hostname, created_by=current_user.username)
history.add()
return render_template('dyndns.html', response='nohost'), 200
r = Record(type='A')
r = Record()
r.name = hostname
# check if the user requested record exists within this domain
if r.exists(domain.name) and r.is_allowed: