From d9ebd3015c24b4e5832c0941b3af1c12f726d8fc Mon Sep 17 00:00:00 2001 From: Evan Hunt Date: Mon, 23 May 2011 22:24:12 +0000 Subject: [PATCH] 3118. [bug] nsupdate could dump core on shutdown when using SIG(0) keys. [RT #24604] --- CHANGES | 3 +++ bin/nsupdate/nsupdate.c | 9 +++++++-- bin/tests/system/nsupdate/clean.sh | 3 ++- bin/tests/system/nsupdate/tests.sh | 11 ++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 41eb58289b..127c4bfa0f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +3118. [bug] nsupdate could dump core on shutdown when using + SIG(0) keys. [RT #24604] + 3113. [doc] Document the relationship between serial-query-rate and NOTIFY messages. diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index 616e099c7b..2a1380d571 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: nsupdate.c,v 1.163.48.17 2011/03/12 04:57:24 tbox Exp $ */ +/* $Id: nsupdate.c,v 1.163.48.18 2011/05/23 22:24:12 each Exp $ */ /*! \file */ @@ -617,8 +617,10 @@ setup_keyfile(void) { keyfile, isc_result_totext(result)); return; } - } else + } else { dst_key_attach(dstkey, &sig0key); + dst_key_free(&dstkey); + } } static void @@ -2707,6 +2709,9 @@ cleanup(void) { } #endif + if (sig0key != NULL) + dst_key_free(&sig0key); + ddebug("Shutting down task manager"); isc_taskmgr_destroy(&taskmgr); diff --git a/bin/tests/system/nsupdate/clean.sh b/bin/tests/system/nsupdate/clean.sh index 10389fb83a..31c403e668 100644 --- a/bin/tests/system/nsupdate/clean.sh +++ b/bin/tests/system/nsupdate/clean.sh @@ -15,7 +15,7 @@ # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. -# $Id: clean.sh,v 1.12.250.2 2011/02/03 12:16:45 tbox Exp $ +# $Id: clean.sh,v 1.12.250.3 2011/05/23 22:24:12 each Exp $ # # Clean up after zone transfer tests. @@ -29,3 +29,4 @@ rm -f */named.memstats 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 Kxxx.* diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh index 4fe47e7885..496b214fef 100644 --- a/bin/tests/system/nsupdate/tests.sh +++ b/bin/tests/system/nsupdate/tests.sh @@ -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.25.332.2 2011/02/03 12:16:45 tbox Exp $ +# $Id: tests.sh,v 1.25.332.3 2011/05/23 22:24:12 each Exp $ SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh @@ -59,6 +59,15 @@ echo "I:comparing post-update copies to known good data" $PERL ../digcomp.pl knowngood.ns1.after dig.out.ns1 || status=1 $PERL ../digcomp.pl knowngood.ns1.after dig.out.ns2 || status=1 +ret=0 +echo "I:check SIG(0) key is accepted" +key=`$KEYGEN -r random.data -a NSEC3RSASHA1 -b 512 -k -n ENTITY xxx 2> /dev/null` +echo "" | $NSUPDATE -k ${key}.private > /dev/null 2>&1 || 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"