diff --git a/app/models.py b/app/models.py index 9a78040..51a6ce6 100644 --- a/app/models.py +++ b/app/models.py @@ -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'] diff --git a/app/views.py b/app/views.py index 70dc96f..a33e6e1 100644 --- a/app/views.py +++ b/app/views.py @@ -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: