From e2f640d3ece2cf2e632f8163fa31eb1e7bbabf35 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 27 Jan 2012 02:13:06 +0000 Subject: [PATCH] back port dns_test_loaddb from 9.9.0 --- lib/dns/tests/dnstest.c | 27 ++++++++++++++++++++++++++- lib/dns/tests/dnstest.h | 6 +++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/lib/dns/tests/dnstest.c b/lib/dns/tests/dnstest.c index 6c955a552e..37d3600a5a 100644 --- a/lib/dns/tests/dnstest.c +++ b/lib/dns/tests/dnstest.c @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnstest.c,v 1.2.2.5 2011/11/04 07:36:58 marka Exp $ */ +/* $Id: dnstest.c,v 1.2.2.6 2012/01/27 02:13:06 marka Exp $ */ /*! \file */ @@ -35,6 +35,7 @@ #include #include +#include #include #include #include @@ -297,3 +298,27 @@ dns_test_nap(isc_uint32_t usec) { sleep((usec / 1000000) + 1); #endif } + +isc_result_t +dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin, + const char *testfile) +{ + isc_result_t result; + dns_fixedname_t fixed; + dns_name_t *name; + + dns_fixedname_init(&fixed); + name = dns_fixedname_name(&fixed); + + result = dns_name_fromstring(name, origin, 0, NULL); + if (result != ISC_R_SUCCESS) + return(result); + + result = dns_db_create(mctx, "rbt", name, dbtype, dns_rdataclass_in, + 0, NULL, db); + if (result != ISC_R_SUCCESS) + return (result); + + result = dns_db_load(*db, testfile); + return (result); +} diff --git a/lib/dns/tests/dnstest.h b/lib/dns/tests/dnstest.h index 9ad026c205..f457b1cc60 100644 --- a/lib/dns/tests/dnstest.h +++ b/lib/dns/tests/dnstest.h @@ -14,7 +14,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dnstest.h,v 1.2.2.4 2011/11/04 07:36:59 marka Exp $ */ +/* $Id: dnstest.h,v 1.2.2.5 2012/01/27 02:13:06 marka Exp $ */ /*! \file */ @@ -75,3 +75,7 @@ dns_test_closezonemgr(void); void dns_test_nap(isc_uint32_t usec); + +isc_result_t +dns_test_loaddb(dns_db_t **db, dns_dbtype_t dbtype, const char *origin, + const char *testfile);