From: Stefan Bühler Date: Sat, 13 Jul 2013 11:37:27 +0000 (+0200) Subject: SOA-EDIT: fix INCEPTION-INCREMENT handling X-Git-Tag: auth-3.3.1~48 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=82def3928596da4f03d8bdd1406cc943c5c0f5c9;p=pdns SOA-EDIT: fix INCEPTION-INCREMENT handling --- diff --git a/pdns/serialtweaker.cc b/pdns/serialtweaker.cc index 32ec01cc2..f824f87cf 100644 --- a/pdns/serialtweaker.cc +++ b/pdns/serialtweaker.cc @@ -62,10 +62,11 @@ uint32_t calculateEditSoa(SOAData sd, const string& kind) { uint32_t inception_serial = localtime_format_YYYYMMDDSS(inception, 1); uint32_t dont_increment_after = localtime_format_YYYYMMDDSS(inception + 2*86400, 99); - if(sd.serial <= dont_increment_after) - return (sd.serial + 2); /* "day00" and "day01" are reserved for inception increasing, so increment sd.serial by two */ - else if(sd.serial < inception_serial) - return inception_serial; + if(sd.serial < inception_serial - 1) { /* less than 00 */ + return inception_serial; /* return 01 (skipping 00 as possible value) */ + } else if(sd.serial <= dont_increment_after) { /* >= 00 but <= 99 */ + return (sd.serial + 2); /* "00" and "01" are reserved for inception increasing, so increment sd.serial by two */ + } } else if(pdns_iequals(kind,"INCEPTION-WEEK")) { time_t inception = getStartOfWeek();