Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid $ORIGIN record #10

Open
do11 opened this issue Feb 15, 2017 · 1 comment
Open

Invalid $ORIGIN record #10

do11 opened this issue Feb 15, 2017 · 1 comment

Comments

@do11
Copy link

do11 commented Feb 15, 2017

  1. $ORIGIN and $TTL records placed in wrong order - after SOA - which make named fail to parse them properly. SOA record should already have $ORIGIN applied. Thus, they should be placed before SOA.

  2. $ORIGIN is not robust against . at the end of domain names.

@do11
Copy link
Author

do11 commented Feb 15, 2017

Fix:

diff --git a/zonefile.rb b/zonefile.rb
index 6da7ca1..c691136 100644
--- a/zonefile.rb
+++ b/zonefile.rb
@@ -389,6 +390,8 @@ class Zonefile
 ;  Database file #{@filename || 'unknown'} for #{@origin || 'unknown'} zone.
 ;      Zone version: #{self.soa[:serial]}
 ;
+#{@origin ? "$ORIGIN #{@origin.chomp('.')}." : ''}
+#{@ttl ? "$TTL #{@ttl}" : ''}
 #{self.soa[:origin]}           #{self.soa[:ttl]} IN  SOA  #{self.soa[:primary]} #{self.soa[:email]} (
                                #{self.soa[:serial]}    ; serial number
                                #{self.soa[:refresh]}   ; refresh
@@ -397,8 +400,6 @@ class Zonefile
                                #{self.soa[:minimumTTL]}        ; minimum TTL
                                )

-#{@origin ? "$ORIGIN #{@origin}" : ''}
-#{@ttl ? "$TTL #{@ttl}" : ''}
 ENDH
    out << "\n; Zone NS Records\n" unless self.ns.empty?
    self.ns.each do |ns|

dmke added a commit to digineo/zonefile that referenced this issue Jul 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant