#57 ✓resolved
jb

Limit of 10 changes per day per domain

Reported by jb | February 9th, 2009 @ 09:45 PM

The serial number of the domain contains an 8 digit day (YYYYMMDD) and a 2 digit suffix. The suffix is supposed to increase by 1 on each update. Unfortunately, only the last digit is considered when incrementing, so when the suffix is '10', it is considered '0', and the next update has a suffix of '01'

To reproduce, simply update a domain 11 times, watching the serial number roll over from '10' to '01'.

To fix, in app/models/soa.rb: on line 69, replace

  increment = self.serial.to_s[9,2].succ

with:

  increment = self.serial.to_s[8,2].succ

Alternative, and better logic (and simpler) would be (in pseudocode, since I'm not too ruby-savvy):

date_segment = Time.now.strftime( "%Y%m%d00" ).to_i

self.serial = if date_segment > self.serial

date_segment

else

self.serial + 1

end

This means that you could do up to 100 changes per day (starting at 00, not 01); after that, it would roll over to the next day, which is better than rolling back. Unless there are other places that assume the serial number is the date.

Please read my code carefully, because this is my first ever code in Ruby.

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

This issue tracker has been deprecated. Please use the Github issue tracker at https://github.com/kennethkalmer/powerdns-on-rails/issues

Thank you

People watching this ticket

Referenced by

Pages