Commit 5874647c authored by Khanh Ngo's avatar Khanh Ngo Committed by GitHub

Merge pull request #150 from mir06/dydns_adjustment

re-fix root domain record update via dyndns
parents bf7924bb 624bbc09
......@@ -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']
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment