3130. [func] Support alternate methods for managing a dynamic

zone's serial number.  Two methods are currently
                        defined using serial-update-method, "increment"
                        (default) and "unixtime".  [RT #23849]
This commit is contained in:
Mark Andrews
2011-07-01 02:25:48 +00:00
parent 923fba44d3
commit a69070d8fa
20 changed files with 303 additions and 50 deletions

View File

@@ -15,14 +15,14 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: clean.sh,v 1.24 2011/05/23 22:25:32 each Exp $
# $Id: clean.sh,v 1.25 2011/07/01 02:25:47 marka Exp $
#
# Clean up after zone transfer tests.
#
rm -f dig.out.ns1 dig.out.ns2 dig.out.ns1.after ns1/*.jnl ns2/*.jnl \
ns1/example.db ns1/update.db ns1/other.db ns1/ddns.key
rm -f ns1/*.jnl ns2/*.jnl
rm -f ns1/example.db ns1/unixtime.db ns1/update.db ns1/other.db ns1/ddns.key
rm -f nsupdate.out
rm -f random.data
rm -f ns2/example.bk
@@ -33,6 +33,6 @@ rm -f ns3/example.db.jnl ns3/example.db
rm -f ns3/nsec3param.test.db.signed.jnl ns3/nsec3param.test.db ns3/nsec3param.test.db.signed ns3/dsset-nsec3param.test.
rm -f ns3/dnskey.test.db.signed.jnl ns3/dnskey.test.db ns3/dnskey.test.db.signed ns3/dsset-dnskey.test.
rm -f ns3/K*
rm -f dig.out.ns3.*
rm -f dig.out.*
rm -f jp.out.ns3.*
rm -f Kxxx.*

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: named.conf,v 1.21 2011/05/06 23:47:29 tbox Exp $ */
/* $Id: named.conf,v 1.22 2011/07/01 02:25:47 marka Exp $ */
controls { /* empty */ };
@@ -80,3 +80,13 @@ zone "update.nil" {
allow-transfer { any; };
also-notify { othermasters; };
};
zone "unixtime.nil" {
type master;
file "unixtime.db";
check-integrity no;
allow-update { any; };
allow-transfer { any; };
serial-update-method unixtime;
};

View File

@@ -15,7 +15,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: setup.sh,v 1.18 2011/05/06 23:47:29 tbox Exp $
# $Id: setup.sh,v 1.19 2011/07/01 02:25:47 marka Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
@@ -30,6 +30,7 @@ rm -f ns3/example.db.jnl
cp -f ns1/example1.db ns1/example.db
sed 's/example.nil/other.nil/g' ns1/example1.db > ns1/other.db
sed 's/example.nil/unixtime.nil/g' ns1/example1.db > ns1/unixtime.db
cp -f ns3/example.db.in ns3/example.db
# update_test.pl has its own zone file because it

View File

@@ -15,7 +15,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.40 2011/06/21 22:15:05 each Exp $
# $Id: tests.sh,v 1.41 2011/07/01 02:25:47 marka Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
@@ -217,6 +217,27 @@ then
status=1
fi
n=`expr $n + 1`
echo "I:check that unixtime serial number is correctly generated ($n)"
oldserial=`$DIG +short unixtime.nil. soa @10.53.0.1 -p 5300 | awk '{print $3}'` || ret=1
$NSUPDATE <<END > /dev/null 2>&1 || ret=1
server 10.53.0.1 5300
ttl 600
update add new.unixtime.nil in a 1.2.3.4
send
END
now=`$PERL -e 'print time()."\n";'`
sleep 1
serial=`$DIG +short unixtime.nil. soa @10.53.0.1 -p 5300 | awk '{print $3}'` || ret=1
[ "$oldserial" -ne "$serial" ] || ret=1
# allow up to 2 seconds difference between the serial
# number and the unix epoch date but no more
$PERL -e 'exit 1 if abs($ARGV[1] - $ARGV[0]) > 2;' $now $serial || ret=1
if [ $ret -ne 0 ]; then
echo "I:failed"
status=1
fi
if $PERL -e 'use Net::DNS;' 2>/dev/null
then
echo "I:running update.pl test"