From bb67a404fb07ccb038851e785ad659b5eeb72b0c Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 4 Sep 2007 11:31:29 +0000 Subject: [PATCH] tests, cleanup tmp when testbound fails, fixup referral glue cleanup. git-svn-id: file:///svn/unbound/trunk@583 be551aaa-1e26-0410-a405-d3ace91eadb9 --- doc/Changelog | 3 + testcode/testbound.c | 13 ++- testdata/val_cname_loop1.rpl | 118 +++++++++++++++++++++++ testdata/val_cname_loop2.rpl | 127 ++++++++++++++++++++++++ testdata/val_cname_loop3.rpl | 140 +++++++++++++++++++++++++++ testdata/val_cnametodname.rpl | 177 ++++++++++++++++++++++++++++++++++ testdata/val_referglue.rpl | 159 ++++++++++++++++++++++++++++++ validator/validator.c | 7 +- 8 files changed, 740 insertions(+), 4 deletions(-) create mode 100644 testdata/val_cname_loop1.rpl create mode 100644 testdata/val_cname_loop2.rpl create mode 100644 testdata/val_cname_loop3.rpl create mode 100644 testdata/val_cnametodname.rpl create mode 100644 testdata/val_referglue.rpl diff --git a/doc/Changelog b/doc/Changelog index ceb4871e8..3ca8db008 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,6 +1,9 @@ 4 September 2007: Wouter - fixup of Leakage warning when serviced queries processed multiple callbacks for the same query from the same server. + - testbound removes config file from /tmp on failed exit. + - fixup for referral cleanup of the additional section. + - tests for cname, referral validation. 3 September 2007: Wouter - Fixed error in iterator that would cause assertion failure in diff --git a/testcode/testbound.c b/testcode/testbound.c index f02fdd61e..0578c57d4 100644 --- a/testcode/testbound.c +++ b/testcode/testbound.c @@ -53,6 +53,8 @@ /** maximum line length for lines in the replay file. */ #define MAX_LINE_LEN 1024 +/** the config file (removed at exit) */ +static char cfgfile[MAX_LINE_LEN]; /** give commandline usage for testbound. */ static void @@ -179,6 +181,12 @@ setup_playback(const char* filename, char* configfile, log_info("Scenario: %s", scen->title); return scen; } + +/** remove config file at exit */ +void remove_configfile(void) +{ + unlink(cfgfile); +} /** * Main fake event test program. Setup, teardown and report errors. @@ -195,11 +203,11 @@ main(int argc, char* argv[]) int init_optind = optind; char* init_optarg = optarg; struct replay_scenario* scen = NULL; - char cfgfile[MAX_LINE_LEN]; log_init(NULL); log_info("Start of %s testbound program.", PACKAGE_STRING); /* determine commandline options for the daemon */ + cfgfile[0] = 0; pass_argc = 1; pass_argv[0] = "unbound"; add_opts("-d", &pass_argc, pass_argv); @@ -224,6 +232,8 @@ main(int argc, char* argv[]) testbound_usage(); return 1; } + if(atexit(&remove_configfile) != 0) + fatal_exit("atexit() failed: %s", strerror(errno)); /* setup test environment */ scen = setup_playback(playback_file, cfgfile, &pass_argc, pass_argv); @@ -240,7 +250,6 @@ main(int argc, char* argv[]) /* run the normal daemon */ res = daemon_main(pass_argc, pass_argv); - unlink(cfgfile); fake_event_cleanup(); for(c=1; crrset_skip == 0) vq->orig_msg->rep->security = vq->chase_reply->security; - else { - /* use the lowest security status as end result. */ + else if(vq->rrset_skip < vq->orig_msg->rep->an_numrrsets + + vq->orig_msg->rep->ns_numrrsets) { + /* ignore sec status of additional section if a referral + * type message skips there and + * use the lowest security status as end result. */ if(vq->chase_reply->security < vq->orig_msg->rep->security) vq->orig_msg->rep->security = vq->chase_reply->security; -- 2.47.2