#include <config.h>
#include <atf-c.h>
#include <stdio.h>
#include <unistd.h>
#include <isc/print.h>
#include <isc/xml.h>
#include <dns/cache.h>
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/master.h>
#include <dns/masterdump.h>
#include <dns/name.h>
#include <dns/rdata.h>
#include <dns/rdatalist.h>
#include <dns/rdataset.h>
#include "dnstest.h"
Go to the source code of this file.
Defines | |
#define | BUFLEN 255 |
#define | BIGBUFLEN (70 * 1024) |
#define | TEST_ORIGIN "test" |
Functions | |
static isc_result_t | add_callback (void *arg, dns_name_t *owner, dns_rdataset_t *dataset) |
static void | rawdata_callback (dns_zone_t *zone, dns_masterrawheader_t *header) |
static isc_result_t | setup_master (void(*warn)(struct dns_rdatacallbacks *, const char *,...), void(*error)(struct dns_rdatacallbacks *, const char *,...)) |
static isc_result_t | test_master (const char *testfile, dns_masterformat_t format, void(*warn)(struct dns_rdatacallbacks *, const char *,...), void(*error)(struct dns_rdatacallbacks *, const char *,...)) |
static void | include_callback (const char *filename, void *arg) |
ATF_TC (load) | |
ATF_TC_HEAD (load, tc) | |
ATF_TC_BODY (load, tc) | |
ATF_TC (unexpected) | |
ATF_TC_HEAD (unexpected, tc) | |
ATF_TC_BODY (unexpected, tc) | |
ATF_TC (noowner) | |
ATF_TC_HEAD (noowner, tc) | |
ATF_TC_BODY (noowner, tc) | |
ATF_TC (nottl) | |
ATF_TC_HEAD (nottl, tc) | |
ATF_TC_BODY (nottl, tc) | |
ATF_TC (badclass) | |
ATF_TC_HEAD (badclass, tc) | |
ATF_TC_BODY (badclass, tc) | |
ATF_TC (toobig) | |
ATF_TC_HEAD (toobig, tc) | |
ATF_TC_BODY (toobig, tc) | |
ATF_TC (maxrdata) | |
ATF_TC_HEAD (maxrdata, tc) | |
ATF_TC_BODY (maxrdata, tc) | |
ATF_TC (dnskey) | |
ATF_TC_HEAD (dnskey, tc) | |
ATF_TC_BODY (dnskey, tc) | |
ATF_TC (dnsnokey) | |
ATF_TC_HEAD (dnsnokey, tc) | |
ATF_TC_BODY (dnsnokey, tc) | |
ATF_TC (include) | |
ATF_TC_HEAD (include, tc) | |
ATF_TC_BODY (include, tc) | |
ATF_TC (master_includelist) | |
ATF_TC_HEAD (master_includelist, tc) | |
ATF_TC_BODY (master_includelist, tc) | |
ATF_TC (includefail) | |
ATF_TC_HEAD (includefail, tc) | |
ATF_TC_BODY (includefail, tc) | |
ATF_TC (blanklines) | |
ATF_TC_HEAD (blanklines, tc) | |
ATF_TC_BODY (blanklines, tc) | |
ATF_TC (leadingzero) | |
ATF_TC_HEAD (leadingzero, tc) | |
ATF_TC_BODY (leadingzero, tc) | |
ATF_TC (totext) | |
ATF_TC_HEAD (totext, tc) | |
ATF_TC_BODY (totext, tc) | |
ATF_TC (loadraw) | |
ATF_TC_HEAD (loadraw, tc) | |
ATF_TC_BODY (loadraw, tc) | |
ATF_TC (dumpraw) | |
ATF_TC_HEAD (dumpraw, tc) | |
ATF_TC_BODY (dumpraw, tc) | |
static void | warn_expect (struct dns_rdatacallbacks *mycallbacks, const char *fmt,...) |
ATF_TC (neworigin) | |
ATF_TC_HEAD (neworigin, tc) | |
ATF_TC_BODY (neworigin, tc) | |
ATF_TP_ADD_TCS (tp) | |
Variables | |
static dns_masterrawheader_t | header |
static isc_boolean_t | headerset |
dns_name_t | dns_origin |
char | origin [sizeof(TEST_ORIGIN)] |
unsigned char | name_buf [BUFLEN] |
dns_rdatacallbacks_t | callbacks |
char * | include_file = NULL |
static const char * | warn_expect_value |
static isc_boolean_t | warn_expect_result |
Definition in file master_test.c.
#define BUFLEN 255 |
Definition at line 47 of file master_test.c.
#define BIGBUFLEN (70 * 1024) |
Definition at line 48 of file master_test.c.
#define TEST_ORIGIN "test" |
Definition at line 49 of file master_test.c.
static isc_result_t add_callback | ( | void * | arg, | |
dns_name_t * | owner, | |||
dns_rdataset_t * | dataset | |||
) | [static] |
Definition at line 67 of file master_test.c.
References BIGBUFLEN, dns_rdataset_totext(), isc_buffer_init, ISC_FALSE, and UNUSED.
Referenced by setup_master().
static void rawdata_callback | ( | dns_zone_t * | zone, | |
dns_masterrawheader_t * | header | |||
) | [static] |
Definition at line 81 of file master_test.c.
References headerset, ISC_TRUE, and UNUSED.
Referenced by setup_master().
static isc_result_t setup_master | ( | void(*)(struct dns_rdatacallbacks *, const char *,...) | warn, | |
void(*)(struct dns_rdatacallbacks *, const char *,...) | error | |||
) | [static] |
Definition at line 88 of file master_test.c.
References dns_rdatacallbacks::add, add_callback(), BUFLEN, dns_master_initrawheader(), dns_name_fromtext(), dns_name_init(), dns_rdatacallbacks_init_stdio(), dns_rootname, dns_rdatacallbacks::error, error(), headerset, isc_buffer_add, isc_buffer_init, isc_buffer_setactive, ISC_FALSE, ISC_R_SUCCESS, name_buf, origin, dns_rdatacallbacks::rawdata, rawdata_callback(), TEST_ORIGIN, dns_rdatacallbacks::warn, and dns_rdatacallbacks::zone.
Referenced by ATF_TC_BODY(), and test_master().
static isc_result_t test_master | ( | const char * | testfile, | |
dns_masterformat_t | format, | |||
void(*)(struct dns_rdatacallbacks *, const char *,...) | warn, | |||
void(*)(struct dns_rdatacallbacks *, const char *,...) | error | |||
) | [static] |
Definition at line 123 of file master_test.c.
References dns_master_loadfile2(), error(), ISC_R_SUCCESS, ISC_TRUE, mctx, and setup_master().
Referenced by ATF_TC_BODY().
static void include_callback | ( | const char * | filename, | |
void * | arg | |||
) | [static] |
Definition at line 140 of file master_test.c.
References isc_mem_strdup, and mctx.
Referenced by ATF_TC_BODY().
ATF_TC | ( | load | ) |
ATF_TC_HEAD | ( | load | , | |
tc | ||||
) |
Definition at line 151 of file master_test.c.
ATF_TC_BODY | ( | load | , | |
tc | ||||
) |
Definition at line 155 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | unexpected | ) |
ATF_TC_HEAD | ( | unexpected | , | |
tc | ||||
) |
Definition at line 173 of file master_test.c.
ATF_TC_BODY | ( | unexpected | , | |
tc | ||||
) |
Definition at line 178 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, ISC_R_UNEXPECTEDEND, test_master(), and UNUSED.
ATF_TC | ( | noowner | ) |
ATF_TC_HEAD | ( | noowner | , | |
tc | ||||
) |
Definition at line 196 of file master_test.c.
ATF_TC_BODY | ( | noowner | , | |
tc | ||||
) |
Definition at line 201 of file master_test.c.
References dns_masterformat_text, DNS_R_NOOWNER, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | nottl | ) |
ATF_TC_HEAD | ( | nottl | , | |
tc | ||||
) |
Definition at line 219 of file master_test.c.
ATF_TC_BODY | ( | nottl | , | |
tc | ||||
) |
Definition at line 225 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | badclass | ) |
ATF_TC_HEAD | ( | badclass | , | |
tc | ||||
) |
Definition at line 243 of file master_test.c.
ATF_TC_BODY | ( | badclass | , | |
tc | ||||
) |
Definition at line 248 of file master_test.c.
References dns_masterformat_text, DNS_R_BADCLASS, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | toobig | ) |
ATF_TC_HEAD | ( | toobig | , | |
tc | ||||
) |
Definition at line 265 of file master_test.c.
ATF_TC_BODY | ( | toobig | , | |
tc | ||||
) |
Definition at line 269 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_NOSPACE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | maxrdata | ) |
ATF_TC_HEAD | ( | maxrdata | , | |
tc | ||||
) |
Definition at line 286 of file master_test.c.
ATF_TC_BODY | ( | maxrdata | , | |
tc | ||||
) |
Definition at line 291 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | dnskey | ) |
ATF_TC_HEAD | ( | dnskey | , | |
tc | ||||
) |
Definition at line 308 of file master_test.c.
ATF_TC_BODY | ( | dnskey | , | |
tc | ||||
) |
Definition at line 312 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | dnsnokey | ) |
ATF_TC_HEAD | ( | dnsnokey | , | |
tc | ||||
) |
Definition at line 330 of file master_test.c.
ATF_TC_BODY | ( | dnsnokey | , | |
tc | ||||
) |
Definition at line 334 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | include | ) |
ATF_TC_HEAD | ( | include | , | |
tc | ||||
) |
Definition at line 351 of file master_test.c.
ATF_TC_BODY | ( | include | , | |
tc | ||||
) |
Definition at line 355 of file master_test.c.
References dns_masterformat_text, DNS_R_SEENINCLUDE, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | master_includelist | ) |
ATF_TC_HEAD | ( | master_includelist | , | |
tc | ||||
) |
Definition at line 372 of file master_test.c.
ATF_TC_BODY | ( | master_includelist | , | |
tc | ||||
) |
Definition at line 376 of file master_test.c.
References dns_master_loadfile4(), dns_masterformat_text, DNS_R_SEENINCLUDE, dns_test_begin(), dns_test_end(), include_callback(), ISC_FALSE, isc_mem_free, ISC_R_SUCCESS, ISC_TRUE, mctx, setup_master(), and UNUSED.
ATF_TC | ( | includefail | ) |
ATF_TC_HEAD | ( | includefail | , | |
tc | ||||
) |
Definition at line 405 of file master_test.c.
ATF_TC_BODY | ( | includefail | , | |
tc | ||||
) |
Definition at line 409 of file master_test.c.
References dns_masterformat_text, DNS_R_BADCLASS, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | blanklines | ) |
ATF_TC_HEAD | ( | blanklines | , | |
tc | ||||
) |
Definition at line 427 of file master_test.c.
ATF_TC_BODY | ( | blanklines | , | |
tc | ||||
) |
Definition at line 431 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | leadingzero | ) |
ATF_TC_HEAD | ( | leadingzero | , | |
tc | ||||
) |
Definition at line 448 of file master_test.c.
ATF_TC_BODY | ( | leadingzero | , | |
tc | ||||
) |
Definition at line 452 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), and UNUSED.
ATF_TC | ( | totext | ) |
ATF_TC_HEAD | ( | totext | , | |
tc | ||||
) |
Definition at line 468 of file master_test.c.
ATF_TC_BODY | ( | totext | , | |
tc | ||||
) |
Definition at line 471 of file master_test.c.
References BIGBUFLEN, dns_rdatalist::covers, dns_master_rdatasettotext(), dns_master_style_debug, dns_rdatalist_init(), dns_rdatalist_tordataset(), dns_rdataset_init(), dns_rootname, dns_test_begin(), dns_test_end(), isc_buffer_init, isc_buffer_usedlength, ISC_FALSE, ISC_R_SUCCESS, dns_rdatalist::rdclass, dns_rdatalist::type, and UNUSED.
ATF_TC | ( | loadraw | ) |
ATF_TC_HEAD | ( | loadraw | , | |
tc | ||||
) |
Definition at line 511 of file master_test.c.
ATF_TC_BODY | ( | loadraw | , | |
tc | ||||
) |
Definition at line 515 of file master_test.c.
References dns_masterformat_raw, DNS_MASTERRAW_SOURCESERIALSET, dns_test_begin(), dns_test_end(), dns_masterrawheader::flags, headerset, ISC_FALSE, ISC_R_SUCCESS, isc_result_totext(), dns_masterrawheader::sourceserial, test_master(), and UNUSED.
ATF_TC | ( | dumpraw | ) |
ATF_TC_HEAD | ( | dumpraw | , | |
tc | ||||
) |
Definition at line 550 of file master_test.c.
ATF_TC_BODY | ( | dumpraw | , | |
tc | ||||
) |
Definition at line 554 of file master_test.c.
References BUFLEN, dns_db_closeversion(), dns_db_create(), dns_db_currentversion(), dns_db_detach(), dns_db_load(), dns_dbtype_zone, dns_master_dump2(), dns_master_dump3(), dns_master_initrawheader(), dns_master_style_default, dns_masterformat_raw, DNS_MASTERRAW_SOURCESERIALSET, dns_name_fromtext(), dns_name_init(), dns_rootname, dns_test_begin(), dns_test_end(), dns_masterrawheader::flags, headerset, isc_buffer_add, isc_buffer_init, isc_buffer_setactive, ISC_FALSE, ISC_R_SUCCESS, isc_result_totext(), mctx, namebuf, dns_masterrawheader::sourceserial, test_master(), TEST_ORIGIN, UNUSED, and version.
static void warn_expect | ( | struct dns_rdatacallbacks * | mycallbacks, | |
const char * | fmt, | |||
... | ||||
) | [static] |
Definition at line 625 of file master_test.c.
References ISC_TRUE, and UNUSED.
Referenced by ATF_TC_BODY().
ATF_TC | ( | neworigin | ) |
ATF_TC_HEAD | ( | neworigin | , | |
tc | ||||
) |
Definition at line 640 of file master_test.c.
ATF_TC_BODY | ( | neworigin | , | |
tc | ||||
) |
Definition at line 645 of file master_test.c.
References dns_masterformat_text, dns_test_begin(), dns_test_end(), ISC_FALSE, ISC_R_SUCCESS, test_master(), UNUSED, and warn_expect().
ATF_TP_ADD_TCS | ( | tp | ) |
dns_masterrawheader_t header [static] |
Definition at line 51 of file master_test.c.
Referenced by activeempty(), activeemtpynode(), add32(), addrdataset(), cache_find(), cache_findrdataset(), cache_findzonecut(), cache_zonecut_callback(), closeversion(), cname_and_other_data(), deserialize32(), destroynode(), dns_dnssec_signmessage(), dns_dnssec_verifymessage(), dns_rbt_deserialize_tree(), dns_tsig_sign(), dns_tsig_verify(), expirenode(), find_closest_nsec(), find_coveringnsec(), find_deepest_zonecut(), find_wildcard(), getsigningtime(), index_add(), ISC_LIST(), journal_file_create(), load_header(), main(), overmem_purge(), rbt_datafixer(), rbt_datawriter(), rbtdb_write_header(), rdataset_clearprefetch(), rdataset_expire(), rdataset_getadditional(), rdataset_getownercase(), rdataset_putadditional(), rdataset_setadditional(), rdataset_setownercase(), rdataset_settrust(), rdatasetiter_current(), rdatasetiter_first(), rdatasetiter_next(), resigned(), rollback_node(), setnsec3parameters(), setsigningtime(), subtractrdataset(), treefix(), tsig_verify_tcp(), valid_glue(), write_header(), zone_find(), zone_findrdataset(), and zone_zonecut_callback().
isc_boolean_t headerset [static] |
Definition at line 52 of file master_test.c.
Referenced by ATF_TC_BODY(), rawdata_callback(), and setup_master().
Definition at line 54 of file master_test.c.
char origin[sizeof(TEST_ORIGIN)] |
Definition at line 55 of file master_test.c.
Referenced by activeempty(), activeemtpynode(), cleanup_ring(), closeversion(), configure_zone(), dbiterator_current(), dbiterator_first(), dbiterator_last(), dbiterator_next(), dbiterator_origin(), dbiterator_prev(), dbiterator_seek(), del_sigs(), delete_keynames(), dlzconfigure_callback(), dns_dlz_writeablezone(), dns_nsec3_addnsec3(), dns_nsec3_delnsec3(), dns_nsec3param_deletechains(), dns_rbtdb_create(), dns_rpz_ready(), dns_sdb_putrr(), dns_sdlz_putnamedrr(), dns_sdlz_putrr(), dns_test_makezone(), dns_tsigkeyring_dumpanddetach(), dumptostreaminc(), find_closest_nsec(), find_coveringnsec(), fromtext_afsdb(), fromtext_any_tsig(), fromtext_caa(), fromtext_cdnskey(), fromtext_cds(), fromtext_cert(), fromtext_ch_a(), fromtext_cname(), fromtext_dlv(), fromtext_dname(), fromtext_dnskey(), fromtext_ds(), fromtext_eui48(), fromtext_eui64(), fromtext_gpos(), fromtext_hinfo(), fromtext_hip(), fromtext_hs_a(), fromtext_in_a(), fromtext_in_a6(), fromtext_in_aaaa(), fromtext_in_apl(), fromtext_in_dhcid(), fromtext_in_kx(), fromtext_in_nsap(), fromtext_in_nsap_ptr(), fromtext_in_px(), fromtext_in_srv(), fromtext_in_wks(), fromtext_ipseckey(), fromtext_isdn(), fromtext_key(), fromtext_keydata(), fromtext_l32(), fromtext_l64(), fromtext_loc(), fromtext_lp(), fromtext_mb(), fromtext_md(), fromtext_mf(), fromtext_mg(), fromtext_minfo(), fromtext_mr(), fromtext_mx(), fromtext_naptr(), fromtext_nid(), fromtext_ns(), fromtext_nsec(), fromtext_nsec3(), fromtext_nsec3param(), fromtext_null(), fromtext_nxt(), fromtext_openpgpkey(), fromtext_opt(), fromtext_ptr(), fromtext_rp(), fromtext_rrsig(), fromtext_rt(), fromtext_sig(), fromtext_soa(), fromtext_spf(), fromtext_sshfp(), fromtext_tkey(), fromtext_tlsa(), fromtext_txt(), fromtext_unspec(), fromtext_uri(), fromtext_x25(), getnode(), ISC_LIST(), list_keynames(), load_zone(), main(), newversion(), ns_server_signing(), setup_master(), sync_keyzone(), updatesignwithkey(), and zone_notify().
unsigned char name_buf[BUFLEN] |
Definition at line 57 of file master_test.c.
Referenced by db_load_from_stream(), dns_db_load3(), dns_rootns_create(), fromtext_afsdb(), fromtext_any_tsig(), fromtext_caa(), fromtext_cdnskey(), fromtext_cds(), fromtext_cert(), fromtext_ch_a(), fromtext_cname(), fromtext_dlv(), fromtext_dname(), fromtext_dnskey(), fromtext_ds(), fromtext_eui48(), fromtext_eui64(), fromtext_gpos(), fromtext_hinfo(), fromtext_hip(), fromtext_hs_a(), fromtext_in_a(), fromtext_in_a6(), fromtext_in_aaaa(), fromtext_in_apl(), fromtext_in_dhcid(), fromtext_in_kx(), fromtext_in_nsap(), fromtext_in_nsap_ptr(), fromtext_in_px(), fromtext_in_srv(), fromtext_in_wks(), fromtext_ipseckey(), fromtext_isdn(), fromtext_key(), fromtext_keydata(), fromtext_l32(), fromtext_l64(), fromtext_loc(), fromtext_lp(), fromtext_mb(), fromtext_md(), fromtext_mf(), fromtext_mg(), fromtext_minfo(), fromtext_mr(), fromtext_mx(), fromtext_naptr(), fromtext_nid(), fromtext_ns(), fromtext_nsec(), fromtext_nsec3(), fromtext_nsec3param(), fromtext_null(), fromtext_nxt(), fromtext_openpgpkey(), fromtext_opt(), fromtext_ptr(), fromtext_rp(), fromtext_rrsig(), fromtext_rt(), fromtext_sig(), fromtext_soa(), fromtext_spf(), fromtext_sshfp(), fromtext_tkey(), fromtext_tlsa(), fromtext_txt(), fromtext_unspec(), fromtext_uri(), fromtext_x25(), generate(), ISC_LIST(), load_header(), load_map(), load_raw(), load_text(), parse_rdata(), and zone_startload().
char* include_file = NULL |
const char* warn_expect_value [static] |
Definition at line 621 of file master_test.c.
isc_boolean_t warn_expect_result [static] |
Definition at line 622 of file master_test.c.