tuxis-ie / nsedit

DNS Editor working with PowerDNS's new API
GNU General Public License v2.0
199 stars 55 forks source link

Error in processing template records if name is '' #142

Closed bajizs closed 7 years ago

bajizs commented 7 years ago

If you have empty name for some template records (for example MX record), get an API error of not canonical name.

can be solved withthis lines in zones .php (replace lines 296-298 with next lines): foreach ($template['records'] as $record) { $name = $record['name']; if ('' == $name) { $name = $zone->name; } elseif (string_ends_with($name, '.')) { $name = substr($name, 0, -1); if (!string_ends_with($name, $zone->name)) { jtable_respond(null, 'error', "Name $name not in zone ".$zone->name); } } else if (!string_ends_with($name, $zone->name)) { $name = $name . '.' . $zone->name; } $zone->addRecord($name, $record['type'], $record['content']); }

tuxis-ie commented 7 years ago

This works for me?

        array(
            'name'      => '',
            'type'      => 'MX',
            'content'   => '10 connect.tuxis.nl.'),
        array(
            'name'      => '',
            'type'      => 'MX',
            'content'   => '20 fallback.tuxis.nl.'),
bajizs commented 7 years ago

On relase v1.1?

tuxis-ie commented 7 years ago

Yes, always worked.