From ea648e70a989cca190cd7403fe892fd2dcc290b4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 20:37:14 +0200 Subject: Adding upstream version 1:9.11.5.P4+dfsg. Signed-off-by: Daniel Baumann --- bin/tests/Makefile.in | 85 + bin/tests/bigtest/README | 18 + bin/tests/bigtest/buildzones.sh | 267 + bin/tests/bigtest/rndc.key | 5 + bin/tests/bigtest/tests.sh | 76 + bin/tests/bigtest/zones | 18 + bin/tests/cfg_test.c | 184 + bin/tests/fromhex.pl | 45 + bin/tests/headerdep_test.sh.in | 49 + bin/tests/makejournal.c | 167 + bin/tests/named.conf | 617 + bin/tests/optional/Kchild.example.+003+04017.key | 1 + .../optional/Kchild.example.+003+04017.private | 7 + bin/tests/optional/Makefile.in | 299 + bin/tests/optional/adb_test.c | 431 + bin/tests/optional/backtrace_test.c | 91 + bin/tests/optional/byaddr_test.c | 259 + bin/tests/optional/byname_test.c | 368 + bin/tests/optional/db_test.c | 936 + bin/tests/optional/dst_test.c | 293 + bin/tests/optional/entropy2_test.c | 168 + bin/tests/optional/entropy_test.c | 133 + bin/tests/optional/fsaccess_test.c | 70 + bin/tests/optional/gsstest.c | 563 + bin/tests/optional/gxba_test.c | 91 + bin/tests/optional/gxbn_test.c | 79 + bin/tests/optional/hash_test.c | 288 + bin/tests/optional/inter_test.c | 130 + bin/tests/optional/keyboard_test.c | 67 + bin/tests/optional/lex_test.c | 153 + bin/tests/optional/lfsr_test.c | 89 + bin/tests/optional/log_test.c | 345 + bin/tests/optional/lwres_test.c | 298 + bin/tests/optional/lwresconf_test.c | 91 + bin/tests/optional/master_test.c | 88 + bin/tests/optional/mempool_test.c | 120 + bin/tests/optional/name_test.c | 340 + bin/tests/optional/nsecify.c | 208 + bin/tests/optional/ratelimiter_test.c | 146 + bin/tests/optional/rbt_test.c | 445 + bin/tests/optional/rbt_test.out | 395 + bin/tests/optional/rbt_test.txt | 85 + bin/tests/optional/rwlock_test.c | 144 + bin/tests/optional/serial_test.c | 44 + bin/tests/optional/shutdown_test.c | 231 + bin/tests/optional/sig0_test.c | 295 + bin/tests/optional/sock_test.c | 400 + bin/tests/optional/sym_test.c | 121 + bin/tests/optional/task_test.c | 203 + bin/tests/optional/timer_test.c | 181 + bin/tests/optional/zone_test.c | 309 + bin/tests/pkcs11/Makefile.in | 44 + bin/tests/pkcs11/README | 15 + bin/tests/pkcs11/benchmarks/Makefile.in | 83 + bin/tests/pkcs11/benchmarks/create.c | 263 + bin/tests/pkcs11/benchmarks/find.c | 232 + bin/tests/pkcs11/benchmarks/genrsa.c | 298 + bin/tests/pkcs11/benchmarks/login.c | 252 + bin/tests/pkcs11/benchmarks/privrsa.c | 363 + bin/tests/pkcs11/benchmarks/pubrsa.c | 284 + bin/tests/pkcs11/benchmarks/random.c | 194 + bin/tests/pkcs11/benchmarks/session.c | 216 + bin/tests/pkcs11/benchmarks/sha1.c | 217 + bin/tests/pkcs11/benchmarks/sign.c | 371 + bin/tests/pkcs11/benchmarks/verify.c | 295 + bin/tests/pkcs11/pkcs11-hmacmd5.c | 327 + bin/tests/pkcs11/pkcs11-md5sum.c | 230 + bin/tests/startperf/README | 17 + bin/tests/startperf/clean.sh | 13 + bin/tests/startperf/makenames.pl | 28 + bin/tests/startperf/mkzonefile.pl | 45 + bin/tests/startperf/setup.sh | 80 + bin/tests/startperf/smallzone.db | 26 + bin/tests/system/Makefile.in | 140 + bin/tests/system/README | 773 + bin/tests/system/acl/clean.sh | 23 + bin/tests/system/acl/ns2/named1.conf.in | 59 + bin/tests/system/acl/ns2/named2.conf.in | 63 + bin/tests/system/acl/ns2/named3.conf.in | 72 + bin/tests/system/acl/ns2/named4.conf.in | 71 + bin/tests/system/acl/ns2/named5.conf.in | 60 + bin/tests/system/acl/ns2/named6.conf.in | 50 + bin/tests/system/acl/ns2/named7.conf.in | 60 + bin/tests/system/acl/ns3/example.db | 19 + bin/tests/system/acl/ns3/named.conf.in | 33 + bin/tests/system/acl/ns4/example.db | 19 + bin/tests/system/acl/ns4/existing.db | 19 + bin/tests/system/acl/ns4/named.conf.in | 38 + bin/tests/system/acl/setup.sh | 20 + bin/tests/system/acl/tests.sh | 236 + bin/tests/system/additional/clean.sh | 20 + bin/tests/system/additional/ns1/mx.db | 16 + bin/tests/system/additional/ns1/named.args | 2 + bin/tests/system/additional/ns1/named1.conf.in | 55 + bin/tests/system/additional/ns1/named2.conf.in | 55 + bin/tests/system/additional/ns1/named3.conf.in | 56 + bin/tests/system/additional/ns1/named4.conf.in | 65 + bin/tests/system/additional/ns1/naptr.db | 18 + bin/tests/system/additional/ns1/naptr2.db | 18 + bin/tests/system/additional/ns1/nid.db | 19 + bin/tests/system/additional/ns1/rt.db | 18 + bin/tests/system/additional/ns1/rt2.db | 18 + bin/tests/system/additional/ns1/srv.db | 16 + bin/tests/system/additional/ns3/named.conf.in | 28 + bin/tests/system/additional/ns3/root.hint | 11 + bin/tests/system/additional/setup.sh | 17 + bin/tests/system/additional/tests.sh | 330 + bin/tests/system/addzone/clean.sh | 29 + bin/tests/system/addzone/ns1/inlineslave.db | 24 + bin/tests/system/addzone/ns1/named.conf.in | 35 + bin/tests/system/addzone/ns2/added.db | 24 + bin/tests/system/addzone/ns2/default.nzf.in | 1 + bin/tests/system/addzone/ns2/hints.db | 12 + bin/tests/system/addzone/ns2/inline.db | 24 + bin/tests/system/addzone/ns2/named1.conf.in | 41 + bin/tests/system/addzone/ns2/named2.conf.in | 65 + bin/tests/system/addzone/ns2/normal.db | 24 + bin/tests/system/addzone/ns2/previous.db | 24 + bin/tests/system/addzone/ns2/redirect.db | 11 + bin/tests/system/addzone/ns3/e.db | 12 + bin/tests/system/addzone/ns3/named1.conf.in | 30 + bin/tests/system/addzone/ns3/named2.conf.in | 26 + bin/tests/system/addzone/setup.sh | 24 + bin/tests/system/addzone/tests.sh | 539 + bin/tests/system/allow-query/clean.sh | 21 + bin/tests/system/allow-query/ns1/named.conf.in | 23 + bin/tests/system/allow-query/ns1/root.db | 16 + bin/tests/system/allow-query/ns2/generic.db | 24 + bin/tests/system/allow-query/ns2/named01.conf.in | 32 + bin/tests/system/allow-query/ns2/named02.conf.in | 33 + bin/tests/system/allow-query/ns2/named03.conf.in | 33 + bin/tests/system/allow-query/ns2/named04.conf.in | 33 + bin/tests/system/allow-query/ns2/named05.conf.in | 33 + bin/tests/system/allow-query/ns2/named06.conf.in | 33 + bin/tests/system/allow-query/ns2/named07.conf.in | 35 + bin/tests/system/allow-query/ns2/named08.conf.in | 35 + bin/tests/system/allow-query/ns2/named09.conf.in | 35 + bin/tests/system/allow-query/ns2/named10.conf.in | 38 + bin/tests/system/allow-query/ns2/named11.conf.in | 44 + bin/tests/system/allow-query/ns2/named12.conf.in | 38 + bin/tests/system/allow-query/ns2/named21.conf.in | 35 + bin/tests/system/allow-query/ns2/named22.conf.in | 38 + bin/tests/system/allow-query/ns2/named23.conf.in | 37 + bin/tests/system/allow-query/ns2/named24.conf.in | 37 + bin/tests/system/allow-query/ns2/named25.conf.in | 37 + bin/tests/system/allow-query/ns2/named26.conf.in | 37 + bin/tests/system/allow-query/ns2/named27.conf.in | 40 + bin/tests/system/allow-query/ns2/named28.conf.in | 39 + bin/tests/system/allow-query/ns2/named29.conf.in | 39 + bin/tests/system/allow-query/ns2/named30.conf.in | 42 + bin/tests/system/allow-query/ns2/named31.conf.in | 49 + bin/tests/system/allow-query/ns2/named32.conf.in | 42 + bin/tests/system/allow-query/ns2/named33.conf.in | 39 + bin/tests/system/allow-query/ns2/named34.conf.in | 38 + bin/tests/system/allow-query/ns2/named40.conf.in | 107 + bin/tests/system/allow-query/ns2/named53.conf.in | 34 + bin/tests/system/allow-query/ns2/named54.conf.in | 34 + bin/tests/system/allow-query/ns2/named55.conf.in | 39 + bin/tests/system/allow-query/ns2/named56.conf.in | 38 + bin/tests/system/allow-query/ns2/named57.conf.in | 42 + bin/tests/system/allow-query/ns3/named.args | 2 + bin/tests/system/allow-query/ns3/named.conf.in | 24 + bin/tests/system/allow-query/setup.sh | 18 + bin/tests/system/allow-query/tests.sh | 617 + bin/tests/system/ans.pl | 519 + bin/tests/system/autosign/clean.sh | 64 + bin/tests/system/autosign/ns1/keygen.sh | 52 + bin/tests/system/autosign/ns1/named.conf.in | 46 + bin/tests/system/autosign/ns1/root.db.in | 24 + bin/tests/system/autosign/ns2/Xbar.+005+30676.key | 5 + .../system/autosign/ns2/Xbar.+005+30676.private | 13 + bin/tests/system/autosign/ns2/Xbar.+005+30804.key | 5 + .../system/autosign/ns2/Xbar.+005+30804.private | 13 + bin/tests/system/autosign/ns2/bar.db.in | 78 + .../system/autosign/ns2/child.nsec3.example.db | 18 + .../system/autosign/ns2/child.optout.example.db | 18 + bin/tests/system/autosign/ns2/dst.example.db.in | 19 + bin/tests/system/autosign/ns2/example.db.in | 84 + .../system/autosign/ns2/insecure.secure.example.db | 24 + bin/tests/system/autosign/ns2/keygen.sh | 52 + bin/tests/system/autosign/ns2/named.conf.in | 98 + .../autosign/ns2/private.secure.example.db.in | 25 + .../system/autosign/ns3/autonsec3.example.db.in | 35 + bin/tests/system/autosign/ns3/delay.example.db | 24 + bin/tests/system/autosign/ns3/delzsk.example.db.in | 23 + .../system/autosign/ns3/inacksk2.example.db.in | 24 + .../system/autosign/ns3/inacksk3.example.db.in | 24 + .../system/autosign/ns3/inaczsk.example.db.in | 24 + .../system/autosign/ns3/inaczsk2.example.db.in | 24 + .../system/autosign/ns3/inaczsk3.example.db.in | 24 + bin/tests/system/autosign/ns3/insecure.example.db | 24 + bin/tests/system/autosign/ns3/keygen.sh | 318 + bin/tests/system/autosign/ns3/named.conf.in | 284 + bin/tests/system/autosign/ns3/nozsk.example.db.in | 24 + bin/tests/system/autosign/ns3/nsec.example.db.in | 24 + .../autosign/ns3/nsec3-to-nsec.example.db.in | 24 + bin/tests/system/autosign/ns3/nsec3.example.db.in | 35 + .../system/autosign/ns3/nsec3.nsec3.example.db.in | 33 + .../system/autosign/ns3/nsec3.optout.example.db.in | 33 + .../system/autosign/ns3/oldsigs.example.db.in | 24 + bin/tests/system/autosign/ns3/optout.example.db.in | 36 + .../system/autosign/ns3/optout.nsec3.example.db.in | 33 + .../autosign/ns3/optout.optout.example.db.in | 33 + .../system/autosign/ns3/rsasha256.example.db.in | 26 + .../system/autosign/ns3/rsasha512.example.db.in | 26 + .../autosign/ns3/secure-to-insecure.example.db.in | 24 + .../autosign/ns3/secure-to-insecure2.example.db.in | 24 + bin/tests/system/autosign/ns3/secure.example.db.in | 33 + .../system/autosign/ns3/secure.nsec3.example.db.in | 33 + .../autosign/ns3/secure.optout.example.db.in | 33 + bin/tests/system/autosign/ns3/sync.example.db.in | 32 + bin/tests/system/autosign/ns3/ttl1.example.db.in | 24 + bin/tests/system/autosign/ns3/ttl2.example.db.in | 24 + bin/tests/system/autosign/ns3/ttl3.example.db.in | 24 + bin/tests/system/autosign/ns3/ttl4.example.db.in | 24 + bin/tests/system/autosign/ns4/named.conf.in | 34 + bin/tests/system/autosign/ns5/named.conf.in | 33 + bin/tests/system/autosign/prereq.sh | 15 + bin/tests/system/autosign/setup.sh | 26 + bin/tests/system/autosign/tests.sh | 1428 ++ bin/tests/system/builtin/clean.sh | 17 + bin/tests/system/builtin/ns1/named.conf.in | 28 + bin/tests/system/builtin/ns2/named.conf.in | 29 + bin/tests/system/builtin/ns3/named.conf.in | 31 + bin/tests/system/builtin/setup.sh | 18 + bin/tests/system/builtin/tests.sh | 242 + bin/tests/system/cacheclean/clean.sh | 23 + bin/tests/system/cacheclean/dig.batch | 924 + bin/tests/system/cacheclean/knowngood.dig.out | 953 + bin/tests/system/cacheclean/ns1/example.db | 2940 +++ bin/tests/system/cacheclean/ns1/expire-test.db | 19 + bin/tests/system/cacheclean/ns1/flushtest.db | 42 + bin/tests/system/cacheclean/ns1/named.conf.in | 38 + bin/tests/system/cacheclean/ns2/named.conf.in | 47 + bin/tests/system/cacheclean/setup.sh | 17 + bin/tests/system/cacheclean/tests.sh | 257 + bin/tests/system/case/clean.sh | 21 + bin/tests/system/case/dynamic.good | 6 + bin/tests/system/case/ns1/dynamic.db.in | 25 + bin/tests/system/case/ns1/example.db | 22 + bin/tests/system/case/ns1/named.conf.in | 37 + bin/tests/system/case/ns2/named.conf.in | 37 + bin/tests/system/case/postns1.good | 14 + bin/tests/system/case/postupdate.good | 6 + bin/tests/system/case/setup.sh | 16 + bin/tests/system/case/tests.sh | 138 + bin/tests/system/catz/clean.sh | 24 + bin/tests/system/catz/ns1/catalog.example.db.in | 12 + bin/tests/system/catz/ns1/named.conf.in | 65 + bin/tests/system/catz/ns2/named.conf.in | 74 + bin/tests/system/catz/ns3/dom5.example.db | 11 + bin/tests/system/catz/ns3/dom6.example.db | 11 + bin/tests/system/catz/ns3/named.conf.in | 55 + bin/tests/system/catz/setup.sh | 26 + bin/tests/system/catz/tests.sh | 1999 ++ bin/tests/system/chain/README | 15 + bin/tests/system/chain/ans3/ans.pl | 101 + bin/tests/system/chain/ans4/README.anspy | 17 + bin/tests/system/chain/ans4/ans.py | 347 + bin/tests/system/chain/clean.sh | 15 + bin/tests/system/chain/ns1/named.conf.in | 25 + bin/tests/system/chain/ns1/root.db | 45 + bin/tests/system/chain/ns2/example.db | 67 + bin/tests/system/chain/ns2/generic.db | 17 + bin/tests/system/chain/ns2/named.conf.in | 51 + bin/tests/system/chain/ns2/sign.sh | 20 + bin/tests/system/chain/ns2/sub.db | 24 + bin/tests/system/chain/ns5/named.conf.in | 39 + bin/tests/system/chain/ns5/sub.db | 24 + bin/tests/system/chain/ns7/named.conf.in | 43 + bin/tests/system/chain/ns7/root.hint | 12 + bin/tests/system/chain/prereq.sh | 50 + bin/tests/system/chain/setup.sh | 25 + bin/tests/system/chain/tests.sh | 269 + bin/tests/system/checkconf/altdb.conf | 17 + bin/tests/system/checkconf/altdlz.conf | 25 + bin/tests/system/checkconf/bad-also-notify.conf | 20 + bin/tests/system/checkconf/bad-catz-zone.conf | 16 + bin/tests/system/checkconf/bad-dnssec.conf | 29 + bin/tests/system/checkconf/bad-hint.conf | 16 + bin/tests/system/checkconf/bad-in-view-dup.conf | 19 + bin/tests/system/checkconf/bad-inline-slave.conf | 20 + .../system/checkconf/bad-keep-response-order.conf | 16 + bin/tests/system/checkconf/bad-lifetime.conf | 14 + .../system/checkconf/bad-lmdb-mapsize-bogus.conf | 14 + .../checkconf/bad-lmdb-mapsize-toolarge.conf | 14 + .../checkconf/bad-lmdb-mapsize-toosmall.conf | 14 + .../checkconf/bad-lmdb-mapsize-unlimited.conf | 14 + bin/tests/system/checkconf/bad-many.conf | 46 + .../system/checkconf/bad-master-request-ixfr.conf | 20 + bin/tests/system/checkconf/bad-maxttlmap.conf | 17 + bin/tests/system/checkconf/bad-noddns.conf | 17 + .../system/checkconf/bad-options-also-notify.conf | 19 + bin/tests/system/checkconf/bad-rate-limit-acl.conf | 18 + .../checkconf/bad-rate-limit-all-per-second.conf | 16 + .../bad-rate-limit-errors-per-second.conf | 16 + .../bad-rate-limit-ipv4-prefix-length.conf | 16 + .../bad-rate-limit-ipv6-prefix-length.conf | 16 + .../checkconf/bad-rate-limit-max-table-size.conf | 16 + .../bad-rate-limit-nodata-per-second.conf | 16 + .../bad-rate-limit-nxdomains-per-second.conf | 16 + .../system/checkconf/bad-rate-limit-qps-scale.conf | 16 + .../bad-rate-limit-referrals-per-second.conf | 16 + .../bad-rate-limit-responses-per-second.conf | 16 + .../system/checkconf/bad-rate-limit-slip.conf | 16 + .../system/checkconf/bad-rate-limit-window.conf | 16 + bin/tests/system/checkconf/bad-rpz-zone.conf | 16 + .../system/checkconf/bad-sharedwritable1.conf | 20 + .../system/checkconf/bad-sharedwritable2.conf | 21 + bin/tests/system/checkconf/bad-sharedzone1.conf | 29 + bin/tests/system/checkconf/bad-sharedzone2.conf | 31 + bin/tests/system/checkconf/bad-sharedzone3.conf | 23 + bin/tests/system/checkconf/bad-tsig.conf | 17 + bin/tests/system/checkconf/bad-update-policy1.conf | 18 + .../system/checkconf/bad-update-policy10.conf | 18 + .../system/checkconf/bad-update-policy11.conf | 18 + .../system/checkconf/bad-update-policy12.conf | 18 + .../system/checkconf/bad-update-policy13.conf | 18 + .../system/checkconf/bad-update-policy14.conf | 18 + .../system/checkconf/bad-update-policy15.conf | 18 + bin/tests/system/checkconf/bad-update-policy2.conf | 18 + bin/tests/system/checkconf/bad-update-policy3.conf | 18 + bin/tests/system/checkconf/bad-update-policy4.conf | 18 + bin/tests/system/checkconf/bad-update-policy5.conf | 18 + bin/tests/system/checkconf/bad-update-policy6.conf | 18 + bin/tests/system/checkconf/bad-update-policy7.conf | 18 + bin/tests/system/checkconf/bad-update-policy8.conf | 18 + bin/tests/system/checkconf/bad-update-policy9.conf | 18 + .../system/checkconf/bad-view-also-notify.conf | 18 + bin/tests/system/checkconf/check-dlv-ksk-key.conf | 20 + .../system/checkconf/check-dup-records-fail.conf | 21 + bin/tests/system/checkconf/check-dup-records.db | 31 + .../system/checkconf/check-mx-cname-fail.conf | 20 + bin/tests/system/checkconf/check-mx-cname.db | 24 + bin/tests/system/checkconf/check-mx-fail.conf | 20 + bin/tests/system/checkconf/check-mx.db | 22 + bin/tests/system/checkconf/check-names-fail.conf | 20 + bin/tests/system/checkconf/check-names.db | 26 + .../system/checkconf/check-root-ksk-2010.conf | 24 + .../system/checkconf/check-root-ksk-2017.conf | 27 + .../system/checkconf/check-root-ksk-both.conf | 39 + .../system/checkconf/check-srv-cname-fail.conf | 20 + bin/tests/system/checkconf/check-srv-cname.db | 26 + bin/tests/system/checkconf/clean.sh | 15 + bin/tests/system/checkconf/dlz-bad.conf | 25 + bin/tests/system/checkconf/dnssec.1 | 15 + bin/tests/system/checkconf/dnssec.2 | 29 + bin/tests/system/checkconf/dnssec.3 | 39 + bin/tests/system/checkconf/good-acl.conf | 19 + bin/tests/system/checkconf/good-class.conf | 12 + .../system/checkconf/good-dlv-dlv.example.com.conf | 14 + .../checkconf/good-lmdb-mapsize-largest.conf | 14 + .../checkconf/good-lmdb-mapsize-smallest.conf | 14 + bin/tests/system/checkconf/good-nested.conf | 18 + .../system/checkconf/good-options-also-notify.conf | 20 + bin/tests/system/checkconf/good-response-dot.conf | 21 + .../system/checkconf/good-update-policy1.conf | 18 + .../system/checkconf/good-update-policy10.conf | 18 + .../system/checkconf/good-update-policy11.conf | 18 + .../system/checkconf/good-update-policy12.conf | 18 + .../system/checkconf/good-update-policy2.conf | 18 + .../system/checkconf/good-update-policy3.conf | 18 + .../system/checkconf/good-update-policy4.conf | 18 + .../system/checkconf/good-update-policy5.conf | 18 + .../system/checkconf/good-update-policy6.conf | 18 + .../system/checkconf/good-update-policy7.conf | 18 + .../system/checkconf/good-update-policy8.conf | 18 + .../system/checkconf/good-update-policy9.conf | 18 + .../system/checkconf/good-view-also-notify.conf | 19 + bin/tests/system/checkconf/good.conf | 158 + bin/tests/system/checkconf/hint-nofile.conf | 15 + bin/tests/system/checkconf/in-view-good.conf | 23 + bin/tests/system/checkconf/inline-bad.conf | 25 + bin/tests/system/checkconf/inline-good.conf | 26 + bin/tests/system/checkconf/inline-no.conf | 25 + .../system/checkconf/max-cache-size-good.conf | 14 + bin/tests/system/checkconf/max-ttl.conf | 32 + bin/tests/system/checkconf/maxttl-bad.conf | 22 + bin/tests/system/checkconf/maxttl-bad.db | 23 + bin/tests/system/checkconf/maxttl.db | 23 + bin/tests/system/checkconf/notify.conf | 82 + bin/tests/system/checkconf/portrange-good.conf | 20 + bin/tests/system/checkconf/range.conf | 23 + bin/tests/system/checkconf/shared.example.db | 11 + bin/tests/system/checkconf/tests.sh | 394 + bin/tests/system/checkconf/view-class-any1.conf | 12 + bin/tests/system/checkconf/view-class-any2.conf | 12 + bin/tests/system/checkconf/view-class-in1.conf | 12 + bin/tests/system/checkconf/view-class-in2.conf | 12 + bin/tests/system/checkconf/warn-dlv-auto.conf | 14 + .../system/checkconf/warn-dlv-dlv.isc.org.conf | 14 + bin/tests/system/checkconf/warn-keydir.conf | 23 + bin/tests/system/checkds/clean.sh | 15 + bin/tests/system/checkds/dig.bat | 38 + bin/tests/system/checkds/dig.pl | 45 + bin/tests/system/checkds/dig.sh | 26 + .../checkds/missing.example.dlv.example.dlv.db | 2 + bin/tests/system/checkds/missing.example.dnskey.db | 3 + bin/tests/system/checkds/missing.example.ds.db | 2 + .../system/checkds/none.example.dlv.example.dlv.db | 0 bin/tests/system/checkds/none.example.dnskey.db | 3 + bin/tests/system/checkds/none.example.ds.db | 0 .../system/checkds/ok.example.dlv.example.dlv.db | 2 + bin/tests/system/checkds/ok.example.dnskey.db | 2 + bin/tests/system/checkds/ok.example.ds.db | 2 + bin/tests/system/checkds/setup.sh | 15 + bin/tests/system/checkds/tests.sh | 179 + .../checkds/wrong.example.dlv.example.dlv.db | 2 + bin/tests/system/checkds/wrong.example.dnskey.db | 2 + bin/tests/system/checkds/wrong.example.ds.db | 2 + bin/tests/system/checknames/clean.sh | 22 + bin/tests/system/checknames/ns1/fail.example.db.in | 15 + bin/tests/system/checknames/ns1/fail.update.db.in | 14 + .../system/checknames/ns1/ignore.example.db.in | 16 + .../system/checknames/ns1/ignore.update.db.in | 14 + bin/tests/system/checknames/ns1/named.conf.in | 67 + bin/tests/system/checknames/ns1/root.db | 28 + bin/tests/system/checknames/ns1/warn.example.db.in | 15 + bin/tests/system/checknames/ns1/warn.update.db.in | 14 + bin/tests/system/checknames/ns2/named.conf.in | 29 + bin/tests/system/checknames/ns2/root.hints | 12 + bin/tests/system/checknames/ns3/named.conf.in | 29 + bin/tests/system/checknames/ns3/root.hints | 12 + .../checknames/ns4/master-ignore.update.db.in | 14 + bin/tests/system/checknames/ns4/named.conf.in | 35 + bin/tests/system/checknames/ns4/root.hints | 12 + bin/tests/system/checknames/setup.sh | 28 + bin/tests/system/checknames/tests.sh | 148 + bin/tests/system/checkzone/clean.sh | 11 + bin/tests/system/checkzone/setup.sh | 19 + bin/tests/system/checkzone/tests.sh | 185 + bin/tests/system/checkzone/zones/.gitattributes | 1 + bin/tests/system/checkzone/zones/bad-badclass.raw | Bin 0 -> 104 bytes bin/tests/system/checkzone/zones/bad-caa-rr.db | Bin 0 -> 600 bytes .../system/checkzone/zones/bad-dns-sd-reverse.db | 19 + .../system/checkzone/zones/bad-generate-tkey.db | 15 + bin/tests/system/checkzone/zones/bad-nsap-empty.db | 16 + .../system/checkzone/zones/bad-nsap-odd-nibble.db | 16 + .../system/checkzone/zones/bad-nsec3-padded.db | 19 + .../checkzone/zones/bad-nsec3owner-padded.db | 17 + bin/tests/system/checkzone/zones/bad-tkey.db | 15 + bin/tests/system/checkzone/zones/bad-tsig.db | 15 + bin/tests/system/checkzone/zones/bad-unspec.db | 14 + bin/tests/system/checkzone/zones/bad1.db | Bin 0 -> 507 bytes bin/tests/system/checkzone/zones/bad2.db | 17 + bin/tests/system/checkzone/zones/bad3.db | 17 + bin/tests/system/checkzone/zones/bad4.db | 17 + bin/tests/system/checkzone/zones/badttl.db | 18 + bin/tests/system/checkzone/zones/crashzone.db | 62 + .../zones/delegating-ns-address-below-dname.db | 22 + .../system/checkzone/zones/good-dns-sd-reverse.db | 21 + bin/tests/system/checkzone/zones/good-gc-msdcs.db | 14 + bin/tests/system/checkzone/zones/good-nsap.db | 16 + .../system/checkzone/zones/good-nsec3-nopadhash.db | 17 + .../checkzone/zones/good-occulted-ns-by-dname.db | 20 + .../checkzone/zones/good-occulted-ns-by-ns.db | 20 + bin/tests/system/checkzone/zones/good1.db | 17 + bin/tests/system/checkzone/zones/inherit.db | 10 + .../checkzone/zones/nowarn.inherited.owner.db | 11 + .../checkzone/zones/ns-address-below-dname.db | 20 + bin/tests/system/checkzone/zones/spf.db | 16 + bin/tests/system/checkzone/zones/test1.db | 16 + bin/tests/system/checkzone/zones/test2.db | 17 + .../system/checkzone/zones/warn.inherit.origin.db | 12 + .../system/checkzone/zones/warn.inherited.owner.db | 11 + bin/tests/system/clean.sh | 51 + bin/tests/system/cleanall.sh | 35 + bin/tests/system/cleanpkcs11.sh | 17 + bin/tests/system/common/controls.conf | 20 + bin/tests/system/common/controls.conf.in | 20 + bin/tests/system/common/rndc.conf | 19 + bin/tests/system/common/rndc.key | 15 + bin/tests/system/common/root.hint | 12 + bin/tests/system/conf.sh.in | 366 + bin/tests/system/conf.sh.win32 | 344 + bin/tests/system/cookie/bad-cookie-badhex.conf | 14 + bin/tests/system/cookie/bad-cookie-badsha1.conf | 15 + bin/tests/system/cookie/bad-cookie-badsha256.conf | 15 + bin/tests/system/cookie/bad-cookie-toolong.conf | 14 + bin/tests/system/cookie/clean.sh | 15 + bin/tests/system/cookie/good-cookie-sha1.conf | 15 + bin/tests/system/cookie/good-cookie-sha256.conf | 15 + bin/tests/system/cookie/ns1/example.db | 22 + bin/tests/system/cookie/ns1/named.conf.in | 49 + bin/tests/system/cookie/ns1/root.hint | 12 + bin/tests/system/cookie/ns2/named.conf.in | 29 + bin/tests/system/cookie/ns2/root.db | 22 + bin/tests/system/cookie/ns3/named.conf.in | 50 + bin/tests/system/cookie/ns3/root.hint | 12 + bin/tests/system/cookie/ns4/named.conf.in | 38 + bin/tests/system/cookie/ns4/root.hint | 12 + bin/tests/system/cookie/ns5/named.conf.in | 39 + bin/tests/system/cookie/ns5/root.hint | 12 + bin/tests/system/cookie/ns6/named.conf.in | 38 + bin/tests/system/cookie/ns6/root.hint | 12 + bin/tests/system/cookie/ns7/named.conf.in | 29 + bin/tests/system/cookie/ns7/root.db | 22 + bin/tests/system/cookie/setup.sh | 22 + bin/tests/system/cookie/tests.sh | 273 + bin/tests/system/coverage/01-ksk-inactive/README | 10 + bin/tests/system/coverage/01-ksk-inactive/expect | 6 + bin/tests/system/coverage/02-zsk-inactive/README | 10 + bin/tests/system/coverage/02-zsk-inactive/expect | 6 + .../system/coverage/03-ksk-unpublished/README | 10 + .../system/coverage/03-ksk-unpublished/expect | 8 + .../system/coverage/04-zsk-unpublished/README | 10 + .../system/coverage/04-zsk-unpublished/expect | 8 + .../system/coverage/05-ksk-unpub-active/README | 12 + .../system/coverage/05-ksk-unpub-active/expect | 8 + .../system/coverage/06-zsk-unpub-active/README | 12 + .../system/coverage/06-zsk-unpub-active/expect | 8 + bin/tests/system/coverage/07-ksk-ttl/README | 4 + bin/tests/system/coverage/07-ksk-ttl/expect | 9 + bin/tests/system/coverage/08-zsk-ttl/README | 4 + bin/tests/system/coverage/08-zsk-ttl/expect | 9 + bin/tests/system/coverage/09-check-zsk/README | 6 + bin/tests/system/coverage/09-check-zsk/expect | 6 + bin/tests/system/coverage/10-check-ksk/README | 7 + bin/tests/system/coverage/10-check-ksk/expect | 6 + bin/tests/system/coverage/11-cutoff/README | 10 + bin/tests/system/coverage/11-cutoff/expect | 6 + bin/tests/system/coverage/clean.sh | 16 + bin/tests/system/coverage/prereq.sh | 15 + bin/tests/system/coverage/setup.sh | 131 + bin/tests/system/coverage/tests.sh | 79 + bin/tests/system/database/clean.sh | 14 + bin/tests/system/database/ns1/named1.conf.in | 40 + bin/tests/system/database/ns1/named2.conf.in | 40 + bin/tests/system/database/setup.sh | 16 + bin/tests/system/database/tests.sh | 53 + bin/tests/system/delzone/clean.sh | 22 + bin/tests/system/delzone/ns1/inlineslave.db | 24 + bin/tests/system/delzone/ns1/named.conf | 31 + bin/tests/system/delzone/ns2/added.db | 24 + bin/tests/system/delzone/ns2/named.args | 1 + bin/tests/system/delzone/ns2/named.conf | 32 + bin/tests/system/delzone/ns2/normal.db | 24 + bin/tests/system/delzone/setup.sh | 15 + bin/tests/system/delzone/tests.sh | 63 + bin/tests/system/dialup/ns1/example.db | 17 + bin/tests/system/dialup/ns1/named.conf | 37 + bin/tests/system/dialup/ns1/root.db | 18 + bin/tests/system/dialup/ns2/hint.db | 11 + bin/tests/system/dialup/ns2/named.conf | 37 + bin/tests/system/dialup/ns3/hint.db | 11 + bin/tests/system/dialup/ns3/named.conf | 37 + bin/tests/system/dialup/setup.sh | 11 + bin/tests/system/dialup/tests.sh | 63 + bin/tests/system/digcomp.pl | 118 + bin/tests/system/digdelv/ans4/startme | 0 bin/tests/system/digdelv/clean.sh | 17 + bin/tests/system/digdelv/ns1/named.conf.in | 29 + bin/tests/system/digdelv/ns1/root.db | 24 + bin/tests/system/digdelv/ns2/example.db | 57 + bin/tests/system/digdelv/ns2/named.conf.in | 33 + bin/tests/system/digdelv/ns3/named.conf.in | 28 + bin/tests/system/digdelv/prereq.sh | 21 + bin/tests/system/digdelv/setup.sh | 18 + bin/tests/system/digdelv/tests.sh | 652 + bin/tests/system/ditch.pl | 85 + bin/tests/system/dlv/clean.sh | 42 + bin/tests/system/dlv/ns1/named.conf.in | 26 + bin/tests/system/dlv/ns1/root.db.in | 19 + bin/tests/system/dlv/ns1/rootservers.utld.db | 13 + bin/tests/system/dlv/ns1/sign.sh | 36 + bin/tests/system/dlv/ns2/druz.db.in | 47 + bin/tests/system/dlv/ns2/hints | 11 + bin/tests/system/dlv/ns2/named.conf.in | 27 + bin/tests/system/dlv/ns2/sign.sh | 37 + bin/tests/system/dlv/ns2/utld.db | 49 + bin/tests/system/dlv/ns3/child.db.in | 17 + bin/tests/system/dlv/ns3/dlv.db.in | 13 + bin/tests/system/dlv/ns3/hints | 11 + bin/tests/system/dlv/ns3/named.conf.in | 42 + bin/tests/system/dlv/ns3/sign.sh | 286 + bin/tests/system/dlv/ns4/child.db | 34 + bin/tests/system/dlv/ns4/hints | 11 + bin/tests/system/dlv/ns4/named.conf.in | 27 + bin/tests/system/dlv/ns5/hints | 11 + bin/tests/system/dlv/ns5/named.conf.in | 31 + bin/tests/system/dlv/ns5/rndc.conf | 20 + bin/tests/system/dlv/ns6/child.db.in | 15 + bin/tests/system/dlv/ns6/hints | 11 + bin/tests/system/dlv/ns6/named.conf.in | 41 + bin/tests/system/dlv/ns6/sign.sh | 251 + bin/tests/system/dlv/prereq.sh | 15 + bin/tests/system/dlv/setup.sh | 24 + bin/tests/system/dlv/tests.sh | 55 + bin/tests/system/dlz/clean.sh | 16 + .../com/broken/dns.d/@/DNAME=10=example.net.= | 6 + .../com/broken/dns.d/@/NS=10=example.com.= | 6 + ...om.=root.example.com.=None=None=None=None=None= | 6 + .../com/example/dns.d/@/DNAME=10=example.net.= | 6 + .../com/example/dns.d/@/NS=10=example.com.= | 6 + ...ple.com.=root.example.com.=2010062900=0=0=0=10= | 6 + .../dlz/ns1/dns-root/com/example/xfr.d/10.53.0.1 | 6 + bin/tests/system/dlz/ns1/named.conf.in | 25 + bin/tests/system/dlz/prereq.sh.in | 19 + bin/tests/system/dlz/setup.sh | 16 + bin/tests/system/dlz/tests.sh | 75 + bin/tests/system/dlzexternal/Makefile.in | 46 + bin/tests/system/dlzexternal/clean.sh | 23 + bin/tests/system/dlzexternal/driver.c | 830 + bin/tests/system/dlzexternal/driver.h | 30 + bin/tests/system/dlzexternal/ns1/dlzs.conf.in | 33 + bin/tests/system/dlzexternal/ns1/named.conf.in | 51 + bin/tests/system/dlzexternal/ns1/root.db | 24 + bin/tests/system/dlzexternal/prereq.sh | 19 + bin/tests/system/dlzexternal/setup.sh | 19 + bin/tests/system/dlzexternal/tests.sh | 210 + bin/tests/system/dns64/clean.sh | 19 + bin/tests/system/dns64/conf/bad1.conf | 14 + bin/tests/system/dns64/conf/bad2.conf | 14 + bin/tests/system/dns64/conf/bad3.conf | 14 + bin/tests/system/dns64/conf/bad4.conf | 14 + bin/tests/system/dns64/conf/bad5.conf | 14 + bin/tests/system/dns64/conf/bad6.conf | 14 + bin/tests/system/dns64/conf/bad7.conf | 16 + bin/tests/system/dns64/conf/bad8.conf | 16 + bin/tests/system/dns64/conf/bad9.conf | 16 + bin/tests/system/dns64/conf/good1.conf | 20 + bin/tests/system/dns64/conf/good2.conf | 19 + bin/tests/system/dns64/conf/good3.conf | 19 + bin/tests/system/dns64/conf/good4.conf | 19 + bin/tests/system/dns64/conf/good5.conf | 16 + bin/tests/system/dns64/ns1/example.db | 54 + bin/tests/system/dns64/ns1/named.conf.in | 53 + bin/tests/system/dns64/ns1/root.db | 17 + bin/tests/system/dns64/ns1/sign.sh | 24 + bin/tests/system/dns64/ns2/named.conf.in | 70 + bin/tests/system/dns64/ns2/rpz.db | 21 + bin/tests/system/dns64/prereq.sh | 15 + bin/tests/system/dns64/setup.sh | 22 + bin/tests/system/dns64/tests.sh | 1404 ++ bin/tests/system/dnssec/README | 19 + bin/tests/system/dnssec/clean.sh | 95 + bin/tests/system/dnssec/dnssec_update_test.pl | 97 + bin/tests/system/dnssec/ns1/named.conf.in | 35 + bin/tests/system/dnssec/ns1/root.db.in | 29 + bin/tests/system/dnssec/ns1/sign.sh | 53 + bin/tests/system/dnssec/ns2/algroll.db.in | 24 + bin/tests/system/dnssec/ns2/badparam.db.in | 19 + .../system/dnssec/ns2/cdnskey-auto.secure.db.in | 12 + .../system/dnssec/ns2/cdnskey-update.secure.db.in | 12 + bin/tests/system/dnssec/ns2/cdnskey.secure.db.in | 12 + bin/tests/system/dnssec/ns2/cds-auto.secure.db.in | 12 + .../system/dnssec/ns2/cds-update.secure.db.in | 12 + bin/tests/system/dnssec/ns2/cds.secure.db.in | 12 + bin/tests/system/dnssec/ns2/child.nsec3.example.db | 18 + .../system/dnssec/ns2/child.optout.example.db | 18 + bin/tests/system/dnssec/ns2/dlv.db.in | 19 + bin/tests/system/dnssec/ns2/dst.example.db.in | 19 + bin/tests/system/dnssec/ns2/example.db.in | 160 + bin/tests/system/dnssec/ns2/in-addr.arpa.db.in | 17 + .../system/dnssec/ns2/insecure.secure.example.db | 24 + bin/tests/system/dnssec/ns2/named.conf.in | 136 + .../system/dnssec/ns2/private.secure.example.db.in | 26 + bin/tests/system/dnssec/ns2/rfc2335.example.db | 103 + bin/tests/system/dnssec/ns2/sign.sh | 239 + bin/tests/system/dnssec/ns2/single-nsec3.db.in | 19 + .../system/dnssec/ns3/auto-nsec.example.db.in | 38 + .../system/dnssec/ns3/auto-nsec3.example.db.in | 38 + bin/tests/system/dnssec/ns3/bogus.example.db.in | 25 + .../dnssec/ns3/dnskey-nsec3-unknown.example.db.in | 28 + .../system/dnssec/ns3/dnskey-unknown.example.db.in | 27 + bin/tests/system/dnssec/ns3/dynamic.example.db.in | 23 + bin/tests/system/dnssec/ns3/expired.example.db.in | 42 + bin/tests/system/dnssec/ns3/expiring.example.db.in | 38 + bin/tests/system/dnssec/ns3/future.example.db.in | 38 + bin/tests/system/dnssec/ns3/generic.example.db.in | 21 + bin/tests/system/dnssec/ns3/inline.example.db | 24 + .../dnssec/ns3/insecure.below-cname.example.db | 24 + bin/tests/system/dnssec/ns3/insecure.example.db | 24 + .../system/dnssec/ns3/insecure.nsec3.example.db | 24 + .../system/dnssec/ns3/insecure.optout.example.db | 24 + bin/tests/system/dnssec/ns3/kskonly.example.db.in | 24 + bin/tests/system/dnssec/ns3/lower.example.db.in | 19 + .../system/dnssec/ns3/managed-future.example.db.in | 38 + bin/tests/system/dnssec/ns3/multiple.example.db.in | 27 + bin/tests/system/dnssec/ns3/named.conf.in | 298 + bin/tests/system/dnssec/ns3/nosign.example.db.in | 21 + .../system/dnssec/ns3/nsec3-unknown.example.db.in | 27 + bin/tests/system/dnssec/ns3/nsec3.example.db.in | 36 + .../system/dnssec/ns3/nsec3.nsec3.example.db.in | 33 + .../system/dnssec/ns3/nsec3.optout.example.db.in | 33 + .../system/dnssec/ns3/optout-unknown.example.db.in | 27 + bin/tests/system/dnssec/ns3/optout.example.db.in | 38 + .../system/dnssec/ns3/optout.nsec3.example.db.in | 33 + .../system/dnssec/ns3/optout.optout.example.db.in | 33 + .../dnssec/ns3/publish-inactive.example.db.in | 24 + .../system/dnssec/ns3/rsasha256.example.db.in | 26 + .../system/dnssec/ns3/rsasha512.example.db.in | 26 + .../dnssec/ns3/secure.below-cname.example.db.in | 24 + bin/tests/system/dnssec/ns3/secure.example.db.in | 46 + .../system/dnssec/ns3/secure.nsec3.example.db.in | 33 + .../system/dnssec/ns3/secure.optout.example.db.in | 33 + .../system/dnssec/ns3/siginterval.example.db.in | 19 + bin/tests/system/dnssec/ns3/siginterval1.conf | 18 + bin/tests/system/dnssec/ns3/siginterval2.conf | 18 + bin/tests/system/dnssec/ns3/sign.sh | 545 + .../system/dnssec/ns3/split-dnssec.example.db.in | 36 + .../system/dnssec/ns3/split-smart.example.db.in | 36 + bin/tests/system/dnssec/ns3/ttlpatch.example.db.in | 24 + .../system/dnssec/ns3/update-nsec3.example.db.in | 38 + bin/tests/system/dnssec/ns3/upper.example.db.in | 19 + bin/tests/system/dnssec/ns4/named1.conf.in | 53 + bin/tests/system/dnssec/ns4/named2.conf.in | 42 + bin/tests/system/dnssec/ns4/named3.conf.in | 42 + bin/tests/system/dnssec/ns4/named4.conf.in | 42 + bin/tests/system/dnssec/ns4/named5.conf.in | 76 + bin/tests/system/dnssec/ns5/named1.conf.in | 43 + bin/tests/system/dnssec/ns5/named2.conf.in | 50 + bin/tests/system/dnssec/ns5/sign.sh | 29 + bin/tests/system/dnssec/ns5/trusted.conf.bad | 14 + bin/tests/system/dnssec/ns6/named.args | 1 + bin/tests/system/dnssec/ns6/named.conf.in | 41 + bin/tests/system/dnssec/ns6/optout-tld.db.in | 20 + bin/tests/system/dnssec/ns6/sign.sh | 23 + bin/tests/system/dnssec/ns7/named.conf.in | 75 + bin/tests/system/dnssec/ns7/named.nosoa | 5 + .../system/dnssec/ns7/nosoa.secure.example.db | 20 + bin/tests/system/dnssec/ns7/sign.sh | 28 + bin/tests/system/dnssec/ns7/split-rrsig.db.in | 19 + bin/tests/system/dnssec/ntadiff.pl | 22 + bin/tests/system/dnssec/prereq.sh | 26 + bin/tests/system/dnssec/setup.sh | 41 + bin/tests/system/dnssec/signer/example.db.in | 15 + .../signer/general/Kexample.com.+005+07065.key | 1 + .../signer/general/Kexample.com.+005+07065.private | 10 + .../signer/general/Kexample.com.+005+23362.key | 1 + .../signer/general/Kexample.com.+005+23362.private | 10 + .../system/dnssec/signer/general/bogus-ksk.key | 6 + .../system/dnssec/signer/general/bogus-zsk.key | 6 + bin/tests/system/dnssec/signer/general/test1.zone | 17 + bin/tests/system/dnssec/signer/general/test2.zone | 16 + bin/tests/system/dnssec/signer/general/test3.zone | 16 + bin/tests/system/dnssec/signer/general/test4.zone | 18 + bin/tests/system/dnssec/signer/general/test5.zone | 17 + bin/tests/system/dnssec/signer/general/test6.zone | 19 + bin/tests/system/dnssec/signer/general/test7.zone | 17 + bin/tests/system/dnssec/signer/general/test8.zone | 17 + bin/tests/system/dnssec/signer/remove.db.in | 16 + bin/tests/system/dnssec/signer/remove2.db.in | 14 + bin/tests/system/dnssec/tests.sh | 3529 ++++ .../dnstap/bad-fstrm-set-buffer-hint-max.conf | 14 + .../dnstap/bad-fstrm-set-buffer-hint-min.conf | 14 + .../dnstap/bad-fstrm-set-flush-timeout-max.conf | 14 + .../dnstap/bad-fstrm-set-flush-timeout-min.conf | 14 + .../dnstap/bad-fstrm-set-input-queue-size-max.conf | 14 + .../dnstap/bad-fstrm-set-input-queue-size-min.conf | 14 + .../dnstap/bad-fstrm-set-input-queue-size-po2.conf | 14 + .../bad-fstrm-set-output-notify-threshold.conf | 14 + .../bad-fstrm-set-output-queue-size-max.conf | 17 + .../bad-fstrm-set-output-queue-size-min.conf | 14 + .../dnstap/bad-fstrm-set-reopen-interval-max.conf | 14 + .../dnstap/bad-fstrm-set-reopen-interval-min.conf | 14 + bin/tests/system/dnstap/clean.sh | 24 + .../system/dnstap/good-fstrm-set-buffer-hint.conf | 14 + .../dnstap/good-fstrm-set-flush-timeout.conf | 14 + .../dnstap/good-fstrm-set-input-queue-size.conf | 14 + .../good-fstrm-set-output-notify-threshold.conf | 14 + .../good-fstrm-set-output-queue-model-mpsc.conf | 14 + .../good-fstrm-set-output-queue-model-spsc.conf | 14 + .../dnstap/good-fstrm-set-output-queue-size.conf | 14 + .../dnstap/good-fstrm-set-reopen-interval.conf | 14 + bin/tests/system/dnstap/ns1/named.conf.in | 43 + bin/tests/system/dnstap/ns1/root.db | 22 + bin/tests/system/dnstap/ns2/example.db | 28 + bin/tests/system/dnstap/ns2/named.conf.in | 49 + bin/tests/system/dnstap/ns3/named.conf.in | 45 + bin/tests/system/dnstap/ns4/named.conf.in | 45 + bin/tests/system/dnstap/setup.sh | 19 + bin/tests/system/dnstap/tests.sh | 591 + bin/tests/system/dnstap/ydump.py | 26 + bin/tests/system/dscp/clean.sh | 15 + bin/tests/system/dscp/ns1/named.args | 1 + bin/tests/system/dscp/ns1/named.conf.in | 28 + bin/tests/system/dscp/ns1/root.db | 17 + bin/tests/system/dscp/ns2/named.args | 1 + bin/tests/system/dscp/ns2/named.conf.in | 29 + bin/tests/system/dscp/ns3/hint.db | 14 + bin/tests/system/dscp/ns3/named.args | 1 + bin/tests/system/dscp/ns3/named.conf.in | 27 + bin/tests/system/dscp/ns4/named.args | 1 + bin/tests/system/dscp/ns4/named.conf.in | 28 + bin/tests/system/dscp/ns4/root.db | 17 + bin/tests/system/dscp/ns5/named.args | 1 + bin/tests/system/dscp/ns5/named.conf.in | 30 + bin/tests/system/dscp/ns6/hint.db | 14 + bin/tests/system/dscp/ns6/named.args | 1 + bin/tests/system/dscp/ns6/named.conf.in | 27 + bin/tests/system/dscp/ns7/named.args | 1 + bin/tests/system/dscp/ns7/named.conf.in | 33 + bin/tests/system/dscp/setup.sh | 22 + bin/tests/system/dscp/tests.sh | 38 + bin/tests/system/dsdigest/clean.sh | 21 + bin/tests/system/dsdigest/ns1/named.conf.in | 35 + bin/tests/system/dsdigest/ns1/root.db.in | 24 + bin/tests/system/dsdigest/ns1/sign.sh | 35 + bin/tests/system/dsdigest/ns2/bad.db.in | 21 + bin/tests/system/dsdigest/ns2/good.db.in | 21 + bin/tests/system/dsdigest/ns2/named.conf.in | 45 + bin/tests/system/dsdigest/ns2/sign.sh | 46 + bin/tests/system/dsdigest/ns3/named.conf.in | 38 + bin/tests/system/dsdigest/ns4/named.conf.in | 36 + bin/tests/system/dsdigest/prereq.sh | 28 + bin/tests/system/dsdigest/setup.sh | 22 + bin/tests/system/dsdigest/tests.sh | 52 + bin/tests/system/dupsigs/check_journal.pl | 209 + bin/tests/system/dupsigs/clean.sh | 19 + bin/tests/system/dupsigs/ns1/named.args | 1 + bin/tests/system/dupsigs/ns1/named.conf.in | 31 + bin/tests/system/dupsigs/ns1/reset_keys.sh | 97 + bin/tests/system/dupsigs/ns1/signing.test.db.in | 16 + bin/tests/system/dupsigs/prereq.sh | 15 + bin/tests/system/dupsigs/setup.sh | 20 + bin/tests/system/dupsigs/tests.sh | 35 + bin/tests/system/dyndb/Makefile.in | 21 + bin/tests/system/dyndb/clean.sh | 22 + bin/tests/system/dyndb/driver/AUTHORS | 8 + bin/tests/system/dyndb/driver/COPYING | 19 + bin/tests/system/dyndb/driver/Makefile.in | 57 + bin/tests/system/dyndb/driver/README | 65 + bin/tests/system/dyndb/driver/db.c | 822 + bin/tests/system/dyndb/driver/db.h | 15 + bin/tests/system/dyndb/driver/driver.c | 141 + bin/tests/system/dyndb/driver/instance.c | 158 + bin/tests/system/dyndb/driver/instance.h | 49 + bin/tests/system/dyndb/driver/lock.c | 56 + bin/tests/system/dyndb/driver/lock.h | 17 + bin/tests/system/dyndb/driver/log.c | 21 + bin/tests/system/dyndb/driver/log.h | 27 + bin/tests/system/dyndb/driver/syncptr.c | 266 + bin/tests/system/dyndb/driver/syncptr.h | 15 + bin/tests/system/dyndb/driver/util.h | 57 + bin/tests/system/dyndb/driver/zone.c | 194 + bin/tests/system/dyndb/driver/zone.h | 15 + bin/tests/system/dyndb/ns1/named.conf.in | 37 + bin/tests/system/dyndb/prereq.sh | 19 + bin/tests/system/dyndb/setup.sh | 16 + bin/tests/system/dyndb/tests.sh | 153 + bin/tests/system/ecdsa/clean.sh | 18 + bin/tests/system/ecdsa/ns1/named.conf | 35 + bin/tests/system/ecdsa/ns1/root.db.in | 19 + bin/tests/system/ecdsa/ns1/sign.sh | 29 + bin/tests/system/ecdsa/ns2/named.conf | 35 + bin/tests/system/ecdsa/prereq.sh | 15 + bin/tests/system/ecdsa/setup.sh | 17 + bin/tests/system/ecdsa/tests.sh | 35 + bin/tests/system/eddsa/clean.sh | 18 + bin/tests/system/eddsa/ns1/named.conf | 35 + bin/tests/system/eddsa/ns1/root.db.in | 19 + bin/tests/system/eddsa/ns1/sign.sh | 32 + .../system/eddsa/ns2/Xexample.com.+015+03613.key | 1 + .../eddsa/ns2/Xexample.com.+015+03613.private | 4 + .../system/eddsa/ns2/Xexample.com.+015+35217.key | 1 + .../eddsa/ns2/Xexample.com.+015+35217.private | 3 + bin/tests/system/eddsa/ns2/example.com.db | 23 + bin/tests/system/eddsa/ns2/named.conf | 35 + bin/tests/system/eddsa/ns2/sign.sh | 26 + bin/tests/system/eddsa/prereq.sh | 15 + bin/tests/system/eddsa/setup.sh | 17 + bin/tests/system/eddsa/tests.sh | 47 + bin/tests/system/ednscompliance/clean.sh | 16 + bin/tests/system/ednscompliance/ns1/named.conf.in | 26 + bin/tests/system/ednscompliance/ns1/root.db | 19 + bin/tests/system/ednscompliance/setup.sh | 16 + bin/tests/system/ednscompliance/tests.sh | 111 + bin/tests/system/emptyzones/clean.sh | 14 + bin/tests/system/emptyzones/ns1/empty.db | 11 + bin/tests/system/emptyzones/ns1/named1.conf.in | 44 + bin/tests/system/emptyzones/ns1/named2.conf.in | 47 + bin/tests/system/emptyzones/ns1/rfc1918.zones | 30 + bin/tests/system/emptyzones/ns1/root.hint | 12 + bin/tests/system/emptyzones/setup.sh | 14 + bin/tests/system/emptyzones/tests.sh | 44 + bin/tests/system/feature-test.c | 195 + bin/tests/system/fetchlimit/ans4/ans.pl | 84 + bin/tests/system/fetchlimit/clean.sh | 16 + bin/tests/system/fetchlimit/ns1/named.conf.in | 32 + bin/tests/system/fetchlimit/ns1/root.db | 22 + bin/tests/system/fetchlimit/ns2/example.db | 35 + bin/tests/system/fetchlimit/ns2/named.conf.in | 38 + bin/tests/system/fetchlimit/ns3/named.args | 2 + bin/tests/system/fetchlimit/ns3/named1.conf.in | 40 + bin/tests/system/fetchlimit/ns3/named2.conf.in | 38 + bin/tests/system/fetchlimit/ns3/named3.conf.in | 38 + bin/tests/system/fetchlimit/ns3/root.hint | 12 + bin/tests/system/fetchlimit/prereq.sh | 21 + bin/tests/system/fetchlimit/setup.sh | 19 + bin/tests/system/fetchlimit/tests.sh | 186 + bin/tests/system/filter-aaaa/clean.sh | 27 + bin/tests/system/filter-aaaa/conf/bad1.conf | 15 + bin/tests/system/filter-aaaa/conf/bad2.conf | 24 + bin/tests/system/filter-aaaa/conf/bad3.conf | 18 + bin/tests/system/filter-aaaa/conf/bad4.conf | 18 + bin/tests/system/filter-aaaa/conf/bad5.conf | 18 + bin/tests/system/filter-aaaa/conf/bad6.conf | 18 + bin/tests/system/filter-aaaa/conf/good1.conf | 14 + bin/tests/system/filter-aaaa/conf/good2.conf | 14 + bin/tests/system/filter-aaaa/conf/good3.conf | 15 + bin/tests/system/filter-aaaa/conf/good4.conf | 15 + bin/tests/system/filter-aaaa/conf/good5.conf | 18 + bin/tests/system/filter-aaaa/conf/good6.conf | 18 + bin/tests/system/filter-aaaa/conf/good7.conf | 18 + bin/tests/system/filter-aaaa/conf/good8.conf | 19 + bin/tests/system/filter-aaaa/ns1/named1.conf.in | 38 + bin/tests/system/filter-aaaa/ns1/named2.conf.in | 37 + bin/tests/system/filter-aaaa/ns1/root.db | 23 + bin/tests/system/filter-aaaa/ns1/sign.sh | 30 + bin/tests/system/filter-aaaa/ns1/signed.db.in | 23 + .../system/filter-aaaa/ns1/signed.db.presigned | 125 + bin/tests/system/filter-aaaa/ns1/unsigned.db | 23 + bin/tests/system/filter-aaaa/ns2/hints | 11 + bin/tests/system/filter-aaaa/ns2/named1.conf.in | 35 + bin/tests/system/filter-aaaa/ns2/named2.conf.in | 35 + bin/tests/system/filter-aaaa/ns3/hints | 11 + bin/tests/system/filter-aaaa/ns3/named1.conf.in | 35 + bin/tests/system/filter-aaaa/ns3/named2.conf.in | 35 + bin/tests/system/filter-aaaa/ns4/named1.conf.in | 37 + bin/tests/system/filter-aaaa/ns4/named2.conf.in | 37 + bin/tests/system/filter-aaaa/ns4/root.db | 22 + bin/tests/system/filter-aaaa/ns4/sign.sh | 30 + bin/tests/system/filter-aaaa/ns4/signed.db.in | 23 + .../system/filter-aaaa/ns4/signed.db.presigned | 110 + bin/tests/system/filter-aaaa/ns4/unsigned.db | 23 + bin/tests/system/filter-aaaa/ns5/hints | 11 + bin/tests/system/filter-aaaa/ns5/named.conf.in | 42 + bin/tests/system/filter-aaaa/prereq.sh | 19 + bin/tests/system/filter-aaaa/setup.sh | 33 + bin/tests/system/filter-aaaa/tests.sh | 1390 ++ bin/tests/system/formerr/clean.sh | 16 + bin/tests/system/formerr/formerr.pl | 95 + bin/tests/system/formerr/nametoolong | 19 + bin/tests/system/formerr/noquestions | 1 + bin/tests/system/formerr/ns1/named.conf.in | 26 + bin/tests/system/formerr/ns1/root.db | 19 + bin/tests/system/formerr/setup.sh | 16 + bin/tests/system/formerr/tests.sh | 45 + bin/tests/system/formerr/twoquestions | 7 + bin/tests/system/forward/clean.sh | 17 + bin/tests/system/forward/ns1/example.db | 12 + bin/tests/system/forward/ns1/named.conf.in | 56 + bin/tests/system/forward/ns1/root.db | 28 + bin/tests/system/forward/ns2/example.db | 12 + bin/tests/system/forward/ns2/named.conf.in | 56 + bin/tests/system/forward/ns2/root.db | 28 + bin/tests/system/forward/ns3/named.conf.in | 45 + bin/tests/system/forward/ns3/root.db | 28 + bin/tests/system/forward/ns4/named.conf.in | 54 + bin/tests/system/forward/ns4/root.db | 28 + bin/tests/system/forward/ns5/named.conf.in | 27 + bin/tests/system/forward/ns5/root.db | 28 + bin/tests/system/forward/rfc1918-inherited.conf | 15 + bin/tests/system/forward/rfc1918-notinherited.conf | 16 + bin/tests/system/forward/setup.sh | 20 + bin/tests/system/forward/tests.sh | 135 + bin/tests/system/forward/ula-inherited.conf | 15 + bin/tests/system/forward/ula-notinherited.conf | 16 + bin/tests/system/genzone.sh | 468 + bin/tests/system/geoip/clean.sh | 19 + bin/tests/system/geoip/data/GeoIP.csv | 8 + bin/tests/system/geoip/data/GeoIP.dat | Bin 0 -> 385 bytes bin/tests/system/geoip/data/GeoIPASNum.csv | 7 + bin/tests/system/geoip/data/GeoIPASNum.dat | Bin 0 -> 433 bytes bin/tests/system/geoip/data/GeoIPASNumv6.csv | 7 + bin/tests/system/geoip/data/GeoIPASNumv6.dat | Bin 0 -> 1003 bytes bin/tests/system/geoip/data/GeoIPCity.csv | 7 + bin/tests/system/geoip/data/GeoIPCity.dat | Bin 0 -> 457 bytes bin/tests/system/geoip/data/GeoIPCityv6.csv | 7 + bin/tests/system/geoip/data/GeoIPCityv6.dat | Bin 0 -> 1023 bytes bin/tests/system/geoip/data/GeoIPDomain.csv | 7 + bin/tests/system/geoip/data/GeoIPDomain.dat | Bin 0 -> 382 bytes bin/tests/system/geoip/data/GeoIPISP.csv | 7 + bin/tests/system/geoip/data/GeoIPISP.dat | Bin 0 -> 442 bytes bin/tests/system/geoip/data/GeoIPNetSpeed.csv | 7 + bin/tests/system/geoip/data/GeoIPNetSpeed.dat | Bin 0 -> 241 bytes bin/tests/system/geoip/data/GeoIPOrg.csv | 7 + bin/tests/system/geoip/data/GeoIPOrg.dat | Bin 0 -> 442 bytes bin/tests/system/geoip/data/GeoIPRegion.csv | 7 + bin/tests/system/geoip/data/GeoIPRegion.dat | Bin 0 -> 250 bytes bin/tests/system/geoip/data/GeoIPv6.csv | 7 + bin/tests/system/geoip/data/GeoIPv6.dat | Bin 0 -> 826 bytes bin/tests/system/geoip/data/README | 34 + bin/tests/system/geoip/ns2/example.db.in | 19 + bin/tests/system/geoip/ns2/named1.conf.in | 105 + bin/tests/system/geoip/ns2/named10.conf.in | 97 + bin/tests/system/geoip/ns2/named11.conf.in | 97 + bin/tests/system/geoip/ns2/named12.conf.in | 73 + bin/tests/system/geoip/ns2/named13.conf.in | 38 + bin/tests/system/geoip/ns2/named14.conf.in | 106 + bin/tests/system/geoip/ns2/named15.conf.in | 48 + bin/tests/system/geoip/ns2/named2.conf.in | 97 + bin/tests/system/geoip/ns2/named3.conf.in | 97 + bin/tests/system/geoip/ns2/named4.conf.in | 89 + bin/tests/system/geoip/ns2/named5.conf.in | 97 + bin/tests/system/geoip/ns2/named6.conf.in | 97 + bin/tests/system/geoip/ns2/named7.conf.in | 97 + bin/tests/system/geoip/ns2/named8.conf.in | 97 + bin/tests/system/geoip/ns2/named9.conf.in | 97 + bin/tests/system/geoip/options.conf | 37 + bin/tests/system/geoip/prereq.sh | 19 + bin/tests/system/geoip/setup.sh | 25 + bin/tests/system/geoip/tests.sh | 484 + bin/tests/system/glue/clean.sh | 20 + bin/tests/system/glue/fi.good | 27 + bin/tests/system/glue/noglue.good | 14 + bin/tests/system/glue/ns1/cache.in | 15 + bin/tests/system/glue/ns1/mil.db | 23 + bin/tests/system/glue/ns1/named.conf.in | 43 + bin/tests/system/glue/ns1/net.db | 32 + bin/tests/system/glue/ns1/root-servers.nil.db | 23 + bin/tests/system/glue/ns1/root.db | 68 + bin/tests/system/glue/setup.sh | 18 + bin/tests/system/glue/tests.sh | 40 + bin/tests/system/glue/xx.good | 16 + bin/tests/system/glue/yy.good | 17 + bin/tests/system/gost/clean.sh | 18 + bin/tests/system/gost/ns1/named.conf | 35 + bin/tests/system/gost/ns1/root.db.in | 19 + bin/tests/system/gost/ns1/sign.sh | 38 + bin/tests/system/gost/ns2/named.conf | 35 + bin/tests/system/gost/prereq.sh | 15 + bin/tests/system/gost/setup.sh | 17 + bin/tests/system/gost/tests.sh | 35 + bin/tests/system/idna/clean.sh | 16 + bin/tests/system/idna/ns1/named.conf.in | 29 + bin/tests/system/idna/ns1/root.db | 24 + bin/tests/system/idna/setup.sh | 16 + bin/tests/system/idna/tests.sh | 347 + bin/tests/system/ifconfig.bat | 34 + bin/tests/system/ifconfig.sh | 263 + bin/tests/system/inline/checkdsa.sh.in | 17 + bin/tests/system/inline/clean.sh | 127 + bin/tests/system/inline/ns1/named.conf.in | 35 + bin/tests/system/inline/ns1/root.db.in | 57 + bin/tests/system/inline/ns1/sign.sh | 24 + bin/tests/system/inline/ns2/bits.db.in | 20 + bin/tests/system/inline/ns2/named.conf.in | 83 + bin/tests/system/inline/ns2/nsec3-loop.db | 23 + bin/tests/system/inline/ns3/master.db.in | 19 + bin/tests/system/inline/ns3/master2.db.in | 21 + bin/tests/system/inline/ns3/master3.db.in | 22 + bin/tests/system/inline/ns3/master4.db.in | 22 + bin/tests/system/inline/ns3/master5.db.in | 22 + bin/tests/system/inline/ns3/named.conf.in | 170 + bin/tests/system/inline/ns3/sign.sh | 176 + bin/tests/system/inline/ns4/named.conf.in | 31 + bin/tests/system/inline/ns4/noixfr.db.in | 20 + bin/tests/system/inline/ns5/named.conf.post | 40 + bin/tests/system/inline/ns5/named.conf.pre | 37 + bin/tests/system/inline/ns6/named.conf.in | 38 + bin/tests/system/inline/ns7/named.conf.in | 48 + bin/tests/system/inline/ns7/sign.sh | 23 + bin/tests/system/inline/prereq.sh | 15 + bin/tests/system/inline/setup.sh | 55 + bin/tests/system/inline/tests.sh | 1369 ++ bin/tests/system/integrity/clean.sh | 15 + bin/tests/system/integrity/ns1/mx-cname.db | 15 + bin/tests/system/integrity/ns1/named.conf.in | 112 + bin/tests/system/integrity/ns1/srv-cname.db | 15 + bin/tests/system/integrity/setup.sh | 16 + bin/tests/system/integrity/tests.sh | 129 + bin/tests/system/ixfr/ans2/startme | 0 bin/tests/system/ixfr/clean.sh | 21 + bin/tests/system/ixfr/ns1/startme | 0 bin/tests/system/ixfr/ns3/mytest0.db | 24 + bin/tests/system/ixfr/ns3/mytest1.db | 24 + bin/tests/system/ixfr/ns3/mytest2.db | 24 + bin/tests/system/ixfr/ns3/named.conf.in | 49 + bin/tests/system/ixfr/ns3/subtest0.db | 22 + bin/tests/system/ixfr/ns3/subtest1.db | 22 + bin/tests/system/ixfr/ns4/named.conf.in | 47 + bin/tests/system/ixfr/prereq.sh | 21 + bin/tests/system/ixfr/setup.sh | 47 + bin/tests/system/ixfr/tests.sh | 311 + bin/tests/system/keymgr/01-ksk-inactive/README | 6 + bin/tests/system/keymgr/01-ksk-inactive/expect | 9 + bin/tests/system/keymgr/02-zsk-inactive/README | 6 + bin/tests/system/keymgr/02-zsk-inactive/expect | 9 + bin/tests/system/keymgr/03-ksk-unpublished/README | 6 + bin/tests/system/keymgr/03-ksk-unpublished/expect | 9 + bin/tests/system/keymgr/04-zsk-unpublished/README | 6 + bin/tests/system/keymgr/04-zsk-unpublished/expect | 9 + bin/tests/system/keymgr/05-ksk-unpub-active/README | 7 + bin/tests/system/keymgr/05-ksk-unpub-active/expect | 9 + bin/tests/system/keymgr/06-zsk-unpub-active/README | 7 + bin/tests/system/keymgr/06-zsk-unpub-active/expect | 9 + bin/tests/system/keymgr/07-ksk-ttl/README | 6 + bin/tests/system/keymgr/07-ksk-ttl/expect | 9 + bin/tests/system/keymgr/08-zsk-ttl/README | 6 + bin/tests/system/keymgr/08-zsk-ttl/expect | 9 + bin/tests/system/keymgr/09-no-keys/README | 5 + bin/tests/system/keymgr/09-no-keys/expect | 9 + bin/tests/system/keymgr/10-change-roll/README | 7 + bin/tests/system/keymgr/10-change-roll/expect | 9 + bin/tests/system/keymgr/11-many-simul/README | 6 + bin/tests/system/keymgr/11-many-simul/expect | 9 + bin/tests/system/keymgr/12-many-active/README | 6 + bin/tests/system/keymgr/12-many-active/expect | 9 + bin/tests/system/keymgr/13-noroll/README | 6 + bin/tests/system/keymgr/13-noroll/expect | 9 + bin/tests/system/keymgr/14-wrongalg/README | 6 + bin/tests/system/keymgr/14-wrongalg/expect | 9 + bin/tests/system/keymgr/15-unspec/README | 6 + bin/tests/system/keymgr/15-unspec/expect | 9 + bin/tests/system/keymgr/16-wrongalg-unspec/README | 6 + bin/tests/system/keymgr/16-wrongalg-unspec/expect | 9 + bin/tests/system/keymgr/17-noforce/README | 6 + bin/tests/system/keymgr/17-noforce/expect | 9 + bin/tests/system/keymgr/18-nonstd-prepub/README | 7 + bin/tests/system/keymgr/18-nonstd-prepub/expect | 9 + .../system/keymgr/18-nonstd-prepub/policy.conf | 18 + bin/tests/system/keymgr/clean.sh | 15 + bin/tests/system/keymgr/policy.conf | 21 + bin/tests/system/keymgr/policy.good | 170 + bin/tests/system/keymgr/policy.sample | 58 + bin/tests/system/keymgr/prereq.sh | 15 + bin/tests/system/keymgr/setup.sh | 216 + bin/tests/system/keymgr/testpolicy.py | 39 + bin/tests/system/keymgr/tests.sh | 111 + bin/tests/system/legacy/build.sh | 22 + bin/tests/system/legacy/clean.sh | 25 + bin/tests/system/legacy/ns1/named1.conf.in | 26 + bin/tests/system/legacy/ns1/named2.conf.in | 28 + bin/tests/system/legacy/ns1/root.db | 25 + bin/tests/system/legacy/ns1/trusted.conf | 3 + bin/tests/system/legacy/ns2/dropedns.db | 12 + bin/tests/system/legacy/ns2/named.conf.in | 26 + bin/tests/system/legacy/ns2/named.dropedns | 1 + bin/tests/system/legacy/ns3/dropedns-notcp.db | 12 + bin/tests/system/legacy/ns3/named.conf.in | 26 + bin/tests/system/legacy/ns3/named.dropedns | 1 + bin/tests/system/legacy/ns3/named.notcp | 1 + bin/tests/system/legacy/ns4/named.args | 1 + bin/tests/system/legacy/ns4/named.conf.in | 26 + bin/tests/system/legacy/ns4/plain.db | 12 + bin/tests/system/legacy/ns5/named.args | 1 + bin/tests/system/legacy/ns5/named.conf.in | 26 + bin/tests/system/legacy/ns5/named.notcp | 1 + bin/tests/system/legacy/ns5/plain-notcp.db | 12 + bin/tests/system/legacy/ns6/edns512.db.in | 24 + bin/tests/system/legacy/ns6/edns512.db.signed | 248 + bin/tests/system/legacy/ns6/named.args | 1 + bin/tests/system/legacy/ns6/named.conf.in | 26 + bin/tests/system/legacy/ns6/sign.sh | 29 + bin/tests/system/legacy/ns7/edns512-notcp.db.in | 24 + .../system/legacy/ns7/edns512-notcp.db.signed | 248 + bin/tests/system/legacy/ns7/named.args | 1 + bin/tests/system/legacy/ns7/named.conf.in | 26 + bin/tests/system/legacy/ns7/named.notcp | 1 + bin/tests/system/legacy/ns7/sign.sh | 32 + bin/tests/system/legacy/setup.sh | 24 + bin/tests/system/legacy/tests.sh | 166 + bin/tests/system/limits/clean.sh | 19 + bin/tests/system/limits/knowngood.dig.out.1000 | 1023 + bin/tests/system/limits/knowngood.dig.out.2000 | 2023 ++ bin/tests/system/limits/knowngood.dig.out.3000 | 3023 +++ bin/tests/system/limits/knowngood.dig.out.4000 | 4023 ++++ .../limits/knowngood.dig.out.a-maximum-rrset | 4114 ++++ bin/tests/system/limits/ns1/example.db | 19110 +++++++++++++++++++ bin/tests/system/limits/ns1/named.conf.in | 32 + bin/tests/system/limits/ns1/root.db | 22 + bin/tests/system/limits/setup.sh | 16 + bin/tests/system/limits/tests.sh | 54 + bin/tests/system/logfileconfig/clean.sh | 30 + .../system/logfileconfig/ns1/controls.conf.in | 16 + bin/tests/system/logfileconfig/ns1/named.dirconf | 43 + bin/tests/system/logfileconfig/ns1/named.pipeconf | 43 + bin/tests/system/logfileconfig/ns1/named.plain | 51 + bin/tests/system/logfileconfig/ns1/named.plainconf | 34 + bin/tests/system/logfileconfig/ns1/named.symconf | 43 + bin/tests/system/logfileconfig/ns1/named.unlimited | 53 + bin/tests/system/logfileconfig/ns1/named.versconf | 53 + bin/tests/system/logfileconfig/ns1/rndc.conf.in | 24 + bin/tests/system/logfileconfig/ns1/root.db | 25 + bin/tests/system/logfileconfig/setup.sh | 19 + bin/tests/system/logfileconfig/tests.sh | 364 + bin/tests/system/lwresd/Makefile.in | 50 + bin/tests/system/lwresd/clean.sh | 22 + bin/tests/system/lwresd/lwresd1/lwresd.conf | 28 + bin/tests/system/lwresd/lwresd1/nosearch.conf | 27 + bin/tests/system/lwresd/lwresd1/resolv.conf | 15 + bin/tests/system/lwresd/lwtest.c | 797 + .../system/lwresd/ns1/10.10.10.in-addr.arpa.db | 23 + bin/tests/system/lwresd/ns1/e.example1.db | 54 + bin/tests/system/lwresd/ns1/example1.db | 29 + bin/tests/system/lwresd/ns1/example2.db | 24 + bin/tests/system/lwresd/ns1/ip6.arpa.db | 24 + bin/tests/system/lwresd/ns1/ip6.int.db | 21 + bin/tests/system/lwresd/ns1/named.conf | 63 + bin/tests/system/lwresd/ns1/root.db | 27 + bin/tests/system/lwresd/resolv.conf | 15 + bin/tests/system/lwresd/tests.sh | 87 + bin/tests/system/masterfile/clean.sh | 17 + bin/tests/system/masterfile/knowngood.dig.out | 32 + bin/tests/system/masterfile/ns1/include.db | 33 + bin/tests/system/masterfile/ns1/named.conf.in | 37 + bin/tests/system/masterfile/ns1/sub.db | 13 + bin/tests/system/masterfile/ns1/ttl1.db | 25 + bin/tests/system/masterfile/ns1/ttl2.db | 28 + bin/tests/system/masterfile/ns2/example.db | 19 + bin/tests/system/masterfile/ns2/named.conf.in | 41 + bin/tests/system/masterfile/setup.sh | 17 + bin/tests/system/masterfile/tests.sh | 60 + .../masterfile/zone/inheritownerafterinclude.db | 12 + .../masterfile/zone/inheritownerafterinclude.good | 3 + bin/tests/system/masterfile/zone/nameservers.db | 10 + bin/tests/system/masterformat/clean.sh | 33 + bin/tests/system/masterformat/ns1/compile.sh | 32 + bin/tests/system/masterformat/ns1/example.db | 56 + bin/tests/system/masterformat/ns1/large.db.in | 20 + bin/tests/system/masterformat/ns1/named.conf.in | 86 + bin/tests/system/masterformat/ns1/signed.db | 27 + .../system/masterformat/ns2/formerly-text.db.in | 46 + bin/tests/system/masterformat/ns2/named.conf.in | 62 + bin/tests/system/masterformat/ns3/named.conf.in | 44 + bin/tests/system/masterformat/prereq.sh | 15 + bin/tests/system/masterformat/setup.sh | 31 + bin/tests/system/masterformat/tests.sh | 298 + bin/tests/system/metadata/child.db | 22 + bin/tests/system/metadata/clean.sh | 19 + bin/tests/system/metadata/parent.db | 29 + bin/tests/system/metadata/prereq.sh | 15 + bin/tests/system/metadata/setup.sh | 63 + bin/tests/system/metadata/tests.sh | 211 + bin/tests/system/mkeys/README | 18 + bin/tests/system/mkeys/clean.sh | 21 + bin/tests/system/mkeys/ns1/named1.conf.in | 48 + bin/tests/system/mkeys/ns1/named2.conf.in | 46 + bin/tests/system/mkeys/ns1/named3.conf.in | 40 + bin/tests/system/mkeys/ns1/root.db | 23 + bin/tests/system/mkeys/ns1/sign.sh | 37 + bin/tests/system/mkeys/ns2/named.args | 1 + bin/tests/system/mkeys/ns2/named.conf.in | 42 + bin/tests/system/mkeys/ns3/named.args | 1 + bin/tests/system/mkeys/ns3/named.conf.in | 47 + bin/tests/system/mkeys/ns5/named.conf.in | 41 + bin/tests/system/mkeys/ns5/named1.args | 1 + bin/tests/system/mkeys/ns5/named2.args | 1 + bin/tests/system/mkeys/prereq.sh | 15 + bin/tests/system/mkeys/setup.sh | 27 + bin/tests/system/mkeys/tests.sh | 714 + bin/tests/system/names/clean.sh | 17 + bin/tests/system/names/ns1/example.db | 49 + bin/tests/system/names/ns1/named.conf.in | 42 + bin/tests/system/names/setup.sh | 15 + bin/tests/system/names/tests.sh | 46 + bin/tests/system/notify/clean.sh | 35 + bin/tests/system/notify/ns1/named.conf.in | 27 + bin/tests/system/notify/ns1/root.db | 22 + bin/tests/system/notify/ns2/example1.db | 142 + bin/tests/system/notify/ns2/example2.db | 142 + bin/tests/system/notify/ns2/example3.db | 142 + bin/tests/system/notify/ns2/example4.db | 142 + bin/tests/system/notify/ns2/generic.db | 23 + bin/tests/system/notify/ns2/named.conf.in | 70 + bin/tests/system/notify/ns3/named.conf.in | 34 + bin/tests/system/notify/ns4/named.conf.in | 34 + bin/tests/system/notify/ns4/named.port.in | 1 + bin/tests/system/notify/ns5/named.conf.in | 68 + bin/tests/system/notify/ns5/x21.db | 20 + bin/tests/system/notify/setup.sh | 26 + bin/tests/system/notify/tests.sh | 212 + bin/tests/system/nslookup/clean.sh | 15 + bin/tests/system/nslookup/ns1/example.net.db | 29 + bin/tests/system/nslookup/ns1/named.conf.in | 31 + bin/tests/system/nslookup/setup.sh | 19 + bin/tests/system/nslookup/tests.sh | 110 + bin/tests/system/nsupdate/ans4/ans.pl | 58 + bin/tests/system/nsupdate/clean.sh | 60 + bin/tests/system/nsupdate/commandlist | 15 + bin/tests/system/nsupdate/knowngood.ns1.after | 99 + bin/tests/system/nsupdate/knowngood.ns1.afterstop | 3 + bin/tests/system/nsupdate/knowngood.ns1.before | 98 + bin/tests/system/nsupdate/krb/setup.sh | 113 + bin/tests/system/nsupdate/ns1/example1.db | 144 + bin/tests/system/nsupdate/ns1/many.test.db.in | 20 + bin/tests/system/nsupdate/ns1/max-ttl.db | 27 + bin/tests/system/nsupdate/ns1/named.conf.in | 134 + bin/tests/system/nsupdate/ns1/sample.db.in | 17 + bin/tests/system/nsupdate/ns10/dns.keytab | Bin 0 -> 168 bytes bin/tests/system/nsupdate/ns10/example.com.db.in | 19 + bin/tests/system/nsupdate/ns10/in-addr.db.in | 19 + bin/tests/system/nsupdate/ns10/machine.ccache | Bin 0 -> 1217 bytes bin/tests/system/nsupdate/ns10/named.conf.in | 48 + bin/tests/system/nsupdate/ns2/named.conf.in | 64 + bin/tests/system/nsupdate/ns2/sample.db.in | 19 + .../system/nsupdate/ns3/delegation.test.db.in | 13 + bin/tests/system/nsupdate/ns3/dnskey.test.db.in | 13 + bin/tests/system/nsupdate/ns3/example.db.in | 13 + bin/tests/system/nsupdate/ns3/named.conf.in | 64 + .../system/nsupdate/ns3/nsec3param.test.db.in | 13 + bin/tests/system/nsupdate/ns3/sign.sh | 46 + bin/tests/system/nsupdate/ns3/too-big.test.db.in | 13 + bin/tests/system/nsupdate/ns5/local.db.in | 23 + bin/tests/system/nsupdate/ns5/named.args | 1 + bin/tests/system/nsupdate/ns5/named.conf.in | 38 + bin/tests/system/nsupdate/ns6/in-addr.db.in | 19 + bin/tests/system/nsupdate/ns6/named.args | 1 + bin/tests/system/nsupdate/ns6/named.conf.in | 38 + bin/tests/system/nsupdate/ns7/dns.keytab | Bin 0 -> 166 bytes bin/tests/system/nsupdate/ns7/example.com.db.in | 19 + bin/tests/system/nsupdate/ns7/in-addr.db.in | 19 + bin/tests/system/nsupdate/ns7/machine.ccache | Bin 0 -> 1327 bytes bin/tests/system/nsupdate/ns7/named.conf.in | 48 + bin/tests/system/nsupdate/ns8/dns.keytab | Bin 0 -> 166 bytes bin/tests/system/nsupdate/ns8/example.com.db.in | 19 + bin/tests/system/nsupdate/ns8/in-addr.db.in | 19 + bin/tests/system/nsupdate/ns8/machine.ccache | Bin 0 -> 1327 bytes bin/tests/system/nsupdate/ns8/named.conf.in | 48 + bin/tests/system/nsupdate/ns9/dns.keytab | Bin 0 -> 166 bytes bin/tests/system/nsupdate/ns9/example.com.db.in | 19 + bin/tests/system/nsupdate/ns9/in-addr.db.in | 19 + bin/tests/system/nsupdate/ns9/machine.ccache | Bin 0 -> 1215 bytes bin/tests/system/nsupdate/ns9/named.conf.in | 48 + bin/tests/system/nsupdate/prereq.sh | 26 + bin/tests/system/nsupdate/setup.sh | 90 + bin/tests/system/nsupdate/tests.sh | 1253 ++ bin/tests/system/nsupdate/update_test.pl | 418 + bin/tests/system/nsupdate/verylarge.in | 3 + bin/tests/system/nzd2nzf/clean.sh | 18 + bin/tests/system/nzd2nzf/ns1/added.db | 24 + bin/tests/system/nzd2nzf/ns1/named.conf.in | 29 + bin/tests/system/nzd2nzf/prereq.sh | 18 + bin/tests/system/nzd2nzf/setup.sh | 17 + bin/tests/system/nzd2nzf/tests.sh | 72 + bin/tests/system/org.isc.bind.system | 16 + bin/tests/system/org.isc.bind.system.plist | 17 + bin/tests/system/packet.pl | 100 + bin/tests/system/pending/clean.sh | 24 + bin/tests/system/pending/ns1/named.conf.in | 28 + bin/tests/system/pending/ns1/root.db.in | 27 + bin/tests/system/pending/ns1/sign.sh | 34 + bin/tests/system/pending/ns2/example.com.db.in | 25 + bin/tests/system/pending/ns2/example.db.in | 24 + bin/tests/system/pending/ns2/forgery.db | 22 + bin/tests/system/pending/ns2/named.conf.in | 50 + bin/tests/system/pending/ns2/sign.sh | 32 + bin/tests/system/pending/ns3/hostile.db | 20 + bin/tests/system/pending/ns3/mail.example.db | 21 + bin/tests/system/pending/ns3/named.conf.in | 43 + bin/tests/system/pending/ns4/named.conf.in | 28 + bin/tests/system/pending/prereq.sh | 15 + bin/tests/system/pending/setup.sh | 22 + bin/tests/system/pending/tests.sh | 197 + bin/tests/system/pipelined/Makefile.in | 46 + bin/tests/system/pipelined/clean.sh | 16 + bin/tests/system/pipelined/input | 8 + bin/tests/system/pipelined/inputb | 8 + bin/tests/system/pipelined/ns1/named.conf.in | 36 + bin/tests/system/pipelined/ns1/root.db | 25 + bin/tests/system/pipelined/ns2/examplea.db | 30 + bin/tests/system/pipelined/ns2/named.conf.in | 42 + bin/tests/system/pipelined/ns3/exampleb.db | 30 + bin/tests/system/pipelined/ns3/named.args | 1 + bin/tests/system/pipelined/ns3/named.conf.in | 42 + bin/tests/system/pipelined/ns4/named.conf.in | 38 + bin/tests/system/pipelined/pipequeries.c | 346 + bin/tests/system/pipelined/ref | 8 + bin/tests/system/pipelined/refb | 8 + bin/tests/system/pipelined/setup.sh | 22 + bin/tests/system/pipelined/tests.sh | 75 + bin/tests/system/pkcs11/clean.sh | 16 + bin/tests/system/pkcs11/ns1/example.db.in | 22 + bin/tests/system/pkcs11/ns1/named.conf | 51 + bin/tests/system/pkcs11/prereq.sh | 36 + bin/tests/system/pkcs11/setup.sh | 98 + bin/tests/system/pkcs11/tests.sh | 87 + bin/tests/system/pkcs11/usepkcs11 | 1 + bin/tests/system/pkcs11ssl/clean.sh | 16 + bin/tests/system/pkcs11ssl/ns1/example.db.in | 22 + bin/tests/system/pkcs11ssl/ns1/named.conf | 45 + bin/tests/system/pkcs11ssl/prereq.sh | 16 + bin/tests/system/pkcs11ssl/setup.sh | 40 + bin/tests/system/pkcs11ssl/tests.sh | 62 + bin/tests/system/pkcs11ssl/usepkcs11 | 1 + bin/tests/system/reclimit/README | 13 + bin/tests/system/reclimit/ans2/ans.pl | 233 + bin/tests/system/reclimit/ans7/ans.pl | 74 + bin/tests/system/reclimit/clean.sh | 18 + bin/tests/system/reclimit/ns1/named.conf.in | 24 + bin/tests/system/reclimit/ns1/root.db | 17 + bin/tests/system/reclimit/ns3/hints.db | 11 + bin/tests/system/reclimit/ns3/named1.conf.in | 34 + bin/tests/system/reclimit/ns3/named2.conf.in | 34 + bin/tests/system/reclimit/ns3/named3.conf.in | 35 + bin/tests/system/reclimit/ns3/named4.conf.in | 35 + bin/tests/system/reclimit/prereq.sh | 35 + bin/tests/system/reclimit/setup.sh | 17 + bin/tests/system/reclimit/tests.sh | 191 + bin/tests/system/redirect/clean.sh | 30 + bin/tests/system/redirect/conf/bad1.conf | 23 + bin/tests/system/redirect/conf/bad2.conf | 23 + bin/tests/system/redirect/conf/bad3.conf | 22 + bin/tests/system/redirect/conf/good1.conf | 20 + bin/tests/system/redirect/conf/good2.conf | 20 + bin/tests/system/redirect/conf/good3.conf | 21 + bin/tests/system/redirect/conf/good4.conf | 21 + bin/tests/system/redirect/ns1/example.db | 48 + bin/tests/system/redirect/ns1/named.conf.in | 56 + bin/tests/system/redirect/ns1/redirect.db | 18 + bin/tests/system/redirect/ns1/root.db | 17 + bin/tests/system/redirect/ns1/sign.sh | 35 + bin/tests/system/redirect/ns2/example.db.in | 14 + bin/tests/system/redirect/ns2/named.conf.in | 56 + bin/tests/system/redirect/ns2/redirect.db.in | 18 + bin/tests/system/redirect/ns3/example.db | 48 + bin/tests/system/redirect/ns3/named.conf.in | 53 + bin/tests/system/redirect/ns3/redirect.db | 14 + bin/tests/system/redirect/ns3/root.db | 18 + bin/tests/system/redirect/ns3/sign.sh | 35 + bin/tests/system/redirect/ns4/example.db.in | 14 + bin/tests/system/redirect/ns4/named.conf.in | 51 + bin/tests/system/redirect/ns4/root.hint | 12 + bin/tests/system/redirect/prereq.sh | 15 + bin/tests/system/redirect/setup.sh | 29 + bin/tests/system/redirect/tests.sh | 522 + bin/tests/system/resolver/ans2/ans.pl | 115 + bin/tests/system/resolver/ans3/ans.pl | 99 + bin/tests/system/resolver/ans8/ans.pl | 145 + bin/tests/system/resolver/clean.sh | 36 + bin/tests/system/resolver/ns1/named.conf.in | 61 + bin/tests/system/resolver/ns1/root.hint | 12 + bin/tests/system/resolver/ns4/broken.db | 22 + bin/tests/system/resolver/ns4/child.server.db | 21 + bin/tests/system/resolver/ns4/moves.db | 20 + bin/tests/system/resolver/ns4/named.conf.in | 60 + bin/tests/system/resolver/ns4/named.noaa | 5 + bin/tests/system/resolver/ns4/root.db | 26 + bin/tests/system/resolver/ns4/tld1.db | 29 + bin/tests/system/resolver/ns4/tld2.db | 29 + bin/tests/system/resolver/ns5/child.server.db | 21 + bin/tests/system/resolver/ns5/moves.db | 20 + bin/tests/system/resolver/ns5/named.conf.in | 49 + bin/tests/system/resolver/ns5/root.hint | 12 + bin/tests/system/resolver/ns6/broken.db | 26 + bin/tests/system/resolver/ns6/delegation-only.db | 31 + bin/tests/system/resolver/ns6/ds.example.net.db.in | 13 + bin/tests/system/resolver/ns6/example.net.db.in | 21 + bin/tests/system/resolver/ns6/keygen.sh | 34 + bin/tests/system/resolver/ns6/moves.db | 20 + bin/tests/system/resolver/ns6/named.conf.in | 69 + .../system/resolver/ns6/no-edns-version.tld.db | 12 + bin/tests/system/resolver/ns6/root.db | 31 + .../system/resolver/ns6/to-be-removed.tld.db.in | 26 + bin/tests/system/resolver/ns7/all-cnames.db | 18 + bin/tests/system/resolver/ns7/edns-version.tld.db | 12 + bin/tests/system/resolver/ns7/named.args | 2 + bin/tests/system/resolver/ns7/named1.conf.in | 61 + bin/tests/system/resolver/ns7/named2.conf.in | 61 + bin/tests/system/resolver/ns7/root.hint | 12 + bin/tests/system/resolver/ns7/server.db.in | 22 + bin/tests/system/resolver/prereq.sh | 29 + bin/tests/system/resolver/setup.sh | 27 + bin/tests/system/resolver/tests.sh | 783 + bin/tests/system/rndc/Makefile.in | 50 + bin/tests/system/rndc/clean.sh | 27 + bin/tests/system/rndc/gencheck.c | 88 + bin/tests/system/rndc/ns2/incl.db | 11 + bin/tests/system/rndc/ns2/named.conf.in | 62 + bin/tests/system/rndc/ns2/secondkey.conf | 19 + bin/tests/system/rndc/ns3/named.conf.in | 46 + bin/tests/system/rndc/ns4/named.conf.in | 26 + bin/tests/system/rndc/ns5/named.conf.in | 32 + bin/tests/system/rndc/ns6/named.args | 3 + bin/tests/system/rndc/ns6/named.conf.in | 27 + bin/tests/system/rndc/setup.sh | 45 + bin/tests/system/rndc/tests.sh | 660 + bin/tests/system/rootkeysentinel/clean.sh | 23 + bin/tests/system/rootkeysentinel/ns1/named.conf.in | 31 + bin/tests/system/rootkeysentinel/ns1/root.db.in | 22 + bin/tests/system/rootkeysentinel/ns1/sign.sh | 34 + bin/tests/system/rootkeysentinel/ns2/example.db.in | 19 + bin/tests/system/rootkeysentinel/ns2/named.conf.in | 31 + bin/tests/system/rootkeysentinel/ns2/sign.sh | 40 + bin/tests/system/rootkeysentinel/ns3/hint.db | 11 + bin/tests/system/rootkeysentinel/ns3/named.conf.in | 32 + bin/tests/system/rootkeysentinel/ns4/hint.db | 11 + bin/tests/system/rootkeysentinel/ns4/named.conf.in | 32 + bin/tests/system/rootkeysentinel/prereq.sh | 15 + bin/tests/system/rootkeysentinel/setup.sh | 25 + bin/tests/system/rootkeysentinel/tests.sh | 286 + bin/tests/system/rpz/clean.sh | 21 + bin/tests/system/rpz/ns1/named.conf.in | 24 + bin/tests/system/rpz/ns1/root.db | 35 + bin/tests/system/rpz/ns2/base-tld2s.db | 23 + bin/tests/system/rpz/ns2/bl.tld2.db.in | 19 + bin/tests/system/rpz/ns2/blv2.tld2.db.in | 17 + bin/tests/system/rpz/ns2/blv3.tld2.db.in | 19 + bin/tests/system/rpz/ns2/hints | 11 + bin/tests/system/rpz/ns2/named.conf.in | 45 + bin/tests/system/rpz/ns2/tld2.db | 120 + bin/tests/system/rpz/ns3/base.db | 20 + bin/tests/system/rpz/ns3/crash1 | 21 + bin/tests/system/rpz/ns3/crash2 | 27 + bin/tests/system/rpz/ns3/hints | 11 + bin/tests/system/rpz/ns3/named.conf.in | 91 + bin/tests/system/rpz/ns4/hints | 11 + bin/tests/system/rpz/ns4/named.conf.in | 31 + bin/tests/system/rpz/ns4/tld4.db | 64 + bin/tests/system/rpz/ns5/empty.db.in | 12 + bin/tests/system/rpz/ns5/hints | 11 + bin/tests/system/rpz/ns5/named.args | 3 + bin/tests/system/rpz/ns5/named.conf.in | 82 + bin/tests/system/rpz/ns5/tld5.db | 30 + bin/tests/system/rpz/ns6/hints | 11 + bin/tests/system/rpz/ns6/named.conf.in | 44 + bin/tests/system/rpz/ns7/hints | 11 + bin/tests/system/rpz/ns7/named.conf.in | 43 + bin/tests/system/rpz/prereq.sh | 15 + bin/tests/system/rpz/qperf.sh | 20 + bin/tests/system/rpz/setup.sh | 123 + bin/tests/system/rpz/test1 | 96 + bin/tests/system/rpz/test2 | 74 + bin/tests/system/rpz/test3 | 42 + bin/tests/system/rpz/test4 | 31 + bin/tests/system/rpz/test4a | 25 + bin/tests/system/rpz/test5 | 58 + bin/tests/system/rpz/test6 | 35 + bin/tests/system/rpz/tests.sh | 646 + bin/tests/system/rpzrecurse/README | 117 + bin/tests/system/rpzrecurse/ans5/ans.pl | 79 + bin/tests/system/rpzrecurse/clean.sh | 29 + bin/tests/system/rpzrecurse/ns1/db.l0 | 15 + bin/tests/system/rpzrecurse/ns1/db.l1.l0 | 15 + bin/tests/system/rpzrecurse/ns1/example.db | 14 + bin/tests/system/rpzrecurse/ns1/named.conf.in | 67 + bin/tests/system/rpzrecurse/ns1/root.db | 22 + .../system/rpzrecurse/ns1/test1.example.net.db | 15 + .../system/rpzrecurse/ns1/test2.example.net.db | 15 + bin/tests/system/rpzrecurse/ns2/db.clientip1 | 15 + bin/tests/system/rpzrecurse/ns2/db.clientip2 | 14 + bin/tests/system/rpzrecurse/ns2/db.clientip21 | 15 + bin/tests/system/rpzrecurse/ns2/db.log1 | 14 + bin/tests/system/rpzrecurse/ns2/db.log2 | 15 + bin/tests/system/rpzrecurse/ns2/db.log3 | 16 + bin/tests/system/rpzrecurse/ns2/db.wildcard1 | 15 + bin/tests/system/rpzrecurse/ns2/db.wildcard2a | 15 + bin/tests/system/rpzrecurse/ns2/db.wildcard2b | 15 + bin/tests/system/rpzrecurse/ns2/db.wildcard3 | 14 + .../system/rpzrecurse/ns2/named.clientip.conf | 30 + .../system/rpzrecurse/ns2/named.clientip2.conf | 30 + .../system/rpzrecurse/ns2/named.conf.header.in | 35 + bin/tests/system/rpzrecurse/ns2/named.default.conf | 20 + bin/tests/system/rpzrecurse/ns2/named.log.conf | 32 + .../system/rpzrecurse/ns2/named.wildcard1.conf | 28 + .../system/rpzrecurse/ns2/named.wildcard2.conf | 30 + .../system/rpzrecurse/ns2/named.wildcard3.conf | 28 + bin/tests/system/rpzrecurse/ns2/root.hint | 12 + bin/tests/system/rpzrecurse/ns3/example.db | 15 + bin/tests/system/rpzrecurse/ns3/named1.conf.in | 35 + bin/tests/system/rpzrecurse/ns3/named2.conf.in | 34 + bin/tests/system/rpzrecurse/ns3/policy.db | 13 + bin/tests/system/rpzrecurse/ns3/root.db | 15 + bin/tests/system/rpzrecurse/ns4/child.example.db | 16 + bin/tests/system/rpzrecurse/ns4/named.conf.in | 26 + bin/tests/system/rpzrecurse/prereq.sh | 32 + bin/tests/system/rpzrecurse/setup.sh | 43 + bin/tests/system/rpzrecurse/testgen.pl | 341 + bin/tests/system/rpzrecurse/tests.sh | 389 + bin/tests/system/rrchecker/classlist.good | 3 + bin/tests/system/rrchecker/clean.sh | 11 + bin/tests/system/rrchecker/privatelist.good | 0 bin/tests/system/rrchecker/tests.sh | 82 + bin/tests/system/rrchecker/typelist.good | 77 + bin/tests/system/rrl/broken.conf | 47 + bin/tests/system/rrl/clean.sh | 17 + bin/tests/system/rrl/ns1/named.conf.in | 24 + bin/tests/system/rrl/ns1/root.db | 26 + bin/tests/system/rrl/ns2/hints | 13 + bin/tests/system/rrl/ns2/named.conf.in | 63 + bin/tests/system/rrl/ns2/tld2.db | 42 + bin/tests/system/rrl/ns3/hints | 13 + bin/tests/system/rrl/ns3/named.conf.in | 44 + bin/tests/system/rrl/ns3/tld3.db | 20 + bin/tests/system/rrl/ns4/hints | 13 + bin/tests/system/rrl/ns4/named.conf.in | 64 + bin/tests/system/rrl/ns4/tld4.db | 42 + bin/tests/system/rrl/setup.sh | 20 + bin/tests/system/rrl/tests.sh | 282 + bin/tests/system/rrsetorder/clean.sh | 20 + bin/tests/system/rrsetorder/dig.out.fixed.good | 4 + bin/tests/system/rrsetorder/dig.out.random.good1 | 4 + bin/tests/system/rrsetorder/dig.out.random.good10 | 4 + bin/tests/system/rrsetorder/dig.out.random.good11 | 4 + bin/tests/system/rrsetorder/dig.out.random.good12 | 4 + bin/tests/system/rrsetorder/dig.out.random.good13 | 4 + bin/tests/system/rrsetorder/dig.out.random.good14 | 4 + bin/tests/system/rrsetorder/dig.out.random.good15 | 4 + bin/tests/system/rrsetorder/dig.out.random.good16 | 4 + bin/tests/system/rrsetorder/dig.out.random.good17 | 4 + bin/tests/system/rrsetorder/dig.out.random.good18 | 4 + bin/tests/system/rrsetorder/dig.out.random.good19 | 4 + bin/tests/system/rrsetorder/dig.out.random.good2 | 4 + bin/tests/system/rrsetorder/dig.out.random.good20 | 4 + bin/tests/system/rrsetorder/dig.out.random.good21 | 4 + bin/tests/system/rrsetorder/dig.out.random.good22 | 4 + bin/tests/system/rrsetorder/dig.out.random.good23 | 4 + bin/tests/system/rrsetorder/dig.out.random.good24 | 4 + bin/tests/system/rrsetorder/dig.out.random.good3 | 4 + bin/tests/system/rrsetorder/dig.out.random.good4 | 4 + bin/tests/system/rrsetorder/dig.out.random.good5 | 4 + bin/tests/system/rrsetorder/dig.out.random.good6 | 4 + bin/tests/system/rrsetorder/dig.out.random.good7 | 4 + bin/tests/system/rrsetorder/dig.out.random.good8 | 4 + bin/tests/system/rrsetorder/dig.out.random.good9 | 4 + bin/tests/system/rrsetorder/ns1/named.conf.in | 36 + bin/tests/system/rrsetorder/ns1/root.db | 39 + bin/tests/system/rrsetorder/ns2/named.conf.in | 36 + bin/tests/system/rrsetorder/ns3/named.conf.in | 35 + bin/tests/system/rrsetorder/ns4/named.conf.in | 32 + bin/tests/system/rrsetorder/setup.sh | 19 + bin/tests/system/rrsetorder/tests.sh | 472 + bin/tests/system/rsabigexponent/Makefile.in | 50 + bin/tests/system/rsabigexponent/bigkey.c | 258 + bin/tests/system/rsabigexponent/clean.sh | 20 + bin/tests/system/rsabigexponent/conf/bad01.conf | 14 + bin/tests/system/rsabigexponent/conf/bad02.conf | 14 + bin/tests/system/rsabigexponent/conf/bad03.conf | 14 + bin/tests/system/rsabigexponent/conf/good01.conf | 14 + bin/tests/system/rsabigexponent/conf/good02.conf | 14 + bin/tests/system/rsabigexponent/conf/good03.conf | 14 + bin/tests/system/rsabigexponent/ns1/named.conf.in | 33 + bin/tests/system/rsabigexponent/ns1/root.db.in | 22 + bin/tests/system/rsabigexponent/ns1/sign.sh | 32 + .../rsabigexponent/ns2/Xexample.+005+05896.key | 2 + .../rsabigexponent/ns2/Xexample.+005+05896.private | 10 + .../rsabigexponent/ns2/Xexample.+005+51829.key | 2 + .../rsabigexponent/ns2/Xexample.+005+51829.private | 10 + .../system/rsabigexponent/ns2/dsset-example.in | 2 + bin/tests/system/rsabigexponent/ns2/example.db.bad | 110 + bin/tests/system/rsabigexponent/ns2/example.db.in | 21 + bin/tests/system/rsabigexponent/ns2/named.conf.in | 37 + bin/tests/system/rsabigexponent/ns2/sign.sh | 27 + bin/tests/system/rsabigexponent/ns3/named.conf.in | 34 + bin/tests/system/rsabigexponent/prereq.sh | 24 + bin/tests/system/rsabigexponent/setup.sh | 23 + bin/tests/system/rsabigexponent/tests.sh | 55 + bin/tests/system/run.sh | 207 + bin/tests/system/runall.sh | 96 + bin/tests/system/runsequential.sh | 25 + bin/tests/system/runtime/README | 6 + bin/tests/system/runtime/clean.sh | 20 + bin/tests/system/runtime/ns2/named-alt1.conf.in | 33 + bin/tests/system/runtime/ns2/named-alt2.conf.in | 33 + bin/tests/system/runtime/ns2/named-alt3.conf.in | 34 + bin/tests/system/runtime/ns2/named-alt4.conf.in | 30 + bin/tests/system/runtime/ns2/named-alt5.conf.in | 29 + bin/tests/system/runtime/ns2/named-alt6.conf.in | 30 + bin/tests/system/runtime/ns2/named1.conf.in | 33 + bin/tests/system/runtime/setup.sh | 35 + bin/tests/system/runtime/tests.sh | 153 + bin/tests/system/send.pl | 31 + bin/tests/system/setup.sh | 32 + bin/tests/system/sfcache/README | 12 + bin/tests/system/sfcache/clean.sh | 19 + bin/tests/system/sfcache/ns1/named.conf.in | 33 + bin/tests/system/sfcache/ns1/root.db.in | 22 + bin/tests/system/sfcache/ns1/sign.sh | 34 + bin/tests/system/sfcache/ns2/example.db.in | 101 + bin/tests/system/sfcache/ns2/named.conf.in | 48 + bin/tests/system/sfcache/ns2/sign.sh | 24 + bin/tests/system/sfcache/ns5/named.conf.in | 43 + bin/tests/system/sfcache/ns5/trusted.conf.bad | 14 + bin/tests/system/sfcache/prereq.sh | 23 + bin/tests/system/sfcache/setup.sh | 26 + bin/tests/system/sfcache/tests.sh | 96 + bin/tests/system/smartsign/child.db | 22 + bin/tests/system/smartsign/clean.sh | 13 + bin/tests/system/smartsign/parent.db | 29 + bin/tests/system/smartsign/prereq.sh | 15 + bin/tests/system/smartsign/setup.sh | 17 + bin/tests/system/smartsign/tests.sh | 342 + bin/tests/system/sortlist/clean.sh | 16 + bin/tests/system/sortlist/ns1/example.db | 35 + bin/tests/system/sortlist/ns1/named.conf.in | 43 + bin/tests/system/sortlist/ns1/root.db | 22 + bin/tests/system/sortlist/setup.sh | 16 + bin/tests/system/sortlist/tests.sh | 49 + bin/tests/system/spf/clean.sh | 13 + bin/tests/system/spf/ns1/named.conf.in | 40 + bin/tests/system/spf/ns1/spf.db | 16 + bin/tests/system/spf/setup.sh | 16 + bin/tests/system/spf/tests.sh | 37 + bin/tests/system/start.pl | 345 + bin/tests/system/start.sh | 13 + bin/tests/system/staticstub/clean.sh | 25 + bin/tests/system/staticstub/conf/bad01.conf | 30 + bin/tests/system/staticstub/conf/bad02.conf | 30 + bin/tests/system/staticstub/conf/bad03.conf | 30 + bin/tests/system/staticstub/conf/bad04.conf | 30 + bin/tests/system/staticstub/conf/bad05.conf | 31 + bin/tests/system/staticstub/conf/bad06.conf | 31 + bin/tests/system/staticstub/conf/bad07.conf | 31 + bin/tests/system/staticstub/conf/bad08.conf | 31 + bin/tests/system/staticstub/conf/bad09.conf | 30 + bin/tests/system/staticstub/conf/bad10.conf | 32 + bin/tests/system/staticstub/conf/bad11.conf | 32 + bin/tests/system/staticstub/conf/good01.conf | 31 + bin/tests/system/staticstub/conf/good02.conf | 30 + bin/tests/system/staticstub/conf/good03.conf | 30 + bin/tests/system/staticstub/conf/good04.conf | 30 + bin/tests/system/staticstub/conf/good05.conf | 31 + bin/tests/system/staticstub/knowngood.dig.out.rec | 18 + bin/tests/system/staticstub/ns1/named.conf.in | 22 + bin/tests/system/staticstub/ns1/root.db | 17 + bin/tests/system/staticstub/ns2/named.conf.in | 59 + bin/tests/system/staticstub/ns3/example.db.in | 30 + bin/tests/system/staticstub/ns3/example.org.db | 22 + bin/tests/system/staticstub/ns3/named.conf.in | 43 + bin/tests/system/staticstub/ns3/sign.sh | 42 + bin/tests/system/staticstub/ns3/undelegated.db.in | 21 + bin/tests/system/staticstub/ns4/example.com.db | 21 + bin/tests/system/staticstub/ns4/example.info.db | 22 + bin/tests/system/staticstub/ns4/example.org.db | 23 + bin/tests/system/staticstub/ns4/named.conf.in | 42 + bin/tests/system/staticstub/ns4/sign.sh | 24 + bin/tests/system/staticstub/ns4/sub.example.db.in | 24 + bin/tests/system/staticstub/prereq.sh | 15 + bin/tests/system/staticstub/setup.sh | 28 + bin/tests/system/staticstub/tests.sh | 216 + bin/tests/system/statistics/ans4/ans.pl | 116 + bin/tests/system/statistics/clean.sh | 26 + bin/tests/system/statistics/ns1/named.conf.in | 41 + bin/tests/system/statistics/ns1/root.db | 22 + bin/tests/system/statistics/ns1/zone.db | 12 + bin/tests/system/statistics/ns2/example.db | 26 + bin/tests/system/statistics/ns2/internal.db | 28 + bin/tests/system/statistics/ns2/named.conf.in | 47 + bin/tests/system/statistics/ns3/internal.db | 26 + bin/tests/system/statistics/ns3/named.conf.in | 47 + bin/tests/system/statistics/ns3/root.hint | 12 + bin/tests/system/statistics/prereq.sh | 27 + bin/tests/system/statistics/setup.sh | 18 + bin/tests/system/statistics/tests.sh | 164 + bin/tests/system/statschannel/clean.sh | 20 + bin/tests/system/statschannel/fetch.pl | 41 + bin/tests/system/statschannel/ns2/example.db | 47 + bin/tests/system/statschannel/ns2/named.conf.in | 40 + bin/tests/system/statschannel/prereq.sh | 25 + bin/tests/system/statschannel/server-json.pl | 33 + bin/tests/system/statschannel/server-xml.pl | 23 + bin/tests/system/statschannel/setup.sh | 17 + bin/tests/system/statschannel/tests.sh | 215 + bin/tests/system/statschannel/traffic-json.pl | 47 + bin/tests/system/statschannel/traffic-xml.pl | 44 + bin/tests/system/statschannel/traffic.expect.1 | 2 + bin/tests/system/statschannel/traffic.expect.2 | 4 + bin/tests/system/statschannel/traffic.expect.4 | 5 + bin/tests/system/statschannel/traffic.expect.5 | 7 + bin/tests/system/statschannel/traffic.expect.6 | 8 + bin/tests/system/stop.pl | 193 + bin/tests/system/stop.sh | 14 + bin/tests/system/stopall.sh | 22 + bin/tests/system/stress/clean.sh | 22 + bin/tests/system/stress/ns1/named.conf | 29 + bin/tests/system/stress/ns2/named.conf | 31 + bin/tests/system/stress/ns3/named.conf | 48 + bin/tests/system/stress/ns4/named.conf | 33 + bin/tests/system/stress/prereq.sh | 21 + bin/tests/system/stress/setup.pl | 83 + bin/tests/system/stress/setup.sh | 16 + bin/tests/system/stress/tests.sh | 37 + bin/tests/system/stress/update.pl | 99 + bin/tests/system/stub/clean.sh | 19 + bin/tests/system/stub/knowngood.dig.out.norec | 21 + bin/tests/system/stub/knowngood.dig.out.rec | 18 + bin/tests/system/stub/ns1/named.conf.in | 27 + bin/tests/system/stub/ns1/root.db | 22 + bin/tests/system/stub/ns2/child.example.db | 20 + bin/tests/system/stub/ns2/named.conf.in | 32 + bin/tests/system/stub/ns3/example.db | 20 + bin/tests/system/stub/ns3/named.conf.in | 39 + bin/tests/system/stub/setup.sh | 19 + bin/tests/system/stub/tests.sh | 64 + bin/tests/system/tcp/clean.sh | 17 + bin/tests/system/tcp/ns1/named.conf.in | 37 + bin/tests/system/tcp/ns1/root.db | 22 + bin/tests/system/tcp/ns2/example.db | 26 + bin/tests/system/tcp/ns2/named.conf.in | 44 + bin/tests/system/tcp/ns3/named.conf.in | 39 + bin/tests/system/tcp/ns4/named.conf.in | 41 + bin/tests/system/tcp/setup.sh | 20 + bin/tests/system/tcp/tests.sh | 57 + bin/tests/system/testcrypto.sh | 68 + bin/tests/system/testsock.pl | 42 + bin/tests/system/testsock6.pl | 23 + bin/tests/system/testsummary.sh | 59 + bin/tests/system/tkey/Makefile.in | 54 + bin/tests/system/tkey/clean.sh | 17 + bin/tests/system/tkey/keycreate.c | 337 + bin/tests/system/tkey/keydelete.c | 271 + bin/tests/system/tkey/ns1/example.db | 25 + bin/tests/system/tkey/ns1/named.conf.in | 50 + bin/tests/system/tkey/ns1/setup.sh | 18 + bin/tests/system/tkey/prereq.sh | 15 + bin/tests/system/tkey/setup.sh | 19 + bin/tests/system/tkey/tests.sh | 147 + bin/tests/system/tsig/clean.sh | 22 + bin/tests/system/tsig/ns1/example.db | 161 + bin/tests/system/tsig/ns1/named.conf.in | 87 + bin/tests/system/tsig/setup.sh | 19 + bin/tests/system/tsig/tests.sh | 222 + bin/tests/system/tsiggss/authsock.pl | 89 + bin/tests/system/tsiggss/clean.sh | 25 + bin/tests/system/tsiggss/ns1/administrator.ccache | Bin 0 -> 2315 bytes bin/tests/system/tsiggss/ns1/dns.keytab | Bin 0 -> 1087 bytes bin/tests/system/tsiggss/ns1/example.nil.db.in | 51 + bin/tests/system/tsiggss/ns1/named.conf.in | 47 + bin/tests/system/tsiggss/ns1/testdenied.ccache | Bin 0 -> 2188 bytes bin/tests/system/tsiggss/prereq.sh | 22 + bin/tests/system/tsiggss/setup.sh | 22 + bin/tests/system/tsiggss/tests.sh | 105 + bin/tests/system/unknown/clean.sh | 19 + bin/tests/system/unknown/large.out | 1 + bin/tests/system/unknown/ns1/broken1.db | 21 + bin/tests/system/unknown/ns1/broken2.db | 21 + bin/tests/system/unknown/ns1/broken3.db | 21 + bin/tests/system/unknown/ns1/broken4.db | 21 + bin/tests/system/unknown/ns1/broken5.db | 21 + bin/tests/system/unknown/ns1/class10.hints | 11 + bin/tests/system/unknown/ns1/example-class10.db | 29 + bin/tests/system/unknown/ns1/example-in.db | 54 + bin/tests/system/unknown/ns1/large.db | 3009 +++ bin/tests/system/unknown/ns1/named.conf.in | 66 + bin/tests/system/unknown/ns2/named.conf.in | 30 + bin/tests/system/unknown/ns3/named.conf.in | 32 + bin/tests/system/unknown/ns3/sign.sh | 19 + bin/tests/system/unknown/prereq.sh | 15 + bin/tests/system/unknown/setup.sh | 21 + bin/tests/system/unknown/tests.sh | 189 + bin/tests/system/unknown/zones/nan.bad | 10 + bin/tests/system/upforwd/ans4/ans.pl | 361 + bin/tests/system/upforwd/clean.sh | 26 + bin/tests/system/upforwd/knowngood.after1 | 10 + bin/tests/system/upforwd/knowngood.after2 | 11 + bin/tests/system/upforwd/knowngood.before | 8 + bin/tests/system/upforwd/knowngood.ns2.before | 6 + bin/tests/system/upforwd/ns1/example1.db | 16 + bin/tests/system/upforwd/ns1/named.conf.in | 40 + bin/tests/system/upforwd/ns2/named.conf.in | 35 + bin/tests/system/upforwd/ns3/named.conf.in | 45 + bin/tests/system/upforwd/ns3/nomaster.db | 12 + bin/tests/system/upforwd/prereq.sh | 21 + bin/tests/system/upforwd/setup.sh | 36 + bin/tests/system/upforwd/tests.sh | 198 + bin/tests/system/verify/clean.sh | 17 + bin/tests/system/verify/prereq.sh | 15 + bin/tests/system/verify/setup.sh | 19 + bin/tests/system/verify/tests.sh | 108 + bin/tests/system/verify/zones/genzones.sh | 241 + bin/tests/system/verify/zones/unsigned.db | 27 + bin/tests/system/views/clean.sh | 31 + bin/tests/system/views/ns1/named.conf.in | 27 + bin/tests/system/views/ns1/root.db | 22 + bin/tests/system/views/ns2/1.10.in-addr.arpa.db | 11 + bin/tests/system/views/ns2/clone.db | 23 + bin/tests/system/views/ns2/example1.db | 26 + bin/tests/system/views/ns2/example2.db | 26 + bin/tests/system/views/ns2/external/inline.db | 27 + bin/tests/system/views/ns2/internal.db | 28 + bin/tests/system/views/ns2/internal/inline.db | 27 + bin/tests/system/views/ns2/named1.conf.in | 43 + bin/tests/system/views/ns2/named2.conf.in | 98 + bin/tests/system/views/ns3/child.clone.db | 21 + bin/tests/system/views/ns3/internal.db | 26 + bin/tests/system/views/ns3/named1.conf.in | 48 + bin/tests/system/views/ns3/named2.conf.in | 48 + bin/tests/system/views/ns5/child.clone.db | 21 + bin/tests/system/views/ns5/named.conf.in | 42 + bin/tests/system/views/setup.sh | 44 + bin/tests/system/views/tests.sh | 134 + bin/tests/system/wildcard/clean.sh | 25 + bin/tests/system/wildcard/ns1/dlv.db.in | 12 + bin/tests/system/wildcard/ns1/named.conf.in | 38 + bin/tests/system/wildcard/ns1/nsec.db.in | 15 + bin/tests/system/wildcard/ns1/nsec3.db.in | 15 + bin/tests/system/wildcard/ns1/private.nsec.db.in | 14 + bin/tests/system/wildcard/ns1/private.nsec3.db.in | 15 + bin/tests/system/wildcard/ns1/root.db.in | 16 + bin/tests/system/wildcard/ns1/sign.sh | 104 + bin/tests/system/wildcard/ns2/hints | 11 + bin/tests/system/wildcard/ns2/named.conf.in | 24 + bin/tests/system/wildcard/ns3/hints | 11 + bin/tests/system/wildcard/ns3/named.conf.in | 26 + bin/tests/system/wildcard/ns4/named.conf.in | 28 + bin/tests/system/wildcard/ns5/hints | 11 + bin/tests/system/wildcard/ns5/named.conf.in | 27 + bin/tests/system/wildcard/prereq.sh | 15 + bin/tests/system/wildcard/setup.sh | 25 + bin/tests/system/wildcard/tests.sh | 147 + bin/tests/system/win32/bigkey.dsp.in | 95 + bin/tests/system/win32/bigkey.dsw | 29 + bin/tests/system/win32/bigkey.mak.in | 346 + bin/tests/system/win32/bigkey.vcxproj.filters.in | 22 + bin/tests/system/win32/bigkey.vcxproj.in | 110 + bin/tests/system/win32/bigkey.vcxproj.user | 3 + bin/tests/system/win32/feature-test.dsp.in | 95 + bin/tests/system/win32/feature-test.dsw | 29 + bin/tests/system/win32/feature-test.mak.in | 318 + .../system/win32/feature-test.vcxproj.filters.in | 22 + bin/tests/system/win32/feature-test.vcxproj.in | 110 + bin/tests/system/win32/feature-test.vcxproj.user | 3 + bin/tests/system/win32/gencheck.dsp.in | 95 + bin/tests/system/win32/gencheck.dsw | 29 + bin/tests/system/win32/gencheck.mak.in | 318 + bin/tests/system/win32/gencheck.vcxproj.filters.in | 22 + bin/tests/system/win32/gencheck.vcxproj.in | 110 + bin/tests/system/win32/gencheck.vcxproj.user | 3 + bin/tests/system/win32/keycreate.dsp.in | 95 + bin/tests/system/win32/keycreate.dsw | 29 + bin/tests/system/win32/keycreate.mak.in | 346 + .../system/win32/keycreate.vcxproj.filters.in | 22 + bin/tests/system/win32/keycreate.vcxproj.in | 110 + bin/tests/system/win32/keycreate.vcxproj.user | 3 + bin/tests/system/win32/keydelete.dsp.in | 95 + bin/tests/system/win32/keydelete.dsw | 29 + bin/tests/system/win32/keydelete.mak.in | 346 + .../system/win32/keydelete.vcxproj.filters.in | 22 + bin/tests/system/win32/keydelete.vcxproj.in | 110 + bin/tests/system/win32/keydelete.vcxproj.user | 3 + bin/tests/system/win32/lwtest.dsp.in | 95 + bin/tests/system/win32/lwtest.dsw | 29 + bin/tests/system/win32/lwtest.mak.in | 346 + bin/tests/system/win32/lwtest.vcxproj.filters.in | 22 + bin/tests/system/win32/lwtest.vcxproj.in | 110 + bin/tests/system/win32/lwtest.vcxproj.user | 3 + bin/tests/system/win32/pipequeries.dsp.in | 95 + bin/tests/system/win32/pipequeries.dsw | 29 + bin/tests/system/win32/pipequeries.mak.in | 346 + .../system/win32/pipequeries.vcxproj.filters.in | 22 + bin/tests/system/win32/pipequeries.vcxproj.in | 110 + bin/tests/system/win32/pipequeries.vcxproj.user | 3 + bin/tests/system/xfer/ans5/badkeydata | 10 + bin/tests/system/xfer/ans5/goodaxfr | 10 + bin/tests/system/xfer/ans5/partial | 11 + bin/tests/system/xfer/ans5/unknownkey | 11 + bin/tests/system/xfer/ans5/unsigned | 11 + bin/tests/system/xfer/ans5/wrongkey | 11 + bin/tests/system/xfer/clean.sh | 35 + bin/tests/system/xfer/dig1.good | 155 + bin/tests/system/xfer/dig2.good | 155 + bin/tests/system/xfer/knowngood.mapped | 26 + bin/tests/system/xfer/ns1/axfr-too-big.db | 13 + bin/tests/system/xfer/ns1/ixfr-too-big.db.in | 16 + bin/tests/system/xfer/ns1/named.conf.in | 54 + bin/tests/system/xfer/ns1/root.db | 25 + bin/tests/system/xfer/ns2/mapped.db.in | 26 + bin/tests/system/xfer/ns2/named.conf.in | 72 + bin/tests/system/xfer/ns2/slave.db.in | 17 + bin/tests/system/xfer/ns3/named.conf.in | 72 + bin/tests/system/xfer/ns4/named.conf.base | 46 + bin/tests/system/xfer/ns4/root.db.in | 12 + bin/tests/system/xfer/ns6/named.conf.in | 67 + bin/tests/system/xfer/ns7/named.conf.in | 52 + bin/tests/system/xfer/ns8/example.db | 22 + bin/tests/system/xfer/ns8/named.conf.in | 44 + bin/tests/system/xfer/prereq.sh | 27 + bin/tests/system/xfer/setup.sh | 45 + bin/tests/system/xfer/tests.sh | 468 + bin/tests/system/xferquota/clean.sh | 23 + bin/tests/system/xferquota/ns1/changing1.db | 25 + bin/tests/system/xferquota/ns1/changing2.db | 25 + bin/tests/system/xferquota/ns1/named.conf.in | 43 + bin/tests/system/xferquota/ns1/root.db | 27 + bin/tests/system/xferquota/ns2/example.db | 144 + bin/tests/system/xferquota/ns2/named.conf.in | 38 + bin/tests/system/xferquota/setup.pl | 38 + bin/tests/system/xferquota/setup.sh | 26 + bin/tests/system/xferquota/tests.sh | 62 + bin/tests/system/zero/ans5/ans.pl | 79 + bin/tests/system/zero/clean.sh | 17 + bin/tests/system/zero/ns1/named.conf.in | 27 + bin/tests/system/zero/ns1/root.db | 24 + bin/tests/system/zero/ns2/named.conf.in | 32 + bin/tests/system/zero/ns2/tld.db | 18 + bin/tests/system/zero/ns3/named.conf.in | 27 + bin/tests/system/zero/ns3/root.hint | 11 + bin/tests/system/zero/ns4/named.conf.in | 33 + bin/tests/system/zero/ns4/one.tld.db | 15 + bin/tests/system/zero/prereq.sh | 21 + bin/tests/system/zero/setup.sh | 20 + bin/tests/system/zero/tests.sh | 89 + bin/tests/system/zonechecks/a.db | 12 + bin/tests/system/zonechecks/aaaa.db | 12 + bin/tests/system/zonechecks/bigserial.db | 12 + bin/tests/system/zonechecks/clean.sh | 19 + bin/tests/system/zonechecks/cname.db | 12 + bin/tests/system/zonechecks/dname.db | 12 + bin/tests/system/zonechecks/noaddress.db | 12 + bin/tests/system/zonechecks/ns1/named.conf.in | 71 + bin/tests/system/zonechecks/ns2/named.conf.in | 41 + bin/tests/system/zonechecks/nxdomain.db | 12 + bin/tests/system/zonechecks/prereq.sh | 15 + bin/tests/system/zonechecks/setup.sh | 34 + bin/tests/system/zonechecks/tests.sh | 255 + bin/tests/testdata/wire/wire_test.data | 9 + bin/tests/testdata/wire/wire_test.data2 | 14 + bin/tests/testdata/wire/wire_test.data3 | 14 + bin/tests/testdata/wire/wire_test.data4 | 31 + bin/tests/virtual-time/Makefile.in | 38 + bin/tests/virtual-time/README | 18 + bin/tests/virtual-time/autosign-ksk/clean.sh | 20 + .../virtual-time/autosign-ksk/ns1/example.db.in | 21 + bin/tests/virtual-time/autosign-ksk/ns1/named.conf | 50 + bin/tests/virtual-time/autosign-ksk/ns1/root.db | 23 + bin/tests/virtual-time/autosign-ksk/ns1/sign.sh | 33 + bin/tests/virtual-time/autosign-ksk/ns1/wrap.sh | 17 + bin/tests/virtual-time/autosign-ksk/setup.sh | 21 + bin/tests/virtual-time/autosign-ksk/tests.sh | 102 + bin/tests/virtual-time/autosign-zsk/clean.sh | 20 + .../virtual-time/autosign-zsk/ns1/example.db.in | 21 + bin/tests/virtual-time/autosign-zsk/ns1/named.conf | 50 + bin/tests/virtual-time/autosign-zsk/ns1/root.db | 23 + bin/tests/virtual-time/autosign-zsk/ns1/sign.sh | 33 + bin/tests/virtual-time/autosign-zsk/ns1/wrap.sh | 17 + bin/tests/virtual-time/autosign-zsk/setup.sh | 21 + bin/tests/virtual-time/autosign-zsk/tests.sh | 93 + bin/tests/virtual-time/cleanall.sh | 30 + bin/tests/virtual-time/common/controls.conf | 20 + bin/tests/virtual-time/common/rndc.conf | 19 + bin/tests/virtual-time/common/root.hint | 12 + bin/tests/virtual-time/conf.sh.in | 45 + bin/tests/virtual-time/run.sh | 102 + bin/tests/virtual-time/runall.sh | 33 + bin/tests/virtual-time/setup.sh | 30 + bin/tests/virtual-time/slave/clean.sh | 17 + bin/tests/virtual-time/slave/ns1/example.db.in | 21 + bin/tests/virtual-time/slave/ns1/named.conf | 45 + bin/tests/virtual-time/slave/ns1/root.db | 23 + bin/tests/virtual-time/slave/ns1/wrap.sh | 17 + bin/tests/virtual-time/slave/setup.sh | 11 + bin/tests/virtual-time/slave/tests.sh | 42 + bin/tests/virtual-time/start.pl | 177 + bin/tests/virtual-time/start.sh | 13 + bin/tests/virtual-time/stop.pl | 174 + bin/tests/virtual-time/stop.sh | 14 + bin/tests/virtual-time/testsock.pl | 43 + bin/tests/virtual-time/vtwrapper.c | 301 + bin/tests/win32/backtrace_test.dsp.in | 103 + bin/tests/win32/backtrace_test.dsw | 29 + bin/tests/win32/backtrace_test.mak.in | 299 + bin/tests/win32/backtrace_test.vcxproj.filters.in | 22 + bin/tests/win32/backtrace_test.vcxproj.in | 110 + bin/tests/win32/backtrace_test.vcxproj.user | 3 + bin/tests/win32/inter_test.dsp.in | 103 + bin/tests/win32/inter_test.dsw | 29 + bin/tests/win32/inter_test.mak.in | 299 + bin/tests/win32/inter_test.vcxproj.filters.in | 22 + bin/tests/win32/inter_test.vcxproj.in | 110 + bin/tests/win32/inter_test.vcxproj.user | 3 + bin/tests/win32/makejournal.dsp.in | 103 + bin/tests/win32/makejournal.dsw | 29 + bin/tests/win32/makejournal.mak.in | 299 + bin/tests/win32/makejournal.vcxproj.filters.in | 18 + bin/tests/win32/makejournal.vcxproj.in | 110 + bin/tests/win32/makejournal.vcxproj.user | 3 + bin/tests/win32/rwlock_test.dsp.in | 103 + bin/tests/win32/rwlock_test.dsw | 29 + bin/tests/win32/rwlock_test.mak.in | 299 + bin/tests/win32/rwlock_test.vcxproj.filters.in | 22 + bin/tests/win32/rwlock_test.vcxproj.in | 110 + bin/tests/win32/rwlock_test.vcxproj.user | 3 + bin/tests/win32/shutdown_test.dsp.in | 103 + bin/tests/win32/shutdown_test.dsw | 29 + bin/tests/win32/shutdown_test.mak.in | 299 + bin/tests/win32/shutdown_test.vcxproj.filters.in | 22 + bin/tests/win32/shutdown_test.vcxproj.in | 110 + bin/tests/win32/shutdown_test.vcxproj.user | 3 + bin/tests/win32/sock_test.dsp.in | 103 + bin/tests/win32/sock_test.dsw | 29 + bin/tests/win32/sock_test.mak.in | 299 + bin/tests/win32/sock_test.vcxproj.filters.in | 22 + bin/tests/win32/sock_test.vcxproj.in | 110 + bin/tests/win32/sock_test.vcxproj.user | 3 + bin/tests/win32/task_test.dsp.in | 103 + bin/tests/win32/task_test.dsw | 29 + bin/tests/win32/task_test.mak.in | 299 + bin/tests/win32/task_test.vcxproj.filters.in | 22 + bin/tests/win32/task_test.vcxproj.in | 110 + bin/tests/win32/task_test.vcxproj.user | 3 + bin/tests/win32/timer_test.dsp.in | 103 + bin/tests/win32/timer_test.dsw | 29 + bin/tests/win32/timer_test.mak.in | 299 + bin/tests/win32/timer_test.vcxproj.filters.in | 22 + bin/tests/win32/timer_test.vcxproj.in | 110 + bin/tests/win32/timer_test.vcxproj.user | 3 + bin/tests/wire_test.c | 348 + 2089 files changed, 158656 insertions(+) create mode 100644 bin/tests/Makefile.in create mode 100644 bin/tests/bigtest/README create mode 100644 bin/tests/bigtest/buildzones.sh create mode 100644 bin/tests/bigtest/rndc.key create mode 100644 bin/tests/bigtest/tests.sh create mode 100644 bin/tests/bigtest/zones create mode 100644 bin/tests/cfg_test.c create mode 100644 bin/tests/fromhex.pl create mode 100644 bin/tests/headerdep_test.sh.in create mode 100644 bin/tests/makejournal.c create mode 100644 bin/tests/named.conf create mode 100644 bin/tests/optional/Kchild.example.+003+04017.key create mode 100644 bin/tests/optional/Kchild.example.+003+04017.private create mode 100644 bin/tests/optional/Makefile.in create mode 100644 bin/tests/optional/adb_test.c create mode 100644 bin/tests/optional/backtrace_test.c create mode 100644 bin/tests/optional/byaddr_test.c create mode 100644 bin/tests/optional/byname_test.c create mode 100644 bin/tests/optional/db_test.c create mode 100644 bin/tests/optional/dst_test.c create mode 100644 bin/tests/optional/entropy2_test.c create mode 100644 bin/tests/optional/entropy_test.c create mode 100644 bin/tests/optional/fsaccess_test.c create mode 100644 bin/tests/optional/gsstest.c create mode 100644 bin/tests/optional/gxba_test.c create mode 100644 bin/tests/optional/gxbn_test.c create mode 100644 bin/tests/optional/hash_test.c create mode 100644 bin/tests/optional/inter_test.c create mode 100644 bin/tests/optional/keyboard_test.c create mode 100644 bin/tests/optional/lex_test.c create mode 100644 bin/tests/optional/lfsr_test.c create mode 100644 bin/tests/optional/log_test.c create mode 100644 bin/tests/optional/lwres_test.c create mode 100644 bin/tests/optional/lwresconf_test.c create mode 100644 bin/tests/optional/master_test.c create mode 100644 bin/tests/optional/mempool_test.c create mode 100644 bin/tests/optional/name_test.c create mode 100644 bin/tests/optional/nsecify.c create mode 100644 bin/tests/optional/ratelimiter_test.c create mode 100644 bin/tests/optional/rbt_test.c create mode 100644 bin/tests/optional/rbt_test.out create mode 100644 bin/tests/optional/rbt_test.txt create mode 100644 bin/tests/optional/rwlock_test.c create mode 100644 bin/tests/optional/serial_test.c create mode 100644 bin/tests/optional/shutdown_test.c create mode 100644 bin/tests/optional/sig0_test.c create mode 100644 bin/tests/optional/sock_test.c create mode 100644 bin/tests/optional/sym_test.c create mode 100644 bin/tests/optional/task_test.c create mode 100644 bin/tests/optional/timer_test.c create mode 100644 bin/tests/optional/zone_test.c create mode 100644 bin/tests/pkcs11/Makefile.in create mode 100644 bin/tests/pkcs11/README create mode 100644 bin/tests/pkcs11/benchmarks/Makefile.in create mode 100644 bin/tests/pkcs11/benchmarks/create.c create mode 100644 bin/tests/pkcs11/benchmarks/find.c create mode 100644 bin/tests/pkcs11/benchmarks/genrsa.c create mode 100644 bin/tests/pkcs11/benchmarks/login.c create mode 100644 bin/tests/pkcs11/benchmarks/privrsa.c create mode 100644 bin/tests/pkcs11/benchmarks/pubrsa.c create mode 100644 bin/tests/pkcs11/benchmarks/random.c create mode 100644 bin/tests/pkcs11/benchmarks/session.c create mode 100644 bin/tests/pkcs11/benchmarks/sha1.c create mode 100644 bin/tests/pkcs11/benchmarks/sign.c create mode 100644 bin/tests/pkcs11/benchmarks/verify.c create mode 100644 bin/tests/pkcs11/pkcs11-hmacmd5.c create mode 100644 bin/tests/pkcs11/pkcs11-md5sum.c create mode 100644 bin/tests/startperf/README create mode 100644 bin/tests/startperf/clean.sh create mode 100644 bin/tests/startperf/makenames.pl create mode 100644 bin/tests/startperf/mkzonefile.pl create mode 100644 bin/tests/startperf/setup.sh create mode 100644 bin/tests/startperf/smallzone.db create mode 100644 bin/tests/system/Makefile.in create mode 100644 bin/tests/system/README create mode 100644 bin/tests/system/acl/clean.sh create mode 100644 bin/tests/system/acl/ns2/named1.conf.in create mode 100644 bin/tests/system/acl/ns2/named2.conf.in create mode 100644 bin/tests/system/acl/ns2/named3.conf.in create mode 100644 bin/tests/system/acl/ns2/named4.conf.in create mode 100644 bin/tests/system/acl/ns2/named5.conf.in create mode 100644 bin/tests/system/acl/ns2/named6.conf.in create mode 100644 bin/tests/system/acl/ns2/named7.conf.in create mode 100644 bin/tests/system/acl/ns3/example.db create mode 100644 bin/tests/system/acl/ns3/named.conf.in create mode 100644 bin/tests/system/acl/ns4/example.db create mode 100644 bin/tests/system/acl/ns4/existing.db create mode 100644 bin/tests/system/acl/ns4/named.conf.in create mode 100644 bin/tests/system/acl/setup.sh create mode 100644 bin/tests/system/acl/tests.sh create mode 100644 bin/tests/system/additional/clean.sh create mode 100644 bin/tests/system/additional/ns1/mx.db create mode 100644 bin/tests/system/additional/ns1/named.args create mode 100644 bin/tests/system/additional/ns1/named1.conf.in create mode 100644 bin/tests/system/additional/ns1/named2.conf.in create mode 100644 bin/tests/system/additional/ns1/named3.conf.in create mode 100644 bin/tests/system/additional/ns1/named4.conf.in create mode 100644 bin/tests/system/additional/ns1/naptr.db create mode 100644 bin/tests/system/additional/ns1/naptr2.db create mode 100644 bin/tests/system/additional/ns1/nid.db create mode 100644 bin/tests/system/additional/ns1/rt.db create mode 100644 bin/tests/system/additional/ns1/rt2.db create mode 100644 bin/tests/system/additional/ns1/srv.db create mode 100644 bin/tests/system/additional/ns3/named.conf.in create mode 100644 bin/tests/system/additional/ns3/root.hint create mode 100644 bin/tests/system/additional/setup.sh create mode 100644 bin/tests/system/additional/tests.sh create mode 100644 bin/tests/system/addzone/clean.sh create mode 100644 bin/tests/system/addzone/ns1/inlineslave.db create mode 100644 bin/tests/system/addzone/ns1/named.conf.in create mode 100644 bin/tests/system/addzone/ns2/added.db create mode 100644 bin/tests/system/addzone/ns2/default.nzf.in create mode 100644 bin/tests/system/addzone/ns2/hints.db create mode 100644 bin/tests/system/addzone/ns2/inline.db create mode 100644 bin/tests/system/addzone/ns2/named1.conf.in create mode 100644 bin/tests/system/addzone/ns2/named2.conf.in create mode 100644 bin/tests/system/addzone/ns2/normal.db create mode 100644 bin/tests/system/addzone/ns2/previous.db create mode 100644 bin/tests/system/addzone/ns2/redirect.db create mode 100644 bin/tests/system/addzone/ns3/e.db create mode 100644 bin/tests/system/addzone/ns3/named1.conf.in create mode 100644 bin/tests/system/addzone/ns3/named2.conf.in create mode 100644 bin/tests/system/addzone/setup.sh create mode 100755 bin/tests/system/addzone/tests.sh create mode 100644 bin/tests/system/allow-query/clean.sh create mode 100644 bin/tests/system/allow-query/ns1/named.conf.in create mode 100644 bin/tests/system/allow-query/ns1/root.db create mode 100644 bin/tests/system/allow-query/ns2/generic.db create mode 100644 bin/tests/system/allow-query/ns2/named01.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named02.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named03.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named04.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named05.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named06.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named07.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named08.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named09.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named10.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named11.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named12.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named21.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named22.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named23.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named24.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named25.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named26.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named27.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named28.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named29.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named30.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named31.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named32.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named33.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named34.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named40.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named53.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named54.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named55.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named56.conf.in create mode 100644 bin/tests/system/allow-query/ns2/named57.conf.in create mode 100644 bin/tests/system/allow-query/ns3/named.args create mode 100644 bin/tests/system/allow-query/ns3/named.conf.in create mode 100644 bin/tests/system/allow-query/setup.sh create mode 100644 bin/tests/system/allow-query/tests.sh create mode 100644 bin/tests/system/ans.pl create mode 100644 bin/tests/system/autosign/clean.sh create mode 100644 bin/tests/system/autosign/ns1/keygen.sh create mode 100644 bin/tests/system/autosign/ns1/named.conf.in create mode 100644 bin/tests/system/autosign/ns1/root.db.in create mode 100644 bin/tests/system/autosign/ns2/Xbar.+005+30676.key create mode 100644 bin/tests/system/autosign/ns2/Xbar.+005+30676.private create mode 100644 bin/tests/system/autosign/ns2/Xbar.+005+30804.key create mode 100644 bin/tests/system/autosign/ns2/Xbar.+005+30804.private create mode 100644 bin/tests/system/autosign/ns2/bar.db.in create mode 100644 bin/tests/system/autosign/ns2/child.nsec3.example.db create mode 100644 bin/tests/system/autosign/ns2/child.optout.example.db create mode 100644 bin/tests/system/autosign/ns2/dst.example.db.in create mode 100644 bin/tests/system/autosign/ns2/example.db.in create mode 100644 bin/tests/system/autosign/ns2/insecure.secure.example.db create mode 100644 bin/tests/system/autosign/ns2/keygen.sh create mode 100644 bin/tests/system/autosign/ns2/named.conf.in create mode 100644 bin/tests/system/autosign/ns2/private.secure.example.db.in create mode 100644 bin/tests/system/autosign/ns3/autonsec3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/delay.example.db create mode 100644 bin/tests/system/autosign/ns3/delzsk.example.db.in create mode 100644 bin/tests/system/autosign/ns3/inacksk2.example.db.in create mode 100644 bin/tests/system/autosign/ns3/inacksk3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/inaczsk.example.db.in create mode 100644 bin/tests/system/autosign/ns3/inaczsk2.example.db.in create mode 100644 bin/tests/system/autosign/ns3/inaczsk3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/insecure.example.db create mode 100644 bin/tests/system/autosign/ns3/keygen.sh create mode 100644 bin/tests/system/autosign/ns3/named.conf.in create mode 100644 bin/tests/system/autosign/ns3/nozsk.example.db.in create mode 100644 bin/tests/system/autosign/ns3/nsec.example.db.in create mode 100644 bin/tests/system/autosign/ns3/nsec3-to-nsec.example.db.in create mode 100644 bin/tests/system/autosign/ns3/nsec3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/nsec3.nsec3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/nsec3.optout.example.db.in create mode 100644 bin/tests/system/autosign/ns3/oldsigs.example.db.in create mode 100644 bin/tests/system/autosign/ns3/optout.example.db.in create mode 100644 bin/tests/system/autosign/ns3/optout.nsec3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/optout.optout.example.db.in create mode 100644 bin/tests/system/autosign/ns3/rsasha256.example.db.in create mode 100644 bin/tests/system/autosign/ns3/rsasha512.example.db.in create mode 100644 bin/tests/system/autosign/ns3/secure-to-insecure.example.db.in create mode 100644 bin/tests/system/autosign/ns3/secure-to-insecure2.example.db.in create mode 100644 bin/tests/system/autosign/ns3/secure.example.db.in create mode 100644 bin/tests/system/autosign/ns3/secure.nsec3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/secure.optout.example.db.in create mode 100644 bin/tests/system/autosign/ns3/sync.example.db.in create mode 100644 bin/tests/system/autosign/ns3/ttl1.example.db.in create mode 100644 bin/tests/system/autosign/ns3/ttl2.example.db.in create mode 100644 bin/tests/system/autosign/ns3/ttl3.example.db.in create mode 100644 bin/tests/system/autosign/ns3/ttl4.example.db.in create mode 100644 bin/tests/system/autosign/ns4/named.conf.in create mode 100644 bin/tests/system/autosign/ns5/named.conf.in create mode 100644 bin/tests/system/autosign/prereq.sh create mode 100644 bin/tests/system/autosign/setup.sh create mode 100755 bin/tests/system/autosign/tests.sh create mode 100644 bin/tests/system/builtin/clean.sh create mode 100644 bin/tests/system/builtin/ns1/named.conf.in create mode 100644 bin/tests/system/builtin/ns2/named.conf.in create mode 100644 bin/tests/system/builtin/ns3/named.conf.in create mode 100644 bin/tests/system/builtin/setup.sh create mode 100644 bin/tests/system/builtin/tests.sh create mode 100644 bin/tests/system/cacheclean/clean.sh create mode 100644 bin/tests/system/cacheclean/dig.batch create mode 100644 bin/tests/system/cacheclean/knowngood.dig.out create mode 100644 bin/tests/system/cacheclean/ns1/example.db create mode 100644 bin/tests/system/cacheclean/ns1/expire-test.db create mode 100644 bin/tests/system/cacheclean/ns1/flushtest.db create mode 100644 bin/tests/system/cacheclean/ns1/named.conf.in create mode 100644 bin/tests/system/cacheclean/ns2/named.conf.in create mode 100644 bin/tests/system/cacheclean/setup.sh create mode 100755 bin/tests/system/cacheclean/tests.sh create mode 100644 bin/tests/system/case/clean.sh create mode 100644 bin/tests/system/case/dynamic.good create mode 100644 bin/tests/system/case/ns1/dynamic.db.in create mode 100644 bin/tests/system/case/ns1/example.db create mode 100644 bin/tests/system/case/ns1/named.conf.in create mode 100644 bin/tests/system/case/ns2/named.conf.in create mode 100644 bin/tests/system/case/postns1.good create mode 100644 bin/tests/system/case/postupdate.good create mode 100644 bin/tests/system/case/setup.sh create mode 100644 bin/tests/system/case/tests.sh create mode 100644 bin/tests/system/catz/clean.sh create mode 100644 bin/tests/system/catz/ns1/catalog.example.db.in create mode 100644 bin/tests/system/catz/ns1/named.conf.in create mode 100644 bin/tests/system/catz/ns2/named.conf.in create mode 100644 bin/tests/system/catz/ns3/dom5.example.db create mode 100644 bin/tests/system/catz/ns3/dom6.example.db create mode 100644 bin/tests/system/catz/ns3/named.conf.in create mode 100644 bin/tests/system/catz/setup.sh create mode 100644 bin/tests/system/catz/tests.sh create mode 100644 bin/tests/system/chain/README create mode 100644 bin/tests/system/chain/ans3/ans.pl create mode 100644 bin/tests/system/chain/ans4/README.anspy create mode 100755 bin/tests/system/chain/ans4/ans.py create mode 100755 bin/tests/system/chain/clean.sh create mode 100644 bin/tests/system/chain/ns1/named.conf.in create mode 100644 bin/tests/system/chain/ns1/root.db create mode 100644 bin/tests/system/chain/ns2/example.db create mode 100644 bin/tests/system/chain/ns2/generic.db create mode 100644 bin/tests/system/chain/ns2/named.conf.in create mode 100644 bin/tests/system/chain/ns2/sign.sh create mode 100644 bin/tests/system/chain/ns2/sub.db create mode 100644 bin/tests/system/chain/ns5/named.conf.in create mode 100644 bin/tests/system/chain/ns5/sub.db create mode 100644 bin/tests/system/chain/ns7/named.conf.in create mode 100644 bin/tests/system/chain/ns7/root.hint create mode 100644 bin/tests/system/chain/prereq.sh create mode 100644 bin/tests/system/chain/setup.sh create mode 100644 bin/tests/system/chain/tests.sh create mode 100644 bin/tests/system/checkconf/altdb.conf create mode 100644 bin/tests/system/checkconf/altdlz.conf create mode 100644 bin/tests/system/checkconf/bad-also-notify.conf create mode 100644 bin/tests/system/checkconf/bad-catz-zone.conf create mode 100644 bin/tests/system/checkconf/bad-dnssec.conf create mode 100644 bin/tests/system/checkconf/bad-hint.conf create mode 100644 bin/tests/system/checkconf/bad-in-view-dup.conf create mode 100644 bin/tests/system/checkconf/bad-inline-slave.conf create mode 100644 bin/tests/system/checkconf/bad-keep-response-order.conf create mode 100644 bin/tests/system/checkconf/bad-lifetime.conf create mode 100644 bin/tests/system/checkconf/bad-lmdb-mapsize-bogus.conf create mode 100644 bin/tests/system/checkconf/bad-lmdb-mapsize-toolarge.conf create mode 100644 bin/tests/system/checkconf/bad-lmdb-mapsize-toosmall.conf create mode 100644 bin/tests/system/checkconf/bad-lmdb-mapsize-unlimited.conf create mode 100644 bin/tests/system/checkconf/bad-many.conf create mode 100644 bin/tests/system/checkconf/bad-master-request-ixfr.conf create mode 100644 bin/tests/system/checkconf/bad-maxttlmap.conf create mode 100644 bin/tests/system/checkconf/bad-noddns.conf create mode 100644 bin/tests/system/checkconf/bad-options-also-notify.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-acl.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-all-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-errors-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-ipv4-prefix-length.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-ipv6-prefix-length.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-max-table-size.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-nodata-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-nxdomains-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-qps-scale.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-referrals-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-responses-per-second.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-slip.conf create mode 100644 bin/tests/system/checkconf/bad-rate-limit-window.conf create mode 100644 bin/tests/system/checkconf/bad-rpz-zone.conf create mode 100644 bin/tests/system/checkconf/bad-sharedwritable1.conf create mode 100644 bin/tests/system/checkconf/bad-sharedwritable2.conf create mode 100644 bin/tests/system/checkconf/bad-sharedzone1.conf create mode 100644 bin/tests/system/checkconf/bad-sharedzone2.conf create mode 100644 bin/tests/system/checkconf/bad-sharedzone3.conf create mode 100644 bin/tests/system/checkconf/bad-tsig.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy1.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy10.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy11.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy12.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy13.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy14.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy15.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy2.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy3.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy4.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy5.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy6.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy7.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy8.conf create mode 100644 bin/tests/system/checkconf/bad-update-policy9.conf create mode 100644 bin/tests/system/checkconf/bad-view-also-notify.conf create mode 100644 bin/tests/system/checkconf/check-dlv-ksk-key.conf create mode 100644 bin/tests/system/checkconf/check-dup-records-fail.conf create mode 100644 bin/tests/system/checkconf/check-dup-records.db create mode 100644 bin/tests/system/checkconf/check-mx-cname-fail.conf create mode 100644 bin/tests/system/checkconf/check-mx-cname.db create mode 100644 bin/tests/system/checkconf/check-mx-fail.conf create mode 100644 bin/tests/system/checkconf/check-mx.db create mode 100644 bin/tests/system/checkconf/check-names-fail.conf create mode 100644 bin/tests/system/checkconf/check-names.db create mode 100644 bin/tests/system/checkconf/check-root-ksk-2010.conf create mode 100644 bin/tests/system/checkconf/check-root-ksk-2017.conf create mode 100644 bin/tests/system/checkconf/check-root-ksk-both.conf create mode 100644 bin/tests/system/checkconf/check-srv-cname-fail.conf create mode 100644 bin/tests/system/checkconf/check-srv-cname.db create mode 100644 bin/tests/system/checkconf/clean.sh create mode 100644 bin/tests/system/checkconf/dlz-bad.conf create mode 100644 bin/tests/system/checkconf/dnssec.1 create mode 100644 bin/tests/system/checkconf/dnssec.2 create mode 100644 bin/tests/system/checkconf/dnssec.3 create mode 100644 bin/tests/system/checkconf/good-acl.conf create mode 100644 bin/tests/system/checkconf/good-class.conf create mode 100644 bin/tests/system/checkconf/good-dlv-dlv.example.com.conf create mode 100644 bin/tests/system/checkconf/good-lmdb-mapsize-largest.conf create mode 100644 bin/tests/system/checkconf/good-lmdb-mapsize-smallest.conf create mode 100644 bin/tests/system/checkconf/good-nested.conf create mode 100644 bin/tests/system/checkconf/good-options-also-notify.conf create mode 100644 bin/tests/system/checkconf/good-response-dot.conf create mode 100644 bin/tests/system/checkconf/good-update-policy1.conf create mode 100644 bin/tests/system/checkconf/good-update-policy10.conf create mode 100644 bin/tests/system/checkconf/good-update-policy11.conf create mode 100644 bin/tests/system/checkconf/good-update-policy12.conf create mode 100644 bin/tests/system/checkconf/good-update-policy2.conf create mode 100644 bin/tests/system/checkconf/good-update-policy3.conf create mode 100644 bin/tests/system/checkconf/good-update-policy4.conf create mode 100644 bin/tests/system/checkconf/good-update-policy5.conf create mode 100644 bin/tests/system/checkconf/good-update-policy6.conf create mode 100644 bin/tests/system/checkconf/good-update-policy7.conf create mode 100644 bin/tests/system/checkconf/good-update-policy8.conf create mode 100644 bin/tests/system/checkconf/good-update-policy9.conf create mode 100644 bin/tests/system/checkconf/good-view-also-notify.conf create mode 100644 bin/tests/system/checkconf/good.conf create mode 100644 bin/tests/system/checkconf/hint-nofile.conf create mode 100644 bin/tests/system/checkconf/in-view-good.conf create mode 100644 bin/tests/system/checkconf/inline-bad.conf create mode 100644 bin/tests/system/checkconf/inline-good.conf create mode 100644 bin/tests/system/checkconf/inline-no.conf create mode 100644 bin/tests/system/checkconf/max-cache-size-good.conf create mode 100644 bin/tests/system/checkconf/max-ttl.conf create mode 100644 bin/tests/system/checkconf/maxttl-bad.conf create mode 100644 bin/tests/system/checkconf/maxttl-bad.db create mode 100644 bin/tests/system/checkconf/maxttl.db create mode 100644 bin/tests/system/checkconf/notify.conf create mode 100644 bin/tests/system/checkconf/portrange-good.conf create mode 100644 bin/tests/system/checkconf/range.conf create mode 100644 bin/tests/system/checkconf/shared.example.db create mode 100644 bin/tests/system/checkconf/tests.sh create mode 100644 bin/tests/system/checkconf/view-class-any1.conf create mode 100644 bin/tests/system/checkconf/view-class-any2.conf create mode 100644 bin/tests/system/checkconf/view-class-in1.conf create mode 100644 bin/tests/system/checkconf/view-class-in2.conf create mode 100644 bin/tests/system/checkconf/warn-dlv-auto.conf create mode 100644 bin/tests/system/checkconf/warn-dlv-dlv.isc.org.conf create mode 100644 bin/tests/system/checkconf/warn-keydir.conf create mode 100644 bin/tests/system/checkds/clean.sh create mode 100755 bin/tests/system/checkds/dig.bat create mode 100644 bin/tests/system/checkds/dig.pl create mode 100755 bin/tests/system/checkds/dig.sh create mode 100644 bin/tests/system/checkds/missing.example.dlv.example.dlv.db create mode 100644 bin/tests/system/checkds/missing.example.dnskey.db create mode 100644 bin/tests/system/checkds/missing.example.ds.db create mode 100644 bin/tests/system/checkds/none.example.dlv.example.dlv.db create mode 100644 bin/tests/system/checkds/none.example.dnskey.db create mode 100644 bin/tests/system/checkds/none.example.ds.db create mode 100644 bin/tests/system/checkds/ok.example.dlv.example.dlv.db create mode 100644 bin/tests/system/checkds/ok.example.dnskey.db create mode 100644 bin/tests/system/checkds/ok.example.ds.db create mode 100644 bin/tests/system/checkds/setup.sh create mode 100644 bin/tests/system/checkds/tests.sh create mode 100644 bin/tests/system/checkds/wrong.example.dlv.example.dlv.db create mode 100644 bin/tests/system/checkds/wrong.example.dnskey.db create mode 100644 bin/tests/system/checkds/wrong.example.ds.db create mode 100644 bin/tests/system/checknames/clean.sh create mode 100644 bin/tests/system/checknames/ns1/fail.example.db.in create mode 100644 bin/tests/system/checknames/ns1/fail.update.db.in create mode 100644 bin/tests/system/checknames/ns1/ignore.example.db.in create mode 100644 bin/tests/system/checknames/ns1/ignore.update.db.in create mode 100644 bin/tests/system/checknames/ns1/named.conf.in create mode 100644 bin/tests/system/checknames/ns1/root.db create mode 100644 bin/tests/system/checknames/ns1/warn.example.db.in create mode 100644 bin/tests/system/checknames/ns1/warn.update.db.in create mode 100644 bin/tests/system/checknames/ns2/named.conf.in create mode 100644 bin/tests/system/checknames/ns2/root.hints create mode 100644 bin/tests/system/checknames/ns3/named.conf.in create mode 100644 bin/tests/system/checknames/ns3/root.hints create mode 100644 bin/tests/system/checknames/ns4/master-ignore.update.db.in create mode 100644 bin/tests/system/checknames/ns4/named.conf.in create mode 100644 bin/tests/system/checknames/ns4/root.hints create mode 100644 bin/tests/system/checknames/setup.sh create mode 100644 bin/tests/system/checknames/tests.sh create mode 100644 bin/tests/system/checkzone/clean.sh create mode 100644 bin/tests/system/checkzone/setup.sh create mode 100644 bin/tests/system/checkzone/tests.sh create mode 100644 bin/tests/system/checkzone/zones/.gitattributes create mode 100644 bin/tests/system/checkzone/zones/bad-badclass.raw create mode 100644 bin/tests/system/checkzone/zones/bad-caa-rr.db create mode 100644 bin/tests/system/checkzone/zones/bad-dns-sd-reverse.db create mode 100644 bin/tests/system/checkzone/zones/bad-generate-tkey.db create mode 100644 bin/tests/system/checkzone/zones/bad-nsap-empty.db create mode 100644 bin/tests/system/checkzone/zones/bad-nsap-odd-nibble.db create mode 100644 bin/tests/system/checkzone/zones/bad-nsec3-padded.db create mode 100644 bin/tests/system/checkzone/zones/bad-nsec3owner-padded.db create mode 100644 bin/tests/system/checkzone/zones/bad-tkey.db create mode 100644 bin/tests/system/checkzone/zones/bad-tsig.db create mode 100644 bin/tests/system/checkzone/zones/bad-unspec.db create mode 100644 bin/tests/system/checkzone/zones/bad1.db create mode 100644 bin/tests/system/checkzone/zones/bad2.db create mode 100644 bin/tests/system/checkzone/zones/bad3.db create mode 100644 bin/tests/system/checkzone/zones/bad4.db create mode 100644 bin/tests/system/checkzone/zones/badttl.db create mode 100644 bin/tests/system/checkzone/zones/crashzone.db create mode 100644 bin/tests/system/checkzone/zones/delegating-ns-address-below-dname.db create mode 100644 bin/tests/system/checkzone/zones/good-dns-sd-reverse.db create mode 100644 bin/tests/system/checkzone/zones/good-gc-msdcs.db create mode 100644 bin/tests/system/checkzone/zones/good-nsap.db create mode 100644 bin/tests/system/checkzone/zones/good-nsec3-nopadhash.db create mode 100644 bin/tests/system/checkzone/zones/good-occulted-ns-by-dname.db create mode 100644 bin/tests/system/checkzone/zones/good-occulted-ns-by-ns.db create mode 100644 bin/tests/system/checkzone/zones/good1.db create mode 100644 bin/tests/system/checkzone/zones/inherit.db create mode 100644 bin/tests/system/checkzone/zones/nowarn.inherited.owner.db create mode 100644 bin/tests/system/checkzone/zones/ns-address-below-dname.db create mode 100644 bin/tests/system/checkzone/zones/spf.db create mode 100644 bin/tests/system/checkzone/zones/test1.db create mode 100644 bin/tests/system/checkzone/zones/test2.db create mode 100644 bin/tests/system/checkzone/zones/warn.inherit.origin.db create mode 100644 bin/tests/system/checkzone/zones/warn.inherited.owner.db create mode 100644 bin/tests/system/clean.sh create mode 100644 bin/tests/system/cleanall.sh create mode 100644 bin/tests/system/cleanpkcs11.sh create mode 100644 bin/tests/system/common/controls.conf create mode 100644 bin/tests/system/common/controls.conf.in create mode 100644 bin/tests/system/common/rndc.conf create mode 100644 bin/tests/system/common/rndc.key create mode 100644 bin/tests/system/common/root.hint create mode 100644 bin/tests/system/conf.sh.in create mode 100644 bin/tests/system/conf.sh.win32 create mode 100644 bin/tests/system/cookie/bad-cookie-badhex.conf create mode 100644 bin/tests/system/cookie/bad-cookie-badsha1.conf create mode 100644 bin/tests/system/cookie/bad-cookie-badsha256.conf create mode 100644 bin/tests/system/cookie/bad-cookie-toolong.conf create mode 100644 bin/tests/system/cookie/clean.sh create mode 100644 bin/tests/system/cookie/good-cookie-sha1.conf create mode 100644 bin/tests/system/cookie/good-cookie-sha256.conf create mode 100644 bin/tests/system/cookie/ns1/example.db create mode 100644 bin/tests/system/cookie/ns1/named.conf.in create mode 100644 bin/tests/system/cookie/ns1/root.hint create mode 100644 bin/tests/system/cookie/ns2/named.conf.in create mode 100644 bin/tests/system/cookie/ns2/root.db create mode 100644 bin/tests/system/cookie/ns3/named.conf.in create mode 100644 bin/tests/system/cookie/ns3/root.hint create mode 100644 bin/tests/system/cookie/ns4/named.conf.in create mode 100644 bin/tests/system/cookie/ns4/root.hint create mode 100644 bin/tests/system/cookie/ns5/named.conf.in create mode 100644 bin/tests/system/cookie/ns5/root.hint create mode 100644 bin/tests/system/cookie/ns6/named.conf.in create mode 100644 bin/tests/system/cookie/ns6/root.hint create mode 100644 bin/tests/system/cookie/ns7/named.conf.in create mode 100644 bin/tests/system/cookie/ns7/root.db create mode 100644 bin/tests/system/cookie/setup.sh create mode 100755 bin/tests/system/cookie/tests.sh create mode 100644 bin/tests/system/coverage/01-ksk-inactive/README create mode 100644 bin/tests/system/coverage/01-ksk-inactive/expect create mode 100644 bin/tests/system/coverage/02-zsk-inactive/README create mode 100644 bin/tests/system/coverage/02-zsk-inactive/expect create mode 100644 bin/tests/system/coverage/03-ksk-unpublished/README create mode 100644 bin/tests/system/coverage/03-ksk-unpublished/expect create mode 100644 bin/tests/system/coverage/04-zsk-unpublished/README create mode 100644 bin/tests/system/coverage/04-zsk-unpublished/expect create mode 100644 bin/tests/system/coverage/05-ksk-unpub-active/README create mode 100644 bin/tests/system/coverage/05-ksk-unpub-active/expect create mode 100644 bin/tests/system/coverage/06-zsk-unpub-active/README create mode 100644 bin/tests/system/coverage/06-zsk-unpub-active/expect create mode 100644 bin/tests/system/coverage/07-ksk-ttl/README create mode 100644 bin/tests/system/coverage/07-ksk-ttl/expect create mode 100644 bin/tests/system/coverage/08-zsk-ttl/README create mode 100644 bin/tests/system/coverage/08-zsk-ttl/expect create mode 100644 bin/tests/system/coverage/09-check-zsk/README create mode 100644 bin/tests/system/coverage/09-check-zsk/expect create mode 100644 bin/tests/system/coverage/10-check-ksk/README create mode 100644 bin/tests/system/coverage/10-check-ksk/expect create mode 100644 bin/tests/system/coverage/11-cutoff/README create mode 100644 bin/tests/system/coverage/11-cutoff/expect create mode 100644 bin/tests/system/coverage/clean.sh create mode 100644 bin/tests/system/coverage/prereq.sh create mode 100644 bin/tests/system/coverage/setup.sh create mode 100644 bin/tests/system/coverage/tests.sh create mode 100644 bin/tests/system/database/clean.sh create mode 100644 bin/tests/system/database/ns1/named1.conf.in create mode 100644 bin/tests/system/database/ns1/named2.conf.in create mode 100644 bin/tests/system/database/setup.sh create mode 100644 bin/tests/system/database/tests.sh create mode 100644 bin/tests/system/delzone/clean.sh create mode 100644 bin/tests/system/delzone/ns1/inlineslave.db create mode 100644 bin/tests/system/delzone/ns1/named.conf create mode 100644 bin/tests/system/delzone/ns2/added.db create mode 100644 bin/tests/system/delzone/ns2/named.args create mode 100644 bin/tests/system/delzone/ns2/named.conf create mode 100644 bin/tests/system/delzone/ns2/normal.db create mode 100644 bin/tests/system/delzone/setup.sh create mode 100755 bin/tests/system/delzone/tests.sh create mode 100644 bin/tests/system/dialup/ns1/example.db create mode 100644 bin/tests/system/dialup/ns1/named.conf create mode 100644 bin/tests/system/dialup/ns1/root.db create mode 100644 bin/tests/system/dialup/ns2/hint.db create mode 100644 bin/tests/system/dialup/ns2/named.conf create mode 100644 bin/tests/system/dialup/ns3/hint.db create mode 100644 bin/tests/system/dialup/ns3/named.conf create mode 100644 bin/tests/system/dialup/setup.sh create mode 100644 bin/tests/system/dialup/tests.sh create mode 100644 bin/tests/system/digcomp.pl create mode 100644 bin/tests/system/digdelv/ans4/startme create mode 100644 bin/tests/system/digdelv/clean.sh create mode 100644 bin/tests/system/digdelv/ns1/named.conf.in create mode 100644 bin/tests/system/digdelv/ns1/root.db create mode 100644 bin/tests/system/digdelv/ns2/example.db create mode 100644 bin/tests/system/digdelv/ns2/named.conf.in create mode 100644 bin/tests/system/digdelv/ns3/named.conf.in create mode 100644 bin/tests/system/digdelv/prereq.sh create mode 100644 bin/tests/system/digdelv/setup.sh create mode 100644 bin/tests/system/digdelv/tests.sh create mode 100644 bin/tests/system/ditch.pl create mode 100644 bin/tests/system/dlv/clean.sh create mode 100644 bin/tests/system/dlv/ns1/named.conf.in create mode 100644 bin/tests/system/dlv/ns1/root.db.in create mode 100644 bin/tests/system/dlv/ns1/rootservers.utld.db create mode 100755 bin/tests/system/dlv/ns1/sign.sh create mode 100644 bin/tests/system/dlv/ns2/druz.db.in create mode 100644 bin/tests/system/dlv/ns2/hints create mode 100644 bin/tests/system/dlv/ns2/named.conf.in create mode 100755 bin/tests/system/dlv/ns2/sign.sh create mode 100644 bin/tests/system/dlv/ns2/utld.db create mode 100644 bin/tests/system/dlv/ns3/child.db.in create mode 100644 bin/tests/system/dlv/ns3/dlv.db.in create mode 100644 bin/tests/system/dlv/ns3/hints create mode 100644 bin/tests/system/dlv/ns3/named.conf.in create mode 100755 bin/tests/system/dlv/ns3/sign.sh create mode 100644 bin/tests/system/dlv/ns4/child.db create mode 100644 bin/tests/system/dlv/ns4/hints create mode 100644 bin/tests/system/dlv/ns4/named.conf.in create mode 100644 bin/tests/system/dlv/ns5/hints create mode 100644 bin/tests/system/dlv/ns5/named.conf.in create mode 100644 bin/tests/system/dlv/ns5/rndc.conf create mode 100644 bin/tests/system/dlv/ns6/child.db.in create mode 100644 bin/tests/system/dlv/ns6/hints create mode 100644 bin/tests/system/dlv/ns6/named.conf.in create mode 100755 bin/tests/system/dlv/ns6/sign.sh create mode 100644 bin/tests/system/dlv/prereq.sh create mode 100644 bin/tests/system/dlv/setup.sh create mode 100644 bin/tests/system/dlv/tests.sh create mode 100644 bin/tests/system/dlz/clean.sh create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/broken/dns.d/@/DNAME=10=example.net.= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/broken/dns.d/@/NS=10=example.com.= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/broken/dns.d/@/SOA=10=ns.example.com.=root.example.com.=None=None=None=None=None= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/example/dns.d/@/DNAME=10=example.net.= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/example/dns.d/@/NS=10=example.com.= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/example/dns.d/@/SOA=10=ns.example.com.=root.example.com.=2010062900=0=0=0=10= create mode 100644 bin/tests/system/dlz/ns1/dns-root/com/example/xfr.d/10.53.0.1 create mode 100644 bin/tests/system/dlz/ns1/named.conf.in create mode 100644 bin/tests/system/dlz/prereq.sh.in create mode 100644 bin/tests/system/dlz/setup.sh create mode 100644 bin/tests/system/dlz/tests.sh create mode 100644 bin/tests/system/dlzexternal/Makefile.in create mode 100644 bin/tests/system/dlzexternal/clean.sh create mode 100644 bin/tests/system/dlzexternal/driver.c create mode 100644 bin/tests/system/dlzexternal/driver.h create mode 100644 bin/tests/system/dlzexternal/ns1/dlzs.conf.in create mode 100644 bin/tests/system/dlzexternal/ns1/named.conf.in create mode 100644 bin/tests/system/dlzexternal/ns1/root.db create mode 100644 bin/tests/system/dlzexternal/prereq.sh create mode 100644 bin/tests/system/dlzexternal/setup.sh create mode 100644 bin/tests/system/dlzexternal/tests.sh create mode 100644 bin/tests/system/dns64/clean.sh create mode 100644 bin/tests/system/dns64/conf/bad1.conf create mode 100644 bin/tests/system/dns64/conf/bad2.conf create mode 100644 bin/tests/system/dns64/conf/bad3.conf create mode 100644 bin/tests/system/dns64/conf/bad4.conf create mode 100644 bin/tests/system/dns64/conf/bad5.conf create mode 100644 bin/tests/system/dns64/conf/bad6.conf create mode 100644 bin/tests/system/dns64/conf/bad7.conf create mode 100644 bin/tests/system/dns64/conf/bad8.conf create mode 100644 bin/tests/system/dns64/conf/bad9.conf create mode 100644 bin/tests/system/dns64/conf/good1.conf create mode 100644 bin/tests/system/dns64/conf/good2.conf create mode 100644 bin/tests/system/dns64/conf/good3.conf create mode 100644 bin/tests/system/dns64/conf/good4.conf create mode 100644 bin/tests/system/dns64/conf/good5.conf create mode 100644 bin/tests/system/dns64/ns1/example.db create mode 100644 bin/tests/system/dns64/ns1/named.conf.in create mode 100644 bin/tests/system/dns64/ns1/root.db create mode 100644 bin/tests/system/dns64/ns1/sign.sh create mode 100644 bin/tests/system/dns64/ns2/named.conf.in create mode 100644 bin/tests/system/dns64/ns2/rpz.db create mode 100644 bin/tests/system/dns64/prereq.sh create mode 100644 bin/tests/system/dns64/setup.sh create mode 100644 bin/tests/system/dns64/tests.sh create mode 100644 bin/tests/system/dnssec/README create mode 100644 bin/tests/system/dnssec/clean.sh create mode 100644 bin/tests/system/dnssec/dnssec_update_test.pl create mode 100644 bin/tests/system/dnssec/ns1/named.conf.in create mode 100644 bin/tests/system/dnssec/ns1/root.db.in create mode 100644 bin/tests/system/dnssec/ns1/sign.sh create mode 100644 bin/tests/system/dnssec/ns2/algroll.db.in create mode 100644 bin/tests/system/dnssec/ns2/badparam.db.in create mode 100644 bin/tests/system/dnssec/ns2/cdnskey-auto.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/cdnskey-update.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/cdnskey.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/cds-auto.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/cds-update.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/cds.secure.db.in create mode 100644 bin/tests/system/dnssec/ns2/child.nsec3.example.db create mode 100644 bin/tests/system/dnssec/ns2/child.optout.example.db create mode 100644 bin/tests/system/dnssec/ns2/dlv.db.in create mode 100644 bin/tests/system/dnssec/ns2/dst.example.db.in create mode 100644 bin/tests/system/dnssec/ns2/example.db.in create mode 100644 bin/tests/system/dnssec/ns2/in-addr.arpa.db.in create mode 100644 bin/tests/system/dnssec/ns2/insecure.secure.example.db create mode 100644 bin/tests/system/dnssec/ns2/named.conf.in create mode 100644 bin/tests/system/dnssec/ns2/private.secure.example.db.in create mode 100644 bin/tests/system/dnssec/ns2/rfc2335.example.db create mode 100644 bin/tests/system/dnssec/ns2/sign.sh create mode 100644 bin/tests/system/dnssec/ns2/single-nsec3.db.in create mode 100644 bin/tests/system/dnssec/ns3/auto-nsec.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/auto-nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/bogus.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/dnskey-nsec3-unknown.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/dnskey-unknown.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/dynamic.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/expired.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/expiring.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/future.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/generic.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/inline.example.db create mode 100644 bin/tests/system/dnssec/ns3/insecure.below-cname.example.db create mode 100644 bin/tests/system/dnssec/ns3/insecure.example.db create mode 100644 bin/tests/system/dnssec/ns3/insecure.nsec3.example.db create mode 100644 bin/tests/system/dnssec/ns3/insecure.optout.example.db create mode 100644 bin/tests/system/dnssec/ns3/kskonly.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/lower.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/managed-future.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/multiple.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/named.conf.in create mode 100644 bin/tests/system/dnssec/ns3/nosign.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/nsec3-unknown.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/nsec3.nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/nsec3.optout.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/optout-unknown.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/optout.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/optout.nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/optout.optout.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/publish-inactive.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/rsasha256.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/rsasha512.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/secure.below-cname.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/secure.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/secure.nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/secure.optout.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/siginterval.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/siginterval1.conf create mode 100644 bin/tests/system/dnssec/ns3/siginterval2.conf create mode 100644 bin/tests/system/dnssec/ns3/sign.sh create mode 100644 bin/tests/system/dnssec/ns3/split-dnssec.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/split-smart.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/ttlpatch.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/update-nsec3.example.db.in create mode 100644 bin/tests/system/dnssec/ns3/upper.example.db.in create mode 100644 bin/tests/system/dnssec/ns4/named1.conf.in create mode 100644 bin/tests/system/dnssec/ns4/named2.conf.in create mode 100644 bin/tests/system/dnssec/ns4/named3.conf.in create mode 100644 bin/tests/system/dnssec/ns4/named4.conf.in create mode 100644 bin/tests/system/dnssec/ns4/named5.conf.in create mode 100644 bin/tests/system/dnssec/ns5/named1.conf.in create mode 100644 bin/tests/system/dnssec/ns5/named2.conf.in create mode 100644 bin/tests/system/dnssec/ns5/sign.sh create mode 100644 bin/tests/system/dnssec/ns5/trusted.conf.bad create mode 100644 bin/tests/system/dnssec/ns6/named.args create mode 100644 bin/tests/system/dnssec/ns6/named.conf.in create mode 100644 bin/tests/system/dnssec/ns6/optout-tld.db.in create mode 100644 bin/tests/system/dnssec/ns6/sign.sh create mode 100644 bin/tests/system/dnssec/ns7/named.conf.in create mode 100644 bin/tests/system/dnssec/ns7/named.nosoa create mode 100644 bin/tests/system/dnssec/ns7/nosoa.secure.example.db create mode 100644 bin/tests/system/dnssec/ns7/sign.sh create mode 100644 bin/tests/system/dnssec/ns7/split-rrsig.db.in create mode 100755 bin/tests/system/dnssec/ntadiff.pl create mode 100644 bin/tests/system/dnssec/prereq.sh create mode 100644 bin/tests/system/dnssec/setup.sh create mode 100644 bin/tests/system/dnssec/signer/example.db.in create mode 100644 bin/tests/system/dnssec/signer/general/Kexample.com.+005+07065.key create mode 100644 bin/tests/system/dnssec/signer/general/Kexample.com.+005+07065.private create mode 100644 bin/tests/system/dnssec/signer/general/Kexample.com.+005+23362.key create mode 100644 bin/tests/system/dnssec/signer/general/Kexample.com.+005+23362.private create mode 100644 bin/tests/system/dnssec/signer/general/bogus-ksk.key create mode 100644 bin/tests/system/dnssec/signer/general/bogus-zsk.key create mode 100644 bin/tests/system/dnssec/signer/general/test1.zone create mode 100644 bin/tests/system/dnssec/signer/general/test2.zone create mode 100644 bin/tests/system/dnssec/signer/general/test3.zone create mode 100644 bin/tests/system/dnssec/signer/general/test4.zone create mode 100644 bin/tests/system/dnssec/signer/general/test5.zone create mode 100644 bin/tests/system/dnssec/signer/general/test6.zone create mode 100644 bin/tests/system/dnssec/signer/general/test7.zone create mode 100644 bin/tests/system/dnssec/signer/general/test8.zone create mode 100644 bin/tests/system/dnssec/signer/remove.db.in create mode 100644 bin/tests/system/dnssec/signer/remove2.db.in create mode 100644 bin/tests/system/dnssec/tests.sh create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-buffer-hint-max.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-buffer-hint-min.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-flush-timeout-max.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-flush-timeout-min.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-input-queue-size-max.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-input-queue-size-min.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-input-queue-size-po2.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-output-notify-threshold.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-output-queue-size-max.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-output-queue-size-min.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-reopen-interval-max.conf create mode 100644 bin/tests/system/dnstap/bad-fstrm-set-reopen-interval-min.conf create mode 100644 bin/tests/system/dnstap/clean.sh create mode 100644 bin/tests/system/dnstap/good-fstrm-set-buffer-hint.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-flush-timeout.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-input-queue-size.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-output-notify-threshold.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-output-queue-model-mpsc.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-output-queue-model-spsc.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-output-queue-size.conf create mode 100644 bin/tests/system/dnstap/good-fstrm-set-reopen-interval.conf create mode 100644 bin/tests/system/dnstap/ns1/named.conf.in create mode 100644 bin/tests/system/dnstap/ns1/root.db create mode 100644 bin/tests/system/dnstap/ns2/example.db create mode 100644 bin/tests/system/dnstap/ns2/named.conf.in create mode 100644 bin/tests/system/dnstap/ns3/named.conf.in create mode 100644 bin/tests/system/dnstap/ns4/named.conf.in create mode 100644 bin/tests/system/dnstap/setup.sh create mode 100644 bin/tests/system/dnstap/tests.sh create mode 100644 bin/tests/system/dnstap/ydump.py create mode 100644 bin/tests/system/dscp/clean.sh create mode 100644 bin/tests/system/dscp/ns1/named.args create mode 100644 bin/tests/system/dscp/ns1/named.conf.in create mode 100644 bin/tests/system/dscp/ns1/root.db create mode 100644 bin/tests/system/dscp/ns2/named.args create mode 100644 bin/tests/system/dscp/ns2/named.conf.in create mode 100644 bin/tests/system/dscp/ns3/hint.db create mode 100644 bin/tests/system/dscp/ns3/named.args create mode 100644 bin/tests/system/dscp/ns3/named.conf.in create mode 100644 bin/tests/system/dscp/ns4/named.args create mode 100644 bin/tests/system/dscp/ns4/named.conf.in create mode 100644 bin/tests/system/dscp/ns4/root.db create mode 100644 bin/tests/system/dscp/ns5/named.args create mode 100644 bin/tests/system/dscp/ns5/named.conf.in create mode 100644 bin/tests/system/dscp/ns6/hint.db create mode 100644 bin/tests/system/dscp/ns6/named.args create mode 100644 bin/tests/system/dscp/ns6/named.conf.in create mode 100644 bin/tests/system/dscp/ns7/named.args create mode 100644 bin/tests/system/dscp/ns7/named.conf.in create mode 100644 bin/tests/system/dscp/setup.sh create mode 100644 bin/tests/system/dscp/tests.sh create mode 100644 bin/tests/system/dsdigest/clean.sh create mode 100644 bin/tests/system/dsdigest/ns1/named.conf.in create mode 100644 bin/tests/system/dsdigest/ns1/root.db.in create mode 100644 bin/tests/system/dsdigest/ns1/sign.sh create mode 100644 bin/tests/system/dsdigest/ns2/bad.db.in create mode 100644 bin/tests/system/dsdigest/ns2/good.db.in create mode 100644 bin/tests/system/dsdigest/ns2/named.conf.in create mode 100644 bin/tests/system/dsdigest/ns2/sign.sh create mode 100644 bin/tests/system/dsdigest/ns3/named.conf.in create mode 100644 bin/tests/system/dsdigest/ns4/named.conf.in create mode 100644 bin/tests/system/dsdigest/prereq.sh create mode 100644 bin/tests/system/dsdigest/setup.sh create mode 100644 bin/tests/system/dsdigest/tests.sh create mode 100644 bin/tests/system/dupsigs/check_journal.pl create mode 100644 bin/tests/system/dupsigs/clean.sh create mode 100644 bin/tests/system/dupsigs/ns1/named.args create mode 100644 bin/tests/system/dupsigs/ns1/named.conf.in create mode 100644 bin/tests/system/dupsigs/ns1/reset_keys.sh create mode 100644 bin/tests/system/dupsigs/ns1/signing.test.db.in create mode 100644 bin/tests/system/dupsigs/prereq.sh create mode 100644 bin/tests/system/dupsigs/setup.sh create mode 100644 bin/tests/system/dupsigs/tests.sh create mode 100644 bin/tests/system/dyndb/Makefile.in create mode 100644 bin/tests/system/dyndb/clean.sh create mode 100644 bin/tests/system/dyndb/driver/AUTHORS create mode 100644 bin/tests/system/dyndb/driver/COPYING create mode 100644 bin/tests/system/dyndb/driver/Makefile.in create mode 100644 bin/tests/system/dyndb/driver/README create mode 100644 bin/tests/system/dyndb/driver/db.c create mode 100644 bin/tests/system/dyndb/driver/db.h create mode 100644 bin/tests/system/dyndb/driver/driver.c create mode 100644 bin/tests/system/dyndb/driver/instance.c create mode 100644 bin/tests/system/dyndb/driver/instance.h create mode 100644 bin/tests/system/dyndb/driver/lock.c create mode 100644 bin/tests/system/dyndb/driver/lock.h create mode 100644 bin/tests/system/dyndb/driver/log.c create mode 100644 bin/tests/system/dyndb/driver/log.h create mode 100644 bin/tests/system/dyndb/driver/syncptr.c create mode 100644 bin/tests/system/dyndb/driver/syncptr.h create mode 100644 bin/tests/system/dyndb/driver/util.h create mode 100644 bin/tests/system/dyndb/driver/zone.c create mode 100644 bin/tests/system/dyndb/driver/zone.h create mode 100644 bin/tests/system/dyndb/ns1/named.conf.in create mode 100644 bin/tests/system/dyndb/prereq.sh create mode 100644 bin/tests/system/dyndb/setup.sh create mode 100644 bin/tests/system/dyndb/tests.sh create mode 100644 bin/tests/system/ecdsa/clean.sh create mode 100644 bin/tests/system/ecdsa/ns1/named.conf create mode 100644 bin/tests/system/ecdsa/ns1/root.db.in create mode 100644 bin/tests/system/ecdsa/ns1/sign.sh create mode 100644 bin/tests/system/ecdsa/ns2/named.conf create mode 100644 bin/tests/system/ecdsa/prereq.sh create mode 100644 bin/tests/system/ecdsa/setup.sh create mode 100644 bin/tests/system/ecdsa/tests.sh create mode 100644 bin/tests/system/eddsa/clean.sh create mode 100644 bin/tests/system/eddsa/ns1/named.conf create mode 100644 bin/tests/system/eddsa/ns1/root.db.in create mode 100644 bin/tests/system/eddsa/ns1/sign.sh create mode 100644 bin/tests/system/eddsa/ns2/Xexample.com.+015+03613.key create mode 100644 bin/tests/system/eddsa/ns2/Xexample.com.+015+03613.private create mode 100644 bin/tests/system/eddsa/ns2/Xexample.com.+015+35217.key create mode 100644 bin/tests/system/eddsa/ns2/Xexample.com.+015+35217.private create mode 100644 bin/tests/system/eddsa/ns2/example.com.db create mode 100644 bin/tests/system/eddsa/ns2/named.conf create mode 100644 bin/tests/system/eddsa/ns2/sign.sh create mode 100644 bin/tests/system/eddsa/prereq.sh create mode 100644 bin/tests/system/eddsa/setup.sh create mode 100644 bin/tests/system/eddsa/tests.sh create mode 100644 bin/tests/system/ednscompliance/clean.sh create mode 100644 bin/tests/system/ednscompliance/ns1/named.conf.in create mode 100644 bin/tests/system/ednscompliance/ns1/root.db create mode 100644 bin/tests/system/ednscompliance/setup.sh create mode 100644 bin/tests/system/ednscompliance/tests.sh create mode 100644 bin/tests/system/emptyzones/clean.sh create mode 100644 bin/tests/system/emptyzones/ns1/empty.db create mode 100644 bin/tests/system/emptyzones/ns1/named1.conf.in create mode 100644 bin/tests/system/emptyzones/ns1/named2.conf.in create mode 100644 bin/tests/system/emptyzones/ns1/rfc1918.zones create mode 100644 bin/tests/system/emptyzones/ns1/root.hint create mode 100644 bin/tests/system/emptyzones/setup.sh create mode 100644 bin/tests/system/emptyzones/tests.sh create mode 100644 bin/tests/system/feature-test.c create mode 100644 bin/tests/system/fetchlimit/ans4/ans.pl create mode 100644 bin/tests/system/fetchlimit/clean.sh create mode 100644 bin/tests/system/fetchlimit/ns1/named.conf.in create mode 100644 bin/tests/system/fetchlimit/ns1/root.db create mode 100644 bin/tests/system/fetchlimit/ns2/example.db create mode 100644 bin/tests/system/fetchlimit/ns2/named.conf.in create mode 100644 bin/tests/system/fetchlimit/ns3/named.args create mode 100644 bin/tests/system/fetchlimit/ns3/named1.conf.in create mode 100644 bin/tests/system/fetchlimit/ns3/named2.conf.in create mode 100644 bin/tests/system/fetchlimit/ns3/named3.conf.in create mode 100644 bin/tests/system/fetchlimit/ns3/root.hint create mode 100644 bin/tests/system/fetchlimit/prereq.sh create mode 100644 bin/tests/system/fetchlimit/setup.sh create mode 100644 bin/tests/system/fetchlimit/tests.sh create mode 100644 bin/tests/system/filter-aaaa/clean.sh create mode 100644 bin/tests/system/filter-aaaa/conf/bad1.conf create mode 100644 bin/tests/system/filter-aaaa/conf/bad2.conf create mode 100644 bin/tests/system/filter-aaaa/conf/bad3.conf create mode 100644 bin/tests/system/filter-aaaa/conf/bad4.conf create mode 100644 bin/tests/system/filter-aaaa/conf/bad5.conf create mode 100644 bin/tests/system/filter-aaaa/conf/bad6.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good1.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good2.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good3.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good4.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good5.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good6.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good7.conf create mode 100644 bin/tests/system/filter-aaaa/conf/good8.conf create mode 100644 bin/tests/system/filter-aaaa/ns1/named1.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns1/named2.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns1/root.db create mode 100755 bin/tests/system/filter-aaaa/ns1/sign.sh create mode 100644 bin/tests/system/filter-aaaa/ns1/signed.db.in create mode 100644 bin/tests/system/filter-aaaa/ns1/signed.db.presigned create mode 100644 bin/tests/system/filter-aaaa/ns1/unsigned.db create mode 100644 bin/tests/system/filter-aaaa/ns2/hints create mode 100644 bin/tests/system/filter-aaaa/ns2/named1.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns2/named2.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns3/hints create mode 100644 bin/tests/system/filter-aaaa/ns3/named1.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns3/named2.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns4/named1.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns4/named2.conf.in create mode 100644 bin/tests/system/filter-aaaa/ns4/root.db create mode 100755 bin/tests/system/filter-aaaa/ns4/sign.sh create mode 100644 bin/tests/system/filter-aaaa/ns4/signed.db.in create mode 100644 bin/tests/system/filter-aaaa/ns4/signed.db.presigned create mode 100644 bin/tests/system/filter-aaaa/ns4/unsigned.db create mode 100644 bin/tests/system/filter-aaaa/ns5/hints create mode 100644 bin/tests/system/filter-aaaa/ns5/named.conf.in create mode 100644 bin/tests/system/filter-aaaa/prereq.sh create mode 100644 bin/tests/system/filter-aaaa/setup.sh create mode 100644 bin/tests/system/filter-aaaa/tests.sh create mode 100644 bin/tests/system/formerr/clean.sh create mode 100644 bin/tests/system/formerr/formerr.pl create mode 100644 bin/tests/system/formerr/nametoolong create mode 100644 bin/tests/system/formerr/noquestions create mode 100644 bin/tests/system/formerr/ns1/named.conf.in create mode 100644 bin/tests/system/formerr/ns1/root.db create mode 100644 bin/tests/system/formerr/setup.sh create mode 100644 bin/tests/system/formerr/tests.sh create mode 100644 bin/tests/system/formerr/twoquestions create mode 100644 bin/tests/system/forward/clean.sh create mode 100644 bin/tests/system/forward/ns1/example.db create mode 100644 bin/tests/system/forward/ns1/named.conf.in create mode 100644 bin/tests/system/forward/ns1/root.db create mode 100644 bin/tests/system/forward/ns2/example.db create mode 100644 bin/tests/system/forward/ns2/named.conf.in create mode 100644 bin/tests/system/forward/ns2/root.db create mode 100644 bin/tests/system/forward/ns3/named.conf.in create mode 100644 bin/tests/system/forward/ns3/root.db create mode 100644 bin/tests/system/forward/ns4/named.conf.in create mode 100644 bin/tests/system/forward/ns4/root.db create mode 100644 bin/tests/system/forward/ns5/named.conf.in create mode 100644 bin/tests/system/forward/ns5/root.db create mode 100644 bin/tests/system/forward/rfc1918-inherited.conf create mode 100644 bin/tests/system/forward/rfc1918-notinherited.conf create mode 100644 bin/tests/system/forward/setup.sh create mode 100644 bin/tests/system/forward/tests.sh create mode 100644 bin/tests/system/forward/ula-inherited.conf create mode 100644 bin/tests/system/forward/ula-notinherited.conf create mode 100644 bin/tests/system/genzone.sh create mode 100644 bin/tests/system/geoip/clean.sh create mode 100644 bin/tests/system/geoip/data/GeoIP.csv create mode 100644 bin/tests/system/geoip/data/GeoIP.dat create mode 100644 bin/tests/system/geoip/data/GeoIPASNum.csv create mode 100644 bin/tests/system/geoip/data/GeoIPASNum.dat create mode 100644 bin/tests/system/geoip/data/GeoIPASNumv6.csv create mode 100644 bin/tests/system/geoip/data/GeoIPASNumv6.dat create mode 100644 bin/tests/system/geoip/data/GeoIPCity.csv create mode 100644 bin/tests/system/geoip/data/GeoIPCity.dat create mode 100644 bin/tests/system/geoip/data/GeoIPCityv6.csv create mode 100644 bin/tests/system/geoip/data/GeoIPCityv6.dat create mode 100644 bin/tests/system/geoip/data/GeoIPDomain.csv create mode 100644 bin/tests/system/geoip/data/GeoIPDomain.dat create mode 100644 bin/tests/system/geoip/data/GeoIPISP.csv create mode 100644 bin/tests/system/geoip/data/GeoIPISP.dat create mode 100644 bin/tests/system/geoip/data/GeoIPNetSpeed.csv create mode 100644 bin/tests/system/geoip/data/GeoIPNetSpeed.dat create mode 100644 bin/tests/system/geoip/data/GeoIPOrg.csv create mode 100644 bin/tests/system/geoip/data/GeoIPOrg.dat create mode 100644 bin/tests/system/geoip/data/GeoIPRegion.csv create mode 100644 bin/tests/system/geoip/data/GeoIPRegion.dat create mode 100644 bin/tests/system/geoip/data/GeoIPv6.csv create mode 100644 bin/tests/system/geoip/data/GeoIPv6.dat create mode 100644 bin/tests/system/geoip/data/README create mode 100644 bin/tests/system/geoip/ns2/example.db.in create mode 100644 bin/tests/system/geoip/ns2/named1.conf.in create mode 100644 bin/tests/system/geoip/ns2/named10.conf.in create mode 100644 bin/tests/system/geoip/ns2/named11.conf.in create mode 100644 bin/tests/system/geoip/ns2/named12.conf.in create mode 100644 bin/tests/system/geoip/ns2/named13.conf.in create mode 100644 bin/tests/system/geoip/ns2/named14.conf.in create mode 100644 bin/tests/system/geoip/ns2/named15.conf.in create mode 100644 bin/tests/system/geoip/ns2/named2.conf.in create mode 100644 bin/tests/system/geoip/ns2/named3.conf.in create mode 100644 bin/tests/system/geoip/ns2/named4.conf.in create mode 100644 bin/tests/system/geoip/ns2/named5.conf.in create mode 100644 bin/tests/system/geoip/ns2/named6.conf.in create mode 100644 bin/tests/system/geoip/ns2/named7.conf.in create mode 100644 bin/tests/system/geoip/ns2/named8.conf.in create mode 100644 bin/tests/system/geoip/ns2/named9.conf.in create mode 100644 bin/tests/system/geoip/options.conf create mode 100644 bin/tests/system/geoip/prereq.sh create mode 100644 bin/tests/system/geoip/setup.sh create mode 100644 bin/tests/system/geoip/tests.sh create mode 100644 bin/tests/system/glue/clean.sh create mode 100644 bin/tests/system/glue/fi.good create mode 100644 bin/tests/system/glue/noglue.good create mode 100644 bin/tests/system/glue/ns1/cache.in create mode 100644 bin/tests/system/glue/ns1/mil.db create mode 100644 bin/tests/system/glue/ns1/named.conf.in create mode 100644 bin/tests/system/glue/ns1/net.db create mode 100644 bin/tests/system/glue/ns1/root-servers.nil.db create mode 100644 bin/tests/system/glue/ns1/root.db create mode 100644 bin/tests/system/glue/setup.sh create mode 100644 bin/tests/system/glue/tests.sh create mode 100644 bin/tests/system/glue/xx.good create mode 100644 bin/tests/system/glue/yy.good create mode 100644 bin/tests/system/gost/clean.sh create mode 100644 bin/tests/system/gost/ns1/named.conf create mode 100644 bin/tests/system/gost/ns1/root.db.in create mode 100644 bin/tests/system/gost/ns1/sign.sh create mode 100644 bin/tests/system/gost/ns2/named.conf create mode 100644 bin/tests/system/gost/prereq.sh create mode 100644 bin/tests/system/gost/setup.sh create mode 100644 bin/tests/system/gost/tests.sh create mode 100644 bin/tests/system/idna/clean.sh create mode 100644 bin/tests/system/idna/ns1/named.conf.in create mode 100644 bin/tests/system/idna/ns1/root.db create mode 100644 bin/tests/system/idna/setup.sh create mode 100644 bin/tests/system/idna/tests.sh create mode 100644 bin/tests/system/ifconfig.bat create mode 100755 bin/tests/system/ifconfig.sh create mode 100644 bin/tests/system/inline/checkdsa.sh.in create mode 100644 bin/tests/system/inline/clean.sh create mode 100644 bin/tests/system/inline/ns1/named.conf.in create mode 100644 bin/tests/system/inline/ns1/root.db.in create mode 100644 bin/tests/system/inline/ns1/sign.sh create mode 100644 bin/tests/system/inline/ns2/bits.db.in create mode 100644 bin/tests/system/inline/ns2/named.conf.in create mode 100644 bin/tests/system/inline/ns2/nsec3-loop.db create mode 100644 bin/tests/system/inline/ns3/master.db.in create mode 100644 bin/tests/system/inline/ns3/master2.db.in create mode 100644 bin/tests/system/inline/ns3/master3.db.in create mode 100644 bin/tests/system/inline/ns3/master4.db.in create mode 100644 bin/tests/system/inline/ns3/master5.db.in create mode 100644 bin/tests/system/inline/ns3/named.conf.in create mode 100755 bin/tests/system/inline/ns3/sign.sh create mode 100644 bin/tests/system/inline/ns4/named.conf.in create mode 100644 bin/tests/system/inline/ns4/noixfr.db.in create mode 100644 bin/tests/system/inline/ns5/named.conf.post create mode 100644 bin/tests/system/inline/ns5/named.conf.pre create mode 100644 bin/tests/system/inline/ns6/named.conf.in create mode 100644 bin/tests/system/inline/ns7/named.conf.in create mode 100755 bin/tests/system/inline/ns7/sign.sh create mode 100644 bin/tests/system/inline/prereq.sh create mode 100644 bin/tests/system/inline/setup.sh create mode 100755 bin/tests/system/inline/tests.sh create mode 100644 bin/tests/system/integrity/clean.sh create mode 100644 bin/tests/system/integrity/ns1/mx-cname.db create mode 100644 bin/tests/system/integrity/ns1/named.conf.in create mode 100644 bin/tests/system/integrity/ns1/srv-cname.db create mode 100644 bin/tests/system/integrity/setup.sh create mode 100644 bin/tests/system/integrity/tests.sh create mode 100644 bin/tests/system/ixfr/ans2/startme create mode 100644 bin/tests/system/ixfr/clean.sh create mode 100644 bin/tests/system/ixfr/ns1/startme create mode 100644 bin/tests/system/ixfr/ns3/mytest0.db create mode 100644 bin/tests/system/ixfr/ns3/mytest1.db create mode 100644 bin/tests/system/ixfr/ns3/mytest2.db create mode 100644 bin/tests/system/ixfr/ns3/named.conf.in create mode 100644 bin/tests/system/ixfr/ns3/subtest0.db create mode 100644 bin/tests/system/ixfr/ns3/subtest1.db create mode 100644 bin/tests/system/ixfr/ns4/named.conf.in create mode 100644 bin/tests/system/ixfr/prereq.sh create mode 100644 bin/tests/system/ixfr/setup.sh create mode 100644 bin/tests/system/ixfr/tests.sh create mode 100644 bin/tests/system/keymgr/01-ksk-inactive/README create mode 100644 bin/tests/system/keymgr/01-ksk-inactive/expect create mode 100644 bin/tests/system/keymgr/02-zsk-inactive/README create mode 100644 bin/tests/system/keymgr/02-zsk-inactive/expect create mode 100644 bin/tests/system/keymgr/03-ksk-unpublished/README create mode 100644 bin/tests/system/keymgr/03-ksk-unpublished/expect create mode 100644 bin/tests/system/keymgr/04-zsk-unpublished/README create mode 100644 bin/tests/system/keymgr/04-zsk-unpublished/expect create mode 100644 bin/tests/system/keymgr/05-ksk-unpub-active/README create mode 100644 bin/tests/system/keymgr/05-ksk-unpub-active/expect create mode 100644 bin/tests/system/keymgr/06-zsk-unpub-active/README create mode 100644 bin/tests/system/keymgr/06-zsk-unpub-active/expect create mode 100644 bin/tests/system/keymgr/07-ksk-ttl/README create mode 100644 bin/tests/system/keymgr/07-ksk-ttl/expect create mode 100644 bin/tests/system/keymgr/08-zsk-ttl/README create mode 100644 bin/tests/system/keymgr/08-zsk-ttl/expect create mode 100644 bin/tests/system/keymgr/09-no-keys/README create mode 100644 bin/tests/system/keymgr/09-no-keys/expect create mode 100644 bin/tests/system/keymgr/10-change-roll/README create mode 100644 bin/tests/system/keymgr/10-change-roll/expect create mode 100644 bin/tests/system/keymgr/11-many-simul/README create mode 100644 bin/tests/system/keymgr/11-many-simul/expect create mode 100644 bin/tests/system/keymgr/12-many-active/README create mode 100644 bin/tests/system/keymgr/12-many-active/expect create mode 100644 bin/tests/system/keymgr/13-noroll/README create mode 100644 bin/tests/system/keymgr/13-noroll/expect create mode 100644 bin/tests/system/keymgr/14-wrongalg/README create mode 100644 bin/tests/system/keymgr/14-wrongalg/expect create mode 100644 bin/tests/system/keymgr/15-unspec/README create mode 100644 bin/tests/system/keymgr/15-unspec/expect create mode 100644 bin/tests/system/keymgr/16-wrongalg-unspec/README create mode 100644 bin/tests/system/keymgr/16-wrongalg-unspec/expect create mode 100644 bin/tests/system/keymgr/17-noforce/README create mode 100644 bin/tests/system/keymgr/17-noforce/expect create mode 100644 bin/tests/system/keymgr/18-nonstd-prepub/README create mode 100644 bin/tests/system/keymgr/18-nonstd-prepub/expect create mode 100644 bin/tests/system/keymgr/18-nonstd-prepub/policy.conf create mode 100644 bin/tests/system/keymgr/clean.sh create mode 100644 bin/tests/system/keymgr/policy.conf create mode 100644 bin/tests/system/keymgr/policy.good create mode 100644 bin/tests/system/keymgr/policy.sample create mode 100644 bin/tests/system/keymgr/prereq.sh create mode 100644 bin/tests/system/keymgr/setup.sh create mode 100644 bin/tests/system/keymgr/testpolicy.py create mode 100644 bin/tests/system/keymgr/tests.sh create mode 100644 bin/tests/system/legacy/build.sh create mode 100644 bin/tests/system/legacy/clean.sh create mode 100644 bin/tests/system/legacy/ns1/named1.conf.in create mode 100644 bin/tests/system/legacy/ns1/named2.conf.in create mode 100644 bin/tests/system/legacy/ns1/root.db create mode 100644 bin/tests/system/legacy/ns1/trusted.conf create mode 100644 bin/tests/system/legacy/ns2/dropedns.db create mode 100644 bin/tests/system/legacy/ns2/named.conf.in create mode 100644 bin/tests/system/legacy/ns2/named.dropedns create mode 100644 bin/tests/system/legacy/ns3/dropedns-notcp.db create mode 100644 bin/tests/system/legacy/ns3/named.conf.in create mode 100644 bin/tests/system/legacy/ns3/named.dropedns create mode 100644 bin/tests/system/legacy/ns3/named.notcp create mode 100644 bin/tests/system/legacy/ns4/named.args create mode 100644 bin/tests/system/legacy/ns4/named.conf.in create mode 100644 bin/tests/system/legacy/ns4/plain.db create mode 100644 bin/tests/system/legacy/ns5/named.args create mode 100644 bin/tests/system/legacy/ns5/named.conf.in create mode 100644 bin/tests/system/legacy/ns5/named.notcp create mode 100644 bin/tests/system/legacy/ns5/plain-notcp.db create mode 100644 bin/tests/system/legacy/ns6/edns512.db.in create mode 100644 bin/tests/system/legacy/ns6/edns512.db.signed create mode 100644 bin/tests/system/legacy/ns6/named.args create mode 100644 bin/tests/system/legacy/ns6/named.conf.in create mode 100755 bin/tests/system/legacy/ns6/sign.sh create mode 100644 bin/tests/system/legacy/ns7/edns512-notcp.db.in create mode 100644 bin/tests/system/legacy/ns7/edns512-notcp.db.signed create mode 100644 bin/tests/system/legacy/ns7/named.args create mode 100644 bin/tests/system/legacy/ns7/named.conf.in create mode 100644 bin/tests/system/legacy/ns7/named.notcp create mode 100755 bin/tests/system/legacy/ns7/sign.sh create mode 100644 bin/tests/system/legacy/setup.sh create mode 100755 bin/tests/system/legacy/tests.sh create mode 100644 bin/tests/system/limits/clean.sh create mode 100644 bin/tests/system/limits/knowngood.dig.out.1000 create mode 100644 bin/tests/system/limits/knowngood.dig.out.2000 create mode 100644 bin/tests/system/limits/knowngood.dig.out.3000 create mode 100644 bin/tests/system/limits/knowngood.dig.out.4000 create mode 100644 bin/tests/system/limits/knowngood.dig.out.a-maximum-rrset create mode 100644 bin/tests/system/limits/ns1/example.db create mode 100644 bin/tests/system/limits/ns1/named.conf.in create mode 100644 bin/tests/system/limits/ns1/root.db create mode 100644 bin/tests/system/limits/setup.sh create mode 100644 bin/tests/system/limits/tests.sh create mode 100644 bin/tests/system/logfileconfig/clean.sh create mode 100644 bin/tests/system/logfileconfig/ns1/controls.conf.in create mode 100644 bin/tests/system/logfileconfig/ns1/named.dirconf create mode 100644 bin/tests/system/logfileconfig/ns1/named.pipeconf create mode 100644 bin/tests/system/logfileconfig/ns1/named.plain create mode 100644 bin/tests/system/logfileconfig/ns1/named.plainconf create mode 100644 bin/tests/system/logfileconfig/ns1/named.symconf create mode 100644 bin/tests/system/logfileconfig/ns1/named.unlimited create mode 100644 bin/tests/system/logfileconfig/ns1/named.versconf create mode 100644 bin/tests/system/logfileconfig/ns1/rndc.conf.in create mode 100644 bin/tests/system/logfileconfig/ns1/root.db create mode 100644 bin/tests/system/logfileconfig/setup.sh create mode 100644 bin/tests/system/logfileconfig/tests.sh create mode 100644 bin/tests/system/lwresd/Makefile.in create mode 100644 bin/tests/system/lwresd/clean.sh create mode 100644 bin/tests/system/lwresd/lwresd1/lwresd.conf create mode 100644 bin/tests/system/lwresd/lwresd1/nosearch.conf create mode 100644 bin/tests/system/lwresd/lwresd1/resolv.conf create mode 100644 bin/tests/system/lwresd/lwtest.c create mode 100644 bin/tests/system/lwresd/ns1/10.10.10.in-addr.arpa.db create mode 100644 bin/tests/system/lwresd/ns1/e.example1.db create mode 100644 bin/tests/system/lwresd/ns1/example1.db create mode 100644 bin/tests/system/lwresd/ns1/example2.db create mode 100644 bin/tests/system/lwresd/ns1/ip6.arpa.db create mode 100644 bin/tests/system/lwresd/ns1/ip6.int.db create mode 100644 bin/tests/system/lwresd/ns1/named.conf create mode 100644 bin/tests/system/lwresd/ns1/root.db create mode 100644 bin/tests/system/lwresd/resolv.conf create mode 100644 bin/tests/system/lwresd/tests.sh create mode 100644 bin/tests/system/masterfile/clean.sh create mode 100644 bin/tests/system/masterfile/knowngood.dig.out create mode 100644 bin/tests/system/masterfile/ns1/include.db create mode 100644 bin/tests/system/masterfile/ns1/named.conf.in create mode 100644 bin/tests/system/masterfile/ns1/sub.db create mode 100644 bin/tests/system/masterfile/ns1/ttl1.db create mode 100644 bin/tests/system/masterfile/ns1/ttl2.db create mode 100644 bin/tests/system/masterfile/ns2/example.db create mode 100644 bin/tests/system/masterfile/ns2/named.conf.in create mode 100644 bin/tests/system/masterfile/setup.sh create mode 100644 bin/tests/system/masterfile/tests.sh create mode 100644 bin/tests/system/masterfile/zone/inheritownerafterinclude.db create mode 100644 bin/tests/system/masterfile/zone/inheritownerafterinclude.good create mode 100644 bin/tests/system/masterfile/zone/nameservers.db create mode 100755 bin/tests/system/masterformat/clean.sh create mode 100755 bin/tests/system/masterformat/ns1/compile.sh create mode 100644 bin/tests/system/masterformat/ns1/example.db create mode 100644 bin/tests/system/masterformat/ns1/large.db.in create mode 100644 bin/tests/system/masterformat/ns1/named.conf.in create mode 100644 bin/tests/system/masterformat/ns1/signed.db create mode 100644 bin/tests/system/masterformat/ns2/formerly-text.db.in create mode 100644 bin/tests/system/masterformat/ns2/named.conf.in create mode 100644 bin/tests/system/masterformat/ns3/named.conf.in create mode 100755 bin/tests/system/masterformat/prereq.sh create mode 100755 bin/tests/system/masterformat/setup.sh create mode 100755 bin/tests/system/masterformat/tests.sh create mode 100644 bin/tests/system/metadata/child.db create mode 100644 bin/tests/system/metadata/clean.sh create mode 100644 bin/tests/system/metadata/parent.db create mode 100644 bin/tests/system/metadata/prereq.sh create mode 100644 bin/tests/system/metadata/setup.sh create mode 100644 bin/tests/system/metadata/tests.sh create mode 100644 bin/tests/system/mkeys/README create mode 100644 bin/tests/system/mkeys/clean.sh create mode 100644 bin/tests/system/mkeys/ns1/named1.conf.in create mode 100644 bin/tests/system/mkeys/ns1/named2.conf.in create mode 100644 bin/tests/system/mkeys/ns1/named3.conf.in create mode 100644 bin/tests/system/mkeys/ns1/root.db create mode 100644 bin/tests/system/mkeys/ns1/sign.sh create mode 100644 bin/tests/system/mkeys/ns2/named.args create mode 100644 bin/tests/system/mkeys/ns2/named.conf.in create mode 100644 bin/tests/system/mkeys/ns3/named.args create mode 100644 bin/tests/system/mkeys/ns3/named.conf.in create mode 100644 bin/tests/system/mkeys/ns5/named.conf.in create mode 100644 bin/tests/system/mkeys/ns5/named1.args create mode 100644 bin/tests/system/mkeys/ns5/named2.args create mode 100644 bin/tests/system/mkeys/prereq.sh create mode 100644 bin/tests/system/mkeys/setup.sh create mode 100644 bin/tests/system/mkeys/tests.sh create mode 100644 bin/tests/system/names/clean.sh create mode 100644 bin/tests/system/names/ns1/example.db create mode 100644 bin/tests/system/names/ns1/named.conf.in create mode 100644 bin/tests/system/names/setup.sh create mode 100644 bin/tests/system/names/tests.sh create mode 100644 bin/tests/system/notify/clean.sh create mode 100644 bin/tests/system/notify/ns1/named.conf.in create mode 100644 bin/tests/system/notify/ns1/root.db create mode 100644 bin/tests/system/notify/ns2/example1.db create mode 100644 bin/tests/system/notify/ns2/example2.db create mode 100644 bin/tests/system/notify/ns2/example3.db create mode 100644 bin/tests/system/notify/ns2/example4.db create mode 100644 bin/tests/system/notify/ns2/generic.db create mode 100644 bin/tests/system/notify/ns2/named.conf.in create mode 100644 bin/tests/system/notify/ns3/named.conf.in create mode 100644 bin/tests/system/notify/ns4/named.conf.in create mode 100644 bin/tests/system/notify/ns4/named.port.in create mode 100644 bin/tests/system/notify/ns5/named.conf.in create mode 100644 bin/tests/system/notify/ns5/x21.db create mode 100644 bin/tests/system/notify/setup.sh create mode 100644 bin/tests/system/notify/tests.sh create mode 100644 bin/tests/system/nslookup/clean.sh create mode 100644 bin/tests/system/nslookup/ns1/example.net.db create mode 100644 bin/tests/system/nslookup/ns1/named.conf.in create mode 100644 bin/tests/system/nslookup/setup.sh create mode 100644 bin/tests/system/nslookup/tests.sh create mode 100644 bin/tests/system/nsupdate/ans4/ans.pl create mode 100644 bin/tests/system/nsupdate/clean.sh create mode 100644 bin/tests/system/nsupdate/commandlist create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.after create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.afterstop create mode 100644 bin/tests/system/nsupdate/knowngood.ns1.before create mode 100644 bin/tests/system/nsupdate/krb/setup.sh create mode 100644 bin/tests/system/nsupdate/ns1/example1.db create mode 100644 bin/tests/system/nsupdate/ns1/many.test.db.in create mode 100644 bin/tests/system/nsupdate/ns1/max-ttl.db create mode 100644 bin/tests/system/nsupdate/ns1/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns1/sample.db.in create mode 100644 bin/tests/system/nsupdate/ns10/dns.keytab create mode 100644 bin/tests/system/nsupdate/ns10/example.com.db.in create mode 100644 bin/tests/system/nsupdate/ns10/in-addr.db.in create mode 100644 bin/tests/system/nsupdate/ns10/machine.ccache create mode 100644 bin/tests/system/nsupdate/ns10/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns2/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns2/sample.db.in create mode 100644 bin/tests/system/nsupdate/ns3/delegation.test.db.in create mode 100644 bin/tests/system/nsupdate/ns3/dnskey.test.db.in create mode 100644 bin/tests/system/nsupdate/ns3/example.db.in create mode 100644 bin/tests/system/nsupdate/ns3/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns3/nsec3param.test.db.in create mode 100644 bin/tests/system/nsupdate/ns3/sign.sh create mode 100644 bin/tests/system/nsupdate/ns3/too-big.test.db.in create mode 100644 bin/tests/system/nsupdate/ns5/local.db.in create mode 100644 bin/tests/system/nsupdate/ns5/named.args create mode 100644 bin/tests/system/nsupdate/ns5/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns6/in-addr.db.in create mode 100644 bin/tests/system/nsupdate/ns6/named.args create mode 100644 bin/tests/system/nsupdate/ns6/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns7/dns.keytab create mode 100644 bin/tests/system/nsupdate/ns7/example.com.db.in create mode 100644 bin/tests/system/nsupdate/ns7/in-addr.db.in create mode 100644 bin/tests/system/nsupdate/ns7/machine.ccache create mode 100644 bin/tests/system/nsupdate/ns7/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns8/dns.keytab create mode 100644 bin/tests/system/nsupdate/ns8/example.com.db.in create mode 100644 bin/tests/system/nsupdate/ns8/in-addr.db.in create mode 100644 bin/tests/system/nsupdate/ns8/machine.ccache create mode 100644 bin/tests/system/nsupdate/ns8/named.conf.in create mode 100644 bin/tests/system/nsupdate/ns9/dns.keytab create mode 100644 bin/tests/system/nsupdate/ns9/example.com.db.in create mode 100644 bin/tests/system/nsupdate/ns9/in-addr.db.in create mode 100644 bin/tests/system/nsupdate/ns9/machine.ccache create mode 100644 bin/tests/system/nsupdate/ns9/named.conf.in create mode 100644 bin/tests/system/nsupdate/prereq.sh create mode 100644 bin/tests/system/nsupdate/setup.sh create mode 100755 bin/tests/system/nsupdate/tests.sh create mode 100644 bin/tests/system/nsupdate/update_test.pl create mode 100644 bin/tests/system/nsupdate/verylarge.in create mode 100644 bin/tests/system/nzd2nzf/clean.sh create mode 100644 bin/tests/system/nzd2nzf/ns1/added.db create mode 100644 bin/tests/system/nzd2nzf/ns1/named.conf.in create mode 100644 bin/tests/system/nzd2nzf/prereq.sh create mode 100644 bin/tests/system/nzd2nzf/setup.sh create mode 100644 bin/tests/system/nzd2nzf/tests.sh create mode 100644 bin/tests/system/org.isc.bind.system create mode 100644 bin/tests/system/org.isc.bind.system.plist create mode 100644 bin/tests/system/packet.pl create mode 100644 bin/tests/system/pending/clean.sh create mode 100644 bin/tests/system/pending/ns1/named.conf.in create mode 100644 bin/tests/system/pending/ns1/root.db.in create mode 100644 bin/tests/system/pending/ns1/sign.sh create mode 100644 bin/tests/system/pending/ns2/example.com.db.in create mode 100644 bin/tests/system/pending/ns2/example.db.in create mode 100644 bin/tests/system/pending/ns2/forgery.db create mode 100644 bin/tests/system/pending/ns2/named.conf.in create mode 100644 bin/tests/system/pending/ns2/sign.sh create mode 100644 bin/tests/system/pending/ns3/hostile.db create mode 100644 bin/tests/system/pending/ns3/mail.example.db create mode 100644 bin/tests/system/pending/ns3/named.conf.in create mode 100644 bin/tests/system/pending/ns4/named.conf.in create mode 100644 bin/tests/system/pending/prereq.sh create mode 100644 bin/tests/system/pending/setup.sh create mode 100644 bin/tests/system/pending/tests.sh create mode 100644 bin/tests/system/pipelined/Makefile.in create mode 100644 bin/tests/system/pipelined/clean.sh create mode 100644 bin/tests/system/pipelined/input create mode 100644 bin/tests/system/pipelined/inputb create mode 100644 bin/tests/system/pipelined/ns1/named.conf.in create mode 100644 bin/tests/system/pipelined/ns1/root.db create mode 100644 bin/tests/system/pipelined/ns2/examplea.db create mode 100644 bin/tests/system/pipelined/ns2/named.conf.in create mode 100644 bin/tests/system/pipelined/ns3/exampleb.db create mode 100644 bin/tests/system/pipelined/ns3/named.args create mode 100644 bin/tests/system/pipelined/ns3/named.conf.in create mode 100644 bin/tests/system/pipelined/ns4/named.conf.in create mode 100644 bin/tests/system/pipelined/pipequeries.c create mode 100644 bin/tests/system/pipelined/ref create mode 100644 bin/tests/system/pipelined/refb create mode 100644 bin/tests/system/pipelined/setup.sh create mode 100644 bin/tests/system/pipelined/tests.sh create mode 100644 bin/tests/system/pkcs11/clean.sh create mode 100644 bin/tests/system/pkcs11/ns1/example.db.in create mode 100644 bin/tests/system/pkcs11/ns1/named.conf create mode 100644 bin/tests/system/pkcs11/prereq.sh create mode 100644 bin/tests/system/pkcs11/setup.sh create mode 100644 bin/tests/system/pkcs11/tests.sh create mode 100644 bin/tests/system/pkcs11/usepkcs11 create mode 100644 bin/tests/system/pkcs11ssl/clean.sh create mode 100644 bin/tests/system/pkcs11ssl/ns1/example.db.in create mode 100644 bin/tests/system/pkcs11ssl/ns1/named.conf create mode 100644 bin/tests/system/pkcs11ssl/prereq.sh create mode 100644 bin/tests/system/pkcs11ssl/setup.sh create mode 100644 bin/tests/system/pkcs11ssl/tests.sh create mode 100644 bin/tests/system/pkcs11ssl/usepkcs11 create mode 100644 bin/tests/system/reclimit/README create mode 100644 bin/tests/system/reclimit/ans2/ans.pl create mode 100644 bin/tests/system/reclimit/ans7/ans.pl create mode 100644 bin/tests/system/reclimit/clean.sh create mode 100644 bin/tests/system/reclimit/ns1/named.conf.in create mode 100644 bin/tests/system/reclimit/ns1/root.db create mode 100644 bin/tests/system/reclimit/ns3/hints.db create mode 100644 bin/tests/system/reclimit/ns3/named1.conf.in create mode 100644 bin/tests/system/reclimit/ns3/named2.conf.in create mode 100644 bin/tests/system/reclimit/ns3/named3.conf.in create mode 100644 bin/tests/system/reclimit/ns3/named4.conf.in create mode 100644 bin/tests/system/reclimit/prereq.sh create mode 100644 bin/tests/system/reclimit/setup.sh create mode 100644 bin/tests/system/reclimit/tests.sh create mode 100644 bin/tests/system/redirect/clean.sh create mode 100644 bin/tests/system/redirect/conf/bad1.conf create mode 100644 bin/tests/system/redirect/conf/bad2.conf create mode 100644 bin/tests/system/redirect/conf/bad3.conf create mode 100644 bin/tests/system/redirect/conf/good1.conf create mode 100644 bin/tests/system/redirect/conf/good2.conf create mode 100644 bin/tests/system/redirect/conf/good3.conf create mode 100644 bin/tests/system/redirect/conf/good4.conf create mode 100644 bin/tests/system/redirect/ns1/example.db create mode 100644 bin/tests/system/redirect/ns1/named.conf.in create mode 100644 bin/tests/system/redirect/ns1/redirect.db create mode 100644 bin/tests/system/redirect/ns1/root.db create mode 100644 bin/tests/system/redirect/ns1/sign.sh create mode 100644 bin/tests/system/redirect/ns2/example.db.in create mode 100644 bin/tests/system/redirect/ns2/named.conf.in create mode 100644 bin/tests/system/redirect/ns2/redirect.db.in create mode 100644 bin/tests/system/redirect/ns3/example.db create mode 100644 bin/tests/system/redirect/ns3/named.conf.in create mode 100644 bin/tests/system/redirect/ns3/redirect.db create mode 100644 bin/tests/system/redirect/ns3/root.db create mode 100644 bin/tests/system/redirect/ns3/sign.sh create mode 100644 bin/tests/system/redirect/ns4/example.db.in create mode 100644 bin/tests/system/redirect/ns4/named.conf.in create mode 100644 bin/tests/system/redirect/ns4/root.hint create mode 100644 bin/tests/system/redirect/prereq.sh create mode 100644 bin/tests/system/redirect/setup.sh create mode 100644 bin/tests/system/redirect/tests.sh create mode 100644 bin/tests/system/resolver/ans2/ans.pl create mode 100644 bin/tests/system/resolver/ans3/ans.pl create mode 100644 bin/tests/system/resolver/ans8/ans.pl create mode 100644 bin/tests/system/resolver/clean.sh create mode 100644 bin/tests/system/resolver/ns1/named.conf.in create mode 100644 bin/tests/system/resolver/ns1/root.hint create mode 100644 bin/tests/system/resolver/ns4/broken.db create mode 100644 bin/tests/system/resolver/ns4/child.server.db create mode 100644 bin/tests/system/resolver/ns4/moves.db create mode 100644 bin/tests/system/resolver/ns4/named.conf.in create mode 100644 bin/tests/system/resolver/ns4/named.noaa create mode 100644 bin/tests/system/resolver/ns4/root.db create mode 100644 bin/tests/system/resolver/ns4/tld1.db create mode 100644 bin/tests/system/resolver/ns4/tld2.db create mode 100644 bin/tests/system/resolver/ns5/child.server.db create mode 100644 bin/tests/system/resolver/ns5/moves.db create mode 100644 bin/tests/system/resolver/ns5/named.conf.in create mode 100644 bin/tests/system/resolver/ns5/root.hint create mode 100644 bin/tests/system/resolver/ns6/broken.db create mode 100644 bin/tests/system/resolver/ns6/delegation-only.db create mode 100644 bin/tests/system/resolver/ns6/ds.example.net.db.in create mode 100644 bin/tests/system/resolver/ns6/example.net.db.in create mode 100644 bin/tests/system/resolver/ns6/keygen.sh create mode 100644 bin/tests/system/resolver/ns6/moves.db create mode 100644 bin/tests/system/resolver/ns6/named.conf.in create mode 100644 bin/tests/system/resolver/ns6/no-edns-version.tld.db create mode 100644 bin/tests/system/resolver/ns6/root.db create mode 100644 bin/tests/system/resolver/ns6/to-be-removed.tld.db.in create mode 100644 bin/tests/system/resolver/ns7/all-cnames.db create mode 100644 bin/tests/system/resolver/ns7/edns-version.tld.db create mode 100644 bin/tests/system/resolver/ns7/named.args create mode 100644 bin/tests/system/resolver/ns7/named1.conf.in create mode 100644 bin/tests/system/resolver/ns7/named2.conf.in create mode 100644 bin/tests/system/resolver/ns7/root.hint create mode 100644 bin/tests/system/resolver/ns7/server.db.in create mode 100644 bin/tests/system/resolver/prereq.sh create mode 100644 bin/tests/system/resolver/setup.sh create mode 100755 bin/tests/system/resolver/tests.sh create mode 100644 bin/tests/system/rndc/Makefile.in create mode 100644 bin/tests/system/rndc/clean.sh create mode 100644 bin/tests/system/rndc/gencheck.c create mode 100644 bin/tests/system/rndc/ns2/incl.db create mode 100644 bin/tests/system/rndc/ns2/named.conf.in create mode 100644 bin/tests/system/rndc/ns2/secondkey.conf create mode 100644 bin/tests/system/rndc/ns3/named.conf.in create mode 100644 bin/tests/system/rndc/ns4/named.conf.in create mode 100644 bin/tests/system/rndc/ns5/named.conf.in create mode 100644 bin/tests/system/rndc/ns6/named.args create mode 100644 bin/tests/system/rndc/ns6/named.conf.in create mode 100644 bin/tests/system/rndc/setup.sh create mode 100644 bin/tests/system/rndc/tests.sh create mode 100644 bin/tests/system/rootkeysentinel/clean.sh create mode 100644 bin/tests/system/rootkeysentinel/ns1/named.conf.in create mode 100644 bin/tests/system/rootkeysentinel/ns1/root.db.in create mode 100644 bin/tests/system/rootkeysentinel/ns1/sign.sh create mode 100644 bin/tests/system/rootkeysentinel/ns2/example.db.in create mode 100644 bin/tests/system/rootkeysentinel/ns2/named.conf.in create mode 100644 bin/tests/system/rootkeysentinel/ns2/sign.sh create mode 100644 bin/tests/system/rootkeysentinel/ns3/hint.db create mode 100644 bin/tests/system/rootkeysentinel/ns3/named.conf.in create mode 100644 bin/tests/system/rootkeysentinel/ns4/hint.db create mode 100644 bin/tests/system/rootkeysentinel/ns4/named.conf.in create mode 100644 bin/tests/system/rootkeysentinel/prereq.sh create mode 100644 bin/tests/system/rootkeysentinel/setup.sh create mode 100644 bin/tests/system/rootkeysentinel/tests.sh create mode 100644 bin/tests/system/rpz/clean.sh create mode 100644 bin/tests/system/rpz/ns1/named.conf.in create mode 100644 bin/tests/system/rpz/ns1/root.db create mode 100644 bin/tests/system/rpz/ns2/base-tld2s.db create mode 100644 bin/tests/system/rpz/ns2/bl.tld2.db.in create mode 100644 bin/tests/system/rpz/ns2/blv2.tld2.db.in create mode 100644 bin/tests/system/rpz/ns2/blv3.tld2.db.in create mode 100644 bin/tests/system/rpz/ns2/hints create mode 100644 bin/tests/system/rpz/ns2/named.conf.in create mode 100644 bin/tests/system/rpz/ns2/tld2.db create mode 100644 bin/tests/system/rpz/ns3/base.db create mode 100644 bin/tests/system/rpz/ns3/crash1 create mode 100644 bin/tests/system/rpz/ns3/crash2 create mode 100644 bin/tests/system/rpz/ns3/hints create mode 100644 bin/tests/system/rpz/ns3/named.conf.in create mode 100644 bin/tests/system/rpz/ns4/hints create mode 100644 bin/tests/system/rpz/ns4/named.conf.in create mode 100644 bin/tests/system/rpz/ns4/tld4.db create mode 100644 bin/tests/system/rpz/ns5/empty.db.in create mode 100644 bin/tests/system/rpz/ns5/hints create mode 100644 bin/tests/system/rpz/ns5/named.args create mode 100644 bin/tests/system/rpz/ns5/named.conf.in create mode 100644 bin/tests/system/rpz/ns5/tld5.db create mode 100644 bin/tests/system/rpz/ns6/hints create mode 100644 bin/tests/system/rpz/ns6/named.conf.in create mode 100644 bin/tests/system/rpz/ns7/hints create mode 100644 bin/tests/system/rpz/ns7/named.conf.in create mode 100644 bin/tests/system/rpz/prereq.sh create mode 100644 bin/tests/system/rpz/qperf.sh create mode 100644 bin/tests/system/rpz/setup.sh create mode 100644 bin/tests/system/rpz/test1 create mode 100644 bin/tests/system/rpz/test2 create mode 100644 bin/tests/system/rpz/test3 create mode 100644 bin/tests/system/rpz/test4 create mode 100644 bin/tests/system/rpz/test4a create mode 100644 bin/tests/system/rpz/test5 create mode 100644 bin/tests/system/rpz/test6 create mode 100644 bin/tests/system/rpz/tests.sh create mode 100644 bin/tests/system/rpzrecurse/README create mode 100644 bin/tests/system/rpzrecurse/ans5/ans.pl create mode 100644 bin/tests/system/rpzrecurse/clean.sh create mode 100644 bin/tests/system/rpzrecurse/ns1/db.l0 create mode 100644 bin/tests/system/rpzrecurse/ns1/db.l1.l0 create mode 100644 bin/tests/system/rpzrecurse/ns1/example.db create mode 100644 bin/tests/system/rpzrecurse/ns1/named.conf.in create mode 100644 bin/tests/system/rpzrecurse/ns1/root.db create mode 100644 bin/tests/system/rpzrecurse/ns1/test1.example.net.db create mode 100644 bin/tests/system/rpzrecurse/ns1/test2.example.net.db create mode 100644 bin/tests/system/rpzrecurse/ns2/db.clientip1 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.clientip2 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.clientip21 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.log1 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.log2 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.log3 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.wildcard1 create mode 100644 bin/tests/system/rpzrecurse/ns2/db.wildcard2a create mode 100644 bin/tests/system/rpzrecurse/ns2/db.wildcard2b create mode 100644 bin/tests/system/rpzrecurse/ns2/db.wildcard3 create mode 100644 bin/tests/system/rpzrecurse/ns2/named.clientip.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.clientip2.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.conf.header.in create mode 100644 bin/tests/system/rpzrecurse/ns2/named.default.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.log.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.wildcard1.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.wildcard2.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/named.wildcard3.conf create mode 100644 bin/tests/system/rpzrecurse/ns2/root.hint create mode 100644 bin/tests/system/rpzrecurse/ns3/example.db create mode 100644 bin/tests/system/rpzrecurse/ns3/named1.conf.in create mode 100644 bin/tests/system/rpzrecurse/ns3/named2.conf.in create mode 100644 bin/tests/system/rpzrecurse/ns3/policy.db create mode 100644 bin/tests/system/rpzrecurse/ns3/root.db create mode 100644 bin/tests/system/rpzrecurse/ns4/child.example.db create mode 100644 bin/tests/system/rpzrecurse/ns4/named.conf.in create mode 100644 bin/tests/system/rpzrecurse/prereq.sh create mode 100644 bin/tests/system/rpzrecurse/setup.sh create mode 100755 bin/tests/system/rpzrecurse/testgen.pl create mode 100644 bin/tests/system/rpzrecurse/tests.sh create mode 100644 bin/tests/system/rrchecker/classlist.good create mode 100644 bin/tests/system/rrchecker/clean.sh create mode 100644 bin/tests/system/rrchecker/privatelist.good create mode 100644 bin/tests/system/rrchecker/tests.sh create mode 100644 bin/tests/system/rrchecker/typelist.good create mode 100644 bin/tests/system/rrl/broken.conf create mode 100644 bin/tests/system/rrl/clean.sh create mode 100644 bin/tests/system/rrl/ns1/named.conf.in create mode 100644 bin/tests/system/rrl/ns1/root.db create mode 100644 bin/tests/system/rrl/ns2/hints create mode 100644 bin/tests/system/rrl/ns2/named.conf.in create mode 100644 bin/tests/system/rrl/ns2/tld2.db create mode 100644 bin/tests/system/rrl/ns3/hints create mode 100644 bin/tests/system/rrl/ns3/named.conf.in create mode 100644 bin/tests/system/rrl/ns3/tld3.db create mode 100644 bin/tests/system/rrl/ns4/hints create mode 100644 bin/tests/system/rrl/ns4/named.conf.in create mode 100644 bin/tests/system/rrl/ns4/tld4.db create mode 100644 bin/tests/system/rrl/setup.sh create mode 100644 bin/tests/system/rrl/tests.sh create mode 100644 bin/tests/system/rrsetorder/clean.sh create mode 100644 bin/tests/system/rrsetorder/dig.out.fixed.good create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good1 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good10 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good11 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good12 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good13 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good14 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good15 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good16 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good17 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good18 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good19 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good2 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good20 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good21 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good22 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good23 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good24 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good3 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good4 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good5 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good6 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good7 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good8 create mode 100644 bin/tests/system/rrsetorder/dig.out.random.good9 create mode 100644 bin/tests/system/rrsetorder/ns1/named.conf.in create mode 100644 bin/tests/system/rrsetorder/ns1/root.db create mode 100644 bin/tests/system/rrsetorder/ns2/named.conf.in create mode 100644 bin/tests/system/rrsetorder/ns3/named.conf.in create mode 100644 bin/tests/system/rrsetorder/ns4/named.conf.in create mode 100644 bin/tests/system/rrsetorder/setup.sh create mode 100644 bin/tests/system/rrsetorder/tests.sh create mode 100644 bin/tests/system/rsabigexponent/Makefile.in create mode 100644 bin/tests/system/rsabigexponent/bigkey.c create mode 100644 bin/tests/system/rsabigexponent/clean.sh create mode 100644 bin/tests/system/rsabigexponent/conf/bad01.conf create mode 100644 bin/tests/system/rsabigexponent/conf/bad02.conf create mode 100644 bin/tests/system/rsabigexponent/conf/bad03.conf create mode 100644 bin/tests/system/rsabigexponent/conf/good01.conf create mode 100644 bin/tests/system/rsabigexponent/conf/good02.conf create mode 100644 bin/tests/system/rsabigexponent/conf/good03.conf create mode 100644 bin/tests/system/rsabigexponent/ns1/named.conf.in create mode 100644 bin/tests/system/rsabigexponent/ns1/root.db.in create mode 100755 bin/tests/system/rsabigexponent/ns1/sign.sh create mode 100644 bin/tests/system/rsabigexponent/ns2/Xexample.+005+05896.key create mode 100644 bin/tests/system/rsabigexponent/ns2/Xexample.+005+05896.private create mode 100644 bin/tests/system/rsabigexponent/ns2/Xexample.+005+51829.key create mode 100644 bin/tests/system/rsabigexponent/ns2/Xexample.+005+51829.private create mode 100644 bin/tests/system/rsabigexponent/ns2/dsset-example.in create mode 100644 bin/tests/system/rsabigexponent/ns2/example.db.bad create mode 100644 bin/tests/system/rsabigexponent/ns2/example.db.in create mode 100644 bin/tests/system/rsabigexponent/ns2/named.conf.in create mode 100755 bin/tests/system/rsabigexponent/ns2/sign.sh create mode 100644 bin/tests/system/rsabigexponent/ns3/named.conf.in create mode 100644 bin/tests/system/rsabigexponent/prereq.sh create mode 100644 bin/tests/system/rsabigexponent/setup.sh create mode 100644 bin/tests/system/rsabigexponent/tests.sh create mode 100644 bin/tests/system/run.sh create mode 100644 bin/tests/system/runall.sh create mode 100644 bin/tests/system/runsequential.sh create mode 100644 bin/tests/system/runtime/README create mode 100644 bin/tests/system/runtime/clean.sh create mode 100644 bin/tests/system/runtime/ns2/named-alt1.conf.in create mode 100644 bin/tests/system/runtime/ns2/named-alt2.conf.in create mode 100644 bin/tests/system/runtime/ns2/named-alt3.conf.in create mode 100644 bin/tests/system/runtime/ns2/named-alt4.conf.in create mode 100644 bin/tests/system/runtime/ns2/named-alt5.conf.in create mode 100644 bin/tests/system/runtime/ns2/named-alt6.conf.in create mode 100644 bin/tests/system/runtime/ns2/named1.conf.in create mode 100644 bin/tests/system/runtime/setup.sh create mode 100644 bin/tests/system/runtime/tests.sh create mode 100644 bin/tests/system/send.pl create mode 100644 bin/tests/system/setup.sh create mode 100644 bin/tests/system/sfcache/README create mode 100644 bin/tests/system/sfcache/clean.sh create mode 100644 bin/tests/system/sfcache/ns1/named.conf.in create mode 100644 bin/tests/system/sfcache/ns1/root.db.in create mode 100644 bin/tests/system/sfcache/ns1/sign.sh create mode 100644 bin/tests/system/sfcache/ns2/example.db.in create mode 100644 bin/tests/system/sfcache/ns2/named.conf.in create mode 100644 bin/tests/system/sfcache/ns2/sign.sh create mode 100644 bin/tests/system/sfcache/ns5/named.conf.in create mode 100644 bin/tests/system/sfcache/ns5/trusted.conf.bad create mode 100644 bin/tests/system/sfcache/prereq.sh create mode 100644 bin/tests/system/sfcache/setup.sh create mode 100644 bin/tests/system/sfcache/tests.sh create mode 100644 bin/tests/system/smartsign/child.db create mode 100644 bin/tests/system/smartsign/clean.sh create mode 100644 bin/tests/system/smartsign/parent.db create mode 100644 bin/tests/system/smartsign/prereq.sh create mode 100644 bin/tests/system/smartsign/setup.sh create mode 100644 bin/tests/system/smartsign/tests.sh create mode 100644 bin/tests/system/sortlist/clean.sh create mode 100644 bin/tests/system/sortlist/ns1/example.db create mode 100644 bin/tests/system/sortlist/ns1/named.conf.in create mode 100644 bin/tests/system/sortlist/ns1/root.db create mode 100644 bin/tests/system/sortlist/setup.sh create mode 100644 bin/tests/system/sortlist/tests.sh create mode 100644 bin/tests/system/spf/clean.sh create mode 100644 bin/tests/system/spf/ns1/named.conf.in create mode 100644 bin/tests/system/spf/ns1/spf.db create mode 100644 bin/tests/system/spf/setup.sh create mode 100644 bin/tests/system/spf/tests.sh create mode 100755 bin/tests/system/start.pl create mode 100644 bin/tests/system/start.sh create mode 100755 bin/tests/system/staticstub/clean.sh create mode 100644 bin/tests/system/staticstub/conf/bad01.conf create mode 100644 bin/tests/system/staticstub/conf/bad02.conf create mode 100644 bin/tests/system/staticstub/conf/bad03.conf create mode 100644 bin/tests/system/staticstub/conf/bad04.conf create mode 100644 bin/tests/system/staticstub/conf/bad05.conf create mode 100644 bin/tests/system/staticstub/conf/bad06.conf create mode 100644 bin/tests/system/staticstub/conf/bad07.conf create mode 100644 bin/tests/system/staticstub/conf/bad08.conf create mode 100644 bin/tests/system/staticstub/conf/bad09.conf create mode 100644 bin/tests/system/staticstub/conf/bad10.conf create mode 100644 bin/tests/system/staticstub/conf/bad11.conf create mode 100644 bin/tests/system/staticstub/conf/good01.conf create mode 100644 bin/tests/system/staticstub/conf/good02.conf create mode 100644 bin/tests/system/staticstub/conf/good03.conf create mode 100644 bin/tests/system/staticstub/conf/good04.conf create mode 100644 bin/tests/system/staticstub/conf/good05.conf create mode 100644 bin/tests/system/staticstub/knowngood.dig.out.rec create mode 100644 bin/tests/system/staticstub/ns1/named.conf.in create mode 100644 bin/tests/system/staticstub/ns1/root.db create mode 100644 bin/tests/system/staticstub/ns2/named.conf.in create mode 100644 bin/tests/system/staticstub/ns3/example.db.in create mode 100644 bin/tests/system/staticstub/ns3/example.org.db create mode 100644 bin/tests/system/staticstub/ns3/named.conf.in create mode 100755 bin/tests/system/staticstub/ns3/sign.sh create mode 100644 bin/tests/system/staticstub/ns3/undelegated.db.in create mode 100644 bin/tests/system/staticstub/ns4/example.com.db create mode 100644 bin/tests/system/staticstub/ns4/example.info.db create mode 100644 bin/tests/system/staticstub/ns4/example.org.db create mode 100644 bin/tests/system/staticstub/ns4/named.conf.in create mode 100755 bin/tests/system/staticstub/ns4/sign.sh create mode 100644 bin/tests/system/staticstub/ns4/sub.example.db.in create mode 100755 bin/tests/system/staticstub/prereq.sh create mode 100755 bin/tests/system/staticstub/setup.sh create mode 100755 bin/tests/system/staticstub/tests.sh create mode 100644 bin/tests/system/statistics/ans4/ans.pl create mode 100644 bin/tests/system/statistics/clean.sh create mode 100644 bin/tests/system/statistics/ns1/named.conf.in create mode 100644 bin/tests/system/statistics/ns1/root.db create mode 100644 bin/tests/system/statistics/ns1/zone.db create mode 100644 bin/tests/system/statistics/ns2/example.db create mode 100644 bin/tests/system/statistics/ns2/internal.db create mode 100644 bin/tests/system/statistics/ns2/named.conf.in create mode 100644 bin/tests/system/statistics/ns3/internal.db create mode 100644 bin/tests/system/statistics/ns3/named.conf.in create mode 100644 bin/tests/system/statistics/ns3/root.hint create mode 100644 bin/tests/system/statistics/prereq.sh create mode 100644 bin/tests/system/statistics/setup.sh create mode 100644 bin/tests/system/statistics/tests.sh create mode 100644 bin/tests/system/statschannel/clean.sh create mode 100644 bin/tests/system/statschannel/fetch.pl create mode 100644 bin/tests/system/statschannel/ns2/example.db create mode 100644 bin/tests/system/statschannel/ns2/named.conf.in create mode 100644 bin/tests/system/statschannel/prereq.sh create mode 100644 bin/tests/system/statschannel/server-json.pl create mode 100644 bin/tests/system/statschannel/server-xml.pl create mode 100644 bin/tests/system/statschannel/setup.sh create mode 100644 bin/tests/system/statschannel/tests.sh create mode 100644 bin/tests/system/statschannel/traffic-json.pl create mode 100644 bin/tests/system/statschannel/traffic-xml.pl create mode 100644 bin/tests/system/statschannel/traffic.expect.1 create mode 100644 bin/tests/system/statschannel/traffic.expect.2 create mode 100644 bin/tests/system/statschannel/traffic.expect.4 create mode 100644 bin/tests/system/statschannel/traffic.expect.5 create mode 100644 bin/tests/system/statschannel/traffic.expect.6 create mode 100644 bin/tests/system/stop.pl create mode 100644 bin/tests/system/stop.sh create mode 100644 bin/tests/system/stopall.sh create mode 100644 bin/tests/system/stress/clean.sh create mode 100644 bin/tests/system/stress/ns1/named.conf create mode 100644 bin/tests/system/stress/ns2/named.conf create mode 100644 bin/tests/system/stress/ns3/named.conf create mode 100644 bin/tests/system/stress/ns4/named.conf create mode 100644 bin/tests/system/stress/prereq.sh create mode 100644 bin/tests/system/stress/setup.pl create mode 100644 bin/tests/system/stress/setup.sh create mode 100644 bin/tests/system/stress/tests.sh create mode 100644 bin/tests/system/stress/update.pl create mode 100644 bin/tests/system/stub/clean.sh create mode 100644 bin/tests/system/stub/knowngood.dig.out.norec create mode 100644 bin/tests/system/stub/knowngood.dig.out.rec create mode 100644 bin/tests/system/stub/ns1/named.conf.in create mode 100644 bin/tests/system/stub/ns1/root.db create mode 100644 bin/tests/system/stub/ns2/child.example.db create mode 100644 bin/tests/system/stub/ns2/named.conf.in create mode 100644 bin/tests/system/stub/ns3/example.db create mode 100644 bin/tests/system/stub/ns3/named.conf.in create mode 100644 bin/tests/system/stub/setup.sh create mode 100644 bin/tests/system/stub/tests.sh create mode 100644 bin/tests/system/tcp/clean.sh create mode 100644 bin/tests/system/tcp/ns1/named.conf.in create mode 100644 bin/tests/system/tcp/ns1/root.db create mode 100644 bin/tests/system/tcp/ns2/example.db create mode 100644 bin/tests/system/tcp/ns2/named.conf.in create mode 100644 bin/tests/system/tcp/ns3/named.conf.in create mode 100644 bin/tests/system/tcp/ns4/named.conf.in create mode 100644 bin/tests/system/tcp/setup.sh create mode 100644 bin/tests/system/tcp/tests.sh create mode 100644 bin/tests/system/testcrypto.sh create mode 100644 bin/tests/system/testsock.pl create mode 100644 bin/tests/system/testsock6.pl create mode 100644 bin/tests/system/testsummary.sh create mode 100644 bin/tests/system/tkey/Makefile.in create mode 100644 bin/tests/system/tkey/clean.sh create mode 100644 bin/tests/system/tkey/keycreate.c create mode 100644 bin/tests/system/tkey/keydelete.c create mode 100644 bin/tests/system/tkey/ns1/example.db create mode 100644 bin/tests/system/tkey/ns1/named.conf.in create mode 100644 bin/tests/system/tkey/ns1/setup.sh create mode 100644 bin/tests/system/tkey/prereq.sh create mode 100644 bin/tests/system/tkey/setup.sh create mode 100644 bin/tests/system/tkey/tests.sh create mode 100644 bin/tests/system/tsig/clean.sh create mode 100644 bin/tests/system/tsig/ns1/example.db create mode 100644 bin/tests/system/tsig/ns1/named.conf.in create mode 100644 bin/tests/system/tsig/setup.sh create mode 100644 bin/tests/system/tsig/tests.sh create mode 100644 bin/tests/system/tsiggss/authsock.pl create mode 100644 bin/tests/system/tsiggss/clean.sh create mode 100644 bin/tests/system/tsiggss/ns1/administrator.ccache create mode 100644 bin/tests/system/tsiggss/ns1/dns.keytab create mode 100644 bin/tests/system/tsiggss/ns1/example.nil.db.in create mode 100644 bin/tests/system/tsiggss/ns1/named.conf.in create mode 100644 bin/tests/system/tsiggss/ns1/testdenied.ccache create mode 100644 bin/tests/system/tsiggss/prereq.sh create mode 100644 bin/tests/system/tsiggss/setup.sh create mode 100644 bin/tests/system/tsiggss/tests.sh create mode 100644 bin/tests/system/unknown/clean.sh create mode 100644 bin/tests/system/unknown/large.out create mode 100644 bin/tests/system/unknown/ns1/broken1.db create mode 100644 bin/tests/system/unknown/ns1/broken2.db create mode 100644 bin/tests/system/unknown/ns1/broken3.db create mode 100644 bin/tests/system/unknown/ns1/broken4.db create mode 100644 bin/tests/system/unknown/ns1/broken5.db create mode 100644 bin/tests/system/unknown/ns1/class10.hints create mode 100644 bin/tests/system/unknown/ns1/example-class10.db create mode 100644 bin/tests/system/unknown/ns1/example-in.db create mode 100644 bin/tests/system/unknown/ns1/large.db create mode 100644 bin/tests/system/unknown/ns1/named.conf.in create mode 100644 bin/tests/system/unknown/ns2/named.conf.in create mode 100644 bin/tests/system/unknown/ns3/named.conf.in create mode 100644 bin/tests/system/unknown/ns3/sign.sh create mode 100644 bin/tests/system/unknown/prereq.sh create mode 100644 bin/tests/system/unknown/setup.sh create mode 100644 bin/tests/system/unknown/tests.sh create mode 100644 bin/tests/system/unknown/zones/nan.bad create mode 100644 bin/tests/system/upforwd/ans4/ans.pl create mode 100644 bin/tests/system/upforwd/clean.sh create mode 100644 bin/tests/system/upforwd/knowngood.after1 create mode 100644 bin/tests/system/upforwd/knowngood.after2 create mode 100644 bin/tests/system/upforwd/knowngood.before create mode 100644 bin/tests/system/upforwd/knowngood.ns2.before create mode 100644 bin/tests/system/upforwd/ns1/example1.db create mode 100644 bin/tests/system/upforwd/ns1/named.conf.in create mode 100644 bin/tests/system/upforwd/ns2/named.conf.in create mode 100644 bin/tests/system/upforwd/ns3/named.conf.in create mode 100644 bin/tests/system/upforwd/ns3/nomaster.db create mode 100644 bin/tests/system/upforwd/prereq.sh create mode 100644 bin/tests/system/upforwd/setup.sh create mode 100644 bin/tests/system/upforwd/tests.sh create mode 100644 bin/tests/system/verify/clean.sh create mode 100644 bin/tests/system/verify/prereq.sh create mode 100644 bin/tests/system/verify/setup.sh create mode 100644 bin/tests/system/verify/tests.sh create mode 100644 bin/tests/system/verify/zones/genzones.sh create mode 100644 bin/tests/system/verify/zones/unsigned.db create mode 100644 bin/tests/system/views/clean.sh create mode 100644 bin/tests/system/views/ns1/named.conf.in create mode 100644 bin/tests/system/views/ns1/root.db create mode 100644 bin/tests/system/views/ns2/1.10.in-addr.arpa.db create mode 100644 bin/tests/system/views/ns2/clone.db create mode 100644 bin/tests/system/views/ns2/example1.db create mode 100644 bin/tests/system/views/ns2/example2.db create mode 100644 bin/tests/system/views/ns2/external/inline.db create mode 100644 bin/tests/system/views/ns2/internal.db create mode 100644 bin/tests/system/views/ns2/internal/inline.db create mode 100644 bin/tests/system/views/ns2/named1.conf.in create mode 100644 bin/tests/system/views/ns2/named2.conf.in create mode 100644 bin/tests/system/views/ns3/child.clone.db create mode 100644 bin/tests/system/views/ns3/internal.db create mode 100644 bin/tests/system/views/ns3/named1.conf.in create mode 100644 bin/tests/system/views/ns3/named2.conf.in create mode 100644 bin/tests/system/views/ns5/child.clone.db create mode 100644 bin/tests/system/views/ns5/named.conf.in create mode 100644 bin/tests/system/views/setup.sh create mode 100644 bin/tests/system/views/tests.sh create mode 100644 bin/tests/system/wildcard/clean.sh create mode 100644 bin/tests/system/wildcard/ns1/dlv.db.in create mode 100644 bin/tests/system/wildcard/ns1/named.conf.in create mode 100644 bin/tests/system/wildcard/ns1/nsec.db.in create mode 100644 bin/tests/system/wildcard/ns1/nsec3.db.in create mode 100644 bin/tests/system/wildcard/ns1/private.nsec.db.in create mode 100644 bin/tests/system/wildcard/ns1/private.nsec3.db.in create mode 100644 bin/tests/system/wildcard/ns1/root.db.in create mode 100755 bin/tests/system/wildcard/ns1/sign.sh create mode 100644 bin/tests/system/wildcard/ns2/hints create mode 100644 bin/tests/system/wildcard/ns2/named.conf.in create mode 100644 bin/tests/system/wildcard/ns3/hints create mode 100644 bin/tests/system/wildcard/ns3/named.conf.in create mode 100644 bin/tests/system/wildcard/ns4/named.conf.in create mode 100644 bin/tests/system/wildcard/ns5/hints create mode 100644 bin/tests/system/wildcard/ns5/named.conf.in create mode 100644 bin/tests/system/wildcard/prereq.sh create mode 100644 bin/tests/system/wildcard/setup.sh create mode 100644 bin/tests/system/wildcard/tests.sh create mode 100644 bin/tests/system/win32/bigkey.dsp.in create mode 100644 bin/tests/system/win32/bigkey.dsw create mode 100644 bin/tests/system/win32/bigkey.mak.in create mode 100644 bin/tests/system/win32/bigkey.vcxproj.filters.in create mode 100644 bin/tests/system/win32/bigkey.vcxproj.in create mode 100644 bin/tests/system/win32/bigkey.vcxproj.user create mode 100644 bin/tests/system/win32/feature-test.dsp.in create mode 100644 bin/tests/system/win32/feature-test.dsw create mode 100644 bin/tests/system/win32/feature-test.mak.in create mode 100644 bin/tests/system/win32/feature-test.vcxproj.filters.in create mode 100644 bin/tests/system/win32/feature-test.vcxproj.in create mode 100644 bin/tests/system/win32/feature-test.vcxproj.user create mode 100644 bin/tests/system/win32/gencheck.dsp.in create mode 100644 bin/tests/system/win32/gencheck.dsw create mode 100644 bin/tests/system/win32/gencheck.mak.in create mode 100644 bin/tests/system/win32/gencheck.vcxproj.filters.in create mode 100644 bin/tests/system/win32/gencheck.vcxproj.in create mode 100644 bin/tests/system/win32/gencheck.vcxproj.user create mode 100644 bin/tests/system/win32/keycreate.dsp.in create mode 100644 bin/tests/system/win32/keycreate.dsw create mode 100644 bin/tests/system/win32/keycreate.mak.in create mode 100644 bin/tests/system/win32/keycreate.vcxproj.filters.in create mode 100644 bin/tests/system/win32/keycreate.vcxproj.in create mode 100644 bin/tests/system/win32/keycreate.vcxproj.user create mode 100644 bin/tests/system/win32/keydelete.dsp.in create mode 100644 bin/tests/system/win32/keydelete.dsw create mode 100644 bin/tests/system/win32/keydelete.mak.in create mode 100644 bin/tests/system/win32/keydelete.vcxproj.filters.in create mode 100644 bin/tests/system/win32/keydelete.vcxproj.in create mode 100644 bin/tests/system/win32/keydelete.vcxproj.user create mode 100644 bin/tests/system/win32/lwtest.dsp.in create mode 100644 bin/tests/system/win32/lwtest.dsw create mode 100644 bin/tests/system/win32/lwtest.mak.in create mode 100644 bin/tests/system/win32/lwtest.vcxproj.filters.in create mode 100644 bin/tests/system/win32/lwtest.vcxproj.in create mode 100644 bin/tests/system/win32/lwtest.vcxproj.user create mode 100644 bin/tests/system/win32/pipequeries.dsp.in create mode 100644 bin/tests/system/win32/pipequeries.dsw create mode 100644 bin/tests/system/win32/pipequeries.mak.in create mode 100644 bin/tests/system/win32/pipequeries.vcxproj.filters.in create mode 100644 bin/tests/system/win32/pipequeries.vcxproj.in create mode 100644 bin/tests/system/win32/pipequeries.vcxproj.user create mode 100644 bin/tests/system/xfer/ans5/badkeydata create mode 100644 bin/tests/system/xfer/ans5/goodaxfr create mode 100644 bin/tests/system/xfer/ans5/partial create mode 100644 bin/tests/system/xfer/ans5/unknownkey create mode 100644 bin/tests/system/xfer/ans5/unsigned create mode 100644 bin/tests/system/xfer/ans5/wrongkey create mode 100644 bin/tests/system/xfer/clean.sh create mode 100644 bin/tests/system/xfer/dig1.good create mode 100644 bin/tests/system/xfer/dig2.good create mode 100644 bin/tests/system/xfer/knowngood.mapped create mode 100644 bin/tests/system/xfer/ns1/axfr-too-big.db create mode 100644 bin/tests/system/xfer/ns1/ixfr-too-big.db.in create mode 100644 bin/tests/system/xfer/ns1/named.conf.in create mode 100644 bin/tests/system/xfer/ns1/root.db create mode 100644 bin/tests/system/xfer/ns2/mapped.db.in create mode 100644 bin/tests/system/xfer/ns2/named.conf.in create mode 100644 bin/tests/system/xfer/ns2/slave.db.in create mode 100644 bin/tests/system/xfer/ns3/named.conf.in create mode 100644 bin/tests/system/xfer/ns4/named.conf.base create mode 100644 bin/tests/system/xfer/ns4/root.db.in create mode 100644 bin/tests/system/xfer/ns6/named.conf.in create mode 100644 bin/tests/system/xfer/ns7/named.conf.in create mode 100644 bin/tests/system/xfer/ns8/example.db create mode 100644 bin/tests/system/xfer/ns8/named.conf.in create mode 100644 bin/tests/system/xfer/prereq.sh create mode 100644 bin/tests/system/xfer/setup.sh create mode 100755 bin/tests/system/xfer/tests.sh create mode 100644 bin/tests/system/xferquota/clean.sh create mode 100644 bin/tests/system/xferquota/ns1/changing1.db create mode 100644 bin/tests/system/xferquota/ns1/changing2.db create mode 100644 bin/tests/system/xferquota/ns1/named.conf.in create mode 100644 bin/tests/system/xferquota/ns1/root.db create mode 100644 bin/tests/system/xferquota/ns2/example.db create mode 100644 bin/tests/system/xferquota/ns2/named.conf.in create mode 100644 bin/tests/system/xferquota/setup.pl create mode 100644 bin/tests/system/xferquota/setup.sh create mode 100755 bin/tests/system/xferquota/tests.sh create mode 100644 bin/tests/system/zero/ans5/ans.pl create mode 100644 bin/tests/system/zero/clean.sh create mode 100644 bin/tests/system/zero/ns1/named.conf.in create mode 100644 bin/tests/system/zero/ns1/root.db create mode 100644 bin/tests/system/zero/ns2/named.conf.in create mode 100644 bin/tests/system/zero/ns2/tld.db create mode 100644 bin/tests/system/zero/ns3/named.conf.in create mode 100644 bin/tests/system/zero/ns3/root.hint create mode 100644 bin/tests/system/zero/ns4/named.conf.in create mode 100644 bin/tests/system/zero/ns4/one.tld.db create mode 100644 bin/tests/system/zero/prereq.sh create mode 100644 bin/tests/system/zero/setup.sh create mode 100644 bin/tests/system/zero/tests.sh create mode 100644 bin/tests/system/zonechecks/a.db create mode 100644 bin/tests/system/zonechecks/aaaa.db create mode 100644 bin/tests/system/zonechecks/bigserial.db create mode 100644 bin/tests/system/zonechecks/clean.sh create mode 100644 bin/tests/system/zonechecks/cname.db create mode 100644 bin/tests/system/zonechecks/dname.db create mode 100644 bin/tests/system/zonechecks/noaddress.db create mode 100644 bin/tests/system/zonechecks/ns1/named.conf.in create mode 100644 bin/tests/system/zonechecks/ns2/named.conf.in create mode 100644 bin/tests/system/zonechecks/nxdomain.db create mode 100644 bin/tests/system/zonechecks/prereq.sh create mode 100644 bin/tests/system/zonechecks/setup.sh create mode 100644 bin/tests/system/zonechecks/tests.sh create mode 100644 bin/tests/testdata/wire/wire_test.data create mode 100644 bin/tests/testdata/wire/wire_test.data2 create mode 100644 bin/tests/testdata/wire/wire_test.data3 create mode 100644 bin/tests/testdata/wire/wire_test.data4 create mode 100644 bin/tests/virtual-time/Makefile.in create mode 100644 bin/tests/virtual-time/README create mode 100644 bin/tests/virtual-time/autosign-ksk/clean.sh create mode 100644 bin/tests/virtual-time/autosign-ksk/ns1/example.db.in create mode 100644 bin/tests/virtual-time/autosign-ksk/ns1/named.conf create mode 100644 bin/tests/virtual-time/autosign-ksk/ns1/root.db create mode 100644 bin/tests/virtual-time/autosign-ksk/ns1/sign.sh create mode 100644 bin/tests/virtual-time/autosign-ksk/ns1/wrap.sh create mode 100644 bin/tests/virtual-time/autosign-ksk/setup.sh create mode 100644 bin/tests/virtual-time/autosign-ksk/tests.sh create mode 100644 bin/tests/virtual-time/autosign-zsk/clean.sh create mode 100644 bin/tests/virtual-time/autosign-zsk/ns1/example.db.in create mode 100644 bin/tests/virtual-time/autosign-zsk/ns1/named.conf create mode 100644 bin/tests/virtual-time/autosign-zsk/ns1/root.db create mode 100644 bin/tests/virtual-time/autosign-zsk/ns1/sign.sh create mode 100644 bin/tests/virtual-time/autosign-zsk/ns1/wrap.sh create mode 100644 bin/tests/virtual-time/autosign-zsk/setup.sh create mode 100644 bin/tests/virtual-time/autosign-zsk/tests.sh create mode 100644 bin/tests/virtual-time/cleanall.sh create mode 100644 bin/tests/virtual-time/common/controls.conf create mode 100644 bin/tests/virtual-time/common/rndc.conf create mode 100644 bin/tests/virtual-time/common/root.hint create mode 100644 bin/tests/virtual-time/conf.sh.in create mode 100644 bin/tests/virtual-time/run.sh create mode 100644 bin/tests/virtual-time/runall.sh create mode 100644 bin/tests/virtual-time/setup.sh create mode 100644 bin/tests/virtual-time/slave/clean.sh create mode 100644 bin/tests/virtual-time/slave/ns1/example.db.in create mode 100644 bin/tests/virtual-time/slave/ns1/named.conf create mode 100644 bin/tests/virtual-time/slave/ns1/root.db create mode 100644 bin/tests/virtual-time/slave/ns1/wrap.sh create mode 100644 bin/tests/virtual-time/slave/setup.sh create mode 100644 bin/tests/virtual-time/slave/tests.sh create mode 100644 bin/tests/virtual-time/start.pl create mode 100644 bin/tests/virtual-time/start.sh create mode 100644 bin/tests/virtual-time/stop.pl create mode 100644 bin/tests/virtual-time/stop.sh create mode 100644 bin/tests/virtual-time/testsock.pl create mode 100644 bin/tests/virtual-time/vtwrapper.c create mode 100644 bin/tests/win32/backtrace_test.dsp.in create mode 100644 bin/tests/win32/backtrace_test.dsw create mode 100644 bin/tests/win32/backtrace_test.mak.in create mode 100644 bin/tests/win32/backtrace_test.vcxproj.filters.in create mode 100644 bin/tests/win32/backtrace_test.vcxproj.in create mode 100644 bin/tests/win32/backtrace_test.vcxproj.user create mode 100644 bin/tests/win32/inter_test.dsp.in create mode 100644 bin/tests/win32/inter_test.dsw create mode 100644 bin/tests/win32/inter_test.mak.in create mode 100644 bin/tests/win32/inter_test.vcxproj.filters.in create mode 100644 bin/tests/win32/inter_test.vcxproj.in create mode 100644 bin/tests/win32/inter_test.vcxproj.user create mode 100644 bin/tests/win32/makejournal.dsp.in create mode 100644 bin/tests/win32/makejournal.dsw create mode 100644 bin/tests/win32/makejournal.mak.in create mode 100644 bin/tests/win32/makejournal.vcxproj.filters.in create mode 100644 bin/tests/win32/makejournal.vcxproj.in create mode 100644 bin/tests/win32/makejournal.vcxproj.user create mode 100644 bin/tests/win32/rwlock_test.dsp.in create mode 100644 bin/tests/win32/rwlock_test.dsw create mode 100644 bin/tests/win32/rwlock_test.mak.in create mode 100644 bin/tests/win32/rwlock_test.vcxproj.filters.in create mode 100644 bin/tests/win32/rwlock_test.vcxproj.in create mode 100644 bin/tests/win32/rwlock_test.vcxproj.user create mode 100644 bin/tests/win32/shutdown_test.dsp.in create mode 100644 bin/tests/win32/shutdown_test.dsw create mode 100644 bin/tests/win32/shutdown_test.mak.in create mode 100644 bin/tests/win32/shutdown_test.vcxproj.filters.in create mode 100644 bin/tests/win32/shutdown_test.vcxproj.in create mode 100644 bin/tests/win32/shutdown_test.vcxproj.user create mode 100644 bin/tests/win32/sock_test.dsp.in create mode 100644 bin/tests/win32/sock_test.dsw create mode 100644 bin/tests/win32/sock_test.mak.in create mode 100644 bin/tests/win32/sock_test.vcxproj.filters.in create mode 100644 bin/tests/win32/sock_test.vcxproj.in create mode 100644 bin/tests/win32/sock_test.vcxproj.user create mode 100644 bin/tests/win32/task_test.dsp.in create mode 100644 bin/tests/win32/task_test.dsw create mode 100644 bin/tests/win32/task_test.mak.in create mode 100644 bin/tests/win32/task_test.vcxproj.filters.in create mode 100644 bin/tests/win32/task_test.vcxproj.in create mode 100644 bin/tests/win32/task_test.vcxproj.user create mode 100644 bin/tests/win32/timer_test.dsp.in create mode 100644 bin/tests/win32/timer_test.dsw create mode 100644 bin/tests/win32/timer_test.mak.in create mode 100644 bin/tests/win32/timer_test.vcxproj.filters.in create mode 100644 bin/tests/win32/timer_test.vcxproj.in create mode 100644 bin/tests/win32/timer_test.vcxproj.user create mode 100644 bin/tests/wire_test.c (limited to 'bin/tests') diff --git a/bin/tests/Makefile.in b/bin/tests/Makefile.in new file mode 100644 index 0000000..de68130 --- /dev/null +++ b/bin/tests/Makefile.in @@ -0,0 +1,85 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +@BIND9_MAKE_INCLUDES@ + +CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \ + @DST_OPENSSL_INC@ + +CDEFINES = @CRYPTO@ +CWARNINGS = +BACKTRACECFLAGS = @BACKTRACECFLAGS@ + +DNSLIBS = ../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +ISCLIBS = ../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ +ISCNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@ +ISCCFGLIBS = ../../lib/isccfg/libisccfg.@A@ + +DNSDEPLIBS = ../../lib/dns/libdns.@A@ +ISCDEPLIBS = ../../lib/isc/libisc.@A@ +ISCDEPNOSYMLIBS = ../../lib/isc/libisc-nosymtbl.@A@ +ISCCFGDEPLIBS = ../../lib/isccfg/libisccfg.@A@ + +LIBS = @LIBS@ + +SUBDIRS = system @PKCS11_TOOLS@ +TESTDIRS = system + +# Test programs that are built by default: +# cfg_test is needed for regenerating doc/misc/options +# makejournal is needed by system tests +# wire_test is needed for fuzz testing +# other opptional test programs have been moved to ./optional + +# Alphabetically +XTARGETS = all_tests +TARGETS = cfg_test@EXEEXT@ makejournal@EXEEXT@ \ + wire_test@EXEEXT@ @XTARGETS@ + +SRCS = cfg_test.c makejournal.c wire_test.c + +@BIND9_MAKE_RULES@ + +.NOTPARALLEL: + +.PHONY: +all_tests: + echo "making depend in `pwd`/optional"; \ + (cd optional; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) + +wire_test@EXEEXT@: wire_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ wire_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +cfg_test@EXEEXT@: cfg_test.@O@ ${ISCCFGDEPLIBS} ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ cfg_test.@O@ \ + ${ISCCFGLIBS} ${DNSLIBS} ${ISCLIBS} ${LIBS} + +makejournal@EXEEXT@: makejournal.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ makejournal.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +distclean:: + rm -f headerdep_test.sh + +clean distclean:: + rm -f ${TARGETS} + ( cd optional; $(MAKE) $@) + +check: test + +test: + @for dir in $(SUBDIRS) ;\ + do \ + ( cd $$dir; $(MAKE) test ) ;\ + done diff --git a/bin/tests/bigtest/README b/bin/tests/bigtest/README new file mode 100644 index 0000000..0daea5c --- /dev/null +++ b/bin/tests/bigtest/README @@ -0,0 +1,18 @@ +Copyright (C) Internet Systems Consortium, Inc. ("ISC") + +See COPYRIGHT in the source root or http://isc.org/copyright.html for terms. + + bash buildzones.sh < zones # creates setup, run, servers/* master/* + # named.conf + sudo sh setup # configure interfaces + sh run # setup + + ../named/named [-g] -c named.conf + + sh tests.sh < zones + + sudo sh teardown # teardown interfaces + +The test server can controlled with + + rndc -k rndc.key -s 127.127.0.0 -p 5300 diff --git a/bin/tests/bigtest/buildzones.sh b/bin/tests/bigtest/buildzones.sh new file mode 100644 index 0000000..f8d531a --- /dev/null +++ b/bin/tests/bigtest/buildzones.sh @@ -0,0 +1,267 @@ +#!/bin/bash +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +SYSTEMTESTTOP=.. +. ../conf.sh + +addr=127.127.0.0 +ttl=300 +named=${NAMED} +keygen=${KEYGEN} +dsfromkey=${DSFROMKEY} + +nextaddr() { + OLDIF="$IFS" + IFS="${IFS}." + set $1 + IFS="$OLDIFS" + _a=$1 _b=$2 _c=$3 _d=$4 + _d=$(($_d + 1)) + case $_d in + 256) _c=$(($_c + 1)); _d=0;; + esac + case $_c in + 256) _b=$(($_b + 1)); _c=0;; + esac + echo $_a.$_b.$_c.$_d +} + +parent() { + OLDIF="$IFS" + IFS="${IFS}." + set $1 + IFS="$OLDIFS" + shift + while [ $# -ne 0 ] + do + printf %s ${1} + shift + printf %s ${1:+.} + + done +} + +blackhole() { + echo 'options {' + echo ' port 5300;' + echo " listen-on { $1; };" + echo " query-source $1;" + echo " notify-source $1;" + echo " transfer-source $1;" + echo ' key-directory "keys";' + echo " recursion ${2:-no};" + echo ' pid-file "pids/'"${addr}"'.pid";' + echo ' blackhole { 127.127.0.0; };' + echo '};' +} + +refuse() { + echo 'options {' + echo ' port 5300;' + echo " listen-on { $1; };" + echo " query-source $1;" + echo " notify-source $1;" + echo " transfer-source $1;" + echo ' key-directory "keys";' + echo " recursion ${2:-no};" + echo ' pid-file "pids/'"${addr}"'.pid";' + echo ' allow-query { !127.127.0.0; any; };' + echo '};' +} + +options() { + echo 'options {' + echo ' port 5300;' + echo " listen-on { $1; };" + echo " query-source $1;" + echo " notify-source $1;" + echo " transfer-source $1;" + echo ' key-directory "keys";' + echo " recursion ${2:-no};" + echo ' pid-file "pids/'"${addr}"'.pid";' + echo '};' +} + +controls() { + echo 'include "rndc.key";' + echo "controls { inet $addr port 9953 allow { any; } keys { "rndc-key"; }; };" +} + +delay() { + _s=$1 + OLDIF="$IFS" + IFS="${IFS}/" + set ${2:-.} + IFS="$OLDIFS" + + case $1 in + .) _d=;; + *) _d=$1;; + esac + case $_s in + 1) echo -T delay=${_d:-100};; + 2) echo -T delay=${2:-50};; + 3) echo -T delay=${3:-150};; + 4) echo -T delay=${4:-250};; + 5) echo -T delay=${5:-125};; + 6) echo -T delay=${6:-25};; + 7) echo -T delay=${7:-75};; + 8) echo -T delay=${8:-125};; + 9) echo -T delay=${9:-10};; + 10) echo -T delay=${10:-40};; + 11) echo -T delay=${11:-80};; + 12) echo -T delay=${12:-90};; + *) echo -T delay=50;; + esac +} + +trusted-keys () { + awk '$3 == "DNSKEY" { + b = ""; for (i=7; i <= NF; i++) { b = b $i; }; + print "trusted-keys { \""$1"\"",$4,$5,$6,"\""b"\"; };" };' +} + +signed-zone () { + echo "zone "'"'"${1:-.}"'"'" {" + echo " type master;" + echo " file "'"'"master/${2}.db"'"'";" + echo " auto-dnssec maintain;" + echo " allow-update { any; };" + echo "};" +} + +unsigned-zone () { + echo "zone "'"'"${1:-.}"'"'" {" + echo " type master;" + echo " file "'"'"master/${2}.db"'"'";" + echo "};" +} + +slave-zone () { + echo "zone "'"'"${zone:-.}"'"'" {" + echo " type slave;" + echo " masters { ${master}; };" + echo "};" +} + +rm -rf servers master keys setup teardown run +mkdir -p servers +mkdir -p master +mkdir -p keys + +echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup +echo "ifconfig lo0 $addr -alias" >> teardown +controls $addr > named.conf +options $addr yes >> named.conf +echo 'zone "." { type hint; file "master/hint.db"; };' >> named.conf + +while read zone servers nsfmt signed delay blackhole refuse flags +do + i=1 + case "${zone}" in + .) file=root zone=;; + *) file="$zone";; + esac + if [ "${zone}" != "" ] ; then + p=$(parent $zone) + case "${p}" in + "") p=root;; + esac + else + p=hint + fi + #echo "zone='${zone}' parent='${p}'" + addr=$(nextaddr $addr) + ns=$(printf "$nsfmt" ${i} "${zone}") + d=$(delay $i ${delay:-.}) + + echo "${zone}. ${ttl} soa ${ns}. hostmaster.${zone}${zone:+.} 1 3600 1200 604800 1200" >> master/${file}.db + echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db + echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db + echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db + echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db + if [ $signed = "S" ]; then + kskkey=`${keygen} -K keys -f KSK ${zone:-.}` + zskkey=`${keygen} -K keys ${zone:-.}` + if [ "${zone}" != "" ] ; then + ${dsfromkey} -T ${ttl} keys/${kskkey}.key >> master/${p}.db + else + trusted-keys < keys/${kskkey}.key >> named.conf + fi + fi + echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup + echo "ifconfig lo0 $addr -alias" >> teardown + echo "${named} -D bigtest -c servers/${addr}.conf $d $flags" >> run + options ${addr} > servers/${addr}.conf + case ${signed} in + S) signed-zone ${zone:-.} ${file} >> servers/${addr}.conf;; + P) unsigned-zone ${zone:-.} ${file} >> servers/${addr}.conf;; + *) echo ${signed}; exit 1;; + esac + + # slave servers + while [ $i -lt $servers ] + do + master=$addr + i=$(($i + 1)) + ns=$(printf "$nsfmt" ${i} "${zone}") + d=$(delay $i ${delay:-.}) + addr=$(nextaddr $addr) + echo "${zone}. ${ttl} ns ${ns}." >> master/${file}.db + echo "${ns}. ${ttl} a ${addr}" >> master/${file}.db + echo "${zone}. ${ttl} ns ${ns}." >> master/${p}.db + echo "${ns}. ${ttl} a ${addr}" >> master/${p}.db + echo "ifconfig lo0 $addr netmask 0xffffffff alias" >> setup + echo "ifconfig lo0 $addr -alias" >> teardown + echo "${named} -D bigtest -c servers/${addr}.conf $d $flags" >> run + if [ $i = ${refuse:-.} ] + then + refuse $addr > servers/${addr}.conf + elif [ $i = ${blackhole:-.} ] + then + blackhole $addr > servers/${addr}.conf + else + options $addr > servers/${addr}.conf + fi + slave-zone ${zone:-.} ${master} >> servers/${addr}.conf + done + if [ "${zone}" != "" ] ; then + echo "www.${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db + echo "www.${zone}. ${ttl} aaaa ::1" >> master/${file}.db + echo "${zone}. ${ttl} mx 10 mail.${zone}." >> master/${file}.db + echo "mail.${zone}. ${ttl} a 127.0.0.1" >> master/${file}.db + echo "mail.${zone}. ${ttl} aaaa ::1" >> master/${file}.db + echo "*.big.${zone}. ${ttl} txt (" >> master/${file}.db + i=0 + while [ $i -lt 150 ] + do + echo "1234567890" >> master/${file}.db + i=$(($i + 1)) + done + echo ")" >> master/${file}.db + echo "*.medium.${zone}. ${ttl} txt (" >> master/${file}.db + i=0 + while [ $i -lt 120 ] + do + echo "1234567890" >> master/${file}.db + i=$(($i + 1)) + done + echo ")" >> master/${file}.db + echo "*.medium.${zone}. ${ttl} txt (" >> master/${file}.db + i=0 + while [ $i -lt 120 ] + do + echo "1234567890" >> master/${file}.db + i=$(($i + 1)) + done + echo ")" >> master/${file}.db + fi +done diff --git a/bin/tests/bigtest/rndc.key b/bin/tests/bigtest/rndc.key new file mode 100644 index 0000000..f279e14 --- /dev/null +++ b/bin/tests/bigtest/rndc.key @@ -0,0 +1,5 @@ +key "rndc-key" { + algorithm hmac-md5; + secret "xxxxxxxxxxxxxxxxxxxxHg=="; +}; + diff --git a/bin/tests/bigtest/tests.sh b/bin/tests/bigtest/tests.sh new file mode 100644 index 0000000..7b3bd8f --- /dev/null +++ b/bin/tests/bigtest/tests.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +TOP=$( (cd ../../.. && pwd) ) +dig=${TOP}/bin/dig/dig + +cmd="${dig} -p 5300 @127.127.0.0 txt" +inner() { + zone=$1 i=$2 to=$3 + x=$i + dout=dig$x.out + tout=time$x.out + while [ $i -lt $to ] + do + case $zone in + .) zone=;; + esac + + (time -p $cmd $i.${sub}$zone > $dout ) 2> $tout + s=`sed -n '/real/s/[^0-9]*\([0-9]*\)\..*/\1/p' $tout` + case $s in + 0);; + 1) t1=`expr ${t1:-0} + 1`;; + 2) t2=`expr ${t2:-0} + 1`;; + 3) t3=`expr ${t3:-0} + 1`;; + *) echo $i `grep real $tout`;; + esac + + grep "status: \(NXDOMAIN\|NOERROR\)" $dout > /dev/null || { + echo $cmd $i.${sub}$zone + cat $dout + } + i=`expr $i + 1` + done + if test ${t1:-0} -ne 0 -o ${t2:-0} -ne 0 -o ${t3:-0} -ne 0 + then + echo "$x timeouts: t1=${t1:-0} t2=${t2:-0} t3=${t3:-0}" + fi +} + +while read zone rest +do + for sub in "" medium. big. + do + case $zone in + .) echo doing ${sub:-.};; + *) echo doing $sub$zone;; + esac + ( inner $zone 1 100) & + ( inner $zone 101 200) & + ( inner $zone 201 300) & + ( inner $zone 301 400) & + ( inner $zone 401 500) & + ( inner $zone 501 600) & + ( inner $zone 601 700) & + ( inner $zone 701 800) & + ( inner $zone 801 900) & + ( inner $zone 901 1000) & + ( inner $zone 1001 1100) & + ( inner $zone 1101 1200) & + ( inner $zone 1201 1300) & + ( inner $zone 1301 1400) & + ( inner $zone 1401 1500) & + ( inner $zone 1501 1600) & + ( inner $zone 1601 1700) & + wait + done +done diff --git a/bin/tests/bigtest/zones b/bin/tests/bigtest/zones new file mode 100644 index 0000000..0bdcdfe --- /dev/null +++ b/bin/tests/bigtest/zones @@ -0,0 +1,18 @@ +noedns-1.tld 1 ns%u.%s P . x x -T noedns +dropedns-1.tld 1 ns%u.%s P . x x -T dropedns +maxudp512-1.tld 1 ns%u.%s S . x x -T maxudp=512 +maxudp1460-1.tld 1 ns%u.%s S . x x -T maxudp=1460 +plain-1.tld 1 ns%u.%s S . x x +noedns-3.tld 3 ns%u.%s P . 2 x -T noedns +dropedns-3.tld 3 ns%u.%s P . 2 x -T dropedns +maxudp512-3.tld 3 ns%u.%s S . x x -T maxudp=512 +maxudp1460-3.tld 3 ns%u.%s S . x x -T maxudp=1460 +plain-3.tld 3 ns%u.%s S . x 3 +noedns-5.tld 5 ns%u.%s P . 3 x -T noedns +dropedns-5.tld 5 ns%u.%s P . x x -T dropedns +maxudp512-5.tld 5 ns%u.%s S . x x -T maxudp=512 +maxudp1460-5.tld 5 ns%u.%s S . x x -T maxudp=1460 +400ms-1.tld 5 ns%u.%s S 400/400/400/400/400 2 x +plain-5.tld 5 ns%u.%s S . x x +tld 12 ns%u.%s S . 5 8 +. 12 ns%u.root-servers.nil%s S . x x diff --git a/bin/tests/cfg_test.c b/bin/tests/cfg_test.c new file mode 100644 index 0000000..4d63c3b --- /dev/null +++ b/bin/tests/cfg_test.c @@ -0,0 +1,184 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +static void +check_result(isc_result_t result, const char *format, ...) { + va_list args; + + if (result == ISC_R_SUCCESS) + return; + + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + fprintf(stderr, ": %s\n", isc_result_totext(result)); + exit(1); +} + +static void +output(void *closure, const char *text, int textlen) { + UNUSED(closure); + (void) fwrite(text, 1, textlen, stdout); +} + +static void +usage(void) { + fprintf(stderr, "usage: cfg_test --rndc|--named " + "[--grammar] [--memstats] conffile\n"); + exit(1); +} + +int +main(int argc, char **argv) { + isc_result_t result; + isc_mem_t *mctx = NULL; + isc_log_t *lctx = NULL; + isc_logconfig_t *lcfg = NULL; + isc_logdestination_t destination; + cfg_parser_t *pctx = NULL; + cfg_obj_t *cfg = NULL; + cfg_type_t *type = NULL; + bool grammar = false; + bool memstats = false; + char *filename = NULL; + unsigned int zonetype = 0; + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + result = isc_log_create(mctx, &lctx, &lcfg); + check_result(result, "isc_log_create()"); + isc_log_setcontext(lctx); + + /* + * Create and install the default channel. + */ + destination.file.stream = stderr; + destination.file.name = NULL; + destination.file.versions = ISC_LOG_ROLLNEVER; + destination.file.maximum_size = 0; + result = isc_log_createchannel(lcfg, "_default", + ISC_LOG_TOFILEDESC, + ISC_LOG_DYNAMIC, + &destination, ISC_LOG_PRINTTIME); + check_result(result, "isc_log_createchannel()"); + result = isc_log_usechannel(lcfg, "_default", NULL, NULL); + check_result(result, "isc_log_usechannel()"); + + /* + * Set the initial debug level. + */ + isc_log_setdebuglevel(lctx, 2); + + if (argc < 3) + usage(); + + while (argc > 1) { + if (strcmp(argv[1], "--grammar") == 0) { + grammar = true; + } else if (strcmp(argv[1], "--zonegrammar") == 0) { + argv++, argc--; + if (argc <= 1) { + usage(); + } + if (strcmp(argv[1], "master") == 0 || + strcmp(argv[1], "primary") == 0) + { + zonetype = CFG_ZONE_MASTER; + } else if (strcmp(argv[1], "slave") == 0 || + strcmp(argv[1], "seconary") == 0) + { + zonetype = CFG_ZONE_SLAVE; + } else if (strcmp(argv[1], "stub") == 0) { + zonetype = CFG_ZONE_STUB; + } else if (strcmp(argv[1], "static-stub") == 0) { + zonetype = CFG_ZONE_STATICSTUB; + } else if (strcmp(argv[1], "hint") == 0) { + zonetype = CFG_ZONE_HINT; + } else if (strcmp(argv[1], "forward") == 0) { + zonetype = CFG_ZONE_FORWARD; + } else if (strcmp(argv[1], "redirect") == 0) { + zonetype = CFG_ZONE_REDIRECT; + } else if (strcmp(argv[1], "delegation-only") == 0) { + zonetype = CFG_ZONE_DELEGATION; + } else if (strcmp(argv[1], "in-view") == 0) { + zonetype = CFG_ZONE_INVIEW; + } else { + usage(); + } + } else if (strcmp(argv[1], "--memstats") == 0) { + memstats = true; + } else if (strcmp(argv[1], "--named") == 0) { + type = &cfg_type_namedconf; + } else if (strcmp(argv[1], "--rndc") == 0) { + type = &cfg_type_rndcconf; + } else if (argv[1][0] == '-') { + usage(); + } else { + filename = argv[1]; + } + argv++, argc--; + } + + if (grammar) { + if (type == NULL) + usage(); + cfg_print_grammar(type, output, NULL); + } else if (zonetype != 0) { + cfg_print_zonegrammar(zonetype, output, NULL); + } else { + if (type == NULL || filename == NULL) + usage(); + RUNTIME_CHECK(cfg_parser_create(mctx, lctx, &pctx) == ISC_R_SUCCESS); + + result = cfg_parse_file(pctx, filename, type, &cfg); + + fprintf(stderr, "read config: %s\n", isc_result_totext(result)); + + if (result != ISC_R_SUCCESS) + exit(1); + + cfg_print(cfg, output, NULL); + + cfg_obj_destroy(pctx, &cfg); + + cfg_parser_destroy(&pctx); + } + + isc_log_destroy(&lctx); + if (memstats) + isc_mem_stats(mctx, stderr); + isc_mem_destroy(&mctx); + + fflush(stdout); + if (ferror(stdout)) { + fprintf(stderr, "write error\n"); + return (1); + } else + return (0); +} diff --git a/bin/tests/fromhex.pl b/bin/tests/fromhex.pl new file mode 100644 index 0000000..ab8a74c --- /dev/null +++ b/bin/tests/fromhex.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +# Converts hex ascii into raw data. +# (This can be used, for example, to construct input for "wire_data -d".) + +require 5.006.001; + +use strict; +use IO::File; + +sub usage { + print ("Usage: packet.pl [file]\n"); + exit 1; +} + +my $file = "STDIN"; +if (@ARGV >= 1) { + my $filename = shift @ARGV; + open FH, "<$filename" or die "$filename: $!"; + $file = "FH"; +} + +my $input = ""; +while (defined(my $line = <$file>) ) { + chomp $line; + $line =~ s/#.*$//; + $input .= $line; +} + +$input =~ s/\s+//g; +my $data = pack("H*", $input); +my $len = length $data; + +binmode(STDOUT); +print($data); +exit(0); diff --git a/bin/tests/headerdep_test.sh.in b/bin/tests/headerdep_test.sh.in new file mode 100644 index 0000000..3a94d47 --- /dev/null +++ b/bin/tests/headerdep_test.sh.in @@ -0,0 +1,49 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +# +# Check the installed bind9 headers to make sure that no header +# depends on another header having been included first. +# + +prefix=@prefix@ +tmp=/tmp/thdr$$.tmp + +status=0 + +echo "Checking for header interdependencies..." + +# Make a list of header files. +(cd $prefix/include; find . -name '*.h' -print | sed 's!^./!!') > $tmp + +# Check each header. +while read h +do + echo " - <$h>" + + # Build a test program. + cat <test.c +#include <$h> +EOF + + # Compile the test program. + if + gcc @STD_CWARNINGS@ @STD_CINCLUDES@ -I$prefix/include -c test.c 2>&1 + then + : + else + status=1 + fi +done <$tmp + +rm -f test.c test.o $tmp + +exit $status diff --git a/bin/tests/makejournal.c b/bin/tests/makejournal.c new file mode 100644 index 0000000..61a41b0 --- /dev/null +++ b/bin/tests/makejournal.c @@ -0,0 +1,167 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#define CHECK(r) \ + do { \ + result = (r); \ + if (result != ISC_R_SUCCESS) \ + goto cleanup; \ + } while (0) + +isc_mem_t *mctx = NULL; +isc_log_t *lctx = NULL; +isc_entropy_t *ectx = NULL; + +static bool hash_active = false, dst_active = false; + +/* + * Logging categories: this needs to match the list in bin/named/log.c. + */ +static isc_logcategory_t categories[] = { + { "", 0 }, + { "client", 0 }, + { "network", 0 }, + { "update", 0 }, + { "queries", 0 }, + { "unmatched", 0 }, + { "update-security", 0 }, + { "query-errors", 0 }, + { NULL, 0 } +}; + +static isc_result_t +loadzone(dns_db_t **db, const char *origin, const char *filename) { + isc_result_t result; + dns_fixedname_t fixed; + dns_name_t *name; + + name = dns_fixedname_initname(&fixed); + + result = dns_name_fromstring(name, origin, 0, NULL); + if (result != ISC_R_SUCCESS) + return(result); + + result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, + dns_rdataclass_in, 0, NULL, db); + if (result != ISC_R_SUCCESS) + return (result); + + result = dns_db_load(*db, filename); + return (result); +} + +int +main(int argc, char **argv) { + isc_result_t result; + char *origin, *file1, *file2, *journal; + dns_db_t *olddb = NULL, *newdb = NULL; + isc_logdestination_t destination; + isc_logconfig_t *logconfig = NULL; + + if (argc != 5) { + printf("usage: %s origin file1 file2 journal\n", argv[0]); + return (1); + } + + origin = argv[1]; + file1 = argv[2]; + file2 = argv[3]; + journal = argv[4]; + + isc_mem_debugging |= ISC_MEM_DEBUGRECORD; + CHECK(isc_mem_create(0, 0, &mctx)); + CHECK(isc_entropy_create(mctx, &ectx)); + + CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE)); + hash_active = true; + + CHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING)); + dst_active = true; + + CHECK(isc_log_create(mctx, &lctx, &logconfig)); + isc_log_registercategories(lctx, categories); + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + + destination.file.stream = stderr; + destination.file.name = NULL; + destination.file.versions = ISC_LOG_ROLLNEVER; + destination.file.maximum_size = 0; + CHECK(isc_log_createchannel(logconfig, "stderr", + ISC_LOG_TOFILEDESC, ISC_LOG_DYNAMIC, + &destination, 0)); + CHECK(isc_log_usechannel(logconfig, "stderr", NULL, NULL)); + + dns_result_register(); + + result = loadzone(&olddb, origin, file1); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "Couldn't load %s: ", file1); + goto cleanup; + } + + result = loadzone(&newdb, origin, file2); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "Couldn't load %s: ", file2); + goto cleanup; + } + + result = dns_db_diff(mctx, newdb, NULL, olddb, NULL, journal); + + cleanup: + if (result != ISC_R_SUCCESS) + fprintf(stderr, "%s\n", isc_result_totext(result)); + + if (newdb != NULL) + dns_db_detach(&newdb); + if (olddb != NULL) + dns_db_detach(&olddb); + + if (lctx != NULL) + isc_log_destroy(&lctx); + if (dst_active) { + dst_lib_destroy(); + dst_active = false; + } + if (hash_active) { + isc_hash_destroy(); + hash_active = false; + } + if (ectx != NULL) + isc_entropy_detach(&ectx); + if (mctx != NULL) + isc_mem_destroy(&mctx); + + return(result != ISC_R_SUCCESS ? 1 : 0); +} diff --git a/bin/tests/named.conf b/bin/tests/named.conf new file mode 100644 index 0000000..5673e98 --- /dev/null +++ b/bin/tests/named.conf @@ -0,0 +1,617 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * This is a worthless, nonrunnable example of a named.conf file that has + * every conceivable syntax element in use. We use it to test the parser. + * It could also be used as a conceptual template for users of new features. + */ + +/* + * C-style comments are OK + */ + +// So are C++-style comments + +# So are shell-style comments + +// watch out for ";" -- it's important! + +options { + additional-from-auth true; + additional-from-cache false; + + version "my version string"; + random-device "/dev/random"; + directory "/tmp"; + + port 666; + + sig-validity-interval 33; + +# Obsolete + named-xfer "/usr/libexec/named-xfer"; // _PATH_XFER + + dump-file "named_dump.db"; // _PATH_DUMPFILE + pid-file "/var/run/named.pid"; // _PATH_PIDFILE + statistics-file "named.stats"; // _PATH_STATS + memstatistics-file "named.memstats"; // _PATH_MEMSTATS + + max-cache-ttl 999; + auth-nxdomain yes; // always set AA on NXDOMAIN. + // don't set this to 'no' unless + // you know what you're doing -- older + // servers won't like it. + +# Obsolete + deallocate-on-exit no; + + dialup yes; + +# Obsolete + fake-iquery no; + + fetch-glue yes; + has-old-clients yes; + host-statistics no; + +# Obsolete + multiple-cnames no; // if yes, then a name my have more + // than one CNAME RR. This use + // is non-standard and is not + // recommended, but it is available + // because previous releases supported + // it and it was used by large sites + // for load balancing. + + notify yes; // send NOTIFY messages. You can set + // notify on a zone-by-zone + // basis in the "zone" statement + // see (below) + recursion yes; + rfc2308-type1 no; + +# Obsolete + use-id-pool yes; + +# Obsolete + treat-cr-as-space yes; + + also-notify { 10.0.2.3; }; + + // The "forward" option is only meaningful if you've defined + // forwarders. "first" gives the normal BIND + // forwarding behavior, i.e. ask the forwarders first, and if that + // doesn't work then do the full lookup. You can also say + // "forward only;" which is what used to be specified with + // "slave" or "options forward-only". "only" will never attempt + // a full lookup; only the forwarders will be used. + forward first; + forwarders { + 1.2.3.4; + 5.6.7.8; + }; + + check-names master fail; + check-names slave warn; + check-names response ignore; + + allow-query { any; }; + allow-transfer { any; }; + allow-recursion { !any; }; + blackhole { 45/24; }; + keep-response-order { 46/24; }; + + listen-on { + 10/24; + 10.0.0.3; + }; + + listen-on port 53 { any; }; + + listen-on { 5.6.7.8; }; + + listen-on port 1234 { + !1.2.3.4; + 1.2.3/24; + }; + + listen-on-v6 { + 1:1:1:1:1:1:1:1; + }; + + listen-on-v6 port 777 { + 2:2:2:2:2:2:2:2; + }; + + query-source-v6 address 8:7:6:5:4:3:2:1 port *; + query-source port * address 10.0.0.54 ; + + lame-ttl 444; + + max-transfer-time-in 300; + max-transfer-time-out 10; + max-transfer-idle-in 100; + max-transfer-idle-out 11; + + max-retry-time 1234; + min-retry-time 1111; + max-refresh-time 888; + min-refresh-time 777; + + max-ncache-ttl 333; + min-roots 15; + serial-queries 34; + + transfer-format one-answer; + + transfers-in 10; + transfers-per-ns 2; + transfers-out 0; + + transfer-source 10.0.0.5; + transfer-source-v6 4:3:2:1:5:6:7:8; + + request-ixfr yes; + provide-ixfr yes; + +# Now called 'provide-ixfr' +# maintain-ixfr-base no; // If yes, keep transaction log file for IXFR + + max-ixfr-log-size 20m; + coresize 100; + datasize 101; + files 230; + max-cache-size 1m; + stacksize 231; + cleaning-interval 1000; + heartbeat-interval 1001; + interface-interval 1002; + statistics-interval 1003; + + topology { + 10/8; + + !1.2.3/24; + + { 1.2/16; 3/8; }; + + + }; + + sortlist { 10/8; 11/8; }; + + tkey-domain "foo.com"; + tkey-dhkey "xyz" 666 ; + + rrset-order { + class IN type A name "foo" order random; + order cyclic; + }; +}; + +/* + * Control listeners, for "ndc". Every nameserver needs at least one. + */ +controls { + // 'inet' lines without a 'port' defaults to 'port 953' + // 'keys' must be used and the list must have at least one entry + inet * port 52 allow { any; } keys { "key2"; }; + unix "/var/run/ndc" perm 0600 owner 0 group 0; // ignored by named. + inet 10.0.0.1 allow { any; key foo; } keys { "key4";}; + inet 10.0.0.2 allow { none; } keys { "key-1"; "key-2"; }; + inet 10.0.0.2 allow { none; }; +}; + +zone "master.demo.zone" { + type master; // what used to be called "primary" + database "somedb -option1 -option2 arg1 arg2 arg3"; + file "master.demo.zone"; + check-names fail; + allow-update { none; }; + allow-update-forwarding { 10.0.0.5; !any; }; + allow-transfer { any; }; + allow-query { any; }; + sig-validity-interval 990; + notify explicit; + also-notify { 1.0.0.1; }; // don't notify any nameservers other + // than those on the NS list for this + // zone + forward first; + forwarders { 10.0.0.3; 1:2:3:4:5:6:7:8; }; +}; + +zone "slave.demo.zone" { + type slave; // what used to be called "secondary" + file "slave.demo.zone"; + ixfr-base "slave.demo.zone.ixfr"; // File name for IXFR transaction log file + masters { + 1.2.3.4 port 10 key "foo"; // where to zone transfer from + 5.6.7.8; + 6.7.8.9 key "zippo"; + }; + transfer-source 10.0.0.53; // fixes multihoming problems + check-names warn; + allow-update { none; }; + allow-transfer { any; }; + allow-update-forwarding { any; }; + allow-query { any; }; + max-transfer-time-in 120; // if not set, global option is used. + max-transfer-time-out 1; // if not set, global option is used. + max-transfer-idle-in 2; // if not set, global option is used. + max-transfer-idle-out 3; // if not set, global option is used. + also-notify { 1.0.0.2; }; + forward only; + forwarders { 10.45.45.45; 10.0.0.3; 1:2:3:4:5:6:7:8; }; +}; + +key "non-viewkey" { secret "YWFh" ; algorithm "zzz" ; }; + +view "test-view" in { + key "viewkey" { algorithm "xxx" ; secret "eXl5" ; }; + also-notify { 10.2.2.3; }; + trusted-keys { + foo.com. 4 3 2 "abdefghijklmnopqrstuvwxyz"; + }; + sig-validity-interval 45; + max-cache-size 100000; + allow-query { 10.0.0.30;}; + additional-from-cache false; + additional-from-auth no; + match-clients { 10.0.0.1 ; }; + check-names master warn; + check-names slave ignore; + check-names response fail; + auth-nxdomain false; + recursion true; + provide-ixfr false; + request-ixfr true; + fetch-glue true; + notify false; + rfc2308-type1 false; + transfer-source 10.0.0.55; + transfer-source-v6 4:3:8:1:5:6:7:8; + query-source port * address 10.0.0.54 ; + query-source-v6 address 6:6:6:6:6:6:6:6 port *; + max-transfer-time-out 45; + max-transfer-idle-out 55; + cleaning-interval 100; + min-roots 3; + lame-ttl 477; + max-ncache-ttl 333; + max-cache-ttl 777; + transfer-format many-answers; + max-retry-time 7; + min-retry-time 4; + max-refresh-time 999; + min-refresh-time 111; + + zone "view-zone.com" { + type master; + allow-update-forwarding { 10.0.0.34;}; + file "view-zone-master"; + }; + + server 5.6.7.8 { + keys "viewkey"; + }; + + server 10.9.8.7 { + keys "non-viewkey"; + }; + dialup yes; +}; + + +zone "stub.demo.zone" { + type stub; // stub zones are like slave zones, + // except that only the NS records + // are transferred. + dialup yes; + file "stub.demo.zone"; + masters { + 1.2.3.4 ; // where to zone transfer from + 5.6.7.8 port 999; + }; + check-names warn; + allow-update { none; }; + allow-transfer { any; }; + allow-query { any; }; + + max-retry-time 10; + min-retry-time 11; + max-refresh-time 12; + min-refresh-time 13; + + max-transfer-time-in 120; // if not set, global option is used. + pubkey 257 255 1 "a useless key"; + pubkey 257 255 1 "another useless key"; +}; + +zone "." { + type hint; // used to be specified w/ "cache" + file "cache.db"; +// pubkey 257 255 1 "AQP2fHpZ4VMpKo/jc9Fod821uyfY5p8j5h/Am0V/KpBTMZjdXmp9QJe6yFRoIIzkaNCgTIftASdpXGgCwFB2j2KXP/rick6gvEer5VcDEkLR5Q=="; +}; + +trusted-keys { + "." 257 255 1 "AQP2fHpZ4VMpKo/jc9Fod821uyfY5p8j5h/Am0V/KpBTMZjdXmp9QJe6yFRoIIzkaNCgTIftASdpXGgCwFB2j2KXP/rick6gvEer5VcDEkLR5Q=="; +}; + + +acl can_query { !1.2.3/24; any; }; // network 1.2.3.0 mask 255.255.255.0 + // is disallowed; rest are OK +acl can_axfr { 1.2.3.4; can_query; }; // host 1.2.3.4 and any host allowed + // by can_query are OK + +zone "disabled-zone.com" { + type master; + file "bar"; + + max-retry-time 100; + min-retry-time 110; + max-refresh-time 120; + min-refresh-time 130; +}; + +zone "non-default-acl.demo.zone" { + type master; + file "foo"; + allow-query { can_query; }; + allow-transfer { can_axfr; }; + allow-update { + 1.2.3.4; + 5.6.7.8; + }; + pubkey 666 665 664 "key of the beast"; + // Errors trapped by parser: + // identity or name not absolute + // 'wildcard' match type and no wildcard character in name + // + // issues: + // - certain rdatatype values (such as "key") are config file keywords and + // must be quoted or a syntax error will occur. + // + + update-policy { + grant root.domain. subdomain host.domain. A MX CNAME; + grant sub.root.domain. wildcard *.host.domain. A; + grant root.domain. name host.domain. a ns md mf cname soa mb mg + mr "null" wks ptr hinfo minfo mx txt rp afsdb x25 + isdn rt nsap sig "key" px gpos aaaa loc nxt srv naptr kx + cert a6 dname opt unspec uri tkey tsig ; + grant foo.bar.com. self foo.bar.com. a; + }; +}; + +key sample_key { // for TSIG; supported by parser + algorithm hmac-md5; // but not yet implemented in the + secret "eW91ciBzZWNyZXQgaGVyZQ=="; // rest of the server +}; + +key key2 { + algorithm hmac-md5; + secret "ZXJlaCB0ZXJjZXMgcm91eQ=="; +}; + +acl key_acl { key sample_key; }; // a request signed with sample_key + +server 1.2.3.4 { + request-ixfr no; + provide-ixfr no; + bogus no; // if yes, we won't query or listen + // to this server + transfer-format one-answer; // set transfer format for this + // server (see the description of + // 'transfer-format' above) + // if not specified, the global option + // will be used + transfers 0; // not implemented + keys { "sample_key" }; // for TSIG; supported by the parser + // but not yet implemented in the + // rest of the server +# Now called 'request-ixfr' +# support-ixfr yes; // for IXFR supported by server + // if yes, the listed server talks IXFR +}; + +logging { + /* + * All log output goes to one or more "channels"; you can make as + * many of them as you want. + */ + + channel syslog_errors { // this channel will send errors or + syslog user; // or worse to syslog (user facility) + severity error; + }; + + channel stderr_errors { + stderr; + }; + + /* + * Channels have a severity level. Messages at severity levels + * greater than or equal to the channel's level will be logged on + * the channel. In order of decreasing severity, the levels are: + * + * critical a fatal error + * error + * warning + * notice a normal, but significant event + * info an informational message + * debug 1 the least detailed debugging info + * ... + * debug 99 the most detailed debugging info + */ + + /* + * Here are the built-in channels: + * + * channel default_syslog { + * syslog daemon; + * severity info; + * }; + * + * channel default_debug { + * file "named.run"; // note: stderr is used instead + * // of "named.run" if the server + * // is started with the "-f" + * // option. + * severity dynamic; // this means log debugging + * // at whatever debugging level + * // the server is at, and don't + * // log anything if not + * // debugging. + * }; + * + * channel null { // this is the bit bucket; + * file "/dev/null"; // any logging to this channel + * // is discarded. + * }; + * + * channel default_stderr { // writes to stderr + * file ""; // this is illustrative only; + * // there's currently no way + * // of saying "stderr" in the + * // configuration language. + * // i.e. don't try this at home. + * severity info; + * }; + * + * default_stderr only works before the server daemonizes (i.e. + * during initial startup) or when it is running in foreground + * mode (-f command line option). + */ + + /* + * There are many categories, so you can send the logs + * you want to see wherever you want, without seeing logs you + * don't want. Right now the categories are + * + * default the catch-all. many things still + * aren't classified into categories, and + * they all end up here. also, if you + * don't specify any channels for a + * category, the default category is used + * instead. + * config high-level configuration file + * processing + * parser low-level configuration file processing + * queries what used to be called "query logging" + * lame-servers messages like "Lame server on ..." + * statistics + * panic if the server has to shut itself + * down due to an internal problem, it + * logs the problem here (as well as + * in the problem's native category) + * update dynamic update + * ncache negative caching + * xfer-in zone transfers we're receiving + * xfer-out zone transfers we're sending + * db all database operations + * eventlib debugging info from the event system + * (see below) + * packet dumps of packets received and sent + * (see below) + * notify the NOTIFY protocol + * cname messages like "XX points to a CNAME" + * security approved/unapproved requests + * os operating system problems + * insist consistency check failures + * maintenance periodic maintenance + * load zone loading + * response-checks messages like + * "Malformed response ..." + * "wrong ans. name ..." + * "unrelated additional info ..." + * "invalid RR type ..." + * "bad referral ..." + */ + + category parser { + syslog_errors; // you can log to as many channels + default_syslog; // as you want + }; + + category lame-servers { null; }; // don't log these at all + + channel moderate_debug { + file "foo"; // foo + severity debug 3; // level 3 debugging to file + print-time yes; // timestamp log entries + print-category yes; // print category name + print-severity yes; // print severity level + /* + * Note that debugging must have been turned on either + * on the command line or with a signal to get debugging + * output (non-debugging output will still be written to + * this channel). + */ + }; + + channel another { + file "bar" versions 99 size 10M; + severity info; + }; + + channel third { + file "bar" size 100000 versions unlimited; + severity debug; // use default debug level + }; + + /* + * If you don't want to see "zone XXXX loaded" messages but do + * want to see any problems, you could do the following. + */ + channel no_info_messages { + syslog; + severity notice; + }; + + category load { no_info_messages; }; + + /* + * You can also define category "default"; it gets used when no + * "category" statement has been given for a category. + */ + category default { + default_syslog; + moderate_debug; + }; + + /* + * If you don't define category default yourself, the default + * default category will be used. It is + * + * category default { default_syslog; default_debug; }; + */ + + /* + * If you don't define category panic yourself, the default + * panic category will be used. It is + * + * category panic { default_syslog; default_stderr; }; + */ + + /* + * Two categories, 'packet' and 'eventlib', are special. Only one + * channel may be assigned to each of them, and it must be a + * file channel. If you don't define them yourself, they default to + * + * category eventlib { default_debug; }; + * + * category packet { default_debug; }; + */ +}; + +#include "filename"; // can't do within a statement + diff --git a/bin/tests/optional/Kchild.example.+003+04017.key b/bin/tests/optional/Kchild.example.+003+04017.key new file mode 100644 index 0000000..9f5cbac --- /dev/null +++ b/bin/tests/optional/Kchild.example.+003+04017.key @@ -0,0 +1 @@ +child.example. IN KEY 256 3 3 ALeiYGFXbil6PgHnkm5ZE67ygEVDvGT/gqZmLH7tGboofcPSfyhh1hpw dxZgJ26d/gynWMGVSYzaXfzsxpPoNeYn+qeevQoJOaxXXlfcy8Ik52Rm eW0J9mWlf9hsD7ShIhh1+0kRYGCOCaU25wIe3SLVkN3HgqiCBDYnBY0u nMkqRadiUnoEa3Tcvc9kJx9r9gDstR2A9A5sBhFLI/XQ0gViHHLVpQ4x hz+rTLb/xrBoAb5sQJT3xUjhhdNo9HuL6kwdLdSu//PCl1QnY9NpYPVV SKUo diff --git a/bin/tests/optional/Kchild.example.+003+04017.private b/bin/tests/optional/Kchild.example.+003+04017.private new file mode 100644 index 0000000..176ff98 --- /dev/null +++ b/bin/tests/optional/Kchild.example.+003+04017.private @@ -0,0 +1,7 @@ +Private-key-format: v1.2 +Algorithm: 3 (DSA) +Prime(p): vGT/gqZmLH7tGboofcPSfyhh1hpwdxZgJ26d/gynWMGVSYzaXfzsxpPoNeYn+qeevQoJOaxXXlfcy8Ik52RmeQ== +Subprime(q): t6JgYVduKXo+AeeSblkTrvKARUM= +Base(g): bQn2ZaV/2GwPtKEiGHX7SRFgYI4JpTbnAh7dItWQ3ceCqIIENicFjS6cySpFp2JSegRrdNy9z2QnH2v2AOy1HQ== +Private_value(x): J1Ctez8+w1PTR56Hze3pGoe0Wag= +Public_value(y): gPQObAYRSyP10NIFYhxy1aUOMYc/q0y2/8awaAG+bECU98VI4YXTaPR7i+pMHS3Urv/zwpdUJ2PTaWD1VUilKA== diff --git a/bin/tests/optional/Makefile.in b/bin/tests/optional/Makefile.in new file mode 100644 index 0000000..4442a80 --- /dev/null +++ b/bin/tests/optional/Makefile.in @@ -0,0 +1,299 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +@BIND9_MAKE_INCLUDES@ + +CINCLUDES = ${DNS_INCLUDES} ${ISC_INCLUDES} ${ISCCFG_INCLUDES} \ + ${LWRES_INCLUDES} @DST_OPENSSL_INC@ @DST_GSSAPI_INC@ + +CDEFINES = @CRYPTO@ @USE_GSSAPI@ + +CWARNINGS = +BACKTRACECFLAGS = @BACKTRACECFLAGS@ + +DNSLIBS = ../../../lib/dns/libdns.@A@ @DNS_CRYPTO_LIBS@ +ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ +ISCNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ @ISC_OPENSSL_LIBS@ +ISCCFGLIBS = ../../../lib/isccfg/libisccfg.@A@ +LWRESDEPLIBS = ../../../lib/lwres/liblwres.@A@ + +DNSDEPLIBS = ../../../lib/dns/libdns.@A@ +ISCDEPLIBS = ../../../lib/isc/libisc.@A@ +ISCDEPNOSYMLIBS = ../../../lib/isc/libisc-nosymtbl.@A@ +ISCCFGDEPLIBS = ../../../lib/isccfg/libisccfg.@A@ +LWRESLIBS = ../../../lib/lwres/liblwres.@A@ + +LIBS = @LIBS@ + +SUBDIRS = + +# These programs are not built by default, but only when +# configured with --enable-developer or built explicitly with +# "make all_tests" + +TARGETS = @XTARGETS@ +XTARGETS = adb_test@EXEEXT@ \ + byaddr_test@EXEEXT@ \ + backtrace_test@EXEEXT@ \ + backtrace_test_nosymtbl@EXEEXT@ \ + byname_test@EXEEXT@ \ + db_test@EXEEXT@ \ + dst_test@EXEEXT@ \ + entropy_test@EXEEXT@ \ + entropy2_test@EXEEXT@ \ + gsstest@EXEEXT@ \ + gxba_test@EXEEXT@ \ + gxbn_test@EXEEXT@ \ + hash_test@EXEEXT@ \ + fsaccess_test@EXEEXT@ \ + inter_test@EXEEXT@ \ + keyboard_test@EXEEXT@ \ + lex_test@EXEEXT@ \ + lfsr_test@EXEEXT@ \ + log_test@EXEEXT@ \ + lwres_test@EXEEXT@ \ + lwresconf_test@EXEEXT@ \ + master_test@EXEEXT@ \ + mempool_test@EXEEXT@ \ + name_test@EXEEXT@ \ + nsecify@EXEEXT@ \ + ratelimiter_test@EXEEXT@ \ + rbt_test@EXEEXT@ \ + rwlock_test@EXEEXT@ \ + serial_test@EXEEXT@ \ + shutdown_test@EXEEXT@ \ + sig0_test@EXEEXT@ \ + sock_test@EXEEXT@ \ + sym_test@EXEEXT@ \ + task_test@EXEEXT@ \ + timer_test@EXEEXT@ \ + zone_test@EXEEXT@ + +SRCS = ${XSRCS} +XSRCS = adb_test.c \ + byaddr_test.c \ + backtrace_test.c \ + byname_test.c \ + db_test.c \ + dst_test.c \ + entropy_test.c \ + entropy2_test.c \ + hash_test.c \ + fsaccess_test.c \ + gsstest.c \ + gxba_test.c \ + gxbn_test.c \ + inter_test.c \ + keyboard_test.c \ + lex_test.c \ + lfsr_test.c \ + log_test.c \ + lwres_test.c \ + lwresconf_test.c \ + master_test.c \ + mempool_test.c \ + name_test.c \ + nsecify.c \ + ratelimiter_test.c \ + rbt_test.c \ + rwlock_test.c \ + serial_test.c \ + shutdown_test.c \ + sig0_test.c \ + sock_test.c \ + sym_test.c \ + task_test.c \ + timer_test.c \ + zone_test.c + +@BIND9_MAKE_RULES@ + +# disable optimization for backtrace test to get the expected result +BTTEST_CFLAGS = ${BACKTRACECFLAGS} ${EXT_CFLAGS} ${ALL_CPPFLAGS} -g \ + ${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS} + +all_tests: ${XTARGETS} + +adb_test@EXEEXT@: adb_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ adb_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +backtrace_test_nosymtbl@EXEEXT@: ${srcdir}/backtrace_test.c ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} -o $@ \ + ${srcdir}/backtrace_test.c ${ISCLIBS} ${LIBS} + +backtrace_test@EXEEXT@: ${srcdir}/backtrace_test.c backtrace_test_nosymtbl@EXEEXT@ + #first step: create a first symbol table + rm -f symtbl.c + if test X${MKSYMTBL_PROGRAM} != X; then \ + ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl \ + backtrace_test_nosymtbl@EXEEXT@; else \ + cp ${top_srcdir}/lib/isc/backtrace-emptytbl.c symtbl.c; fi + #second step: build a binary with the first symbol table + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} \ + -o $@0 ${srcdir}/backtrace_test.c symtbl.c \ + ${ISCNOSYMLIBS} ${LIBS} + rm -f symtbl.c + #third step: create a second symbol table + if test X${MKSYMTBL_PROGRAM} != X; then \ + ${MKSYMTBL_PROGRAM} ${top_srcdir}/util/mksymtbl.pl $@0; else \ + cp ${top_srcdir}/lib/isc/backtrace-emptytbl.c symtbl.c; fi + #fourth step: build the final binary + rm -f $@0 + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${BTTEST_CFLAGS} ${LDFLAGS} \ + -o $@ ${srcdir}/backtrace_test.c symtbl.c ${ISCNOSYMLIBS} ${LIBS} + rm -f symtbl.c + +nsecify@EXEEXT@: nsecify.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ nsecify.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +byaddr_test@EXEEXT@: byaddr_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ byaddr_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +byname_test@EXEEXT@: byname_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ byname_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +lex_test@EXEEXT@: lex_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ lex_test.@O@ \ + ${ISCLIBS} ${LIBS} + +lfsr_test@EXEEXT@: lfsr_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ lfsr_test.@O@ \ + ${ISCLIBS} ${LIBS} + +log_test@EXEEXT@: log_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ log_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +name_test@EXEEXT@: name_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ name_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +hash_test@EXEEXT@: hash_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ hash_test.@O@ \ + ${ISCLIBS} ${LIBS} + +entropy_test@EXEEXT@: entropy_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ entropy_test.@O@ \ + ${ISCLIBS} ${LIBS} + +entropy2_test@EXEEXT@: entropy2_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ entropy2_test.@O@ \ + ${ISCLIBS} ${LIBS} + +sock_test@EXEEXT@: sock_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ sock_test.@O@ \ + ${ISCLIBS} ${LIBS} + +sym_test@EXEEXT@: sym_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ sym_test.@O@ \ + ${ISCLIBS} ${LIBS} + +task_test@EXEEXT@: task_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ task_test.@O@ \ + ${ISCLIBS} ${LIBS} + +shutdown_test@EXEEXT@: shutdown_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ shutdown_test.@O@ \ + ${ISCLIBS} ${LIBS} + +timer_test@EXEEXT@: timer_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ timer_test.@O@ \ + ${ISCLIBS} ${LIBS} + +ratelimiter_test@EXEEXT@: ratelimiter_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ ratelimiter_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +rbt_test@EXEEXT@: rbt_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rbt_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +rwlock_test@EXEEXT@: rwlock_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ rwlock_test.@O@ \ + ${ISCLIBS} ${LIBS} + +master_test@EXEEXT@: master_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ master_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +db_test@EXEEXT@: db_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ db_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +mempool_test@EXEEXT@: mempool_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ mempool_test.@O@ \ + ${ISCLIBS} ${LIBS} + +serial_test@EXEEXT@: serial_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ serial_test.@O@ \ + ${ISCLIBS} ${LIBS} + +zone_test@EXEEXT@: zone_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ zone_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +fsaccess_test@EXEEXT@: fsaccess_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ fsaccess_test.@O@ \ + ${ISCLIBS} ${LIBS} + +inter_test@EXEEXT@: inter_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ inter_test.@O@ \ + ${ISCLIBS} ${LIBS} + +keyboard_test@EXEEXT@: keyboard_test.@O@ ${ISCDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ keyboard_test.@O@ \ + ${ISCLIBS} ${LIBS} + +lwresconf_test@EXEEXT@: lwresconf_test.@O@ ${ISCDEPLIBS} ${LWRESDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ lwresconf_test.@O@ \ + ${LWRESLIBS} ${ISCLIBS} ${LIBS} + +lwres_test@EXEEXT@: lwres_test.@O@ ${ISCDEPLIBS} ${LWRESDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ lwres_test.@O@ \ + ${LWRESLIBS} ${ISCLIBS} ${LIBS} + +gxbn_test@EXEEXT@: gxbn_test.@O@ ${LWRESDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ gxbn_test.@O@ \ + ${LWRESLIBS} ${ISCLIBS} ${LIBS} + +gxba_test@EXEEXT@: gxba_test.@O@ ${LWRESDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ gxba_test.@O@ \ + ${LWRESLIBS} ${ISCLIBS} ${LIBS} + +sig0_test@EXEEXT@: sig0_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ sig0_test.@O@ \ + ${DNSLIBS} ${ISCLIBS} ${LIBS} + +dst_test@EXEEXT@: dst_test.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \ + -o $@ dst_test.@O@ ${DNSLIBS} ${ISCLIBS} ${LIBS} + +gsstest@EXEEXT@: gsstest.@O@ ${ISCDEPLIBS} ${DNSDEPLIBS} + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} \ + -o $@ gsstest.@O@ ${DNSLIBS} ${ISCLIBS} ${LIBS} + +clean distclean:: + rm -f ${TARGETS} ${XTARGETS} + rm -f backtrace_test_symtbl.c + +check: test + +test: + @for dir in $(TESTDIRS) ;\ + do \ + ( cd $$dir; $(MAKE) test ) ;\ + done diff --git a/bin/tests/optional/adb_test.c b/bin/tests/optional/adb_test.c new file mode 100644 index 0000000..9cd96a4 --- /dev/null +++ b/bin/tests/optional/adb_test.c @@ -0,0 +1,431 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +typedef struct client client_t; +struct client { + dns_name_t name; + const char *target; + ISC_LINK(client_t) link; + dns_adbfind_t *find; +}; + +static isc_mem_t *mctx = NULL; +static isc_entropy_t *ectx = NULL; +static isc_mempool_t *cmp; +static isc_log_t *lctx; +static isc_logconfig_t *lcfg; +static isc_taskmgr_t *taskmgr; +static isc_socketmgr_t *socketmgr; +static isc_timermgr_t *timermgr; +static dns_dispatchmgr_t *dispatchmgr; +static isc_task_t *t1, *t2; +static dns_view_t *view; +static dns_db_t *rootdb; +static ISC_LIST(client_t) clients; +static isc_mutex_t client_lock; +static isc_stdtime_t now; +static dns_adb_t *adb; + +static void +check_result(isc_result_t result, const char *format, ...) + ISC_FORMAT_PRINTF(2, 3); + +static void +check_result(isc_result_t result, const char *format, ...) { + va_list args; + + if (result == ISC_R_SUCCESS) + return; + + va_start(args, format); + vfprintf(stderr, format, args); + va_end(args); + fprintf(stderr, ": %s\n", isc_result_totext(result)); + exit(1); +} + +static client_t * +new_client(void) { + client_t *client; + + client = isc_mempool_get(cmp); + INSIST(client != NULL); + dns_name_init(&client->name, NULL); + ISC_LINK_INIT(client, link); + client->find = NULL; + + return (client); +} + +static void +free_client(client_t **c) { + client_t *client; + + INSIST(c != NULL); + client = *c; + *c = NULL; + INSIST(client != NULL); + dns_name_free(&client->name, mctx); + INSIST(!ISC_LINK_LINKED(client, link)); + INSIST(client->find == NULL); + + isc_mempool_put(cmp, client); +} + +static inline void +CLOCK(void) { + RUNTIME_CHECK(isc_mutex_lock(&client_lock) == ISC_R_SUCCESS); +} + +static inline void +CUNLOCK(void) { + RUNTIME_CHECK(isc_mutex_unlock(&client_lock) == ISC_R_SUCCESS); +} + +static void +lookup_callback(isc_task_t *task, isc_event_t *ev) { + client_t *client; + + client = ev->ev_arg; + INSIST(client->find == ev->ev_sender); + + printf("NAME %s:\n\tTask %p got event %p type %08x from %p, client %p\n\terr4: %s err6: %s\n", + client->target, + task, ev, ev->ev_type, client->find, client, + isc_result_totext(client->find->result_v4), + isc_result_totext(client->find->result_v6)); + + isc_event_free(&ev); + ev = NULL; + + CLOCK(); + + dns_adb_dumpfind(client->find, stderr); + dns_adb_destroyfind(&client->find); + + ISC_LIST_UNLINK(clients, client, link); + free_client(&client); + + CUNLOCK(); +} + +static void +create_managers(void) { + isc_result_t result; + + taskmgr = NULL; + result = isc_taskmgr_create(mctx, 5, 0, &taskmgr); + check_result(result, "isc_taskmgr_create"); + + timermgr = NULL; + result = isc_timermgr_create(mctx, &timermgr); + check_result(result, "isc_timermgr_create"); + + socketmgr = NULL; + result = isc_socketmgr_create(mctx, &socketmgr); + check_result(result, "isc_socketmgr_create"); + + dispatchmgr = NULL; + result = dns_dispatchmgr_create(mctx, NULL, &dispatchmgr); + check_result(result, "dns_dispatchmgr_create"); +} + +static void +create_view(void) { + dns_cache_t *cache; + isc_result_t result; + + /* + * View. + */ + view = NULL; + result = dns_view_create(mctx, dns_rdataclass_in, "_default", &view); + check_result(result, "dns_view_create"); + + /* + * Cache. + */ + cache = NULL; + result = dns_cache_create(mctx, taskmgr, timermgr, dns_rdataclass_in, + "rbt", 0, NULL, &cache); + check_result(result, "dns_cache_create"); + dns_view_setcache(view, cache); + dns_cache_detach(&cache); + + { + unsigned int attrs; + isc_sockaddr_t any4, any6; + dns_dispatch_t *disp4 = NULL; + dns_dispatch_t *disp6 = NULL; + + isc_sockaddr_any(&any4); + isc_sockaddr_any6(&any6); + + attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr, + taskmgr, &any4, + 512, 6, 1024, 17, 19, + attrs, attrs, &disp4) + == ISC_R_SUCCESS); + INSIST(disp4 != NULL); + + attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, socketmgr, + taskmgr, &any6, + 512, 6, 1024, 17, 19, + attrs, attrs, &disp6) + == ISC_R_SUCCESS); + INSIST(disp6 != NULL); + + RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1, + socketmgr, + timermgr, 0, + dispatchmgr, + disp4, disp6) == + ISC_R_SUCCESS); + } + + rootdb = NULL; + result = dns_rootns_create(mctx, dns_rdataclass_in, NULL, &rootdb); + check_result(result, "dns_rootns_create()"); + dns_view_sethints(view, rootdb); + dns_db_detach(&rootdb); + + dns_view_freeze(view); +} + +static void +lookup(const char *target) { + dns_name_t name; + unsigned char namedata[256]; + client_t *client; + isc_buffer_t t, namebuf; + isc_result_t result; + unsigned int options; + + INSIST(target != NULL); + + client = new_client(); + isc_buffer_constinit(&t, target, strlen(target)); + isc_buffer_add(&t, strlen(target)); + isc_buffer_init(&namebuf, namedata, sizeof(namedata)); + dns_name_init(&name, NULL); + result = dns_name_fromtext(&name, &t, dns_rootname, 0, &namebuf); + check_result(result, "dns_name_fromtext %s", target); + + result = dns_name_dup(&name, mctx, &client->name); + check_result(result, "dns_name_dup %s", target); + + options = 0; + options |= DNS_ADBFIND_INET; + options |= DNS_ADBFIND_INET6; + options |= DNS_ADBFIND_WANTEVENT; + options |= DNS_ADBFIND_HINTOK; + options |= DNS_ADBFIND_GLUEOK; + result = dns_adb_createfind(adb, t2, lookup_callback, client, + &client->name, dns_rootname, 0, options, + now, NULL, view->dstport, &client->find); + if (result != ISC_R_SUCCESS) + printf("DNS_ADB_CREATEFIND -> %s\n", dns_result_totext(result)); + dns_adb_dumpfind(client->find, stderr); + + if ((client->find->options & DNS_ADBFIND_WANTEVENT) != 0) { + client->target = target; + ISC_LIST_APPEND(clients, client, link); + } else { + printf("NAME %s: err4 %s, err6 %s\n", + target, isc_result_totext(client->find->result_v4), + isc_result_totext(client->find->result_v6)); + + dns_adb_destroyfind(&client->find); + free_client(&client); + } +} + +int +main(int argc, char **argv) { + isc_result_t result; + isc_logdestination_t destination; + + UNUSED(argc); + UNUSED(argv); + + dns_result_register(); + result = isc_app_start(); + check_result(result, "isc_app_start()"); + + isc_stdtime_get(&now); + + result = isc_mutex_init(&client_lock); + check_result(result, "isc_mutex_init(&client_lock)"); + ISC_LIST_INIT(clients); + + /* + * EVERYTHING needs a memory context. + */ + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + cmp = NULL; + RUNTIME_CHECK(isc_mempool_create(mctx, sizeof(client_t), &cmp) + == ISC_R_SUCCESS); + isc_mempool_setname(cmp, "adb test clients"); + + result = isc_entropy_create(mctx, &ectx); + check_result(result, "isc_entropy_create()"); + result = isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE); + check_result(result, "isc_hash_create()"); + + result = isc_log_create(mctx, &lctx, &lcfg); + check_result(result, "isc_log_create()"); + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + + /* + * Create and install the default channel. + */ + destination.file.stream = stderr; + destination.file.name = NULL; + destination.file.versions = ISC_LOG_ROLLNEVER; + destination.file.maximum_size = 0; + result = isc_log_createchannel(lcfg, "_default", + ISC_LOG_TOFILEDESC, + ISC_LOG_DYNAMIC, + &destination, ISC_LOG_PRINTTIME); + check_result(result, "isc_log_createchannel()"); + result = isc_log_usechannel(lcfg, "_default", NULL, NULL); + check_result(result, "isc_log_usechannel()"); + + /* + * Set the initial debug level. + */ + isc_log_setdebuglevel(lctx, 2); + + create_managers(); + + t1 = NULL; + result = isc_task_create(taskmgr, 0, &t1); + check_result(result, "isc_task_create t1"); + t2 = NULL; + result = isc_task_create(taskmgr, 0, &t2); + check_result(result, "isc_task_create t2"); + + printf("task 1 = %p\n", t1); + printf("task 2 = %p\n", t2); + + create_view(); + + adb = view->adb; + + /* + * Lock the entire client list here. This will cause all events + * for found names to block as well. + */ + CLOCK(); + lookup("f.root-servers.net."); /* Should be in hints */ + lookup("www.iengines.com"); /* should fetch */ + lookup("www.isc.org"); /* should fetch */ + lookup("www.flame.org"); /* should fetch */ + lookup("kechara.flame.org."); /* should fetch */ + lookup("moghedien.flame.org."); /* should fetch */ + lookup("mailrelay.flame.org."); /* should fetch */ + lookup("ipv4v6.flame.org."); /* should fetch */ + lookup("nonexistant.flame.org."); /* should fail to be found */ + lookup("foobar.badns.flame.org."); /* should fail utterly (NS) */ + lookup("i.root-servers.net."); /* Should be in hints */ + lookup("www.firstcard.com."); + lookup("dns04.flame.org."); + CUNLOCK(); + + sleep(10); + + dns_adb_dump(adb, stderr); + + sleep(10); + + CLOCK(); + lookup("f.root-servers.net."); /* Should be in hints */ + lookup("www.iengines.com"); /* should fetch */ + lookup("www.isc.org"); /* should fetch */ + lookup("www.flame.org"); /* should fetch */ + lookup("kechara.flame.org."); /* should fetch */ + lookup("moghedien.flame.org."); /* should fetch */ + lookup("mailrelay.flame.org."); /* should fetch */ + lookup("ipv4v6.flame.org."); /* should fetch */ + lookup("nonexistant.flame.org."); /* should fail to be found */ + lookup("foobar.badns.flame.org."); /* should fail utterly (NS) */ + lookup("i.root-servers.net."); /* Should be in hints */ + CUNLOCK(); + + sleep(20); + + dns_adb_dump(adb, stderr); + + isc_task_detach(&t1); + isc_task_detach(&t2); + + isc_mem_stats(mctx, stdout); + dns_adb_dump(adb, stderr); + + isc_app_run(); + + dns_adb_dump(adb, stderr); + + dns_view_detach(&view); + adb = NULL; + + fprintf(stderr, "Destroying socket manager\n"); + isc_socketmgr_destroy(&socketmgr); + fprintf(stderr, "Destroying timer manager\n"); + isc_timermgr_destroy(&timermgr); + + fprintf(stderr, "Destroying task manager\n"); + isc_taskmgr_destroy(&taskmgr); + + isc_log_destroy(&lctx); + + isc_hash_destroy(); + isc_entropy_detach(&ectx); + + isc_mempool_destroy(&cmp); + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + isc_app_finish(); + + return (0); +} diff --git a/bin/tests/optional/backtrace_test.c b/bin/tests/optional/backtrace_test.c new file mode 100644 index 0000000..cd89a68 --- /dev/null +++ b/bin/tests/optional/backtrace_test.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include + +const char *expected_symbols[] = { + "func3", + "func2", + "func1", + "main" +}; + +static int +func3() { + void *tracebuf[16]; + int i, nframes; + int error = 0; + const char *fname; + isc_result_t result; + unsigned long offset; + + result = isc_backtrace_gettrace(tracebuf, 16, &nframes); + if (result != ISC_R_SUCCESS) { + printf("isc_backtrace_gettrace failed: %s\n", + isc_result_totext(result)); + return (1); + } + + if (nframes < 4) + error++; + + for (i = 0; i < 4 && i < nframes; i++) { + fname = NULL; + result = isc_backtrace_getsymbol(tracebuf[i], &fname, &offset); + if (result != ISC_R_SUCCESS) { + error++; + continue; + } + if (strcmp(fname, expected_symbols[i]) != 0) + error++; + } + + if (error) { + printf("Unexpected result:\n"); + printf(" # of frames: %d (expected: at least 4)\n", nframes); + printf(" symbols:\n"); + for (i = 0; i < nframes; i++) { + fname = NULL; + result = isc_backtrace_getsymbol(tracebuf[i], &fname, + &offset); + if (result == ISC_R_SUCCESS) + printf(" [%d] %s\n", i, fname); + else { + printf(" [%d] %p getsymbol failed: %s\n", i, + tracebuf[i], isc_result_totext(result)); + } + } + } + + return (error); +} + +static int +func2() { + return (func3()); +} + +static int +func1() { + return (func2()); +} + +int +main() { + return (func1()); +} diff --git a/bin/tests/optional/byaddr_test.c b/bin/tests/optional/byaddr_test.c new file mode 100644 index 0000000..b1c1a7f --- /dev/null +++ b/bin/tests/optional/byaddr_test.c @@ -0,0 +1,259 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static void +done(isc_task_t *task, isc_event_t *event) { + dns_byaddrevent_t *bevent; + dns_byaddr_t *byaddr; + dns_name_t *name; + + REQUIRE(event->ev_type == DNS_EVENT_BYADDRDONE); + bevent = (dns_byaddrevent_t *)event; + + UNUSED(task); + + printf("byaddr event result = %s\n", + isc_result_totext(bevent->result)); + + if (bevent->result == ISC_R_SUCCESS) { + for (name = ISC_LIST_HEAD(bevent->names); + name != NULL; + name = ISC_LIST_NEXT(name, link)) { + char text[DNS_NAME_FORMATSIZE]; + dns_name_format(name, text, sizeof(text)); + printf("%s\n", text); + } + } + + byaddr = event->ev_sender; + dns_byaddr_destroy(&byaddr); + isc_event_free(&event); + + isc_app_shutdown(); +} + +int +main(int argc, char *argv[]) { + isc_mem_t *mctx; + bool verbose = false; + unsigned int workers = 2; + isc_taskmgr_t *taskmgr; + isc_task_t *task; + isc_timermgr_t *timermgr; + dns_view_t *view; + int ch; + isc_socketmgr_t *socketmgr; + dns_dispatchmgr_t *dispatchmgr; + isc_netaddr_t na; + dns_byaddr_t *byaddr; + isc_result_t result; + unsigned int options = 0; + dns_cache_t *cache; + + RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); + + dns_result_register(); + + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + while ((ch = isc_commandline_parse(argc, argv, "nvw:")) != -1) { + switch (ch) { + case 'n': + /* + * We only try nibbles, so do nothing for this option. + */ + break; + case 'v': + verbose = true; + break; + case 'w': + workers = (unsigned int)atoi(isc_commandline_argument); + break; + } + } + + if (verbose) { + printf("%u workers\n", workers); + printf("IPv4: %s\n", isc_result_totext(isc_net_probeipv4())); + printf("IPv6: %s\n", isc_result_totext(isc_net_probeipv6())); + } + + taskmgr = NULL; + RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &taskmgr) + == ISC_R_SUCCESS); + task = NULL; + RUNTIME_CHECK(isc_task_create(taskmgr, 0, &task) + == ISC_R_SUCCESS); + isc_task_setname(task, "byaddr", NULL); + + dispatchmgr = NULL; + RUNTIME_CHECK(dns_dispatchmgr_create(mctx, NULL, &dispatchmgr) + == ISC_R_SUCCESS); + + timermgr = NULL; + RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS); + socketmgr = NULL; + RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); + + cache = NULL; + RUNTIME_CHECK(dns_cache_create(mctx, taskmgr, timermgr, + dns_rdataclass_in, "rbt", 0, NULL, + &cache) == ISC_R_SUCCESS); + + view = NULL; + RUNTIME_CHECK(dns_view_create(mctx, dns_rdataclass_in, "default", + &view) == ISC_R_SUCCESS); + + { + unsigned int attrs; + dns_dispatch_t *disp4 = NULL; + dns_dispatch_t *disp6 = NULL; + + if (isc_net_probeipv4() == ISC_R_SUCCESS) { + isc_sockaddr_t any4; + + isc_sockaddr_any(&any4); + + attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, + socketmgr, + taskmgr, &any4, + 512, 6, 1024, + 17, 19, attrs, + attrs, &disp4) + == ISC_R_SUCCESS); + INSIST(disp4 != NULL); + } + + if (isc_net_probeipv6() == ISC_R_SUCCESS) { + isc_sockaddr_t any6; + + isc_sockaddr_any6(&any6); + + attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, + socketmgr, + taskmgr, &any6, + 512, 6, 1024, + 17, 19, attrs, + attrs, &disp6) + == ISC_R_SUCCESS); + INSIST(disp6 != NULL); + } + + RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1, + socketmgr, + timermgr, 0, + dispatchmgr, + disp4, disp6) == + ISC_R_SUCCESS); + + if (disp4 != NULL) + dns_dispatch_detach(&disp4); + if (disp6 != NULL) + dns_dispatch_detach(&disp6); + } + + { + struct in_addr ina; + isc_sockaddr_t sa; + isc_sockaddrlist_t sal; + + ISC_LIST_INIT(sal); + ina.s_addr = inet_addr("127.0.0.1"); + isc_sockaddr_fromin(&sa, &ina, 53); + ISC_LIST_APPEND(sal, &sa, link); + + RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname, + &sal, dns_fwdpolicy_only) + == ISC_R_SUCCESS); + } + + dns_view_setcache(view, cache); + dns_view_freeze(view); + + dns_cache_detach(&cache); + + printf("address = %s\n", argv[isc_commandline_index]); + na.family = AF_INET; + if (inet_pton(AF_INET, argv[isc_commandline_index], + (char *)&na.type.in) != 1) { + na.family = AF_INET6; + if (inet_pton(AF_INET6, argv[isc_commandline_index], + (char *)&na.type.in6) != 1) { + printf("unknown address format\n"); + exit(1); + } + } + + result = dns_byaddr_create(mctx, &na, view, options, task, + done, NULL, &byaddr); + if (result != ISC_R_SUCCESS) { + printf("dns_byaddr_create() returned %s\n", + isc_result_totext(result)); + RUNTIME_CHECK(0); + } + + (void)isc_app_run(); + + /* + * XXXRTH if we get a control-C before we get to isc_app_run(), + * we're in trouble (because we might try to destroy things before + * they've been created. + */ + + dns_view_detach(&view); + + isc_task_shutdown(task); + isc_task_detach(&task); + + dns_dispatchmgr_destroy(&dispatchmgr); + + isc_taskmgr_destroy(&taskmgr); + + isc_socketmgr_destroy(&socketmgr); + isc_timermgr_destroy(&timermgr); + + if (verbose) + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + isc_app_finish(); + + return (0); +} diff --git a/bin/tests/optional/byname_test.c b/bin/tests/optional/byname_test.c new file mode 100644 index 0000000..4b255ba --- /dev/null +++ b/bin/tests/optional/byname_test.c @@ -0,0 +1,368 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +static isc_mem_t *mctx = NULL; +static isc_entropy_t *ectx = NULL; +static isc_taskmgr_t *taskmgr; +static dns_view_t *view = NULL; +static dns_adbfind_t *find = NULL; +static isc_task_t *task = NULL; +static dns_fixedname_t fixed; +static dns_fixedname_t target; +static isc_log_t *lctx; +static isc_logconfig_t *lcfg; +static unsigned int level = 0; + +static void adb_callback(isc_task_t *task, isc_event_t *event); + +static void +log_init(void) { + isc_logdestination_t destination; + unsigned int flags; + + /* + * Setup a logging context. + */ + RUNTIME_CHECK(isc_log_create(mctx, &lctx, &lcfg) == ISC_R_SUCCESS); + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + + /* + * Create and install the default channel. + */ + destination.file.stream = stderr; + destination.file.name = NULL; + destination.file.versions = ISC_LOG_ROLLNEVER; + destination.file.maximum_size = 0; + flags = ISC_LOG_PRINTTIME; + RUNTIME_CHECK(isc_log_createchannel(lcfg, "_default", + ISC_LOG_TOFILEDESC, + ISC_LOG_DYNAMIC, + &destination, flags) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_log_usechannel(lcfg, "_default", NULL, NULL) == + ISC_R_SUCCESS); + isc_log_setdebuglevel(lctx, level); +} + +static void +print_addresses(dns_adbfind_t *adbfind) { + dns_adbaddrinfo_t *address; + + for (address = ISC_LIST_HEAD(adbfind->list); + address != NULL; + address = ISC_LIST_NEXT(address, publink)) { + isc_netaddr_t netaddr; + char text[ISC_NETADDR_FORMATSIZE]; + isc_netaddr_fromsockaddr(&netaddr, &address->sockaddr); + isc_netaddr_format(&netaddr, text, sizeof(text)); + printf("%s\n", text); + } +} + +static void +print_name(dns_name_t *name) { + char text[DNS_NAME_FORMATSIZE]; + + dns_name_format(name, text, sizeof(text)); + printf("%s\n", text); +} + +static void +do_find(bool want_event) { + isc_result_t result; + bool done = false; + unsigned int options; + + options = DNS_ADBFIND_INET | DNS_ADBFIND_INET6; + if (want_event) + options |= DNS_ADBFIND_WANTEVENT | DNS_ADBFIND_EMPTYEVENT; + dns_fixedname_init(&target); + result = dns_adb_createfind(view->adb, task, adb_callback, NULL, + dns_fixedname_name(&fixed), + dns_rootname, 0, options, 0, + dns_fixedname_name(&target), 0, + &find); + if (result == ISC_R_SUCCESS) { + if (!ISC_LIST_EMPTY(find->list)) { + /* + * We have at least some of the addresses for the + * name. + */ + INSIST((find->options & DNS_ADBFIND_WANTEVENT) == 0); + print_addresses(find); + done = true; + } else { + /* + * We don't know any of the addresses for this + * name. + */ + if ((find->options & DNS_ADBFIND_WANTEVENT) == 0) { + /* + * And ADB isn't going to send us any events + * either. This query loses. + */ + done = true; + } + /* + * If the DNS_ADBFIND_WANTEVENT flag was set, we'll + * get an event when something happens. + */ + } + } else if (result == DNS_R_ALIAS) { + print_name(dns_fixedname_name(&target)); + done = true; + } else { + printf("dns_adb_createfind() returned %s\n", + isc_result_totext(result)); + done = true; + } + + if (done) { + if (find != NULL) + dns_adb_destroyfind(&find); + isc_app_shutdown(); + } +} + +static void +adb_callback(isc_task_t *etask, isc_event_t *event) { + unsigned int type = event->ev_type; + + REQUIRE(etask == task); + + isc_event_free(&event); + dns_adb_destroyfind(&find); + + if (type == DNS_EVENT_ADBMOREADDRESSES) + do_find(false); + else if (type == DNS_EVENT_ADBNOMOREADDRESSES) { + printf("no more addresses\n"); + isc_app_shutdown(); + } else { + printf("unexpected ADB event type %u\n", type); + isc_app_shutdown(); + } +} + +static void +run(isc_task_t *xtask, isc_event_t *event) { + UNUSED(xtask); + do_find(true); + isc_event_free(&event); +} + +int +main(int argc, char *argv[]) { + bool verbose = false; + unsigned int workers = 2; + isc_timermgr_t *timermgr; + int ch; + isc_socketmgr_t *socketmgr; + dns_dispatchmgr_t *dispatchmgr; + dns_cache_t *cache; + isc_buffer_t b; + + RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); + + dns_result_register(); + + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_entropy_create(mctx, &ectx) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_hash_create(mctx, ectx, DNS_NAME_MAXWIRE) + == ISC_R_SUCCESS); + + while ((ch = isc_commandline_parse(argc, argv, "d:vw:")) != -1) { + switch (ch) { + case 'd': + level = (unsigned int)atoi(isc_commandline_argument); + break; + case 'v': + verbose = true; + break; + case 'w': + workers = (unsigned int)atoi(isc_commandline_argument); + break; + } + } + + log_init(); + + if (verbose) { + printf("%u workers\n", workers); + printf("IPv4: %s\n", isc_result_totext(isc_net_probeipv4())); + printf("IPv6: %s\n", isc_result_totext(isc_net_probeipv6())); + } + + taskmgr = NULL; + RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &taskmgr) == + ISC_R_SUCCESS); + task = NULL; + RUNTIME_CHECK(isc_task_create(taskmgr, 0, &task) == + ISC_R_SUCCESS); + isc_task_setname(task, "byname", NULL); + + dispatchmgr = NULL; + RUNTIME_CHECK(dns_dispatchmgr_create(mctx, NULL, &dispatchmgr) + == ISC_R_SUCCESS); + + timermgr = NULL; + RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS); + socketmgr = NULL; + RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); + + cache = NULL; + RUNTIME_CHECK(dns_cache_create(mctx, taskmgr, timermgr, + dns_rdataclass_in, "rbt", 0, NULL, + &cache) == ISC_R_SUCCESS); + + view = NULL; + RUNTIME_CHECK(dns_view_create(mctx, dns_rdataclass_in, "default", + &view) == ISC_R_SUCCESS); + + { + unsigned int attrs; + dns_dispatch_t *disp4 = NULL; + dns_dispatch_t *disp6 = NULL; + + if (isc_net_probeipv4() == ISC_R_SUCCESS) { + isc_sockaddr_t any4; + isc_sockaddr_any(&any4); + + attrs = DNS_DISPATCHATTR_IPV4 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, + socketmgr, + taskmgr, &any4, + 512, 6, 1024, + 17, 19, attrs, + attrs, &disp4) + == ISC_R_SUCCESS); + INSIST(disp4 != NULL); + } + + if (isc_net_probeipv6() == ISC_R_SUCCESS) { + isc_sockaddr_t any6; + + isc_sockaddr_any6(&any6); + + attrs = DNS_DISPATCHATTR_IPV6 | DNS_DISPATCHATTR_UDP; + RUNTIME_CHECK(dns_dispatch_getudp(dispatchmgr, + socketmgr, + taskmgr, &any6, + 512, 6, 1024, + 17, 19, attrs, + attrs, &disp6) + == ISC_R_SUCCESS); + INSIST(disp6 != NULL); + } + + RUNTIME_CHECK(dns_view_createresolver(view, taskmgr, 10, 1, + socketmgr, + timermgr, 0, + dispatchmgr, + disp4, disp6) == + ISC_R_SUCCESS); + + if (disp4 != NULL) + dns_dispatch_detach(&disp4); + if (disp6 != NULL) + dns_dispatch_detach(&disp6); + } + + { + struct in_addr ina; + isc_sockaddr_t sa; + isc_sockaddrlist_t sal; + + ISC_LIST_INIT(sal); + ina.s_addr = inet_addr("127.0.0.1"); + isc_sockaddr_fromin(&sa, &ina, 53); + ISC_LIST_APPEND(sal, &sa, link); + + RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname, + &sal, dns_fwdpolicy_only) + == ISC_R_SUCCESS); + } + + dns_view_setcache(view, cache); + dns_view_freeze(view); + + dns_cache_detach(&cache); + + printf("name = %s\n", argv[isc_commandline_index]); + isc_buffer_init(&b, argv[isc_commandline_index], + strlen(argv[isc_commandline_index])); + isc_buffer_add(&b, strlen(argv[isc_commandline_index])); + dns_fixedname_init(&fixed); + dns_fixedname_init(&target); + RUNTIME_CHECK(dns_name_fromtext(dns_fixedname_name(&fixed), &b, + dns_rootname, 0, NULL) == + ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_app_onrun(mctx, task, run, NULL) == ISC_R_SUCCESS); + + (void)isc_app_run(); + + dns_view_detach(&view); + isc_task_shutdown(task); + isc_task_detach(&task); + + dns_dispatchmgr_destroy(&dispatchmgr); + + isc_taskmgr_destroy(&taskmgr); + + isc_socketmgr_destroy(&socketmgr); + isc_timermgr_destroy(&timermgr); + + isc_log_destroy(&lctx); + + isc_hash_destroy(); + isc_entropy_detach(&ectx); + + if (verbose) + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + isc_app_finish(); + + return (0); +} diff --git a/bin/tests/optional/db_test.c b/bin/tests/optional/db_test.c new file mode 100644 index 0000000..c69af66 --- /dev/null +++ b/bin/tests/optional/db_test.c @@ -0,0 +1,936 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#define MAXHOLD 100 +#define MAXVERSIONS 100 + +typedef struct dbinfo { + dns_db_t * db; + dns_dbversion_t * version; + dns_dbversion_t * wversion; + dns_dbversion_t * rversions[MAXVERSIONS]; + int rcount; + dns_dbnode_t * hold_nodes[MAXHOLD]; + int hold_count; + dns_dbiterator_t * dbiterator; + dns_dbversion_t * iversion; + int pause_every; + bool ascending; + ISC_LINK(struct dbinfo) link; +} dbinfo; + +static isc_mem_t * mctx = NULL; +static char dbtype[128]; +static dns_dbtable_t * dbtable; +static ISC_LIST(dbinfo) dbs; +static dbinfo * cache_dbi = NULL; +static int pause_every = 0; +static bool ascending = true; + +static void +print_result(const char *message, isc_result_t result) { + + if (message == NULL) + message = ""; + printf("%s%sresult %08x: %s\n", message, (*message == '\0') ? "" : " ", + result, isc_result_totext(result)); +} + +static void +print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) { + isc_buffer_t text; + char t[1000]; + isc_result_t result; + isc_region_t r; + + isc_buffer_init(&text, t, sizeof(t)); + result = dns_rdataset_totext(rdataset, name, false, false, + &text); + isc_buffer_usedregion(&text, &r); + if (result == ISC_R_SUCCESS) + printf("%.*s", (int)r.length, (char *)r.base); + else + print_result("", result); +} + +static void +print_rdatasets(dns_name_t *name, dns_rdatasetiter_t *rdsiter) { + isc_result_t result; + dns_rdataset_t rdataset; + + dns_rdataset_init(&rdataset); + result = dns_rdatasetiter_first(rdsiter); + while (result == ISC_R_SUCCESS) { + dns_rdatasetiter_current(rdsiter, &rdataset); + print_rdataset(name, &rdataset); + dns_rdataset_disassociate(&rdataset); + result = dns_rdatasetiter_next(rdsiter); + } + if (result != ISC_R_NOMORE) + print_result("", result); +} + +static dbinfo * +select_db(char *origintext) { + dns_fixedname_t forigin; + dns_name_t *origin; + isc_buffer_t source; + size_t len; + dbinfo *dbi; + isc_result_t result; + + if (strcasecmp(origintext, "cache") == 0) { + if (cache_dbi == NULL) + printf("the cache does not exist\n"); + return (cache_dbi); + } + len = strlen(origintext); + isc_buffer_init(&source, origintext, len); + isc_buffer_add(&source, len); + origin = dns_fixedname_initname(&forigin); + result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL); + if (result != ISC_R_SUCCESS) { + print_result("bad name", result); + return (NULL); + } + + for (dbi = ISC_LIST_HEAD(dbs); + dbi != NULL; + dbi = ISC_LIST_NEXT(dbi, link)) { + if (dns_name_compare(dns_db_origin(dbi->db), origin) == 0) + break; + } + + return (dbi); +} + +static void +list(dbinfo *dbi, char *seektext) { + dns_fixedname_t fname; + dns_name_t *name; + dns_dbnode_t *node; + dns_rdatasetiter_t *rdsiter; + isc_result_t result; + int i; + size_t len; + dns_fixedname_t fseekname; + dns_name_t *seekname; + isc_buffer_t source; + + name = dns_fixedname_initname(&fname); + + if (dbi->dbiterator == NULL) { + INSIST(dbi->iversion == NULL); + if (dns_db_iszone(dbi->db)) { + if (dbi->version != NULL) + dns_db_attachversion(dbi->db, dbi->version, + &dbi->iversion); + else + dns_db_currentversion(dbi->db, &dbi->iversion); + } + + result = dns_db_createiterator(dbi->db, 0, &dbi->dbiterator); + if (result == ISC_R_SUCCESS) { + if (seektext != NULL) { + len = strlen(seektext); + isc_buffer_init(&source, seektext, len); + isc_buffer_add(&source, len); + seekname = dns_fixedname_initname(&fseekname); + result = dns_name_fromtext(seekname, &source, + dns_db_origin( + dbi->db), + 0, NULL); + if (result == ISC_R_SUCCESS) + result = dns_dbiterator_seek( + dbi->dbiterator, + seekname); + } else if (dbi->ascending) + result = dns_dbiterator_first(dbi->dbiterator); + else + result = dns_dbiterator_last(dbi->dbiterator); + } + } else + result = ISC_R_SUCCESS; + + node = NULL; + rdsiter = NULL; + i = 0; + while (result == ISC_R_SUCCESS) { + result = dns_dbiterator_current(dbi->dbiterator, &node, name); + if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) + break; + result = dns_db_allrdatasets(dbi->db, node, dbi->iversion, 0, + &rdsiter); + if (result != ISC_R_SUCCESS) { + dns_db_detachnode(dbi->db, &node); + break; + } + print_rdatasets(name, rdsiter); + dns_rdatasetiter_destroy(&rdsiter); + dns_db_detachnode(dbi->db, &node); + if (dbi->ascending) + result = dns_dbiterator_next(dbi->dbiterator); + else + result = dns_dbiterator_prev(dbi->dbiterator); + i++; + if (result == ISC_R_SUCCESS && i == dbi->pause_every) { + printf("[more...]\n"); + result = dns_dbiterator_pause(dbi->dbiterator); + if (result == ISC_R_SUCCESS) + return; + } + } + if (result != ISC_R_NOMORE) + print_result("", result); + + dns_dbiterator_destroy(&dbi->dbiterator); + if (dbi->iversion != NULL) + dns_db_closeversion(dbi->db, &dbi->iversion, false); +} + +static isc_result_t +load(const char *filename, const char *origintext, bool cache) { + dns_fixedname_t forigin; + dns_name_t *origin; + isc_result_t result; + isc_buffer_t source; + size_t len; + dbinfo *dbi; + unsigned int i; + + dbi = isc_mem_get(mctx, sizeof(*dbi)); + if (dbi == NULL) + return (ISC_R_NOMEMORY); + + dbi->db = NULL; + dbi->version = NULL; + dbi->wversion = NULL; + for (i = 0; i < MAXVERSIONS; i++) + dbi->rversions[i] = NULL; + dbi->hold_count = 0; + for (i = 0; i < MAXHOLD; i++) + dbi->hold_nodes[i] = NULL; + dbi->dbiterator = NULL; + dbi->iversion = NULL; + dbi->pause_every = pause_every; + dbi->ascending = ascending; + ISC_LINK_INIT(dbi, link); + + len = strlen(origintext); + isc_buffer_constinit(&source, origintext, len); + isc_buffer_add(&source, len); + origin = dns_fixedname_initname(&forigin); + result = dns_name_fromtext(origin, &source, dns_rootname, 0, NULL); + if (result != ISC_R_SUCCESS) { + isc_mem_put(mctx, dbi, sizeof(*dbi)); + return (result); + } + + result = dns_db_create(mctx, dbtype, origin, + cache ? dns_dbtype_cache : dns_dbtype_zone, + dns_rdataclass_in, + 0, NULL, &dbi->db); + if (result != ISC_R_SUCCESS) { + isc_mem_put(mctx, dbi, sizeof(*dbi)); + return (result); + } + + printf("loading %s (%s)\n", filename, origintext); + result = dns_db_load(dbi->db, filename); + if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) { + dns_db_detach(&dbi->db); + isc_mem_put(mctx, dbi, sizeof(*dbi)); + return (result); + } + printf("loaded\n"); + + if (cache) { + INSIST(cache_dbi == NULL); + dns_dbtable_adddefault(dbtable, dbi->db); + cache_dbi = dbi; + } else { + result = dns_dbtable_add(dbtable, dbi->db); + if (result != ISC_R_SUCCESS) { + dns_db_detach(&dbi->db); + isc_mem_put(mctx, dbi, sizeof(*dbi)); + return (result); + } + } + ISC_LIST_APPEND(dbs, dbi, link); + + return (ISC_R_SUCCESS); +} + +static void +unload_all(void) { + dbinfo *dbi, *dbi_next; + + for (dbi = ISC_LIST_HEAD(dbs); dbi != NULL; dbi = dbi_next) { + dbi_next = ISC_LIST_NEXT(dbi, link); + if (dns_db_iszone(dbi->db)) + dns_dbtable_remove(dbtable, dbi->db); + else { + INSIST(dbi == cache_dbi); + dns_dbtable_removedefault(dbtable); + cache_dbi = NULL; + } + dns_db_detach(&dbi->db); + ISC_LIST_UNLINK(dbs, dbi, link); + isc_mem_put(mctx, dbi, sizeof(*dbi)); + } +} + +#define DBI_CHECK(dbi) \ +if ((dbi) == NULL) { \ + printf("You must first select a database with !DB\n"); \ + continue; \ +} + +int +main(int argc, char *argv[]) { + dns_db_t *db; + dns_dbnode_t *node; + isc_result_t result; + dns_name_t name; + dns_offsets_t offsets; + size_t len; + isc_buffer_t source, target; + char s[1000]; + char b[255]; + dns_rdataset_t rdataset, sigrdataset; + int ch; + dns_rdatatype_t type = 1; + bool printnode = false; + bool addmode = false; + bool delmode = false; + bool holdmode = false; + bool verbose = false; + bool done = false; + bool quiet = false; + bool time_lookups = false; + bool found_as; + bool find_zonecut = false; + bool noexact_zonecut = false; + int i, v; + dns_rdatasetiter_t *rdsiter; + char t1[256]; + char t2[256]; + isc_buffer_t tb1, tb2; + isc_region_t r1, r2; + dns_fixedname_t foundname; + dns_name_t *fname; + unsigned int options = 0, zcoptions; + isc_time_t start, finish; + const char *origintext; + dbinfo *dbi; + dns_dbversion_t *version; + dns_name_t *origin; + size_t memory_quota = 0; + dns_trust_t trust = 0; + unsigned int addopts; + isc_log_t *lctx = NULL; + size_t n; + + dns_result_register(); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + RUNTIME_CHECK(dns_dbtable_create(mctx, dns_rdataclass_in, &dbtable) == + ISC_R_SUCCESS); + + snprintf(dbtype, sizeof(dbtype), "rbt"); + while ((ch = isc_commandline_parse(argc, argv, "c:d:t:z:P:Q:glpqvT")) + != -1) { + switch (ch) { + case 'c': + result = load(isc_commandline_argument, ".", true); + if (result != ISC_R_SUCCESS) + printf("cache load(%s) %08x: %s\n", + isc_commandline_argument, result, + isc_result_totext(result)); + break; + case 'd': + n = strlcpy(dbtype, isc_commandline_argument, + sizeof(dbtype)); + if (n >= sizeof(dbtype)) { + fprintf(stderr, "bad db type '%s'\n", + isc_commandline_argument); + exit(1); + } + break; + case 'g': + options |= (DNS_DBFIND_GLUEOK|DNS_DBFIND_VALIDATEGLUE); + break; + case 'l': + RUNTIME_CHECK(isc_log_create(mctx, &lctx, + NULL) == ISC_R_SUCCESS); + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + break; + case 'q': + quiet = true; + verbose = false; + break; + case 'p': + printnode = true; + break; + case 'P': + pause_every = atoi(isc_commandline_argument); + break; + case 'Q': + memory_quota = atoi(isc_commandline_argument); + isc_mem_setquota(mctx, memory_quota); + break; + case 't': + type = atoi(isc_commandline_argument); + break; + case 'T': + time_lookups = true; + break; + case 'v': + verbose = true; + break; + case 'z': + origintext = strrchr(isc_commandline_argument, '/'); + if (origintext == NULL) + origintext = isc_commandline_argument; + else + origintext++; /* Skip '/'. */ + result = load(isc_commandline_argument, origintext, + false); + if (result != ISC_R_SUCCESS) + printf("zone load(%s) %08x: %s\n", + isc_commandline_argument, result, + isc_result_totext(result)); + break; + } + } + + argc -= isc_commandline_index; + argv += isc_commandline_index; + POST(argv); + + if (argc != 0) + printf("ignoring trailing arguments\n"); + + /* + * Some final initialization... + */ + fname = dns_fixedname_initname(&foundname); + dbi = NULL; + origin = dns_rootname; + version = NULL; + + if (time_lookups) { + TIME_NOW(&start); + } + + while (!done) { + if (!quiet) + printf("\n"); + if (fgets(s, sizeof(s), stdin) == NULL) { + done = true; + continue; + } + len = strlen(s); + if (len > 0U && s[len - 1] == '\n') { + s[len - 1] = '\0'; + len--; + } + if (verbose && dbi != NULL) { + if (dbi->wversion != NULL) + printf("future version (%p)\n", dbi->wversion); + for (i = 0; i < dbi->rcount; i++) + if (dbi->rversions[i] != NULL) + printf("open version %d (%p)\n", i, + dbi->rversions[i]); + } + dns_name_init(&name, offsets); + if (strcmp(s, "!R") == 0) { + DBI_CHECK(dbi); + if (dbi->rcount == MAXVERSIONS) { + printf("too many open versions\n"); + continue; + } + dns_db_currentversion(dbi->db, + &dbi->rversions[dbi->rcount]); + printf("opened version %d\n", dbi->rcount); + dbi->version = dbi->rversions[dbi->rcount]; + version = dbi->version; + dbi->rcount++; + continue; + } else if (strcmp(s, "!W") == 0) { + DBI_CHECK(dbi); + if (dbi->wversion != NULL) { + printf("using existing future version\n"); + dbi->version = dbi->wversion; + version = dbi->version; + continue; + } + result = dns_db_newversion(dbi->db, &dbi->wversion); + if (result != ISC_R_SUCCESS) + print_result("", result); + else + printf("newversion\n"); + dbi->version = dbi->wversion; + version = dbi->version; + continue; + } else if (strcmp(s, "!C") == 0) { + DBI_CHECK(dbi); + addmode = false; + delmode = false; + if (dbi->version == NULL) + continue; + if (dbi->version == dbi->wversion) { + printf("closing future version\n"); + dbi->wversion = NULL; + } else { + for (i = 0; i < dbi->rcount; i++) { + if (dbi->version == + dbi->rversions[i]) { + dbi->rversions[i] = NULL; + printf("closing open version %d\n", + i); + break; + } + } + } + dns_db_closeversion(dbi->db, &dbi->version, true); + version = NULL; + continue; + } else if (strcmp(s, "!X") == 0) { + DBI_CHECK(dbi); + addmode = false; + delmode = false; + if (dbi->version == NULL) + continue; + if (dbi->version == dbi->wversion) { + printf("aborting future version\n"); + dbi->wversion = NULL; + } else { + for (i = 0; i < dbi->rcount; i++) { + if (dbi->version == + dbi->rversions[i]) { + dbi->rversions[i] = NULL; + printf("closing open version %d\n", + i); + break; + } + } + } + dns_db_closeversion(dbi->db, &dbi->version, false); + version = NULL; + continue; + } else if (strcmp(s, "!A") == 0) { + DBI_CHECK(dbi); + delmode = false; + if (addmode) + addmode = false; + else + addmode = true; + printf("addmode = %s\n", addmode ? "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!D") == 0) { + DBI_CHECK(dbi); + addmode = false; + if (delmode) + delmode = false; + else + delmode = true; + printf("delmode = %s\n", delmode ? "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!H") == 0) { + DBI_CHECK(dbi); + if (holdmode) + holdmode = false; + else + holdmode = true; + printf("holdmode = %s\n", holdmode ? "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!HR") == 0) { + DBI_CHECK(dbi); + for (i = 0; i < dbi->hold_count; i++) + dns_db_detachnode(dbi->db, + &dbi->hold_nodes[i]); + dbi->hold_count = 0; + holdmode = false; + printf("held nodes have been detached\n"); + continue; + } else if (strcmp(s, "!VC") == 0) { + DBI_CHECK(dbi); + printf("switching to current version\n"); + dbi->version = NULL; + version = NULL; + continue; + } else if (strstr(s, "!V") == s) { + DBI_CHECK(dbi); + v = atoi(&s[2]); + if (v >= dbi->rcount || v < 0) { + printf("unknown open version %d\n", v); + continue; + } + if (dbi->rversions[v] == NULL) { + printf("version %d is not open\n", v); + continue; + } + printf("switching to open version %d\n", v); + dbi->version = dbi->rversions[v]; + version = dbi->version; + continue; + } else if (strstr(s, "!TR") == s) { + trust = (unsigned int)atoi(&s[3]); + printf("trust level is now %u\n", (unsigned int)trust); + continue; + } else if (strstr(s, "!T") == s) { + type = (unsigned int)atoi(&s[2]); + printf("now searching for type %u\n", type); + continue; + } else if (strcmp(s, "!G") == 0) { + if ((options & DNS_DBFIND_GLUEOK) != 0) + options &= ~DNS_DBFIND_GLUEOK; + else + options |= DNS_DBFIND_GLUEOK; + printf("glue ok = %s\n", + ((options & DNS_DBFIND_GLUEOK) != 0) ? + "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!GV") == 0) { + if ((options & DNS_DBFIND_VALIDATEGLUE) != 0) + options &= ~DNS_DBFIND_VALIDATEGLUE; + else + options |= DNS_DBFIND_VALIDATEGLUE; + printf("validate glue = %s\n", + ((options & DNS_DBFIND_VALIDATEGLUE) != 0) ? + "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!WC") == 0) { + if ((options & DNS_DBFIND_NOWILD) != 0) + options &= ~DNS_DBFIND_NOWILD; + else + options |= DNS_DBFIND_NOWILD; + printf("wildcard matching = %s\n", + ((options & DNS_DBFIND_NOWILD) == 0) ? + "TRUE" : "FALSE"); + continue; + } else if (strstr(s, "!LS ") == s) { + DBI_CHECK(dbi); + list(dbi, &s[4]); + continue; + } else if (strcmp(s, "!LS") == 0) { + DBI_CHECK(dbi); + list(dbi, NULL); + continue; + } else if (strstr(s, "!DU ") == s) { + DBI_CHECK(dbi); + result = dns_db_dump(dbi->db, dbi->version, s+4); + if (result != ISC_R_SUCCESS) { + printf("\n"); + print_result("", result); + } + continue; + } else if (strcmp(s, "!PN") == 0) { + if (printnode) + printnode = false; + else + printnode = true; + printf("printnode = %s\n", + printnode ? "TRUE" : "FALSE"); + continue; + } else if (strstr(s, "!P") == s) { + DBI_CHECK(dbi); + v = atoi(&s[2]); + dbi->pause_every = v; + continue; + } else if (strcmp(s, "!+") == 0) { + DBI_CHECK(dbi); + dbi->ascending = true; + continue; + } else if (strcmp(s, "!-") == 0) { + DBI_CHECK(dbi); + dbi->ascending = false; + continue; + } else if (strcmp(s, "!DB") == 0) { + dbi = NULL; + origin = dns_rootname; + version = NULL; + printf("now searching all databases\n"); + continue; + } else if (strncmp(s, "!DB ", 4) == 0) { + dbi = select_db(s+4); + if (dbi != NULL) { + db = dbi->db; + origin = dns_db_origin(dbi->db); + version = dbi->version; + addmode = false; + delmode = false; + holdmode = false; + } else { + db = NULL; + version = NULL; + origin = dns_rootname; + printf("database not found; " + "now searching all databases\n"); + } + continue; + } else if (strcmp(s, "!ZC") == 0) { + if (find_zonecut) + find_zonecut = false; + else + find_zonecut = true; + printf("find_zonecut = %s\n", + find_zonecut ? "TRUE" : "FALSE"); + continue; + } else if (strcmp(s, "!NZ") == 0) { + if (noexact_zonecut) + noexact_zonecut = false; + else + noexact_zonecut = true; + printf("noexact_zonecut = %s\n", + noexact_zonecut ? "TRUE" : "FALSE"); + continue; + } + + isc_buffer_init(&source, s, len); + isc_buffer_add(&source, len); + isc_buffer_init(&target, b, sizeof(b)); + result = dns_name_fromtext(&name, &source, origin, 0, &target); + if (result != ISC_R_SUCCESS) { + print_result("bad name: ", result); + continue; + } + + if (dbi == NULL) { + zcoptions = 0; + if (noexact_zonecut) + zcoptions |= DNS_DBTABLEFIND_NOEXACT; + db = NULL; + result = dns_dbtable_find(dbtable, &name, zcoptions, + &db); + if (result != ISC_R_SUCCESS && + result != DNS_R_PARTIALMATCH) { + if (!quiet) { + printf("\n"); + print_result("", result); + } + continue; + } + isc_buffer_init(&tb1, t1, sizeof(t1)); + result = dns_name_totext(dns_db_origin(db), false, + &tb1); + if (result != ISC_R_SUCCESS) { + printf("\n"); + print_result("", result); + dns_db_detach(&db); + continue; + } + isc_buffer_usedregion(&tb1, &r1); + printf("\ndatabase = %.*s (%s)\n", + (int)r1.length, r1.base, + (dns_db_iszone(db)) ? "zone" : "cache"); + } + node = NULL; + dns_rdataset_init(&rdataset); + dns_rdataset_init(&sigrdataset); + + if (find_zonecut && dns_db_iscache(db)) { + zcoptions = options; + if (noexact_zonecut) + zcoptions |= DNS_DBFIND_NOEXACT; + result = dns_db_findzonecut(db, &name, zcoptions, + 0, &node, fname, + &rdataset, &sigrdataset); + } else { + result = dns_db_find(db, &name, version, type, + options, 0, &node, fname, + &rdataset, &sigrdataset); + } + + if (!quiet) { + if (dbi != NULL) + printf("\n"); + print_result("", result); + } + + found_as = false; + switch (result) { + case ISC_R_SUCCESS: + case DNS_R_GLUE: + case DNS_R_CNAME: + case DNS_R_ZONECUT: + break; + case DNS_R_DNAME: + case DNS_R_DELEGATION: + found_as = true; + break; + case DNS_R_NXRRSET: + if (dns_rdataset_isassociated(&rdataset)) + break; + if (dbi != NULL) { + if (holdmode) { + RUNTIME_CHECK(dbi->hold_count < + MAXHOLD); + dbi->hold_nodes[dbi->hold_count++] = + node; + node = NULL; + } else + dns_db_detachnode(db, &node); + } else { + dns_db_detachnode(db, &node); + dns_db_detach(&db); + } + continue; + case DNS_R_NXDOMAIN: + if (dns_rdataset_isassociated(&rdataset)) + break; + /* FALLTHROUGH */ + default: + if (dbi == NULL) + dns_db_detach(&db); + if (quiet) + print_result("", result); + continue; + } + if (found_as && !quiet) { + isc_buffer_init(&tb1, t1, sizeof(t1)); + isc_buffer_init(&tb2, t2, sizeof(t2)); + result = dns_name_totext(&name, false, &tb1); + if (result != ISC_R_SUCCESS) { + print_result("", result); + dns_db_detachnode(db, &node); + if (dbi == NULL) + dns_db_detach(&db); + continue; + } + result = dns_name_totext(fname, false, &tb2); + if (result != ISC_R_SUCCESS) { + print_result("", result); + dns_db_detachnode(db, &node); + if (dbi == NULL) + dns_db_detach(&db); + continue; + } + isc_buffer_usedregion(&tb1, &r1); + isc_buffer_usedregion(&tb2, &r2); + printf("found %.*s as %.*s\n", + (int)r1.length, r1.base, + (int)r2.length, r2.base); + } + + if (printnode) + dns_db_printnode(db, node, stdout); + + if (!found_as && type == dns_rdatatype_any) { + rdsiter = NULL; + result = dns_db_allrdatasets(db, node, version, 0, + &rdsiter); + if (result == ISC_R_SUCCESS) { + if (!quiet) + print_rdatasets(fname, rdsiter); + dns_rdatasetiter_destroy(&rdsiter); + } else + print_result("", result); + } else { + if (!quiet) + print_rdataset(fname, &rdataset); + if (dns_rdataset_isassociated(&sigrdataset)) { + if (!quiet) + print_rdataset(fname, &sigrdataset); + dns_rdataset_disassociate(&sigrdataset); + } + if (dbi != NULL && addmode && !found_as) { + rdataset.ttl++; + rdataset.trust = trust; + if (dns_db_iszone(db)) + addopts = DNS_DBADD_MERGE; + else + addopts = 0; + result = dns_db_addrdataset(db, node, version, + 0, &rdataset, + addopts, NULL); + if (result != ISC_R_SUCCESS) + print_result("", result); + if (printnode) + dns_db_printnode(db, node, stdout); + } else if (dbi != NULL && delmode && !found_as) { + result = dns_db_deleterdataset(db, node, + version, type, + 0); + if (result != ISC_R_SUCCESS) + print_result("", result); + if (printnode) + dns_db_printnode(db, node, stdout); + } + dns_rdataset_disassociate(&rdataset); + } + + if (dbi != NULL) { + if (holdmode) { + RUNTIME_CHECK(dbi->hold_count < MAXHOLD); + dbi->hold_nodes[dbi->hold_count++] = node; + node = NULL; + } else + dns_db_detachnode(db, &node); + } else { + dns_db_detachnode(db, &node); + dns_db_detach(&db); + } + } + + if (time_lookups) { + uint64_t usec; + + TIME_NOW(&finish); + + usec = isc_time_microdiff(&finish, &start); + + printf("elapsed time: %lu.%06lu seconds\n", + (unsigned long)(usec / 1000000), + (unsigned long)(usec % 1000000)); + } + + unload_all(); + + dns_dbtable_detach(&dbtable); + + if (lctx != NULL) + isc_log_destroy(&lctx); + + if (!quiet) + isc_mem_stats(mctx, stdout); + + return (0); +} diff --git a/bin/tests/optional/dst_test.c b/bin/tests/optional/dst_test.c new file mode 100644 index 0000000..405a292 --- /dev/null +++ b/bin/tests/optional/dst_test.c @@ -0,0 +1,293 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include /* XXX */ + +#include +#include +#include +#include +#include +#include /* Required for HP/UX (and others?) */ + +#include +#include +#include +#include + +#include +#include + +char *current; +const char *tmp = "/tmp"; + +static void +use(dst_key_t *key, isc_mem_t *mctx) { + isc_result_t ret; + const char *data = "This is some data"; + unsigned char sig[512]; + isc_buffer_t databuf, sigbuf; + isc_region_t datareg, sigreg; + dst_context_t *ctx = NULL; + + isc_buffer_init(&sigbuf, sig, sizeof(sig)); + /* + * Advance 1 byte for fun. + */ + isc_buffer_add(&sigbuf, 1); + + isc_buffer_constinit(&databuf, data, strlen(data)); + isc_buffer_add(&databuf, strlen(data)); + isc_buffer_usedregion(&databuf, &datareg); + + ret = dst_context_create3(key, mctx, + DNS_LOGCATEGORY_GENERAL, true, &ctx); + if (ret != ISC_R_SUCCESS) { + printf("contextcreate(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + return; + } + ret = dst_context_adddata(ctx, &datareg); + if (ret != ISC_R_SUCCESS) { + printf("adddata(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + dst_context_destroy(&ctx); + return; + } + ret = dst_context_sign(ctx, &sigbuf); + printf("sign(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + dst_context_destroy(&ctx); + + isc_buffer_forward(&sigbuf, 1); + isc_buffer_remainingregion(&sigbuf, &sigreg); + ret = dst_context_create3(key, mctx, + DNS_LOGCATEGORY_GENERAL, false, &ctx); + if (ret != ISC_R_SUCCESS) { + printf("contextcreate(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + return; + } + ret = dst_context_adddata(ctx, &datareg); + if (ret != ISC_R_SUCCESS) { + printf("adddata(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + dst_context_destroy(&ctx); + return; + } + ret = dst_context_verify(ctx, &sigreg); + printf("verify(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + dst_context_destroy(&ctx); +} + +static void +dns(dst_key_t *key, isc_mem_t *mctx) { + unsigned char buffer1[2048]; + unsigned char buffer2[2048]; + isc_buffer_t buf1, buf2; + isc_region_t r1, r2; + dst_key_t *newkey = NULL; + isc_result_t ret; + bool match; + + isc_buffer_init(&buf1, buffer1, sizeof(buffer1)); + ret = dst_key_todns(key, &buf1); + printf("todns(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + if (ret != ISC_R_SUCCESS) + return; + ret = dst_key_fromdns(dst_key_name(key), dns_rdataclass_in, + &buf1, mctx, &newkey); + printf("fromdns(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + if (ret != ISC_R_SUCCESS) + return; + isc_buffer_init(&buf2, buffer2, sizeof(buffer2)); + ret = dst_key_todns(newkey, &buf2); + printf("todns2(%u) returned: %s\n", dst_key_alg(key), + isc_result_totext(ret)); + if (ret != ISC_R_SUCCESS) + return; + isc_buffer_usedregion(&buf1, &r1); + isc_buffer_usedregion(&buf2, &r2); + match = (r1.length == r2.length && + memcmp(r1.base, r2.base, r1.length) == 0); + printf("compare(%u): %s\n", dst_key_alg(key), + match ? "true" : "false"); + dst_key_free(&newkey); +} + +static void +io(dns_name_t *name, int id, int alg, int type, isc_mem_t *mctx) { + dst_key_t *key = NULL; + isc_result_t ret; + + ret = dst_key_fromfile(name, id, alg, type, current, mctx, &key); + printf("read(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + ret = dst_key_tofile(key, type, tmp); + printf("write(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + use(key, mctx); + dns(key, mctx); + dst_key_free(&key); +} + +static void +dh(dns_name_t *name1, int id1, dns_name_t *name2, int id2, isc_mem_t *mctx) { + dst_key_t *key1 = NULL, *key2 = NULL; + isc_result_t ret; + isc_buffer_t b1, b2; + isc_region_t r1, r2; + unsigned char array1[1024], array2[1024]; + int alg = DST_ALG_DH; + int type = DST_TYPE_PUBLIC|DST_TYPE_PRIVATE|DST_TYPE_KEY; + + ret = dst_key_fromfile(name1, id1, alg, type, current, mctx, &key1); + printf("read(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + ret = dst_key_fromfile(name2, id2, alg, type, current, mctx, &key2); + printf("read(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + + ret = dst_key_tofile(key1, type, tmp); + printf("write(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + ret = dst_key_tofile(key2, type, tmp); + printf("write(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != 0) + return; + + isc_buffer_init(&b1, array1, sizeof(array1)); + ret = dst_key_computesecret(key1, key2, &b1); + printf("computesecret() returned: %s\n", isc_result_totext(ret)); + if (ret != 0) + return; + + isc_buffer_init(&b2, array2, sizeof(array2)); + ret = dst_key_computesecret(key2, key1, &b2); + printf("computesecret() returned: %s\n", isc_result_totext(ret)); + if (ret != 0) + return; + + isc_buffer_usedregion(&b1, &r1); + isc_buffer_usedregion(&b2, &r2); + + if (r1.length != r2.length || memcmp(r1.base, r2.base, r1.length) != 0) + { + int i; + printf("secrets don't match\n"); + printf("secret 1: %u bytes\n", r1.length); + for (i = 0; i < (int) r1.length; i++) + printf("%02x ", r1.base[i]); + printf("\n"); + printf("secret 2: %u bytes\n", r2.length); + for (i = 0; i < (int) r2.length; i++) + printf("%02x ", r2.base[i]); + printf("\n"); + } + dst_key_free(&key1); + dst_key_free(&key2); +} + +static void +generate(int alg, isc_mem_t *mctx) { + isc_result_t ret; + dst_key_t *key = NULL; + + ret = dst_key_generate(dns_rootname, alg, 512, 0, 0, 0, + dns_rdataclass_in, mctx, &key); + printf("generate(%d) returned: %s\n", alg, isc_result_totext(ret)); + if (ret != ISC_R_SUCCESS) + return; + + if (alg != DST_ALG_DH) + use(key, mctx); + + dst_key_free(&key); +} + +int +main(void) { + isc_mem_t *mctx = NULL; + isc_entropy_t *ectx = NULL; + isc_buffer_t b; + dns_fixedname_t fname; + dns_name_t *name; + isc_result_t result; + + result = isc_mem_create(0, 0, &mctx); + if (result != ISC_R_SUCCESS) + return (1); + + current = isc_mem_get(mctx, 256); + if (current == NULL) + return (1); + if (getcwd(current, 256) == NULL) { + perror("getcwd"); + return (1); + } + + dns_result_register(); + + result = isc_entropy_create(mctx, &ectx); + if (result != ISC_R_SUCCESS) + return (1); + result = isc_entropy_createfilesource(ectx, "randomfile"); + if (result != ISC_R_SUCCESS) + return (1); + dst_lib_init(mctx, ectx, ISC_ENTROPY_BLOCKING|ISC_ENTROPY_GOODONLY); + + name = dns_fixedname_initname(&fname); + isc_buffer_constinit(&b, "test.", 5); + isc_buffer_add(&b, 5); + result = dns_name_fromtext(name, &b, NULL, 0, NULL); + if (result != ISC_R_SUCCESS) + return (1); + io(name, 23616, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx); + io(name, 54622, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, + mctx); + + io(name, 49667, DST_ALG_DSA, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx); + io(name, 2, DST_ALG_RSAMD5, DST_TYPE_PRIVATE|DST_TYPE_PUBLIC, mctx); + + isc_buffer_constinit(&b, "dh.", 3); + isc_buffer_add(&b, 3); + result = dns_name_fromtext(name, &b, NULL, 0, NULL); + if (result != ISC_R_SUCCESS) + return (1); + dh(name, 18602, name, 48957, mctx); + + generate(DST_ALG_RSAMD5, mctx); + generate(DST_ALG_DH, mctx); + generate(DST_ALG_DSA, mctx); + generate(DST_ALG_HMACMD5, mctx); + + dst_lib_destroy(); + isc_entropy_detach(&ectx); + + isc_mem_put(mctx, current, 256); +/* isc_mem_stats(mctx, stdout);*/ + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/entropy2_test.c b/bin/tests/optional/entropy2_test.c new file mode 100644 index 0000000..b7b2b70 --- /dev/null +++ b/bin/tests/optional/entropy2_test.c @@ -0,0 +1,168 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static void +hex_dump(const char *msg, void *data, unsigned int length) { + unsigned int len; + unsigned char *base; + bool first = true; + + base = data; + + printf("DUMP of %u bytes: %s\n\t", length, msg); + for (len = 0; len < length; len++) { + if (len % 16 == 0 && !first) + printf("\n\t"); + printf("%02x ", base[len]); + first = false; + } + printf("\n"); +} + +static void +CHECK(const char *msg, isc_result_t result) { + if (result != ISC_R_SUCCESS) { + printf("FAILURE: %s: %s\n", msg, isc_result_totext(result)); + exit(1); + } +} + +static isc_result_t +start(isc_entropysource_t *source, void *arg, bool blocking) { + isc_keyboard_t *kbd = (isc_keyboard_t *)arg; + + UNUSED(source); + + if (blocking) + printf("start called, blocking mode.\n"); + else + printf("start called, non-blocking mode.\n"); + + return (isc_keyboard_open(kbd)); +} + +static void +stop(isc_entropysource_t *source, void *arg) { + isc_keyboard_t *kbd = (isc_keyboard_t *)arg; + + UNUSED(source); + + printf("ENOUGH! Stop typing, please.\r\n"); + + (void)isc_keyboard_close(kbd, 3); + printf("stop called\n"); +} + +static isc_result_t +get(isc_entropysource_t *source, void *arg, bool blocking) { + isc_keyboard_t *kbd = (isc_keyboard_t *)arg; + isc_result_t result; + isc_time_t t; + uint32_t sample; + uint32_t extra; + unsigned char c; + + if (!blocking) + return (ISC_R_NOENTROPY); + + result = isc_keyboard_getchar(kbd, &c); + if (result != ISC_R_SUCCESS) + return (result); + + TIME_NOW(&t); + + sample = isc_time_nanoseconds(&t); + extra = c; + + result = isc_entropy_addcallbacksample(source, sample, extra); + if (result != ISC_R_SUCCESS) { + printf("\r\n"); + return (result); + } + + printf("."); + fflush(stdout); + + return (result); +} + +int +main(int argc, char **argv) { + isc_mem_t *mctx; + unsigned char buffer[512]; + isc_entropy_t *ent; + isc_entropysource_t *source; + unsigned int returned; + unsigned int flags; + isc_result_t result; + isc_keyboard_t kbd; + + UNUSED(argc); + UNUSED(argv); + + mctx = NULL; + CHECK("isc_mem_create()", + isc_mem_create(0, 0, &mctx)); + + ent = NULL; + CHECK("isc_entropy_create()", + isc_entropy_create(mctx, &ent)); + + isc_entropy_stats(ent, stderr); + + source = NULL; + result = isc_entropy_createcallbacksource(ent, start, get, stop, &kbd, + &source); + CHECK("isc_entropy_createcallbacksource()", result); + + fprintf(stderr, + "Reading 32 bytes of GOOD random data only, partial OK\n"); + + flags = 0; + flags |= ISC_ENTROPY_GOODONLY; + flags |= ISC_ENTROPY_PARTIAL; + flags |= ISC_ENTROPY_BLOCKING; + returned = 0; + result = isc_entropy_getdata(ent, buffer, 32, &returned, flags); + if (result == ISC_R_NOENTROPY) { + fprintf(stderr, "No entropy.\r\n"); + } + + isc_entropy_stopcallbacksources(ent); + + hex_dump("good data only:", buffer, returned); + + isc_entropy_stats(ent, stderr); + + isc_entropy_destroysource(&source); + isc_entropy_detach(&ent); + + isc_mem_stats(mctx, stderr); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/entropy_test.c b/bin/tests/optional/entropy_test.c new file mode 100644 index 0000000..67ec640 --- /dev/null +++ b/bin/tests/optional/entropy_test.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +static void +hex_dump(const char *msg, void *data, unsigned int length) { + unsigned int len; + unsigned char *base; + bool first = true; + + base = data; + + printf("DUMP of %u bytes: %s\n\t", length, msg); + for (len = 0; len < length; len++) { + if (len % 16 == 0 && !first) + printf("\n\t"); + printf("%02x ", base[len]); + first = false; + } + printf("\n"); +} + +static void +CHECK(const char *msg, isc_result_t result) { + if (result != ISC_R_SUCCESS) { + printf("FAILURE: %s: %s\n", msg, isc_result_totext(result)); + exit(1); + } +} + +int +main(int argc, char **argv) { + isc_mem_t *mctx; + unsigned char buffer[512]; + isc_entropy_t *ent; + unsigned int returned; + unsigned int flags; + isc_result_t result; + + UNUSED(argc); + UNUSED(argv); + + mctx = NULL; + CHECK("isc_mem_create()", + isc_mem_create(0, 0, &mctx)); + + ent = NULL; + CHECK("isc_entropy_create()", + isc_entropy_create(mctx, &ent)); + + isc_entropy_stats(ent, stderr); + +#if 1 + CHECK("isc_entropy_createfilesource() 1", + isc_entropy_createfilesource(ent, "/dev/random")); + CHECK("isc_entropy_createfilesource() 2", + isc_entropy_createfilesource(ent, "/dev/random")); +#else + CHECK("isc_entropy_createfilesource() 3", + isc_entropy_createfilesource(ent, "/tmp/foo")); +#endif + + fprintf(stderr, + "Reading 32 bytes of GOOD random data only, partial OK\n"); + + flags = 0; + flags |= ISC_ENTROPY_GOODONLY; + flags |= ISC_ENTROPY_PARTIAL; + result = isc_entropy_getdata(ent, buffer, 32, &returned, flags); + if (result == ISC_R_NOENTROPY) { + fprintf(stderr, "No entropy.\n"); + goto any; + } + hex_dump("good data only:", buffer, returned); + + any: + isc_entropy_stats(ent, stderr); + CHECK("isc_entropy_getdata() pseudorandom", + isc_entropy_getdata(ent, buffer, 128, NULL, 0)); + hex_dump("pseudorandom data", buffer, 128); + + isc_entropy_stats(ent, stderr); + flags = 0; + flags |= ISC_ENTROPY_GOODONLY; + flags |= ISC_ENTROPY_BLOCKING; + result = isc_entropy_getdata(ent, buffer, sizeof(buffer), &returned, + flags); + CHECK("good data only, blocking mode", result); + hex_dump("blocking mode data", buffer, sizeof(buffer)); + + { + isc_entropy_t *entcopy1 = NULL; + isc_entropy_t *entcopy2 = NULL; + isc_entropy_t *entcopy3 = NULL; + + isc_entropy_attach(ent, &entcopy1); + isc_entropy_attach(ent, &entcopy2); + isc_entropy_attach(ent, &entcopy3); + + isc_entropy_stats(ent, stderr); + + isc_entropy_detach(&entcopy1); + isc_entropy_detach(&entcopy2); + isc_entropy_detach(&entcopy3); + } + + isc_entropy_detach(&ent); + isc_mem_stats(mctx, stderr); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/fsaccess_test.c b/bin/tests/optional/fsaccess_test.c new file mode 100644 index 0000000..f2e4c24 --- /dev/null +++ b/bin/tests/optional/fsaccess_test.c @@ -0,0 +1,70 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ + +#include + +#include +#include +#include + +#include /* Non-portable. */ +#include /* Non-portable. */ + +#include +#include +#include + +#define PATH "/tmp/fsaccess" + +int +main(void) { + isc_fsaccess_t access; + isc_result_t result; + FILE *fp; + int n; + + n = remove(PATH); + if (n != 0 && errno != ENOENT) { + fprintf(stderr, "unable to remove(%s)\n", PATH); + exit(1); + } + fp = fopen(PATH, "w"); + if (fp == NULL) { + fprintf(stderr, "unable to fopen(%s)\n", PATH); + exit(1); + } + n = chmod(PATH, 0); + if (n != 0) { + fprintf(stderr, "unable chmod(%s, 0)\n", PATH); + exit(1); + } + + access = 0; + + isc_fsaccess_add(ISC_FSACCESS_OWNER | ISC_FSACCESS_GROUP, + ISC_FSACCESS_READ | ISC_FSACCESS_WRITE, + &access); + + printf("fsaccess=%u\n", access); + + isc_fsaccess_add(ISC_FSACCESS_OTHER, ISC_FSACCESS_READ, &access); + + printf("fsaccess=%u\n", access); + + result = isc_fsaccess_set(PATH, access); + if (result != ISC_R_SUCCESS) + fprintf(stderr, "result = %s\n", isc_result_totext(result)); + (void)fclose(fp); + + return (0); +} diff --git a/bin/tests/optional/gsstest.c b/bin/tests/optional/gsstest.c new file mode 100644 index 0000000..90059d2 --- /dev/null +++ b/bin/tests/optional/gsstest.c @@ -0,0 +1,563 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include + +#ifdef GSSAPI +#include ISC_PLATFORM_GSSAPIHEADER + +#define CHECK(str, x) { \ + if ((x) != ISC_R_SUCCESS) { \ + fprintf(stderr, "I:%d:%s: %s\n", __LINE__, (str), isc_result_totext(x)); \ + goto end; \ + } \ +} + +static dns_fixedname_t servername, gssname; + +static isc_mem_t *mctx; +static dns_requestmgr_t *requestmgr; +static isc_sockaddr_t address; + +static dns_tsig_keyring_t *ring; +static dns_tsigkey_t *tsigkey = NULL; +static gss_ctx_id_t gssctx; +static gss_ctx_id_t *gssctxp = &gssctx; + +#define RUNCHECK(x) RUNTIME_CHECK((x) == ISC_R_SUCCESS) + +#define PORT 53 +#define TIMEOUT 30 + +static void initctx1(isc_task_t *task, isc_event_t *event); +static void sendquery(isc_task_t *task, isc_event_t *event); +static void setup(); + +static void +console(isc_task_t *task, isc_event_t *event) +{ + char buf[32]; + int c; + + isc_event_t *ev = NULL; + + isc_event_free(&event); + + for (;;) { + printf("\nCommand => "); + c = scanf("%31s", buf); + + if (c == EOF || strcmp(buf, "quit") == 0) { + isc_app_shutdown(); + return; + } + + if (strcmp(buf, "initctx") == 0) { + ev = isc_event_allocate(mctx, (void *)1, 1, initctx1, + NULL, sizeof(*event)); + isc_task_send(task, &ev); + return; + } + + if (strcmp(buf, "query") == 0) { + ev = isc_event_allocate(mctx, (void *)1, 1, sendquery, + NULL, sizeof(*event)); + isc_task_send(task, &ev); + return; + } + + printf("Unknown command\n"); + } +} + +static void +recvresponse(isc_task_t *task, isc_event_t *event) { + dns_requestevent_t *reqev = (dns_requestevent_t *)event; + isc_result_t result, result2; + dns_message_t *query = NULL, *response = NULL; + isc_buffer_t outtoken; + isc_buffer_t outbuf; + char output[10 * 1024]; + + unsigned char array[DNS_NAME_MAXTEXT + 1]; + isc_buffer_init(&outtoken, array, sizeof(array)); + + UNUSED(task); + + REQUIRE(reqev != NULL); + + query = reqev->ev_arg; + + if (reqev->result != ISC_R_SUCCESS) { + fprintf(stderr, "I:request event result: %s\n", + isc_result_totext(reqev->result)); + goto end; + } + + response = NULL; + result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response); + CHECK("dns_message_create", result); + + printf("\nReceived Response:\n"); + + result2 = dns_request_getresponse(reqev->request, response, + DNS_MESSAGEPARSE_PRESERVEORDER); + isc_buffer_init(&outbuf, output, sizeof(output)); + result = dns_message_totext(response, &dns_master_style_debug, 0, + &outbuf); + CHECK("dns_message_totext", result); + printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf), + (char *)isc_buffer_base(&outbuf)); + + CHECK("dns_request_getresponse", result2); + + if (response != NULL) + dns_message_destroy(&response); + + end: + if (query != NULL) + dns_message_destroy(&query); + + if (reqev->request != NULL) + dns_request_destroy(&reqev->request); + + isc_event_free(&event); + + event = isc_event_allocate(mctx, (void *)1, 1, console, NULL, + sizeof(*event)); + isc_task_send(task, &event); + return; +} + + +static void +sendquery(isc_task_t *task, isc_event_t *event) +{ + dns_request_t *request = NULL; + dns_message_t *message = NULL; + dns_name_t *qname = NULL; + dns_rdataset_t *qrdataset = NULL; + isc_result_t result; + dns_fixedname_t queryname; + isc_buffer_t buf; + isc_buffer_t outbuf; + char output[10 * 1024]; + static char host[256]; + int c; + + isc_event_free(&event); + + printf("Query => "); + c = scanf("%255s", host); + if (c == EOF) + return; + + dns_fixedname_init(&queryname); + isc_buffer_init(&buf, host, strlen(host)); + isc_buffer_add(&buf, strlen(host)); + result = dns_name_fromtext(dns_fixedname_name(&queryname), &buf, + dns_rootname, 0, NULL); + CHECK("dns_name_fromtext", result); + + result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &message); + if (result != ISC_R_SUCCESS) + goto end; + + message->opcode = dns_opcode_query; + message->rdclass = dns_rdataclass_in; + message->id = (unsigned short)(random() & 0xFFFF); + + result = dns_message_gettempname(message, &qname); + if (result != ISC_R_SUCCESS) + goto end; + + result = dns_message_gettemprdataset(message, &qrdataset); + if (result != ISC_R_SUCCESS) + goto end; + + dns_name_init(qname, NULL); + dns_name_clone(dns_fixedname_name(&queryname), qname); + dns_rdataset_makequestion(qrdataset, dns_rdataclass_in, + dns_rdatatype_a); + ISC_LIST_APPEND(qname->list, qrdataset, link); + dns_message_addname(message, qname, DNS_SECTION_QUESTION); + + result = dns_request_create(requestmgr, message, &address, 0, tsigkey, + TIMEOUT, task, recvresponse, + message, &request); + CHECK("dns_request_create", result); + + printf("Submitting query:\n"); + isc_buffer_init(&outbuf, output, sizeof(output)); + result = dns_message_totext(message, &dns_master_style_debug, 0, + &outbuf); + CHECK("dns_message_totext", result); + printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf), + (char *)isc_buffer_base(&outbuf)); + + return; + + end: + if (qname != NULL) + dns_message_puttempname(message, &qname); + if (qrdataset != NULL) + dns_message_puttemprdataset(message, &qrdataset); + if (message != NULL) + dns_message_destroy(&message); +} + +static void +initctx2(isc_task_t *task, isc_event_t *event) { + dns_requestevent_t *reqev = (dns_requestevent_t *)event; + isc_result_t result; + dns_message_t *query = NULL, *response = NULL; + isc_buffer_t outtoken; + unsigned char array[DNS_NAME_MAXTEXT + 1]; + dns_rdataset_t *rdataset; + dns_rdatatype_t qtype; + dns_name_t *question_name; + + UNUSED(task); + + REQUIRE(reqev != NULL); + + query = reqev->ev_arg; + + if (reqev->result != ISC_R_SUCCESS) { + fprintf(stderr, "I:request event result: %s\n", + isc_result_totext(reqev->result)); + goto end; + } + + response = NULL; + result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response); + CHECK("dns_message_create", result); + + result = dns_request_getresponse(reqev->request, response, + DNS_MESSAGEPARSE_PRESERVEORDER); + CHECK("dns_request_getresponse", result); + + if (response->rcode != dns_rcode_noerror) { + result = ISC_RESULTCLASS_DNSRCODE + response->rcode; + fprintf(stderr, "I:response rcode: %s\n", + isc_result_totext(result)); + goto end; + } + + printf("Received token from server, calling gss_init_sec_context()\n"); + isc_buffer_init(&outtoken, array, DNS_NAME_MAXTEXT + 1); + result = dns_tkey_processgssresponse(query, response, + dns_fixedname_name(&gssname), + &gssctx, &outtoken, + &tsigkey, ring, NULL); + gssctx = *gssctxp; + CHECK("dns_tkey_processgssresponse", result); + printf("Context accepted\n"); + + question_name = NULL; + dns_message_currentname(response, DNS_SECTION_ANSWER, &question_name); + rdataset = ISC_LIST_HEAD(question_name->list); + INSIST(rdataset != NULL); + qtype = rdataset->type; + if (qtype == dns_rdatatype_tkey) { + printf("Received TKEY response from server\n"); + printf("Context completed\n"); + } else { + printf("Did not receive TKEY response from server\n"); + printf("Context not completed\n"); + dns_tsigkey_detach(&tsigkey); + tsigkey = NULL; + } + + dns_message_destroy(&response); + + end: + if (query != NULL) + dns_message_destroy(&query); + + if (reqev->request != NULL) + dns_request_destroy(&reqev->request); + + isc_event_free(&event); + + event = isc_event_allocate(mctx, (void *)1, 1, console, NULL, + sizeof(*event)); + isc_task_send(task, &event); + return; +} + +static void +initctx1(isc_task_t *task, isc_event_t *event) { + char gssid[512]; + char contextname[512]; + isc_result_t result; + isc_buffer_t buf; + dns_message_t *query; + dns_request_t *request; + int c; + + isc_event_free(&event); + + printf("Initctx - GSS name => "); + c = scanf("%511s", gssid); + if (c == EOF) + return; + + snprintf(contextname, sizeof(contextname), + "gsstest.context.%d.", (int)time(NULL)); + + printf("Initctx - context name we're using: %s\n", contextname); + + printf("Negotiating GSSAPI context: "); + printf("%s", gssid); + printf("\n"); + + /* + * Setup a GSSAPI context with the server + */ + dns_fixedname_init(&servername); + isc_buffer_init(&buf, contextname, strlen(contextname)); + isc_buffer_add(&buf, strlen(contextname)); + result = dns_name_fromtext(dns_fixedname_name(&servername), &buf, + dns_rootname, 0, NULL); + CHECK("dns_name_fromtext", result); + + /* Make name happen */ + dns_fixedname_init(&gssname); + isc_buffer_init(&buf, gssid, strlen(gssid)); + isc_buffer_add(&buf, strlen(gssid)); + result = dns_name_fromtext(dns_fixedname_name(&gssname), &buf, + dns_rootname, 0, NULL); + CHECK("dns_name_fromtext", result); + + query = NULL; + result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &query); + CHECK("dns_message_create", result); + + printf("Calling gss_init_sec_context()\n"); + gssctx = GSS_C_NO_CONTEXT; + result = dns_tkey_buildgssquery(query, dns_fixedname_name(&servername), + dns_fixedname_name(&gssname), + NULL, 36000, &gssctx, true, + mctx, NULL); + CHECK("dns_tkey_buildgssquery", result); + + printf("Sending context token to server\n"); + request = NULL; + result = dns_request_create(requestmgr, query, &address, 0, NULL, + TIMEOUT, task, initctx2, query, &request); + CHECK("dns_request_create", result); + + return; + end: + event = isc_event_allocate(mctx, (void *)1, 1, console, NULL, + sizeof(*event)); + isc_task_send(task, &event);return; +} + +static void +setup(void) +{ + for (;;) { + char serveraddress[512]; + struct in_addr inaddr; + int c; + + printf("Server IP => "); + c = scanf("%511s", serveraddress); + + if (c == EOF || strcmp(serveraddress, "quit") == 0) { + isc_app_shutdown(); + return; + } + + if (inet_pton(AF_INET, serveraddress, &inaddr) == 1) { + isc_sockaddr_fromin(&address, &inaddr, PORT); + return; + } + + } +} + +int +main(int argc, char *argv[]) { + isc_taskmgr_t *taskmgr; + isc_timermgr_t *timermgr; + isc_socketmgr_t *socketmgr; + isc_socket_t *sock; + unsigned int attrs, attrmask; + isc_sockaddr_t bind_any; + dns_dispatchmgr_t *dispatchmgr; + dns_dispatch_t *dispatchv4; + dns_view_t *view; + isc_entropy_t *ectx; + isc_task_t *task; + isc_log_t *lctx = NULL; + isc_logconfig_t *lcfg = NULL; + isc_logdestination_t destination; + + UNUSED(argv); + UNUSED(argc); + + RUNCHECK(isc_app_start()); + + dns_result_register(); + + mctx = NULL; + RUNCHECK(isc_mem_create(0, 0, &mctx)); + + RUNCHECK(isc_log_create(mctx, &lctx, &lcfg)); + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + + /* + * Create and install the default channel. + */ + destination.file.stream = stderr; + destination.file.name = NULL; + destination.file.versions = ISC_LOG_ROLLNEVER; + destination.file.maximum_size = 0; + RUNCHECK(isc_log_createchannel(lcfg, "_default", + ISC_LOG_TOFILEDESC, + ISC_LOG_DYNAMIC, + &destination, ISC_LOG_PRINTTIME)); + RUNCHECK(isc_log_usechannel(lcfg, "_default", NULL, NULL)); + + isc_log_setdebuglevel(lctx, 9); + + ectx = NULL; + RUNCHECK(isc_entropy_create(mctx, &ectx)); + RUNCHECK(isc_entropy_createfilesource(ectx, "/dev/urandom")); + + RUNCHECK(dst_lib_init(mctx, ectx, ISC_ENTROPY_GOODONLY)); + + taskmgr = NULL; + RUNCHECK(isc_taskmgr_create(mctx, 1, 0, &taskmgr)); + task = NULL; + RUNCHECK(isc_task_create(taskmgr, 0, &task)); + timermgr = NULL; + RUNCHECK(isc_timermgr_create(mctx, &timermgr)); + socketmgr = NULL; + RUNCHECK(isc_socketmgr_create(mctx, &socketmgr)); + dispatchmgr = NULL; + RUNCHECK(dns_dispatchmgr_create(mctx, ectx, &dispatchmgr)); + isc_sockaddr_any(&bind_any); + attrs = DNS_DISPATCHATTR_UDP | + DNS_DISPATCHATTR_MAKEQUERY | + DNS_DISPATCHATTR_IPV4; + attrmask = DNS_DISPATCHATTR_UDP | + DNS_DISPATCHATTR_TCP | + DNS_DISPATCHATTR_IPV4 | + DNS_DISPATCHATTR_IPV6; + dispatchv4 = NULL; + RUNCHECK(dns_dispatch_getudp(dispatchmgr, socketmgr, taskmgr, + &bind_any, 4096, 4, 2, 3, 5, + attrs, attrmask, &dispatchv4)); + requestmgr = NULL; + RUNCHECK(dns_requestmgr_create(mctx, timermgr, socketmgr, taskmgr, + dispatchmgr, dispatchv4, NULL, + &requestmgr)); + + ring = NULL; + RUNCHECK(dns_tsigkeyring_create(mctx, &ring)); + + view = NULL; + RUNCHECK(dns_view_create(mctx, 0, "_test", &view)); + dns_view_setkeyring(view, ring); + + sock = NULL; + RUNCHECK(isc_socket_create(socketmgr, PF_INET, isc_sockettype_udp, + &sock)); + + setup(); + + RUNCHECK(isc_app_onrun(mctx, task, console, NULL)); + + (void)isc_app_run(); + + if (tsigkey) + dns_tsigkey_detach(&tsigkey); + + dns_requestmgr_shutdown(requestmgr); + dns_requestmgr_detach(&requestmgr); + + dns_dispatch_detach(&dispatchv4); + dns_dispatchmgr_destroy(&dispatchmgr); + + isc_timermgr_destroy(&timermgr); + + isc_task_detach(&task); + isc_taskmgr_destroy(&taskmgr); + + isc_socket_detach(&sock); + isc_socketmgr_destroy(&socketmgr); + + isc_mem_stats(mctx, stdout); + + dns_view_detach(&view); + + dst_lib_destroy(); + isc_entropy_detach(&ectx); + + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + isc_app_finish(); + + return (0); +} +#else +int +main(int argc, char *argv[]) { + UNUSED(argc); + UNUSED(argv); + fprintf(stderr, "R:GSSAPIONLY\n"); + return (0); +} +#endif diff --git a/bin/tests/optional/gxba_test.c b/bin/tests/optional/gxba_test.c new file mode 100644 index 0000000..61c6a34 --- /dev/null +++ b/bin/tests/optional/gxba_test.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include + +#include +#include + +#include + +static void +print_he(struct hostent *he, int error, const char *fun, const char *name) { + char **c; + int i; + + if (he != NULL) { + printf("%s(%s):\n", fun, name); + printf("\tname = %s\n", he->h_name); + printf("\taddrtype = %d\n", he->h_addrtype); + printf("\tlength = %d\n", he->h_length); + c = he->h_aliases; + i = 1; + while (*c != NULL) { + printf("\talias[%d] = %s\n", i, *c); + i++; + c++; + } + c = he->h_addr_list; + i = 1; + while (*c != NULL) { + char buf[128]; + inet_ntop(he->h_addrtype, *c, buf, sizeof(buf)); + printf("\taddress[%d] = %s\n", i, buf); + c++; + i++; + } + } else { + printf("%s(%s): error = %d (%s)\n", fun, name, error, + hstrerror(error)); + } +} + +int +main(int argc, char **argv) { + struct hostent *he; + int error; + struct in_addr in_addr; + struct in6_addr in6_addr; + void *addr; + int af; + size_t len; + + (void)argc; + + while (argv[1] != NULL) { + if (inet_pton(AF_INET, argv[1], &in_addr) == 1) { + af = AF_INET; + addr = &in_addr; + len = sizeof(in_addr); + } else if (inet_pton(AF_INET6, argv[1], &in6_addr) == 1) { + af = AF_INET6; + addr = &in6_addr; + len = sizeof(in6_addr); + } else { + printf("unable to convert \"%s\" to an address\n", + argv[1]); + argv++; + continue; + } + he = gethostbyaddr(addr, len, af); + print_he(he, h_errno, "gethostbyaddr", argv[1]); + + he = getipnodebyaddr(addr, len, af, &error); + print_he(he, error, "getipnodebyaddr", argv[1]); + if (he != NULL) + freehostent(he); + argv++; + } + return (0); +} diff --git a/bin/tests/optional/gxbn_test.c b/bin/tests/optional/gxbn_test.c new file mode 100644 index 0000000..68f4204 --- /dev/null +++ b/bin/tests/optional/gxbn_test.c @@ -0,0 +1,79 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include + +#include +#include + +#include + +static void +print_he(struct hostent *he, int error, const char *fun, const char *name) { + char **c; + int i; + + if (he != NULL) { + printf("%s(%s):\n", fun, name); + printf("\tname = %s\n", he->h_name); + printf("\taddrtype = %d\n", he->h_addrtype); + printf("\tlength = %d\n", he->h_length); + c = he->h_aliases; + i = 1; + while (*c != NULL) { + printf("\talias[%d] = %s\n", i, *c); + i++; + c++; + } + c = he->h_addr_list; + i = 1; + while (*c != NULL) { + char buf[128]; + inet_ntop(he->h_addrtype, *c, buf, sizeof(buf)); + printf("\taddress[%d] = %s\n", i, buf); + c++; + i++; + } + } else { + printf("%s(%s): error = %d (%s)\n", fun, name, error, + hstrerror(error)); + } +} + +int +main(int argc, char **argv) { + struct hostent *he; + int error; + + (void)argc; + + while (argv[1] != NULL) { + he = gethostbyname(argv[1]); + print_he(he, h_errno, "gethostbyname", argv[1]); + + he = getipnodebyname(argv[1], AF_INET6, AI_DEFAULT|AI_ALL, + &error); + print_he(he, error, "getipnodebyname", argv[1]); + if (he != NULL) + freehostent(he); + + he = getipnodebyname(argv[1], AF_INET6, AI_DEFAULT, + &error); + print_he(he, error, "getipnodebyname", argv[1]); + if (he != NULL) + freehostent(he); + argv++; + } + return (0); +} diff --git a/bin/tests/optional/hash_test.c b/bin/tests/optional/hash_test.c new file mode 100644 index 0000000..bf2891a --- /dev/null +++ b/bin/tests/optional/hash_test.c @@ -0,0 +1,288 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include + +static void +print_digest(const char *s, const char *hash, unsigned char *d, + unsigned int words) +{ + unsigned int i, j; + + printf("hash (%s) %s:\n\t", hash, s); + for (i = 0; i < words; i++) { + printf(" "); + for (j = 0; j < 4; j++) + printf("%02x", d[i * 4 + j]); + } + printf("\n"); +} + +int +main(int argc, char **argv) { + isc_sha1_t sha1; + isc_sha224_t sha224; +#ifndef PK11_MD5_DISABLE + isc_md5_t md5; + isc_hmacmd5_t hmacmd5; +#endif + isc_hmacsha1_t hmacsha1; + isc_hmacsha224_t hmacsha224; + isc_hmacsha256_t hmacsha256; + isc_hmacsha384_t hmacsha384; + isc_hmacsha512_t hmacsha512; + unsigned char digest[ISC_SHA512_DIGESTLENGTH]; + unsigned char buffer[1024]; + const char *s; + unsigned char key[20]; + + UNUSED(argc); + UNUSED(argv); + + s = "abc"; + isc_sha1_init(&sha1); + memmove(buffer, s, strlen(s)); + isc_sha1_update(&sha1, buffer, strlen(s)); + isc_sha1_final(&sha1, digest); + print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4); + + s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + isc_sha1_init(&sha1); + memmove(buffer, s, strlen(s)); + isc_sha1_update(&sha1, buffer, strlen(s)); + isc_sha1_final(&sha1, digest); + print_digest(s, "sha1", digest, ISC_SHA1_DIGESTLENGTH/4); + + s = "abc"; + isc_sha224_init(&sha224); + memmove(buffer, s, strlen(s)); + isc_sha224_update(&sha224, buffer, strlen(s)); + isc_sha224_final(digest, &sha224); + print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4); + + s = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; + isc_sha224_init(&sha224); + memmove(buffer, s, strlen(s)); + isc_sha224_update(&sha224, buffer, strlen(s)); + isc_sha224_final(digest, &sha224); + print_digest(s, "sha224", digest, ISC_SHA224_DIGESTLENGTH/4); + +#ifndef PK11_MD5_DISABLE + s = "abc"; + isc_md5_init(&md5); + memmove(buffer, s, strlen(s)); + isc_md5_update(&md5, buffer, strlen(s)); + isc_md5_final(&md5, digest); + print_digest(s, "md5", digest, 4); + + /* + * The 3 HMAC-MD5 examples from RFC2104 + */ + s = "Hi There"; + memset(key, 0x0b, 16); + isc_hmacmd5_init(&hmacmd5, key, 16); + memmove(buffer, s, strlen(s)); + isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); + isc_hmacmd5_sign(&hmacmd5, digest); + print_digest(s, "hmacmd5", digest, 4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacmd5_init(&hmacmd5, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); + isc_hmacmd5_sign(&hmacmd5, digest); + print_digest(s, "hmacmd5", digest, 4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 16); + isc_hmacmd5_init(&hmacmd5, key, 16); + memmove(buffer, s, strlen(s)); + isc_hmacmd5_update(&hmacmd5, buffer, strlen(s)); + isc_hmacmd5_sign(&hmacmd5, digest); + print_digest(s, "hmacmd5", digest, 4); +#endif + + /* + * The 3 HMAC-SHA1 examples from RFC4634. + */ + s = "Hi There"; + memset(key, 0x0b, 20); + isc_hmacsha1_init(&hmacsha1, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); + isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); + print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacsha1_init(&hmacsha1, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); + isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); + print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 20); + isc_hmacsha1_init(&hmacsha1, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha1_update(&hmacsha1, buffer, strlen(s)); + isc_hmacsha1_sign(&hmacsha1, digest, ISC_SHA1_DIGESTLENGTH); + print_digest(s, "hmacsha1", digest, ISC_SHA1_DIGESTLENGTH/4); + + /* + * The 3 HMAC-SHA224 examples from RFC4634. + */ + s = "Hi There"; + memset(key, 0x0b, 20); + isc_hmacsha224_init(&hmacsha224, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); + isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); + print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacsha224_init(&hmacsha224, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); + isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); + print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 20); + isc_hmacsha224_init(&hmacsha224, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha224_update(&hmacsha224, buffer, strlen(s)); + isc_hmacsha224_sign(&hmacsha224, digest, ISC_SHA224_DIGESTLENGTH); + print_digest(s, "hmacsha224", digest, ISC_SHA224_DIGESTLENGTH/4); + + /* + * The 3 HMAC-SHA256 examples from RFC4634. + */ + s = "Hi There"; + memset(key, 0x0b, 20); + isc_hmacsha256_init(&hmacsha256, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); + isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); + print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacsha256_init(&hmacsha256, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); + isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); + print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 20); + isc_hmacsha256_init(&hmacsha256, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha256_update(&hmacsha256, buffer, strlen(s)); + isc_hmacsha256_sign(&hmacsha256, digest, ISC_SHA256_DIGESTLENGTH); + print_digest(s, "hmacsha256", digest, ISC_SHA256_DIGESTLENGTH/4); + + /* + * The 3 HMAC-SHA384 examples from RFC4634. + */ + s = "Hi There"; + memset(key, 0x0b, 20); + isc_hmacsha384_init(&hmacsha384, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); + isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); + print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacsha384_init(&hmacsha384, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); + isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); + print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 20); + isc_hmacsha384_init(&hmacsha384, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha384_update(&hmacsha384, buffer, strlen(s)); + isc_hmacsha384_sign(&hmacsha384, digest, ISC_SHA384_DIGESTLENGTH); + print_digest(s, "hmacsha384", digest, ISC_SHA384_DIGESTLENGTH/4); + + /* + * The 3 HMAC-SHA512 examples from RFC4634. + */ + s = "Hi There"; + memset(key, 0x0b, 20); + isc_hmacsha512_init(&hmacsha512, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); + isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); + print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); + + s = "what do ya want for nothing?"; + strlcpy((char *)key, "Jefe", sizeof(key)); + isc_hmacsha512_init(&hmacsha512, key, 4); + memmove(buffer, s, strlen(s)); + isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); + isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); + print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); + + s = "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335" + "\335\335\335\335\335\335\335\335\335\335"; + memset(key, 0xaa, 20); + isc_hmacsha512_init(&hmacsha512, key, 20); + memmove(buffer, s, strlen(s)); + isc_hmacsha512_update(&hmacsha512, buffer, strlen(s)); + isc_hmacsha512_sign(&hmacsha512, digest, ISC_SHA512_DIGESTLENGTH); + print_digest(s, "hmacsha512", digest, ISC_SHA512_DIGESTLENGTH/4); + + return (0); +} diff --git a/bin/tests/optional/inter_test.c b/bin/tests/optional/inter_test.c new file mode 100644 index 0000000..42a4ec5 --- /dev/null +++ b/bin/tests/optional/inter_test.c @@ -0,0 +1,130 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include + +#include +#include +#include +#include + +int +main(int argc, char **argv) { + isc_mem_t *mctx = NULL; + isc_interfaceiter_t *iter = NULL; + isc_interface_t ifdata; + isc_result_t result; + const char * res; + char buf[128]; + + UNUSED(argc); + UNUSED(argv); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + result = isc_interfaceiter_create(mctx, &iter); + if (result != ISC_R_SUCCESS) + goto cleanup; + result = isc_interfaceiter_first(iter); + while (result == ISC_R_SUCCESS) { + result = isc_interfaceiter_current(iter, &ifdata); + if (result != ISC_R_SUCCESS) { + fprintf(stdout, "isc_interfaceiter_current: %s", + isc_result_totext(result)); + continue; + } + fprintf(stdout, "%s %u %x\n", ifdata.name, ifdata.af, + ifdata.flags); + INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6); + res = inet_ntop(ifdata.af, &ifdata.address.type, buf, + sizeof(buf)); + if (ifdata.address.zone != 0) + fprintf(stdout, "address = %s (zone %u)\n", + res == NULL ? "BAD" : res, + ifdata.address.zone); + else + fprintf(stdout, "address = %s\n", + res == NULL ? "BAD" : res); + INSIST(ifdata.address.family == ifdata.af); + res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf, + sizeof(buf)); + fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res); + INSIST(ifdata.netmask.family == ifdata.af); + if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) { + res = inet_ntop(ifdata.af, &ifdata.dstaddress.type, + buf, sizeof(buf)); + fprintf(stdout, "dstaddress = %s\n", + res == NULL ? "BAD" : res); + + INSIST(ifdata.dstaddress.family == ifdata.af); + } + result = isc_interfaceiter_next(iter); + if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) { + fprintf(stdout, "isc_interfaceiter_next: %s", + isc_result_totext(result)); + continue; + } + } + isc_interfaceiter_destroy(&iter); + + fprintf(stdout, "\nPass 2\n\n"); + + result = isc_interfaceiter_create(mctx, &iter); + if (result != ISC_R_SUCCESS) + goto cleanup; + result = isc_interfaceiter_first(iter); + while (result == ISC_R_SUCCESS) { + result = isc_interfaceiter_current(iter, &ifdata); + if (result != ISC_R_SUCCESS) { + fprintf(stdout, "isc_interfaceiter_current: %s", + isc_result_totext(result)); + continue; + } + fprintf(stdout, "%s %u %x\n", ifdata.name, ifdata.af, + ifdata.flags); + INSIST(ifdata.af == AF_INET || ifdata.af == AF_INET6); + res = inet_ntop(ifdata.af, &ifdata.address.type, buf, + sizeof(buf)); + if (ifdata.address.zone != 0) + fprintf(stdout, "address = %s (zone %u)\n", + res == NULL ? "BAD" : res, + ifdata.address.zone); + else + fprintf(stdout, "address = %s\n", + res == NULL ? "BAD" : res); + INSIST(ifdata.address.family == ifdata.af); + res = inet_ntop(ifdata.af, &ifdata.netmask.type, buf, + sizeof(buf)); + fprintf(stdout, "netmask = %s\n", res == NULL ? "BAD" : res); + INSIST(ifdata.netmask.family == ifdata.af); + if ((ifdata.flags & INTERFACE_F_POINTTOPOINT) != 0) { + res = inet_ntop(ifdata.af, &ifdata.dstaddress.type, + buf, sizeof(buf)); + fprintf(stdout, "dstaddress = %s\n", + res == NULL ? "BAD" : res); + + INSIST(ifdata.dstaddress.family == ifdata.af); + } + result = isc_interfaceiter_next(iter); + if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE) { + fprintf(stdout, "isc_interfaceiter_next: %s", + isc_result_totext(result)); + continue; + } + } + isc_interfaceiter_destroy(&iter); + cleanup: + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/keyboard_test.c b/bin/tests/optional/keyboard_test.c new file mode 100644 index 0000000..085b314 --- /dev/null +++ b/bin/tests/optional/keyboard_test.c @@ -0,0 +1,67 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include +#include + +#include +#include +#include + +static void +CHECK(const char *msg, isc_result_t result) { + if (result != ISC_R_SUCCESS) { + printf("FAILURE: %s: %s\n", msg, isc_result_totext(result)); + exit(1); + } +} + +int +main(int argc, char **argv) { + isc_keyboard_t kbd; + unsigned char c; + isc_result_t res; + unsigned int count; + + UNUSED(argc); + UNUSED(argv); + + printf("Type Q to exit.\n"); + + res = isc_keyboard_open(&kbd); + CHECK("isc_keyboard_open()", res); + + c = 'x'; + count = 0; + while (res == ISC_R_SUCCESS && c != 'Q') { + res = isc_keyboard_getchar(&kbd, &c); + printf("."); + fflush(stdout); + count++; + if (count % 64 == 0) + printf("\r\n"); + } + printf("\r\n"); + if (res != ISC_R_SUCCESS) { + printf("FAILURE: keyboard getchar failed: %s\r\n", + isc_result_totext(res)); + goto errout; + } + + errout: + res = isc_keyboard_close(&kbd, 3); + CHECK("isc_keyboard_close()", res); + + return (0); +} diff --git a/bin/tests/optional/lex_test.c b/bin/tests/optional/lex_test.c new file mode 100644 index 0000000..4631242 --- /dev/null +++ b/bin/tests/optional/lex_test.c @@ -0,0 +1,153 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include +#include +#include +#include +#include + +isc_mem_t *mctx; +isc_lex_t *lex; + +isc_lexspecials_t specials; + +static void +print_token(isc_token_t *tokenp, FILE *stream) { + switch (tokenp->type) { + case isc_tokentype_unknown: + fprintf(stream, "UNKNOWN"); + break; + case isc_tokentype_string: + fprintf(stream, "STRING %.*s", + (int)tokenp->value.as_region.length, + tokenp->value.as_region.base); + break; + case isc_tokentype_number: + fprintf(stream, "NUMBER %lu", tokenp->value.as_ulong); + break; + case isc_tokentype_qstring: + fprintf(stream, "QSTRING \"%.*s\"", + (int)tokenp->value.as_region.length, + tokenp->value.as_region.base); + break; + case isc_tokentype_eol: + fprintf(stream, "EOL"); + break; + case isc_tokentype_eof: + fprintf(stream, "EOF"); + break; + case isc_tokentype_initialws: + fprintf(stream, "INITIALWS"); + break; + case isc_tokentype_special: + fprintf(stream, "SPECIAL %c", tokenp->value.as_char); + break; + case isc_tokentype_nomore: + fprintf(stream, "NOMORE"); + break; + default: + FATAL_ERROR(__FILE__, __LINE__, "Unexpected type %d", + tokenp->type); + } +} + +int +main(int argc, char *argv[]) { + isc_token_t token; + isc_result_t result; + int quiet = 0; + int c; + int masterfile = 1; + int stats = 0; + unsigned int options = 0; + int done = 0; + + while ((c = isc_commandline_parse(argc, argv, "qmcs")) != -1) { + switch (c) { + case 'q': + quiet = 1; + break; + case 'm': + masterfile = 1; + break; + case 'c': + masterfile = 0; + break; + case 's': + stats = 1; + break; + } + } + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_lex_create(mctx, 256, &lex) == ISC_R_SUCCESS); + + if (masterfile) { + /* Set up to lex DNS master file. */ + + specials['('] = 1; + specials[')'] = 1; + specials['"'] = 1; + isc_lex_setspecials(lex, specials); + options = ISC_LEXOPT_DNSMULTILINE | ISC_LEXOPT_ESCAPE | + ISC_LEXOPT_EOF | + ISC_LEXOPT_QSTRING | ISC_LEXOPT_NOMORE; + isc_lex_setcomments(lex, ISC_LEXCOMMENT_DNSMASTERFILE); + } else { + /* Set up to lex DNS config file. */ + + specials['{'] = 1; + specials['}'] = 1; + specials[';'] = 1; + specials['/'] = 1; + specials['"'] = 1; + specials['!'] = 1; + specials['*'] = 1; + isc_lex_setspecials(lex, specials); + options = ISC_LEXOPT_EOF | + ISC_LEXOPT_QSTRING | + ISC_LEXOPT_NUMBER | ISC_LEXOPT_NOMORE; + isc_lex_setcomments(lex, (ISC_LEXCOMMENT_C| + ISC_LEXCOMMENT_CPLUSPLUS| + ISC_LEXCOMMENT_SHELL)); + } + + RUNTIME_CHECK(isc_lex_openstream(lex, stdin) == ISC_R_SUCCESS); + + while ((result = isc_lex_gettoken(lex, options, &token)) == + ISC_R_SUCCESS && !done) { + if (!quiet) { + char *name = isc_lex_getsourcename(lex); + print_token(&token, stdout); + printf(" line = %lu file = %s\n", + isc_lex_getsourceline(lex), + (name == NULL) ? "" : name); + } + if (token.type == isc_tokentype_eof) + isc_lex_close(lex); + if (token.type == isc_tokentype_nomore) + done = 1; + } + if (result != ISC_R_SUCCESS) + printf("Result: %s\n", isc_result_totext(result)); + + isc_lex_close(lex); + isc_lex_destroy(&lex); + if (!quiet && stats) + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/lfsr_test.c b/bin/tests/optional/lfsr_test.c new file mode 100644 index 0000000..28303e0 --- /dev/null +++ b/bin/tests/optional/lfsr_test.c @@ -0,0 +1,89 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/*! \file */ +#include + +#include +#include + +#include +#include +#include + +uint32_t state[1024 * 64]; + +int +main(int argc, char **argv) { + isc_lfsr_t lfsr1, lfsr2; + int i; + uint32_t temp; + + UNUSED(argc); + UNUSED(argv); + + /* + * Verify that returned values are reproducable. + */ + isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr1, &state[i], 4); + printf("lfsr1: state[%2d] = %08x\n", i, state[i]); + } + isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr1, &temp, 4); + if (state[i] != temp) + printf("lfsr1: state[%2d] = %08x, " + "but new state is %08x\n", + i, state[i], temp); + } + + /* + * Now do the same with skipping. + */ + isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr1, &state[i], 4); + isc_lfsr_skip(&lfsr1, 32); + printf("lfsr1: state[%2d] = %08x\n", i, state[i]); + } + isc_lfsr_init(&lfsr1, 0, 32, 0x80000057U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr1, &temp, 4); + isc_lfsr_skip(&lfsr1, 32); + if (state[i] != temp) + printf("lfsr1: state[%2d] = %08x, " + "but new state is %08x\n", + i, state[i], temp); + } + + /* + * Try to find the period of the LFSR. + * + * x^16 + x^5 + x^3 + x^2 + 1 + */ + isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr2, &state[i], 4); + printf("lfsr2: state[%2d] = %08x\n", i, state[i]); + } + isc_lfsr_init(&lfsr2, 0, 16, 0x00008016U, 0, NULL, NULL); + for (i = 0; i < 32; i++) { + isc_lfsr_generate(&lfsr2, &temp, 4); + if (state[i] != temp) + printf("lfsr2: state[%2d] = %08x, " + "but new state is %08x\n", + i, state[i], temp); + } + + return (0); +} diff --git a/bin/tests/optional/log_test.c b/bin/tests/optional/log_test.c new file mode 100644 index 0000000..1120753 --- /dev/null +++ b/bin/tests/optional/log_test.c @@ -0,0 +1,345 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#define TEST_FILE "/tmp/test_log" +#define SYSLOG_FILE "/var/log/daemon.log" +#define FILE_VERSIONS 10 + +char usage[] = "Usage: %s [-m] [-s syslog_logfile] [-r file_versions]\n"; + +#define CHECK(expr) result = expr; \ + if (result != ISC_R_SUCCESS) { \ + fprintf(stderr, "%s: " #expr "%s: exiting\n", \ + progname, isc_result_totext(result)); \ + } + +int +main(int argc, char **argv) { + const char *progname, *syslog_file, *message; + int ch, i, file_versions, stderr_line; + bool show_final_mem = false; + isc_log_t *lctx; + isc_logconfig_t *lcfg; + isc_mem_t *mctx; + isc_result_t result; + isc_logdestination_t destination; + const isc_logcategory_t *category; + const isc_logmodule_t *module; + + progname = strrchr(*argv, '/'); + if (progname != NULL) + progname++; + else + progname = *argv; + + syslog_file = SYSLOG_FILE; + file_versions = FILE_VERSIONS; + + while ((ch = isc_commandline_parse(argc, argv, "ms:r:")) != -1) { + switch (ch) { + case 'm': + show_final_mem = true; + break; + case 's': + syslog_file = isc_commandline_argument; + break; + case 'r': + file_versions = atoi(isc_commandline_argument); + if (file_versions < 0 && + file_versions != ISC_LOG_ROLLNEVER && + file_versions != ISC_LOG_ROLLINFINITE) { + fprintf(stderr, "%s: file rotations must be " + "%d (ISC_LOG_ROLLNEVER),\n\t" + "%d (ISC_LOG_ROLLINFINITE) " + "or > 0\n", progname, + ISC_LOG_ROLLNEVER, + ISC_LOG_ROLLINFINITE); + exit(1); + } + break; + case '?': + fprintf(stderr, usage, progname); + exit(1); + } + } + + argc -= isc_commandline_index; + argv += isc_commandline_index; + POST(argv); + + if (argc > 0) { + fprintf(stderr, usage, progname); + exit(1); + } + + fprintf(stderr, "EXPECT:\n%s%d%s%s%s", + "8 lines to stderr (first 4 numbered, #3 repeated)\n", + file_versions == 0 || file_versions == ISC_LOG_ROLLNEVER ? 1 : + file_versions > 0 ? file_versions + 1 : FILE_VERSIONS + 1, + " " TEST_FILE " files, and\n", + "2 lines to syslog\n", + "lines ending with exclamation marks are errors\n\n"); + + isc_log_opensyslog(progname, LOG_PID, LOG_DAEMON); + + mctx = NULL; + lctx = NULL; + lcfg = NULL; + + CHECK(isc_mem_create(0, 0, &mctx)); + CHECK(isc_log_create(mctx, &lctx, &lcfg)); + + CHECK(isc_log_settag(lcfg, progname)); + + isc_log_setcontext(lctx); + dns_log_init(lctx); + dns_log_setcontext(lctx); + + /* + * Test isc_log_categorybyname and isc_log_modulebyname. + */ + category = isc_log_categorybyname(lctx, "notify"); + if (category != NULL) + fprintf(stderr, "%s category found. (expected)\n", + category->name); + else + fprintf(stderr, "notify category not found!\n"); + + module = isc_log_modulebyname(lctx, "xyzzy"); + if (module != NULL) + fprintf(stderr, "%s module found!\n", module->name); + else + fprintf(stderr, "xyzzy module not found. (expected)\n"); + + /* + * Create a file channel to test file opening, size limiting and + * version rolling. + */ + + destination.file.name = TEST_FILE; + destination.file.maximum_size = 1; + destination.file.versions = file_versions; + + CHECK(isc_log_createchannel(lcfg, "file_test", ISC_LOG_TOFILE, + ISC_LOG_INFO, &destination, + ISC_LOG_PRINTTIME| + ISC_LOG_PRINTTAG| + ISC_LOG_PRINTLEVEL| + ISC_LOG_PRINTCATEGORY| + ISC_LOG_PRINTMODULE)); + + /* + * Create a dynamic debugging channel to a file descriptor. + */ + destination.file.stream = stderr; + + CHECK(isc_log_createchannel(lcfg, "debug_test", ISC_LOG_TOFILEDESC, + ISC_LOG_DYNAMIC, &destination, + ISC_LOG_PRINTTIME| + ISC_LOG_PRINTLEVEL| + ISC_LOG_DEBUGONLY)); + + /* + * Test the usability of the four predefined logging channels. + */ + CHECK(isc_log_usechannel(lcfg, "default_syslog", + DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE)); + CHECK(isc_log_usechannel(lcfg, "default_stderr", + DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE)); + CHECK(isc_log_usechannel(lcfg, "default_debug", + DNS_LOGCATEGORY_DATABASE, + DNS_LOGMODULE_CACHE)); + CHECK(isc_log_usechannel(lcfg, "null", + DNS_LOGCATEGORY_DATABASE, + NULL)); + + /* + * Use the custom channels. + */ + CHECK(isc_log_usechannel(lcfg, "file_test", + DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_DB)); + + CHECK(isc_log_usechannel(lcfg, "debug_test", + DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_RBTDB)); + + fprintf(stderr, "\n==> stderr begin\n"); + + /* + * Write to the internal default by testing both a category for which + * no channel has been specified and a category which was specified + * but not with the named module. + */ + stderr_line = 1; + + isc_log_write(lctx, DNS_LOGCATEGORY_SECURITY, DNS_LOGMODULE_RBT, + ISC_LOG_CRITICAL, "%s (%d)", + "Unspecified category and unspecified module to stderr", + stderr_line++); + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBT, + ISC_LOG_CRITICAL, "%s (%d)", + "Specified category and unspecified module to stderr", + stderr_line++); + + /* + * Write to default_syslog, default_stderr and default_debug. + */ + isc_log_write(lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_CACHE, + ISC_LOG_WARNING, "%s (%d twice)", + "Using the predefined channels to syslog+stderr", + stderr_line++); + + /* + * Write to predefined null channel. + */ + isc_log_write(lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_RBTDB, + ISC_LOG_INFO, "This is to null and should not appear!"); + + /* + * Reset the internal default to use syslog instead of stderr, + * and test it. + */ + CHECK(isc_log_usechannel(lcfg, "default_syslog", + ISC_LOGCATEGORY_DEFAULT, NULL)); + isc_log_write(lctx, DNS_LOGCATEGORY_SECURITY, DNS_LOGMODULE_RBT, + ISC_LOG_ERROR, "%s%s", + "This message to the redefined default category should ", + "be second in syslog"); + /* + * Write to the file channel. + */ + if (file_versions >= 0 || file_versions == ISC_LOG_ROLLINFINITE) { + + /* + * If file_versions is 0 or ISC_LOG_ROLLINFINITE, write + * the "should not appear" and "should be in file" messages + * to ensure they get rolled. + */ + if (file_versions <= 0) + file_versions = FILE_VERSIONS; + + else + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_DB, ISC_LOG_NOTICE, + "This should be rolled over " + "and not appear!"); + + for (i = file_versions - 1; i >= 0; i--) + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_DB, ISC_LOG_NOTICE, + "should be in file %d/%d", i, + file_versions - 1); + + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_DB, ISC_LOG_NOTICE, + "should be in base file"); + } else { + file_versions = FILE_VERSIONS; + for (i = 1; i <= file_versions; i++) + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, + DNS_LOGMODULE_DB, ISC_LOG_NOTICE, + "This is message %d in the log file", i); + } + + + /* + * Write a debugging message to a category that has no + * debugging channels for the named module. + */ + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_DB, + ISC_LOG_DEBUG(1), + "This debug message should not appear!"); + + /* + * Write debugging messages to a dynamic debugging channel. + */ + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_CRITICAL, "This critical message should " + "not appear because the debug level is 0!"); + + isc_log_setdebuglevel(lctx, 3); + + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_DEBUG(1), "%s (%d)", + "Dynamic debugging to stderr", stderr_line++); + isc_log_write(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_DEBUG(5), + "This debug level is too high and should not appear!"); + + /* + * Test out the duplicate filtering using the debug_test channel. + */ + isc_log_setduplicateinterval(lcfg, 10); + message = "This message should appear only once on stderr"; + + isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_CRITICAL, "%s", message); + isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_CRITICAL, "%s", message); + + isc_log_setduplicateinterval(lcfg, 1); + message = "This message should appear twice on stderr"; + + isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_CRITICAL, "%s", message); + sleep(2); + isc_log_write1(lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_RBTDB, + ISC_LOG_CRITICAL, "%s", message); + + /* + * Review where everything went. + * XXXDCL NT + */ + fputc('\n', stderr); + if (system("head " TEST_FILE "*; rm -f " TEST_FILE "*") != 0) { + fprintf(stderr, "system(\"head " TEST_FILE "*; rm -f " + TEST_FILE "*\") failed\n"); + goto cleanup; + } + + /* This is highly system specific. */ + if (freopen(syslog_file, "r", stdin) == NULL) { + fprintf(stderr, "freopen(%s, \"r\", stdin) failed\n", + syslog_file); + goto cleanup; + } + fprintf(stderr, "\n==> %s <==\n", syslog_file); + if (system("tail -2") != 0) { + fprintf(stderr, "system(\"tail -2\") failed\n"); + goto cleanup; + } + fputc('\n', stderr); + + cleanup: + isc_log_destroy(&lctx); + + if (show_final_mem) + isc_mem_stats(mctx, stderr); + + return (0); +} diff --git a/bin/tests/optional/lwres_test.c b/bin/tests/optional/lwres_test.c new file mode 100644 index 0000000..44e1cb0 --- /dev/null +++ b/bin/tests/optional/lwres_test.c @@ -0,0 +1,298 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define USE_ISC_MEM + +static inline void +CHECK(int val, const char *msg) { + if (val != 0) { + fprintf(stderr, "%s returned %d\n", msg, val); + exit(1); + } +} + +static void +hexdump(const char *msg, void *base, size_t len) { + unsigned char *p; + unsigned int cnt; + + p = base; + cnt = 0; + + printf("*** %s (%lu bytes @ %p)\n", msg, (unsigned long)len, base); + + while (cnt < len) { + if (cnt % 16 == 0) + printf("%p: ", p); + else if (cnt % 8 == 0) + printf(" |"); + printf(" %02x", *p++); + cnt++; + + if (cnt % 16 == 0) + printf("\n"); + } + + if (cnt % 16 != 0) + printf("\n"); +} + +static const char *TESTSTRING = "This is a test. This is only a test. !!!"; +static lwres_context_t *ctx; + +static void +test_noop(void) { + int ret; + lwres_lwpacket_t pkt, pkt2; + lwres_nooprequest_t nooprequest, *nooprequest2; + lwres_noopresponse_t noopresponse, *noopresponse2; + lwres_buffer_t b; + + pkt.pktflags = 0; + pkt.serial = 0x11223344; + pkt.recvlength = 0x55667788; + pkt.result = 0; + + nooprequest.datalength = strlen(TESTSTRING); + /* XXXDCL maybe "nooprequest.data" should be const. */ + DE_CONST(TESTSTRING, nooprequest.data); + ret = lwres_nooprequest_render(ctx, &nooprequest, &pkt, &b); + CHECK(ret, "lwres_nooprequest_render"); + + hexdump("rendered noop request", b.base, b.used); + + /* + * Now, parse it into a new structure. + */ + lwres_buffer_first(&b); + ret = lwres_lwpacket_parseheader(&b, &pkt2); + CHECK(ret, "lwres_lwpacket_parseheader"); + + hexdump("parsed pkt2", &pkt2, sizeof(pkt2)); + + nooprequest2 = NULL; + ret = lwres_nooprequest_parse(ctx, &b, &pkt2, &nooprequest2); + CHECK(ret, "lwres_nooprequest_parse"); + + assert(nooprequest.datalength == nooprequest2->datalength); + assert(memcmp(nooprequest.data, nooprequest2->data, + nooprequest.datalength) == 0); + + lwres_nooprequest_free(ctx, &nooprequest2); + + lwres_context_freemem(ctx, b.base, b.length); + b.base = NULL; + b.length = 0; + + pkt.pktflags = 0; + pkt.serial = 0x11223344; + pkt.recvlength = 0x55667788; + pkt.result = 0xdeadbeef; + + noopresponse.datalength = strlen(TESTSTRING); + /* XXXDCL maybe "noopresponse.data" should be const. */ + DE_CONST(TESTSTRING, noopresponse.data); + ret = lwres_noopresponse_render(ctx, &noopresponse, &pkt, &b); + CHECK(ret, "lwres_noopresponse_render"); + + hexdump("rendered noop response", b.base, b.used); + + /* + * Now, parse it into a new structure. + */ + lwres_buffer_first(&b); + ret = lwres_lwpacket_parseheader(&b, &pkt2); + CHECK(ret, "lwres_lwpacket_parseheader"); + + hexdump("parsed pkt2", &pkt2, sizeof(pkt2)); + + noopresponse2 = NULL; + ret = lwres_noopresponse_parse(ctx, &b, &pkt2, &noopresponse2); + CHECK(ret, "lwres_noopresponse_parse"); + + assert(noopresponse.datalength == noopresponse2->datalength); + assert(memcmp(noopresponse.data, noopresponse2->data, + noopresponse.datalength) == 0); + + lwres_noopresponse_free(ctx, &noopresponse2); + + lwres_context_freemem(ctx, b.base, b.length); + b.base = NULL; + b.length = 0; +} + +static void +test_gabn(const char *target) { + lwres_gabnresponse_t *res; + lwres_addr_t *addr; + int ret; + unsigned int i; + char outbuf[64]; + + res = NULL; + ret = lwres_getaddrsbyname(ctx, target, + LWRES_ADDRTYPE_V4 | LWRES_ADDRTYPE_V6, + &res); + printf("gabn %s ret == %d\n", target, ret); + if (ret != 0) { + printf("FAILURE!\n"); + if (res != NULL) + lwres_gabnresponse_free(ctx, &res); + return; + } + + printf("Returned real name: (%u, %s)\n", + res->realnamelen, res->realname); + printf("%u aliases:\n", res->naliases); + for (i = 0; i < res->naliases; i++) + printf("\t(%u, %s)\n", res->aliaslen[i], res->aliases[i]); + printf("%u addresses:\n", res->naddrs); + addr = LWRES_LIST_HEAD(res->addrs); + for (i = 0; i < res->naddrs; i++) { + INSIST(addr != NULL); + + if (addr->family == LWRES_ADDRTYPE_V4) + (void)inet_ntop(AF_INET, addr->address, + outbuf, sizeof(outbuf)); + else + (void)inet_ntop(AF_INET6, addr->address, + outbuf, sizeof(outbuf)); + printf("\tAddr len %u family %08x %s\n", + addr->length, addr->family, outbuf); + addr = LWRES_LIST_NEXT(addr, link); + } + + lwres_gabnresponse_free(ctx, &res); +} + +static void +test_gnba(const char *target, uint32_t af) { + lwres_gnbaresponse_t *res; + int ret; + unsigned int i; + unsigned char addrbuf[16]; + unsigned int len; + + if (af == LWRES_ADDRTYPE_V4) { + len = 4; + ret = inet_pton(AF_INET, target, addrbuf); + assert(ret == 1); + } else { + len = 16; + ret = inet_pton(AF_INET6, target, addrbuf); + assert(ret == 1); + } + + res = NULL; + ret = lwres_getnamebyaddr(ctx, af, len, addrbuf, &res); + printf("gnba %s ret == %d\n", target, ret); + assert(ret == 0); + assert(res != NULL); + + printf("Returned real name: (%u, %s)\n", + res->realnamelen, res->realname); + printf("%u aliases:\n", res->naliases); + for (i = 0; i < res->naliases; i++) + printf("\t(%u, %s)\n", res->aliaslen[i], res->aliases[i]); + + lwres_gnbaresponse_free(ctx, &res); +} + +#ifdef USE_ISC_MEM +/* + * Wrappers around our memory management stuff, for the lwres functions. + */ +static void * +mem_alloc(void *arg, size_t size) { + return (isc_mem_get(arg, size)); +} + +static void +mem_free(void *arg, void *mem, size_t size) { + isc_mem_put(arg, mem, size); +} +#endif + +int +main(int argc, char *argv[]) { + int ret; +#ifdef USE_ISC_MEM + isc_mem_t *mem; + isc_result_t result; +#endif + + (void)argc; + (void)argv; + +#ifdef USE_ISC_MEM + mem = NULL; + result = isc_mem_create(0, 0, &mem); + INSIST(result == ISC_R_SUCCESS); +#endif + + ctx = NULL; +#ifdef USE_ISC_MEM + ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0); +#else + ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0); +#endif + + CHECK(ret, "lwres_context_create"); + + ret = lwres_conf_parse(ctx, "/etc/resolv.conf"); + CHECK(ret, "lwres_conf_parse"); + + lwres_conf_print(ctx, stdout); + + test_noop(); + + /* + * The following comments about tests all assume your search path is + * nominum.com isc.org flame.org + * and ndots is the default of 1. + */ + test_gabn("alias-05.test"); /* exact, then search. */ + test_gabn("f.root-servers.net."); + test_gabn("poofball.flame.org."); + test_gabn("foo.ip6.int."); + test_gabn("notthereatall.flame.org"); /* exact, then search (!found)*/ + test_gabn("shell"); /* search (found in nominum.com), then exact */ + test_gabn("kechara"); /* search (found in flame.org), then exact */ + test_gabn("lkasdjlaksjdlkasjdlkasjdlkasjd"); /* search, exact(!found)*/ + + test_gnba("198.133.199.1", LWRES_ADDRTYPE_V4); + test_gnba("204.152.184.79", LWRES_ADDRTYPE_V4); + test_gnba("3ffe:8050:201:1860:42::1", LWRES_ADDRTYPE_V6); + + lwres_conf_clear(ctx); + lwres_context_destroy(&ctx); + +#ifdef USE_ISC_MEM + isc_mem_stats(mem, stdout); + isc_mem_destroy(&mem); +#endif + + return (0); +} diff --git a/bin/tests/optional/lwresconf_test.c b/bin/tests/optional/lwresconf_test.c new file mode 100644 index 0000000..a72b08a --- /dev/null +++ b/bin/tests/optional/lwresconf_test.c @@ -0,0 +1,91 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include + +#include +#include +#include + +#include + +#define USE_ISC_MEM + +static inline void +CHECK(int val, const char *msg) { + if (val != 0) { + fprintf(stderr, "%s returned %d\n", msg, val); + exit(1); + } +} + +#ifdef USE_ISC_MEM +/* + * Wrappers around our memory management stuff, for the lwres functions. + */ +static void * +mem_alloc(void *arg, size_t size) { + return (isc_mem_get(arg, size)); +} + +static void +mem_free(void *arg, void *mem, size_t size) { + isc_mem_put(arg, mem, size); +} +#endif + +int +main(int argc, char *argv[]) { + lwres_context_t *ctx; + const char *file = "/etc/resolv.conf"; + int ret; +#ifdef USE_ISC_MEM + isc_mem_t *mem; + isc_result_t result; +#endif + + if (argc > 1) { + file = argv[1]; + } + +#ifdef USE_ISC_MEM + mem = NULL; + result = isc_mem_create(0, 0, &mem); + INSIST(result == ISC_R_SUCCESS); +#endif + + ctx = NULL; +#ifdef USE_ISC_MEM + ret = lwres_context_create(&ctx, mem, mem_alloc, mem_free, 0); +#else + ret = lwres_context_create(&ctx, NULL, NULL, NULL, 0); +#endif + CHECK(ret, "lwres_context_create"); + + lwres_conf_init(ctx); + if (lwres_conf_parse(ctx, file) == 0) { + lwres_conf_print(ctx, stderr); + } else { + perror("lwres_conf_parse"); + } + + lwres_conf_clear(ctx); + lwres_context_destroy(&ctx); + +#ifdef USE_ISC_MEM + isc_mem_stats(mem, stdout); + isc_mem_destroy(&mem); +#endif + + return (0); +} diff --git a/bin/tests/optional/master_test.c b/bin/tests/optional/master_test.c new file mode 100644 index 0000000..9c1a059 --- /dev/null +++ b/bin/tests/optional/master_test.c @@ -0,0 +1,88 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +isc_mem_t *mctx; + +static isc_result_t +print_dataset(void *arg, dns_name_t *owner, dns_rdataset_t *dataset) { + char buf[64*1024]; + isc_buffer_t target; + isc_result_t result; + + UNUSED(arg); + + isc_buffer_init(&target, buf, 64*1024); + result = dns_rdataset_totext(dataset, owner, false, false, + &target); + if (result == ISC_R_SUCCESS) + fprintf(stdout, "%.*s\n", (int)target.used, + (char*)target.base); + else + fprintf(stdout, "dns_rdataset_totext: %s\n", + dns_result_totext(result)); + + return (ISC_R_SUCCESS); +} + +int +main(int argc, char *argv[]) { + isc_result_t result; + dns_name_t origin; + isc_buffer_t source; + isc_buffer_t target; + unsigned char name_buf[255]; + dns_rdatacallbacks_t callbacks; + + UNUSED(argc); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + if (argv[1]) { + isc_buffer_init(&source, argv[1], strlen(argv[1])); + isc_buffer_add(&source, strlen(argv[1])); + isc_buffer_setactive(&source, strlen(argv[1])); + isc_buffer_init(&target, name_buf, 255); + dns_name_init(&origin, NULL); + result = dns_name_fromtext(&origin, &source, dns_rootname, + 0, &target); + if (result != ISC_R_SUCCESS) { + fprintf(stdout, "dns_name_fromtext: %s\n", + dns_result_totext(result)); + exit(1); + } + + dns_rdatacallbacks_init_stdio(&callbacks); + callbacks.add = print_dataset; + + result = dns_master_loadfile(argv[1], &origin, &origin, + dns_rdataclass_in, 0, + &callbacks, mctx); + fprintf(stdout, "dns_master_loadfile: %s\n", + dns_result_totext(result)); + } + return (0); +} diff --git a/bin/tests/optional/mempool_test.c b/bin/tests/optional/mempool_test.c new file mode 100644 index 0000000..6a878f4 --- /dev/null +++ b/bin/tests/optional/mempool_test.c @@ -0,0 +1,120 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +isc_mem_t *mctx; + +int +main(int argc, char *argv[]) { + void *items1[50]; + void *items2[50]; + void *tmp; + isc_mempool_t *mp1, *mp2; + unsigned int i, j; + isc_mutex_t lock; + + UNUSED(argc); + UNUSED(argv); + + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); + + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + mp1 = NULL; + RUNTIME_CHECK(isc_mempool_create(mctx, 24, &mp1) == ISC_R_SUCCESS); + + mp2 = NULL; + RUNTIME_CHECK(isc_mempool_create(mctx, 31, &mp2) == ISC_R_SUCCESS); + + isc_mempool_associatelock(mp1, &lock); + isc_mempool_associatelock(mp2, &lock); + + isc_mem_stats(mctx, stderr); + + isc_mempool_setfreemax(mp1, 10); + isc_mempool_setfillcount(mp1, 10); + isc_mempool_setmaxalloc(mp1, 30); + + /* + * Allocate 30 items from the pool. This is our max. + */ + for (i = 0; i < 30; i++) { + items1[i] = isc_mempool_get(mp1); + RUNTIME_CHECK(items1[i] != NULL); + } + + /* + * Try to allocate one more. This should fail. + */ + tmp = isc_mempool_get(mp1); + RUNTIME_CHECK(tmp == NULL); + + /* + * Free the first 11 items. Verify that there are 10 free items on + * the free list (which is our max). + */ + + for (i = 0; i < 11; i++) { + isc_mempool_put(mp1, items1[i]); + items1[i] = NULL; + } + + RUNTIME_CHECK(isc_mempool_getfreecount(mp1) == 10); + RUNTIME_CHECK(isc_mempool_getallocated(mp1) == 19); + + isc_mem_stats(mctx, stderr); + + /* + * Now, beat up on mp2 for a while. Allocate 50 items, then free + * them, then allocate 50 more, etc. + */ + isc_mempool_setfreemax(mp2, 25); + isc_mempool_setfillcount(mp2, 25); + for (j = 0; j < 5000; j++) { + for (i = 0; i < 50; i++) { + items2[i] = isc_mempool_get(mp2); + RUNTIME_CHECK(items2[i] != NULL); + } + for (i = 0; i < 50; i++) { + isc_mempool_put(mp2, items2[i]); + items2[i] = NULL; + } + } + + /* + * Free all the other items and blow away this pool. + */ + for (i = 11; i < 30; i++) { + isc_mempool_put(mp1, items1[i]); + items1[i] = NULL; + } + + isc_mempool_destroy(&mp1); + + isc_mem_stats(mctx, stderr); + + isc_mempool_destroy(&mp2); + + isc_mem_stats(mctx, stderr); + + isc_mem_destroy(&mctx); + + DESTROYLOCK(&lock); + + return (0); +} diff --git a/bin/tests/optional/name_test.c b/bin/tests/optional/name_test.c new file mode 100644 index 0000000..4ab0dfc --- /dev/null +++ b/bin/tests/optional/name_test.c @@ -0,0 +1,340 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include + +static void +print_wirename(isc_region_t *name) { + unsigned char *ccurr, *cend; + + if (name->length == 0) { + printf("\n"); + return; + } + ccurr = name->base; + cend = ccurr + name->length; + while (ccurr != cend) + printf("%02x ", *ccurr++); + printf("\n"); +} + +static void +print_name(dns_name_t *name) { + isc_result_t result; + isc_buffer_t source; + isc_region_t r; + char s[1000]; + + isc_buffer_init(&source, s, sizeof(s)); + if (dns_name_countlabels(name) > 0) + result = dns_name_totext(name, false, &source); + else + result = ISC_R_SUCCESS; + if (result == ISC_R_SUCCESS) { + isc_buffer_usedregion(&source, &r); + if (r.length > 0) + printf("%.*s\n", (int)r.length, r.base); + else + printf("\n"); + } else + printf("error: %s\n", dns_result_totext(result)); +} + +int +main(int argc, char *argv[]) { + char s[1000]; + isc_result_t result; + dns_fixedname_t wname, wname2, oname, compname, downname; + isc_buffer_t source; + isc_region_t r; + dns_name_t *name, *origin, *comp, *down; + unsigned int downcase = 0; + size_t len; + bool quiet = false; + bool concatenate = false; + bool got_name = false; + bool check_absolute = false; + bool check_wildcard = false; + bool test_downcase = false; + bool inplace = false; + bool want_split = false; + unsigned int labels, split_label = 0; + dns_fixedname_t fprefix, fsuffix; + dns_name_t *prefix, *suffix; + int ch; + + while ((ch = isc_commandline_parse(argc, argv, "acdiqs:w")) != -1) { + switch (ch) { + case 'a': + check_absolute = true; + break; + case 'c': + concatenate = true; + break; + case 'd': + test_downcase = true; + break; + case 'i': + inplace = true; + break; + case 'q': + quiet = true; + break; + case 's': + want_split = true; + split_label = atoi(isc_commandline_argument); + break; + case 'w': + check_wildcard = true; + break; + } + } + + argc -= isc_commandline_index; + argv += isc_commandline_index; + + if (argc > 0) { + if (strcasecmp("none", argv[0]) == 0) + origin = NULL; + else { + len = strlen(argv[0]); + isc_buffer_init(&source, argv[0], len); + isc_buffer_add(&source, len); + origin = dns_fixedname_initname(&oname); + result = dns_name_fromtext(origin, &source, + dns_rootname, 0, NULL); + if (result != 0) { + fprintf(stderr, + "dns_name_fromtext() failed: %s\n", + dns_result_totext(result)); + exit(1); + } + } + } else if (concatenate) + origin = NULL; + else + origin = dns_rootname; + + if (argc >= 1) { + if (strcasecmp("none", argv[1]) == 0) + comp = NULL; + else { + len = strlen(argv[1]); + isc_buffer_init(&source, argv[1], len); + isc_buffer_add(&source, len); + comp = dns_fixedname_initname(&compname); + result = dns_name_fromtext(comp, &source, origin, + 0, NULL); + if (result != 0) { + fprintf(stderr, + "dns_name_fromtext() failed: %s\n", + dns_result_totext(result)); + exit(1); + } + } + } else + comp = NULL; + + name = dns_fixedname_initname(&wname); + dns_fixedname_init(&wname2); + while (fgets(s, sizeof(s), stdin) != NULL) { + len = strlen(s); + if (len > 0U && s[len - 1] == '\n') { + s[len - 1] = '\0'; + len--; + } + isc_buffer_init(&source, s, len); + isc_buffer_add(&source, len); + + if (len > 0U) + result = dns_name_fromtext(name, &source, origin, + downcase, NULL); + else { + if (name == dns_fixedname_name(&wname)) + dns_fixedname_init(&wname); + else + dns_fixedname_init(&wname2); + result = ISC_R_SUCCESS; + } + + if (result != ISC_R_SUCCESS) { + printf("%s\n", dns_result_totext(result)); + if (name == dns_fixedname_name(&wname)) + dns_fixedname_init(&wname); + else + dns_fixedname_init(&wname2); + continue; + } + + if (check_absolute && dns_name_countlabels(name) > 0) { + if (dns_name_isabsolute(name)) + printf("absolute\n"); + else + printf("relative\n"); + } + if (check_wildcard && dns_name_countlabels(name) > 0) { + if (dns_name_iswildcard(name)) + printf("wildcard\n"); + else + printf("not wildcard\n"); + } + dns_name_toregion(name, &r); + if (!quiet) { + print_wirename(&r); + printf("%u labels, %u bytes.\n", + dns_name_countlabels(name), r.length); + } + + if (concatenate) { + if (got_name) { + printf("Concatenating.\n"); + result = dns_name_concatenate( + dns_fixedname_name(&wname), + dns_fixedname_name(&wname2), + dns_fixedname_name(&wname2), + NULL); + name = dns_fixedname_name(&wname2); + if (result == ISC_R_SUCCESS) { + if (check_absolute && + dns_name_countlabels(name) > 0) { + if (dns_name_isabsolute(name)) + printf("absolute\n"); + else + printf("relative\n"); + } + if (check_wildcard && + dns_name_countlabels(name) > 0) { + if (dns_name_iswildcard(name)) + printf("wildcard\n"); + else + printf("not " + "wildcard\n"); + } + dns_name_toregion(name, &r); + if (!quiet) { + print_wirename(&r); + printf("%u labels, " + "%u bytes.\n", + dns_name_countlabels(name), + r.length); + } + } else + printf("%s\n", + dns_result_totext(result)); + got_name = false; + } else + got_name = true; + } + isc_buffer_init(&source, s, sizeof(s)); + if (dns_name_countlabels(name) > 0) + result = dns_name_totext(name, false, &source); + else + result = ISC_R_SUCCESS; + if (result == ISC_R_SUCCESS) { + isc_buffer_usedregion(&source, &r); + if (r.length > 0) + printf("%.*s\n", (int)r.length, r.base); + else + printf("\n"); + if (!quiet) { + printf("%u bytes.\n", source.used); + } + } else + printf("%s\n", dns_result_totext(result)); + + if (test_downcase) { + if (inplace) { + down = name; + } else { + down = dns_fixedname_initname(&downname); + } + result = dns_name_downcase(name, down, NULL); + INSIST(result == ISC_R_SUCCESS); + if (!quiet) { + dns_name_toregion(down, &r); + print_wirename(&r); + printf("%u labels, %u bytes.\n", + dns_name_countlabels(down), + r.length); + } + isc_buffer_init(&source, s, sizeof(s)); + print_name(down); + } + + if (comp != NULL && dns_name_countlabels(name) > 0) { + int order; + unsigned int nlabels; + dns_namereln_t namereln; + + namereln = dns_name_fullcompare(name, comp, &order, + &nlabels); + if (!quiet) { + if (order < 0) + printf("<"); + else if (order > 0) + printf(">"); + else + printf("="); + switch (namereln) { + case dns_namereln_contains: + printf(", contains"); + break; + case dns_namereln_subdomain: + printf(", subdomain"); + break; + case dns_namereln_commonancestor: + printf(", common ancestor"); + break; + default: + break; + } + if (namereln != dns_namereln_none && + namereln != dns_namereln_equal) + printf(", nlabels = %u", nlabels); + printf("\n"); + } + printf("dns_name_equal() returns %s\n", + dns_name_equal(name, comp) ? "TRUE" : "FALSE"); + } + + labels = dns_name_countlabels(name); + if (want_split && split_label < labels) { + prefix = dns_fixedname_initname(&fprefix); + suffix = dns_fixedname_initname(&fsuffix); + printf("splitting at label %u: ", split_label); + dns_name_split(name, split_label, prefix, suffix); + printf("\n prefix = "); + print_name(prefix); + printf(" suffix = "); + print_name(suffix); + } + + if (concatenate) { + if (got_name) + name = dns_fixedname_name(&wname2); + else + name = dns_fixedname_name(&wname); + } + } + + return (0); +} diff --git a/bin/tests/optional/nsecify.c b/bin/tests/optional/nsecify.c new file mode 100644 index 0000000..ac3a306 --- /dev/null +++ b/bin/tests/optional/nsecify.c @@ -0,0 +1,208 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +static isc_mem_t *mctx = NULL; + +static inline void +fatal(const char *message) { + fprintf(stderr, "%s\n", message); + exit(1); +} + +static inline void +check_result(isc_result_t result, const char *message) { + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "%s: %s\n", message, + isc_result_totext(result)); + exit(1); + } +} + +static inline bool +active_node(dns_db_t *db, dns_dbversion_t *version, dns_dbnode_t *node) { + dns_rdatasetiter_t *rdsiter; + bool active = false; + isc_result_t result; + dns_rdataset_t rdataset; + + dns_rdataset_init(&rdataset); + rdsiter = NULL; + result = dns_db_allrdatasets(db, node, version, 0, &rdsiter); + check_result(result, "dns_db_allrdatasets()"); + result = dns_rdatasetiter_first(rdsiter); + while (result == ISC_R_SUCCESS) { + dns_rdatasetiter_current(rdsiter, &rdataset); + if (rdataset.type != dns_rdatatype_nsec) + active = true; + dns_rdataset_disassociate(&rdataset); + if (!active) + result = dns_rdatasetiter_next(rdsiter); + else + result = ISC_R_NOMORE; + } + if (result != ISC_R_NOMORE) + fatal("rdataset iteration failed"); + dns_rdatasetiter_destroy(&rdsiter); + + if (!active) { + /* + * Make sure there is no NSEC record for this node. + */ + result = dns_db_deleterdataset(db, node, version, + dns_rdatatype_nsec, 0); + if (result == DNS_R_UNCHANGED) + result = ISC_R_SUCCESS; + check_result(result, "dns_db_deleterdataset"); + } + + return (active); +} + +static inline isc_result_t +next_active(dns_db_t *db, dns_dbversion_t *version, dns_dbiterator_t *dbiter, + dns_name_t *name, dns_dbnode_t **nodep) +{ + isc_result_t result; + bool active; + + do { + active = false; + result = dns_dbiterator_current(dbiter, nodep, name); + if (result == ISC_R_SUCCESS) { + active = active_node(db, version, *nodep); + if (!active) { + dns_db_detachnode(db, nodep); + result = dns_dbiterator_next(dbiter); + } + } + } while (result == ISC_R_SUCCESS && !active); + + return (result); +} + +static void +nsecify(char *filename) { + isc_result_t result; + dns_db_t *db; + dns_dbversion_t *wversion; + dns_dbnode_t *node, *nextnode; + const char *origintext; + dns_fixedname_t fname, fnextname; + dns_name_t *name, *nextname, *target; + isc_buffer_t b; + size_t len; + dns_dbiterator_t *dbiter; + char newfilename[1024]; + + name = dns_fixedname_initname(&fname); + nextname = dns_fixedname_initname(&fnextname); + + origintext = strrchr(filename, '/'); + if (origintext == NULL) + origintext = filename; + else + origintext++; /* Skip '/'. */ + len = strlen(origintext); + isc_buffer_constinit(&b, origintext, len); + isc_buffer_add(&b, len); + result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL); + check_result(result, "dns_name_fromtext()"); + + db = NULL; + result = dns_db_create(mctx, "rbt", name, dns_dbtype_zone, + dns_rdataclass_in, 0, NULL, &db); + check_result(result, "dns_db_create()"); + result = dns_db_load(db, filename); + if (result == DNS_R_SEENINCLUDE) + result = ISC_R_SUCCESS; + check_result(result, "dns_db_load()"); + wversion = NULL; + result = dns_db_newversion(db, &wversion); + check_result(result, "dns_db_newversion()"); + dbiter = NULL; + result = dns_db_createiterator(db, 0, &dbiter); + check_result(result, "dns_db_createiterator()"); + result = dns_dbiterator_first(dbiter); + check_result(result, "dns_dbiterator_first()"); + node = NULL; + result = next_active(db, wversion, dbiter, name, &node); + while (result == ISC_R_SUCCESS) { + nextnode = NULL; + result = dns_dbiterator_next(dbiter); + if (result == ISC_R_SUCCESS) + result = next_active(db, wversion, dbiter, nextname, + &nextnode); + if (result == ISC_R_SUCCESS) + target = nextname; + else if (result == ISC_R_NOMORE) + target = dns_db_origin(db); + else { + target = NULL; /* Make compiler happy. */ + fatal("db iteration failed"); + } + dns_nsec_build(db, wversion, node, target, 3600); /* XXX BEW */ + dns_db_detachnode(db, &node); + node = nextnode; + } + if (result != ISC_R_NOMORE) + fatal("db iteration failed"); + dns_dbiterator_destroy(&dbiter); + /* + * XXXRTH For now, we don't increment the SOA serial. + */ + dns_db_closeversion(db, &wversion, true); + len = strlen(filename); + if (len + 4 + 1 > sizeof(newfilename)) + fatal("filename too long"); + snprintf(newfilename, sizeof(newfilename), "%s.new", filename); + result = dns_db_dump(db, NULL, newfilename); + check_result(result, "dns_db_dump"); + dns_db_detach(&db); +} + +int +main(int argc, char *argv[]) { + int i; + isc_result_t result; + + dns_result_register(); + + result = isc_mem_create(0, 0, &mctx); + check_result(result, "isc_mem_create()"); + + argc--; + argv++; + + for (i = 0; i < argc; i++) + nsecify(argv[i]); + + /* isc_mem_stats(mctx, stdout); */ + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/ratelimiter_test.c b/bin/tests/optional/ratelimiter_test.c new file mode 100644 index 0000000..02eadac --- /dev/null +++ b/bin/tests/optional/ratelimiter_test.c @@ -0,0 +1,146 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +isc_ratelimiter_t *rlim = NULL; +isc_taskmgr_t *taskmgr = NULL; +isc_timermgr_t *timermgr = NULL; +isc_task_t *g_task = NULL; +isc_mem_t *mctx = NULL; + +static void utick(isc_task_t *task, isc_event_t *event); +static void shutdown_rl(isc_task_t *task, isc_event_t *event); +static void shutdown_all(isc_task_t *task, isc_event_t *event); + +typedef struct { + int milliseconds; + void (*fun)(isc_task_t *, isc_event_t *); +} schedule_t; + +schedule_t schedule[] = { + { 100, utick }, + { 200, utick }, + { 300, utick }, + { 3000, utick }, + { 3100, utick }, + { 3200, utick }, + { 3300, shutdown_rl }, + { 5000, utick }, + { 6000, shutdown_all } +}; + +#define NEVENTS (int)(sizeof(schedule)/sizeof(schedule[0])) + +isc_timer_t *timers[NEVENTS]; + +static void +ltick(isc_task_t *task, isc_event_t *event) { + UNUSED(task); + printf("** ltick%s **\n", + (event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0 ? + " (canceled)" : ""); + isc_event_free(&event); +} + +static void +utick(isc_task_t *task, isc_event_t *event) { + isc_result_t result; + UNUSED(task); + event->ev_action = ltick; + event->ev_sender = NULL; + result = isc_ratelimiter_enqueue(rlim, g_task, &event); + printf("enqueue: %s\n", + result == ISC_R_SUCCESS ? "ok" : "failed"); +} + +static void +shutdown_rl(isc_task_t *task, isc_event_t *event) { + UNUSED(task); + UNUSED(event); + printf("shutdown ratelimiter\n"); + isc_ratelimiter_shutdown(rlim); +} + +static void +shutdown_all(isc_task_t *task, isc_event_t *event) { + int i; + UNUSED(task); + UNUSED(event); + printf("shutdown all\n"); + for (i = 0; i < NEVENTS; i++) { + isc_timer_detach(&timers[i]); + } + + isc_app_shutdown(); +} + +int +main(int argc, char *argv[]) { + isc_interval_t linterval; + int i; + + UNUSED(argc); + UNUSED(argv); + + isc_app_start(); + isc_interval_set(&linterval, 1, 0); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, &taskmgr) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(taskmgr, 0, &g_task) == + ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_ratelimiter_create(mctx, timermgr, g_task, + &rlim) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_ratelimiter_setinterval(rlim, &linterval) == + ISC_R_SUCCESS); + + for (i = 0; i < NEVENTS; i++) { + isc_interval_t uinterval; + int ms = schedule[i].milliseconds; + isc_interval_set(&uinterval, ms / 1000, + (ms % 1000) * 1000000); + timers[i] = NULL; + RUNTIME_CHECK(isc_timer_create(timermgr, + isc_timertype_once, NULL, + &uinterval, + g_task, schedule[i].fun, NULL, + &timers[i]) == ISC_R_SUCCESS); + } + + isc_app_run(); + + isc_task_destroy(&g_task); + + isc_ratelimiter_detach(&rlim); + + isc_timermgr_destroy(&timermgr); + isc_taskmgr_destroy(&taskmgr); + + isc_mem_stats(mctx, stdout); + + isc_app_finish(); + return (0); +} diff --git a/bin/tests/optional/rbt_test.c b/bin/tests/optional/rbt_test.c new file mode 100644 index 0000000..0d41dc2 --- /dev/null +++ b/bin/tests/optional/rbt_test.c @@ -0,0 +1,445 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +const char *progname; +isc_mem_t *mctx; + +#define DNSNAMELEN 255 + +static dns_name_t * +create_name(char *s) { + int length; + isc_result_t result; + isc_buffer_t source, target; + static dns_name_t *name; + + if (s == NULL || *s == '\0') { + printf("missing name argument\n"); + return (NULL); + } + + length = strlen(s); + + isc_buffer_init(&source, s, length); + isc_buffer_add(&source, length); + + /* + * It isn't really necessary in this program to create individual + * memory spaces for each name structure and its associated character + * string. It is done here to provide a relatively easy way to test + * the callback from dns_rbt_deletename that is supposed to free the + * data associated with a node. + * + * The buffer for the actual name will immediately follow the + * name structure. + */ + name = isc_mem_get(mctx, sizeof(*name) + DNSNAMELEN); + if (name == NULL) { + printf("out of memory!\n"); + return (NULL); + } + + dns_name_init(name, NULL); + isc_buffer_init(&target, name + 1, DNSNAMELEN); + + result = dns_name_fromtext(name, &source, dns_rootname, 0, &target); + + if (result != ISC_R_SUCCESS) { + printf("dns_name_fromtext(%s) failed: %s\n", + s, dns_result_totext(result)); + return (NULL); + } + + return (name); +} + +static void +delete_name(void *data, void *arg) { + dns_name_t *name; + + UNUSED(arg); + name = data; + isc_mem_put(mctx, name, sizeof(*name) + DNSNAMELEN); +} + +static void +print_name(dns_name_t *name) { + isc_buffer_t target; + char buffer[1024]; + + isc_buffer_init(&target, buffer, sizeof(buffer)); + + /* + * false means absolute names have the final dot added. + */ + dns_name_totext(name, false, &target); + + printf("%.*s", (int)target.used, (char *)target.base); +} + +static void +detail(dns_rbt_t *rbt, dns_name_t *name) { + dns_name_t *foundname, *origin, *fullname; + dns_fixedname_t fixedfoundname, fixedorigin, fixedfullname; + dns_rbtnode_t *node1, *node2; + dns_rbtnodechain_t chain; + isc_result_t result; + bool nodes_should_match = false; + + dns_rbtnodechain_init(&chain, mctx); + + origin = dns_fixedname_initname(&fixedorigin); + fullname = dns_fixedname_initname(&fixedfullname); + foundname = dns_fixedname_initname(&fixedfoundname); + + node1 = node2 = NULL; + + printf("checking chain information for "); + print_name(name); + printf("\n"); + + result = dns_rbt_findnode(rbt, name, foundname, &node1, &chain, + DNS_RBTFIND_EMPTYDATA, NULL, NULL); + + switch (result) { + case ISC_R_SUCCESS: + printf(" found exact."); + nodes_should_match = true; + break; + case DNS_R_PARTIALMATCH: + printf(" found parent."); + break; + case ISC_R_NOTFOUND: + printf(" name not found."); + break; + default: + printf(" unexpected result: %s\n", dns_result_totext(result)); + return; + } + + if (node1 != NULL && node1->data != NULL) { + printf(" data at node: "); + print_name(node1->data); + } else + printf(" no data at node."); + + if (result == ISC_R_SUCCESS || result == DNS_R_PARTIALMATCH) { + printf("\n name from dns_rbt_findnode: "); + print_name(foundname); + } + + result = dns_rbtnodechain_current(&chain, foundname, origin, &node2); + + if (result == ISC_R_SUCCESS) { + printf("\n name from dns_rbtnodechain_current: "); + + result = dns_name_concatenate(foundname, origin, + fullname, NULL); + if (result == ISC_R_SUCCESS) + print_name(fullname); + else + printf("%s\n", dns_result_totext(result)); + printf("\n (foundname = "); + print_name(foundname); + printf(", origin = "); + print_name(origin); + printf(")\n"); + if (nodes_should_match && node1 != node2) + printf(" nodes returned from each function " + "DO NOT match!\n"); + + } else + printf("\n result from dns_rbtnodechain_current: %s\n", + dns_result_totext(result)); + + printf(" level_matches = %u, level_count = %u\n", + chain.level_matches, chain.level_count); +} + +static void +iterate(dns_rbt_t *rbt, bool forward) { + dns_name_t foundname, *origin; + dns_rbtnodechain_t chain; + dns_fixedname_t fixedorigin; + isc_result_t result; + isc_result_t (*move)(dns_rbtnodechain_t *chain, dns_name_t *name, + dns_name_t *origin); + + dns_rbtnodechain_init(&chain, mctx); + + dns_name_init(&foundname, NULL); + origin = dns_fixedname_initname(&fixedorigin); + + if (forward) { + printf("iterating forward\n" ); + move = dns_rbtnodechain_next; + + result = dns_rbtnodechain_first(&chain, rbt, &foundname, + origin); + + } else { + printf("iterating backward\n" ); + move = dns_rbtnodechain_prev; + + result = dns_rbtnodechain_last(&chain, rbt, &foundname, + origin); + } + + if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) + printf("start not found!\n"); + + else { + for (;;) { + if (result == DNS_R_NEWORIGIN) { + printf(" new origin: "); + print_name(origin); + printf("\n"); + } + + if (result == ISC_R_SUCCESS || + result == DNS_R_NEWORIGIN) { + print_name(&foundname); + printf("\n"); + + } else { + if (result != ISC_R_NOMORE) + printf("UNEXEPCTED ITERATION ERROR: %s", + dns_result_totext(result)); + break; + } + + result = move(&chain, &foundname, origin); + } + } +} + + +#define CMDCHECK(s) (strncasecmp(command, (s), length) == 0) +#define PRINTERR(r) if (r != ISC_R_SUCCESS) \ + printf("... %s\n", dns_result_totext(r)); + +int +main(int argc, char **argv) { + char *command, *arg, buffer[1024]; + const char *whitespace; + dns_name_t *name, *foundname; + dns_fixedname_t fixedname; + dns_rbt_t *rbt = NULL; + int length, ch; + bool show_final_mem = false; + isc_result_t result; + void *data; + + progname = strrchr(*argv, '/'); + if (progname != NULL) + progname++; + else + progname = *argv; + + while ((ch = isc_commandline_parse(argc, argv, "m")) != -1) { + switch (ch) { + case 'm': + show_final_mem = true; + break; + } + } + + argc -= isc_commandline_index; + argv += isc_commandline_index; + POST(argv); + + if (argc > 1) { + printf("Usage: %s [-m]\n", progname); + exit(1); + } + + setbuf(stdout, NULL); + + /* + * So isc_mem_stats() can report any allocation leaks. + */ + isc_mem_debugging = ISC_MEM_DEBUGRECORD; + + result = isc_mem_create(0, 0, &mctx); + if (result != ISC_R_SUCCESS) { + printf("isc_mem_create: %s: exiting\n", + dns_result_totext(result)); + exit(1); + } + + result = dns_rbt_create(mctx, delete_name, NULL, &rbt); + if (result != ISC_R_SUCCESS) { + printf("dns_rbt_create: %s: exiting\n", + dns_result_totext(result)); + exit(1); + } + + whitespace = " \t"; + + while (fgets(buffer, sizeof(buffer), stdin) != NULL) { + length = strlen(buffer); + + if (buffer[length - 1] != '\n') { + printf("line to long (%lu max), ignored\n", + (unsigned long)sizeof(buffer) - 2); + continue; + } + + buffer[length - 1] = '\0'; + + command = buffer + strspn(buffer, whitespace); + + if (*command == '#') + continue; + + arg = strpbrk(command, whitespace); + if (arg != NULL) { + *arg++ = '\0'; + arg += strspn(arg, whitespace); + } + + length = strlen(command); + if (*command != '\0') { + if (CMDCHECK("add")) { + name = create_name(arg); + if (name != NULL) { + printf("adding name %s\n", arg); + result = dns_rbt_addname(rbt, + name, name); + PRINTERR(result); + } + + } else if (CMDCHECK("delete")) { + name = create_name(arg); + if (name != NULL) { + printf("deleting name %s\n", arg); + result = dns_rbt_deletename(rbt, name, + false); + PRINTERR(result); + delete_name(name, NULL); + } + + } else if (CMDCHECK("nuke")) { + name = create_name(arg); + if (name != NULL) { + printf("nuking name %s " + "and its descendants\n", arg); + result = dns_rbt_deletename(rbt, name, + true); + PRINTERR(result); + delete_name(name, NULL); + } + + } else if (CMDCHECK("search")) { + name = create_name(arg); + if (name != NULL) { + printf("searching for name %s ... ", + arg); + + foundname = + dns_fixedname_initname(&fixedname); + data = NULL; + + result = dns_rbt_findname(rbt, name, 0, + foundname, + &data); + switch (result) { + case ISC_R_SUCCESS: + printf("found exact: "); + print_name(data); + putchar('\n'); + break; + case DNS_R_PARTIALMATCH: + printf("found parent: "); + print_name(data); + printf("\n\t(foundname: "); + print_name(foundname); + printf(")\n"); + break; + case ISC_R_NOTFOUND: + printf("NOT FOUND!\n"); + break; + case ISC_R_NOMEMORY: + printf("OUT OF MEMORY!\n"); + break; + default: + printf("UNEXPECTED RESULT\n"); + } + + delete_name(name, NULL); + } + + } else if (CMDCHECK("check")) { + /* + * Or "chain". I know, I know. Lame name. + * I was having a hard time thinking of a + * name (especially one that did not have + * a conflicting first letter with another + * command) that would differentiate this + * from the search command. + * + * But it is just a test program, eh? + */ + name = create_name(arg); + if (name != NULL) { + detail(rbt, name); + + delete_name(name, NULL); + } + + } else if (CMDCHECK("forward")) { + iterate(rbt, true); + + } else if (CMDCHECK("backward")) { + iterate(rbt, false); + + } else if (CMDCHECK("print")) { + if (arg == NULL || *arg == '\0') + dns_rbt_printtext(rbt, NULL, stdout); + else + printf("usage: print\n"); + + } else if (CMDCHECK("quit")) { + if (arg == NULL || *arg == '\0') + break; + else + printf("usage: quit\n"); + } else { + printf("a(dd) NAME, d(elete) NAME, " + "s(earch) NAME, p(rint), or q(uit)\n"); + + } + } + + } + + dns_rbt_destroy(&rbt); + + if (show_final_mem) + isc_mem_stats(mctx, stderr); + + return (0); +} diff --git a/bin/tests/optional/rbt_test.out b/bin/tests/optional/rbt_test.out new file mode 100644 index 0000000..95bf4f9 --- /dev/null +++ b/bin/tests/optional/rbt_test.out @@ -0,0 +1,395 @@ +adding name a.vix.com +adding name b.vix.com +adding name c.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (RED from b) + NULL + NULL + c (RED from b) + NULL + NULL + -- END down from vix.com. + NULL + NULL +adding name a.b.c.d.e.f.vix.com +adding name b.b.c.d.e.f.vix.com +adding name c.b.c.d.e.f.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + NULL + NULL + c (black from b) + NULL + b.c.d.e.f (RED from c) + ++ BEG down from b.c.d.e.f + b (black) + a (RED from b) + NULL + NULL + c (RED from b) + NULL + NULL + -- END down from b.c.d.e.f + NULL + NULL + -- END down from vix.com. + NULL + NULL +adding name a.d.e.f.vix.com +adding name q.d.e.f.vix.com +adding name d.e.f.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + NULL + NULL + c (black from b) + NULL + d.e.f (RED from c) + ++ BEG down from d.e.f + b.c (black) + ++ BEG down from b.c + b (black) + a (RED from b) + NULL + NULL + c (RED from b) + NULL + NULL + -- END down from b.c + a (RED from b.c) + NULL + NULL + q (RED from b.c) + NULL + NULL + -- END down from d.e.f + NULL + NULL + -- END down from vix.com. + NULL + NULL +adding name g.h.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + NULL + NULL + d.e.f (black from b) + ++ BEG down from d.e.f + b.c (black) + ++ BEG down from b.c + b (black) + a (RED from b) + NULL + NULL + c (RED from b) + NULL + NULL + -- END down from b.c + a (RED from b.c) + NULL + NULL + q (RED from b.c) + NULL + NULL + -- END down from d.e.f + c (RED from d.e.f) + NULL + NULL + g.h (RED from d.e.f) + NULL + NULL + -- END down from vix.com. + NULL + NULL +searching for name q.d.e.f.vix.com ... found exact: q.d.e.f.vix.com. +searching for name just-parent.a.vix.com ... found parent: a.vix.com. + (foundname: a.vix.com.) +searching for name no-real-parent.vix.com ... NOT FOUND! +searching for name does.not.exist.at.all ... NOT FOUND! +iterating forward + new origin: . +vix.com + new origin: vix.com. +a +b +c +d.e.f + new origin: d.e.f.vix.com. +a +b.c + new origin: b.c.d.e.f.vix.com. +a +b +c + new origin: d.e.f.vix.com. +q + new origin: vix.com. +g.h +iterating backward + new origin: vix.com. +g.h + new origin: d.e.f.vix.com. +q + new origin: b.c.d.e.f.vix.com. +c +b +a + new origin: d.e.f.vix.com. +b.c +a + new origin: vix.com. +d.e.f +c +b +a + new origin: . +vix.com +checking chain information for vix.com. + found exact. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: vix.com. + (foundname = vix.com, origin = .) + level_matches = 0, level_count = 0 +checking chain information for zzz.com. + name not found. no data at node. + name from dns_rbtnodechain_current: g.h.vix.com. + (foundname = g.h, origin = vix.com.) + level_matches = 0, level_count = 1 +checking chain information for 0.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: vix.com. + (foundname = vix.com, origin = .) + level_matches = 0, level_count = 0 +checking chain information for d.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: c.vix.com. + (foundname = c, origin = vix.com.) + level_matches = 0, level_count = 1 +checking chain information for f.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: c.vix.com. + (foundname = c, origin = vix.com.) + level_matches = 0, level_count = 1 +checking chain information for a.e.f.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: c.vix.com. + (foundname = c, origin = vix.com.) + level_matches = 0, level_count = 1 +checking chain information for z.e.f.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: q.d.e.f.vix.com. + (foundname = q, origin = d.e.f.vix.com.) + level_matches = 0, level_count = 2 +checking chain information for g.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: q.d.e.f.vix.com. + (foundname = q, origin = d.e.f.vix.com.) + level_matches = 0, level_count = 2 +checking chain information for i.vix.com. + found parent. no data at node. + name from dns_rbt_findnode: vix.com. + name from dns_rbtnodechain_current: g.h.vix.com. + (foundname = g.h, origin = vix.com.) + level_matches = 0, level_count = 1 +checking chain information for b.c.vix.com. + found parent. data at node: c.vix.com. + name from dns_rbt_findnode: c.vix.com. + name from dns_rbtnodechain_current: c.vix.com. + (foundname = c, origin = vix.com.) + level_matches = 1, level_count = 1 +nuking name d.e.f.vix.com and its descendants +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + NULL + NULL + g.h (black from b) + c (RED from g.h) + NULL + NULL + NULL + -- END down from vix.com. + NULL + NULL +adding name x.a.vix.com +adding name y.x.a.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + ++ BEG down from a + x (black) + ++ BEG down from x + y (black) + NULL + NULL + -- END down from x + NULL + NULL + -- END down from a + NULL + NULL + g.h (black from b) + c (RED from g.h) + NULL + NULL + NULL + -- END down from vix.com. + NULL + NULL +deleting name a.vix.com +deleting name x.a.vix.com +vix.com. (black) + ++ BEG down from vix.com. + b (black) + a (black from b) + ++ BEG down from a + x (black) + ++ BEG down from x + y (black) + NULL + NULL + -- END down from x + NULL + NULL + -- END down from a + NULL + NULL + g.h (black from b) + c (RED from g.h) + NULL + NULL + NULL + -- END down from vix.com. + NULL + NULL +deleting name b.vix.com +deleting name c.vix.com +vix.com. (black) + ++ BEG down from vix.com. + g.h (black) + a (RED from g.h) + ++ BEG down from a + x (black) + ++ BEG down from x + y (black) + NULL + NULL + -- END down from x + NULL + NULL + -- END down from a + NULL + NULL + NULL + -- END down from vix.com. + NULL + NULL +deleting name y.x.a.vix.com +vix.com. (black) + ++ BEG down from vix.com. + g.h (black) + a (RED from g.h) + ++ BEG down from a + x (black) + NULL + NULL + -- END down from a + NULL + NULL + NULL + -- END down from vix.com. + NULL + NULL +deleting name g.h.vix.com. +adding name \[b100000].vix.com. +adding name \[b010000].vix.com. +adding name \[b001000].vix.com. +adding name \[b000100].vix.com. +adding name \[b000010].vix.com. +adding name \[b000001].vix.com. +vix.com. (black) + ++ BEG down from vix.com. + \[x80/6] (black) + \[x0/1] (RED from \[x80/6]) + ++ BEG down from \[x0/1] + \[x80/5] (black) + \[x0/1] (RED from \[x80/5]) + ++ BEG down from \[x0/1] + \[x8/4] (black) + \[x0/1] (RED from \[x8/4]) + ++ BEG down from \[x0/1] + \[x8/3] (black) + \[x0/1] (RED from \[x8/3]) + ++ BEG down from \[x0/1] + \[x8/2] (black) + \[x4/2] (RED from \[x8/2]) + NULL + NULL + NULL + -- END down from \[x0/1] + NULL + NULL + NULL + -- END down from \[x0/1] + NULL + NULL + NULL + -- END down from \[x0/1] + NULL + NULL + NULL + -- END down from \[x0/1] + NULL + NULL + a (RED from \[x80/6]) + ++ BEG down from a + x (black) + NULL + NULL + -- END down from a + NULL + NULL + -- END down from vix.com. + NULL + NULL +searching for name \[b000100].vix.com. ... found exact: \[x10/6].vix.com. +adding name vix.com. +nuking name vix.com. and its descendants +adding name a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. +adding name b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. +b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. (black) + ++ BEG down from b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. + a (black) + NULL + NULL + -- END down from b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. + NULL + NULL +adding name . +nuking name . and its descendants +adding name \[xFFFF/16].\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/256].com +adding name \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com +\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com. (black) + ++ BEG down from \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com. + \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/144] (black) + NULL + NULL + -- END down from \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com. + NULL + NULL diff --git a/bin/tests/optional/rbt_test.txt b/bin/tests/optional/rbt_test.txt new file mode 100644 index 0000000..4821c34 --- /dev/null +++ b/bin/tests/optional/rbt_test.txt @@ -0,0 +1,85 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +add a.vix.com +add b.vix.com +add c.vix.com +print +add a.b.c.d.e.f.vix.com +add b.b.c.d.e.f.vix.com +add c.b.c.d.e.f.vix.com +print +add a.d.e.f.vix.com +add q.d.e.f.vix.com +add d.e.f.vix.com +print +add g.h.vix.com +print +search q.d.e.f.vix.com +search just-parent.a.vix.com +search no-real-parent.vix.com +search does.not.exist.at.all +forward +backward +# existing name +check vix.com. +# greater than stop node, which has down pointer +check zzz.com. +# less than lowest in level (would be left link from stop node) +check 0.vix.com +# greater than stop node, no down pointer +check d.vix.com +# superdomain stored in existing node +check f.vix.com +# common ancestor stored in existing node; existing is successor +check a.e.f.vix.com +# common ancestor stored in existing node; existing is less but not predecessor +check z.e.f.vix.com +# +check g.vix.com +# +check i.vix.com +# +check b.c.vix.com +nuke d.e.f.vix.com +print +add x.a.vix.com +add y.x.a.vix.com +print +delete a.vix.com +delete x.a.vix.com +print +delete b.vix.com +delete c.vix.com +print +delete y.x.a.vix.com +print +delete g.h.vix.com. +add \[b100000].vix.com. +add \[b010000].vix.com. +add \[b001000].vix.com. +add \[b000100].vix.com. +add \[b000010].vix.com. +add \[b000001].vix.com. +p +search \[b000100].vix.com. +# zap the entire tree +add vix.com. +nuke vix.com. +add a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. +add b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w. +print +add . +# zap it again +nuke . +# test splitting of maximal bitstring +add \[xFFFF/16].\[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/256].com +add \[xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/128].com +print +quit diff --git a/bin/tests/optional/rwlock_test.c b/bin/tests/optional/rwlock_test.c new file mode 100644 index 0000000..a540e3c --- /dev/null +++ b/bin/tests/optional/rwlock_test.c @@ -0,0 +1,144 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#ifdef WIN32 +#define sleep(x) Sleep(1000 * x) +#endif + +#ifdef ISC_PLATFORM_USETHREADS + +isc_rwlock_t lock; + +static isc_threadresult_t +#ifdef WIN32 +WINAPI +#endif +run1(void *arg) { + char *message = arg; + + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + printf("%s got READ lock\n", message); + sleep(1); + printf("%s giving up READ lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + printf("%s got READ lock\n", message); + sleep(1); + printf("%s giving up READ lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + printf("%s got WRITE lock\n", message); + sleep(1); + printf("%s giving up WRITE lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + return ((isc_threadresult_t)0); +} + +static isc_threadresult_t +#ifdef WIN32 +WINAPI +#endif +run2(void *arg) { + char *message = arg; + + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + printf("%s got WRITE lock\n", message); + sleep(1); + printf("%s giving up WRITE lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + printf("%s got WRITE lock\n", message); + sleep(1); + printf("%s giving up WRITE lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_write) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_rwlock_lock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + printf("%s got READ lock\n", message); + sleep(1); + printf("%s giving up READ lock\n", message); + RUNTIME_CHECK(isc_rwlock_unlock(&lock, isc_rwlocktype_read) == + ISC_R_SUCCESS); + return ((isc_threadresult_t)0); +} + +int +main(int argc, char *argv[]) { + unsigned int nworkers; + unsigned int i; + isc_thread_t workers[100]; + char name[100]; + void *dupname; + + if (argc > 1) + nworkers = atoi(argv[1]); + else + nworkers = 2; + if (nworkers > 100) + nworkers = 100; + printf("%u workers\n", nworkers); + + RUNTIME_CHECK(isc_rwlock_init(&lock, 5, 10) == ISC_R_SUCCESS); + + for (i = 0; i < nworkers; i++) { + snprintf(name, sizeof(name), "%02u", i); + dupname = strdup(name); + RUNTIME_CHECK(dupname != NULL); + if (i != 0 && i % 3 == 0) + RUNTIME_CHECK(isc_thread_create(run1, dupname, + &workers[i]) == + ISC_R_SUCCESS); + else + RUNTIME_CHECK(isc_thread_create(run2, dupname, + &workers[i]) == + ISC_R_SUCCESS); + } + + for (i = 0; i < nworkers; i++) + (void)isc_thread_join(workers[i], NULL); + + isc_rwlock_destroy(&lock); + + return (0); +} + +#else + +int +main(int argc, char *argv[]) { + UNUSED(argc); + UNUSED(argv); + fprintf(stderr, "This test requires threads.\n"); + return(1); +} + +#endif diff --git a/bin/tests/optional/serial_test.c b/bin/tests/optional/serial_test.c new file mode 100644 index 0000000..3ecb147 --- /dev/null +++ b/bin/tests/optional/serial_test.c @@ -0,0 +1,44 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include + +int +main() { + uint32_t a, b; + char buf[1024]; + char *s, *e; + + while (fgets(buf, sizeof(buf), stdin) != NULL) { + buf[sizeof(buf) - 1] = '\0'; + s = buf; + a = strtoul(s, &e, 0); + if (s == e) + continue; + s = e; + b = strtoul(s, &e, 0); + if (s == e) + continue; + fprintf(stdout, "%u %u gt:%d lt:%d ge:%d le:%d eq:%d ne:%d\n", + a, b, + isc_serial_gt(a,b), isc_serial_lt(a,b), + isc_serial_ge(a,b), isc_serial_le(a,b), + isc_serial_eq(a,b), isc_serial_ne(a,b)); + } + return (0); +} diff --git a/bin/tests/optional/shutdown_test.c b/bin/tests/optional/shutdown_test.c new file mode 100644 index 0000000..1eeaf07 --- /dev/null +++ b/bin/tests/optional/shutdown_test.c @@ -0,0 +1,231 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef struct { + isc_mem_t * mctx; + isc_task_t * task; + isc_timer_t * timer; + unsigned int ticks; + char name[16]; + bool exiting; + isc_task_t * peer; +} t_info; + +#define MAX_TASKS 3 +#define T2_SHUTDOWNOK (ISC_EVENTCLASS(1024) + 0) +#define T2_SHUTDOWNDONE (ISC_EVENTCLASS(1024) + 1) +#define FOO_EVENT (ISC_EVENTCLASS(1024) + 2) + +static t_info tasks[MAX_TASKS]; +static unsigned int task_count; +static isc_taskmgr_t * task_manager; +static isc_timermgr_t * timer_manager; + +static void +t1_shutdown(isc_task_t *task, isc_event_t *event) { + t_info *info = event->ev_arg; + + printf("task %s (%p) t1_shutdown\n", info->name, task); + isc_task_detach(&info->task); + isc_event_free(&event); +} + +static void +t2_shutdown(isc_task_t *task, isc_event_t *event) { + t_info *info = event->ev_arg; + + printf("task %s (%p) t2_shutdown\n", info->name, task); + info->exiting = true; + isc_event_free(&event); +} + +static void +shutdown_action(isc_task_t *task, isc_event_t *event) { + t_info *info = event->ev_arg; + isc_event_t *nevent; + + INSIST(event->ev_type == ISC_TASKEVENT_SHUTDOWN); + + printf("task %s (%p) shutdown\n", info->name, task); + if (strcmp(info->name, "0") == 0) { + isc_timer_detach(&info->timer); + nevent = isc_event_allocate(info->mctx, info, T2_SHUTDOWNOK, + t2_shutdown, &tasks[1], + sizeof(*event)); + RUNTIME_CHECK(nevent != NULL); + info->exiting = true; + isc_task_sendanddetach(&info->peer, &nevent); + } + isc_event_free(&event); +} + +static void +foo_event(isc_task_t *task, isc_event_t *event) { + printf("task(%p) foo\n", task); + isc_event_free(&event); +} + +static void +tick(isc_task_t *task, isc_event_t *event) { + t_info *info = event->ev_arg; + isc_event_t *nevent; + + INSIST(event->ev_type == ISC_TIMEREVENT_TICK); + + printf("task %s (%p) tick\n", info->name, task); + + info->ticks++; + if (strcmp(info->name, "1") == 0) { + if (info->ticks == 10) { + RUNTIME_CHECK(isc_app_shutdown() == ISC_R_SUCCESS); + } else if (info->ticks >= 15 && info->exiting) { + isc_timer_detach(&info->timer); + isc_task_detach(&info->task); + nevent = isc_event_allocate(info->mctx, info, + T2_SHUTDOWNDONE, + t1_shutdown, &tasks[0], + sizeof(*event)); + RUNTIME_CHECK(nevent != NULL); + isc_task_send(info->peer, &nevent); + isc_task_detach(&info->peer); + } + } else if (strcmp(info->name, "foo") == 0) { + isc_timer_detach(&info->timer); + nevent = isc_event_allocate(info->mctx, info, + FOO_EVENT, + foo_event, task, + sizeof(*event)); + RUNTIME_CHECK(nevent != NULL); + isc_task_sendanddetach(&task, &nevent); + } + + isc_event_free(&event); +} + +static t_info * +new_task(isc_mem_t *mctx, const char *name) { + t_info *ti; + isc_time_t expires; + isc_interval_t interval; + + RUNTIME_CHECK(task_count < MAX_TASKS); + ti = &tasks[task_count]; + ti->mctx = mctx; + ti->task = NULL; + ti->timer = NULL; + ti->ticks = 0; + if (name != NULL) { + INSIST(strlen(name) < sizeof(ti->name)); + strlcpy(ti->name, name, sizeof(ti->name)); + } else { + snprintf(ti->name, sizeof(ti->name), "%u", task_count); + } + RUNTIME_CHECK(isc_task_create(task_manager, 0, &ti->task) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(ti->task, shutdown_action, ti) == + ISC_R_SUCCESS); + + isc_time_settoepoch(&expires); + isc_interval_set(&interval, 1, 0); + RUNTIME_CHECK(isc_timer_create(timer_manager, isc_timertype_ticker, + &expires, &interval, ti->task, + tick, ti, &ti->timer) == + ISC_R_SUCCESS); + + task_count++; + + return (ti); +} + +int +main(int argc, char *argv[]) { + unsigned int workers; + t_info *t1, *t2; + isc_task_t *task; + isc_mem_t *mctx, *mctx2; + + RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); + + if (argc > 1) { + workers = atoi(argv[1]); + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else + workers = 2; + printf("%u workers\n", workers); + + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + mctx2 = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx2) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &task_manager) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_timermgr_create(mctx, &timer_manager) == + ISC_R_SUCCESS); + + t1 = new_task(mctx, NULL); + t2 = new_task(mctx2, NULL); + isc_task_attach(t2->task, &t1->peer); + isc_task_attach(t1->task, &t2->peer); + + /* + * Test run-triggered shutdown. + */ + (void)new_task(mctx2, "foo"); + + /* + * Test implicit shutdown. + */ + task = NULL; + RUNTIME_CHECK(isc_task_create(task_manager, 0, &task) == + ISC_R_SUCCESS); + isc_task_detach(&task); + + /* + * Test anti-zombie code. + */ + RUNTIME_CHECK(isc_task_create(task_manager, 0, &task) == + ISC_R_SUCCESS); + isc_task_detach(&task); + + RUNTIME_CHECK(isc_app_run() == ISC_R_SUCCESS); + + isc_taskmgr_destroy(&task_manager); + isc_timermgr_destroy(&timer_manager); + + printf("Statistics for mctx:\n"); + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + printf("Statistics for mctx2:\n"); + isc_mem_stats(mctx2, stdout); + isc_mem_destroy(&mctx2); + + isc_app_finish(); + + return (0); +} diff --git a/bin/tests/optional/sig0_test.c b/bin/tests/optional/sig0_test.c new file mode 100644 index 0000000..dcf64ba --- /dev/null +++ b/bin/tests/optional/sig0_test.c @@ -0,0 +1,295 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define CHECK(str, x) { \ + if ((x) != ISC_R_SUCCESS) { \ + printf("%s: %s\n", (str), isc_result_totext(x)); \ + exit(-1); \ + } \ +} + +isc_mutex_t lock; +dst_key_t *key; +isc_mem_t *mctx; +unsigned char qdata[1024], rdata[1024]; +isc_buffer_t qbuffer, rbuffer; +isc_taskmgr_t *taskmgr; +isc_entropy_t *ent = NULL; +isc_task_t *task1; +isc_log_t *lctx = NULL; +isc_logconfig_t *logconfig = NULL; +isc_socket_t *s; +isc_sockaddr_t address; +char output[10 * 1024]; +isc_buffer_t outbuf; +static const dns_master_style_t *style = &dns_master_style_debug; + +static void +senddone(isc_task_t *task, isc_event_t *event) { + isc_socketevent_t *sevent = (isc_socketevent_t *)event; + + REQUIRE(sevent != NULL); + REQUIRE(sevent->ev_type == ISC_SOCKEVENT_SENDDONE); + REQUIRE(task == task1); + + printf("senddone\n"); + + isc_event_free(&event); +} + +static void +recvdone(isc_task_t *task, isc_event_t *event) { + isc_socketevent_t *sevent = (isc_socketevent_t *)event; + isc_buffer_t source; + isc_result_t result; + dns_message_t *response; + + REQUIRE(sevent != NULL); + REQUIRE(sevent->ev_type == ISC_SOCKEVENT_RECVDONE); + REQUIRE(task == task1); + + printf("recvdone\n"); + if (sevent->result != ISC_R_SUCCESS) { + printf("failed\n"); + exit(-1); + } + + isc_buffer_init(&source, sevent->region.base, sevent->region.length); + isc_buffer_add(&source, sevent->n); + + response = NULL; + result = dns_message_create(mctx, DNS_MESSAGE_INTENTPARSE, &response); + CHECK("dns_message_create", result); + result = dns_message_parse(response, &source, 0); + CHECK("dns_message_parse", result); + + isc_buffer_init(&outbuf, output, sizeof(output)); + result = dns_message_totext(response, style, 0, &outbuf); + CHECK("dns_message_totext", result); + printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf), + (char *)isc_buffer_base(&outbuf)); + + dns_message_destroy(&response); + isc_event_free(&event); + + isc_app_shutdown(); +} + +static void +buildquery(void) { + isc_result_t result; + dns_rdataset_t *question = NULL; + dns_name_t *qname = NULL; + isc_region_t r, inr; + dns_message_t *query; + char nametext[] = "host.example"; + isc_buffer_t namesrc, namedst; + unsigned char namedata[256]; + isc_sockaddr_t sa; + dns_compress_t cctx; + + query = NULL; + result = dns_message_create(mctx, DNS_MESSAGE_INTENTRENDER, &query); + CHECK("dns_message_create", result); + result = dns_message_setsig0key(query, key); + CHECK("dns_message_setsig0key", result); + + result = dns_message_gettemprdataset(query, &question); + CHECK("dns_message_gettemprdataset", result); + dns_rdataset_makequestion(question, dns_rdataclass_in, + dns_rdatatype_a); + result = dns_message_gettempname(query, &qname); + CHECK("dns_message_gettempname", result); + isc_buffer_init(&namesrc, nametext, strlen(nametext)); + isc_buffer_add(&namesrc, strlen(nametext)); + isc_buffer_init(&namedst, namedata, sizeof(namedata)); + dns_name_init(qname, NULL); + result = dns_name_fromtext(qname, &namesrc, dns_rootname, 0, &namedst); + CHECK("dns_name_fromtext", result); + ISC_LIST_APPEND(qname->list, question, link); + dns_message_addname(query, qname, DNS_SECTION_QUESTION); + + isc_buffer_init(&qbuffer, qdata, sizeof(qdata)); + + result = dns_compress_init(&cctx, -1, mctx); + CHECK("dns_compress_init", result); + result = dns_message_renderbegin(query, &cctx, &qbuffer); + CHECK("dns_message_renderbegin", result); + result = dns_message_rendersection(query, DNS_SECTION_QUESTION, 0); + CHECK("dns_message_rendersection(question)", result); + result = dns_message_rendersection(query, DNS_SECTION_ANSWER, 0); + CHECK("dns_message_rendersection(answer)", result); + result = dns_message_rendersection(query, DNS_SECTION_AUTHORITY, 0); + CHECK("dns_message_rendersection(auth)", result); + result = dns_message_rendersection(query, DNS_SECTION_ADDITIONAL, 0); + CHECK("dns_message_rendersection(add)", result); + result = dns_message_renderend(query); + CHECK("dns_message_renderend", result); + dns_compress_invalidate(&cctx); + + isc_buffer_init(&outbuf, output, sizeof(output)); + result = dns_message_totext(query, style, 0, &outbuf); + CHECK("dns_message_totext", result); + printf("%.*s\n", (int)isc_buffer_usedlength(&outbuf), + (char *)isc_buffer_base(&outbuf)); + + isc_buffer_usedregion(&qbuffer, &r); + isc_sockaddr_any(&sa); + result = isc_socket_bind(s, &sa, 0); + CHECK("isc_socket_bind", result); + result = isc_socket_sendto(s, &r, task1, senddone, NULL, &address, + NULL); + CHECK("isc_socket_sendto", result); + + inr.base = rdata; + inr.length = sizeof(rdata); + result = isc_socket_recv(s, &inr, 1, task1, recvdone, NULL); + CHECK("isc_socket_recv", result); + dns_message_destroy(&query); +} + +int +main(int argc, char *argv[]) { + bool verbose = false; + isc_socketmgr_t *socketmgr; + isc_timermgr_t *timermgr; + struct in_addr inaddr; + dns_fixedname_t fname; + dns_name_t *name; + isc_buffer_t b; + int ch; + isc_result_t result; + in_port_t port = 53; + + RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_mutex_init(&lock) == ISC_R_SUCCESS); + + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + while ((ch = isc_commandline_parse(argc, argv, "vp:")) != -1) { + switch (ch) { + case 'v': + verbose = true; + break; + case 'p': + port = (unsigned int)atoi(isc_commandline_argument); + break; + } + } + + RUNTIME_CHECK(isc_entropy_create(mctx, &ent) == ISC_R_SUCCESS); + RUNTIME_CHECK(dst_lib_init(mctx, ent, 0) == ISC_R_SUCCESS); + + dns_result_register(); + dst_result_register(); + + taskmgr = NULL; + RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, &taskmgr) == + ISC_R_SUCCESS); + task1 = NULL; + RUNTIME_CHECK(isc_task_create(taskmgr, 0, &task1) == ISC_R_SUCCESS); + + timermgr = NULL; + RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS); + socketmgr = NULL; + RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_log_create(mctx, &lctx, &logconfig) == ISC_R_SUCCESS); + + s = NULL; + RUNTIME_CHECK(isc_socket_create(socketmgr, PF_INET, + isc_sockettype_udp, &s) == + ISC_R_SUCCESS); + + inaddr.s_addr = htonl(INADDR_LOOPBACK); + isc_sockaddr_fromin(&address, &inaddr, port); + + name = dns_fixedname_initname(&fname); + isc_buffer_constinit(&b, "child.example.", strlen("child.example.")); + isc_buffer_add(&b, strlen("child.example.")); + result = dns_name_fromtext(name, &b, dns_rootname, 0, NULL); + CHECK("dns_name_fromtext", result); + + key = NULL; + result = dst_key_fromfile(name, 4017, DNS_KEYALG_DSA, + DST_TYPE_PUBLIC | DST_TYPE_PRIVATE, + NULL, mctx, &key); + CHECK("dst_key_fromfile", result); + + buildquery(); + + (void)isc_app_run(); + + isc_task_shutdown(task1); + isc_task_detach(&task1); + isc_taskmgr_destroy(&taskmgr); + + isc_socket_detach(&s); + isc_socketmgr_destroy(&socketmgr); + isc_timermgr_destroy(&timermgr); + + dst_key_free(&key); + + dst_lib_destroy(); + + isc_entropy_detach(&ent); + + isc_log_destroy(&lctx); + + if (verbose) + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + DESTROYLOCK(&lock); + + isc_app_finish(); + + return (0); +} diff --git a/bin/tests/optional/sock_test.c b/bin/tests/optional/sock_test.c new file mode 100644 index 0000000..f13a3ff --- /dev/null +++ b/bin/tests/optional/sock_test.c @@ -0,0 +1,400 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +isc_mem_t *mctx; +isc_taskmgr_t *manager; + +static void +my_shutdown(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + + printf("shutdown %s (%p)\n", name, task); + fflush(stdout); + isc_event_free(&event); +} + +static void +my_send(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock; + isc_socketevent_t *dev; + + sock = event->ev_sender; + dev = (isc_socketevent_t *)event; + + printf("my_send: %s task %p\n\t(sock %p, base %p, length %u, n %u, " + "result %u)\n", + (char *)(event->ev_arg), task, sock, + dev->region.base, dev->region.length, + dev->n, dev->result); + + if (dev->result != ISC_R_SUCCESS) { + isc_socket_detach(&sock); + isc_task_shutdown(task); + } + + if (dev->region.base != NULL) + isc_mem_put(mctx, dev->region.base, dev->region.length); + + isc_event_free(&event); +} + +static void +my_recv(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock; + isc_socketevent_t *dev; + isc_region_t region; + char buf[1024]; + char host[256]; + + sock = event->ev_sender; + dev = (isc_socketevent_t *)event; + + printf("Socket %s (sock %p, base %p, length %u, n %u, result %u)\n", + (char *)(event->ev_arg), sock, + dev->region.base, dev->region.length, + dev->n, dev->result); + if (dev->address.type.sa.sa_family == AF_INET6) { + inet_ntop(AF_INET6, &dev->address.type.sin6.sin6_addr, + host, sizeof(host)); + printf("\tFrom: %s port %d\n", host, + ntohs(dev->address.type.sin6.sin6_port)); + } else { + inet_ntop(AF_INET, &dev->address.type.sin.sin_addr, + host, sizeof(host)); + printf("\tFrom: %s port %d\n", host, + ntohs(dev->address.type.sin.sin_port)); + } + + if (dev->result != ISC_R_SUCCESS) { + isc_socket_detach(&sock); + + if (dev->region.base != NULL) + isc_mem_put(mctx, dev->region.base, dev->region.length); + isc_event_free(&event); + + isc_task_shutdown(task); + return; + } + + /* + * Echo the data back. + */ + if (strcmp(event->ev_arg, "so2") != 0) { + region = dev->region; + snprintf(buf, sizeof(buf), "\r\nReceived: %.*s\r\n\r\n", + (int)dev->n, (char *)region.base); + region.base = isc_mem_get(mctx, strlen(buf) + 1); + if (region.base != NULL) { + region.length = strlen(buf) + 1; + strlcpy((char *)region.base, buf, region.length); + } else + region.length = 0; + isc_socket_send(sock, ®ion, task, my_send, event->ev_arg); + } else { + region = dev->region; + printf("\r\nReceived: %.*s\r\n\r\n", + (int)dev->n, (char *)region.base); + } + + isc_socket_recv(sock, &dev->region, 1, task, my_recv, event->ev_arg); + + isc_event_free(&event); +} + +static void +my_http_get(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock; + isc_socketevent_t *dev; + + sock = event->ev_sender; + dev = (isc_socketevent_t *)event; + + printf("my_http_get: %s task %p\n\t(sock %p, base %p, length %u, " + "n %u, result %u)\n", + (char *)(event->ev_arg), task, sock, + dev->region.base, dev->region.length, + dev->n, dev->result); + + if (dev->result != ISC_R_SUCCESS) { + isc_socket_detach(&sock); + isc_task_shutdown(task); + if (dev->region.base != NULL) + isc_mem_put(mctx, dev->region.base, dev->region.length); + isc_event_free(&event); + return; + } + + isc_socket_recv(sock, &dev->region, 1, task, my_recv, event->ev_arg); + + isc_event_free(&event); +} + +static void +my_connect(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock; + isc_socket_connev_t *dev; + isc_region_t region; + char buf[1024]; + + sock = event->ev_sender; + dev = (isc_socket_connev_t *)event; + + printf("%s: Connection result: %u\n", (char *)(event->ev_arg), + dev->result); + + if (dev->result != ISC_R_SUCCESS) { + isc_socket_detach(&sock); + isc_event_free(&event); + isc_task_shutdown(task); + return; + } + + /* + * Send a GET string, and set up to receive (and just display) + * the result. + */ + snprintf(buf, sizeof(buf), + "GET / HTTP/1.1\r\nHost: www.flame.org\r\n" + "Connection: Close\r\n\r\n"); + region.base = isc_mem_get(mctx, strlen(buf) + 1); + if (region.base != NULL) { + region.length = strlen(buf) + 1; + strlcpy((char *)region.base, buf, region.length); + } else { + region.length = 0; + } + + isc_socket_send(sock, ®ion, task, my_http_get, event->ev_arg); + + isc_event_free(&event); +} + +static void +my_listen(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + isc_socket_newconnev_t *dev; + isc_region_t region; + isc_socket_t *oldsock; + isc_task_t *newtask; + + dev = (isc_socket_newconnev_t *)event; + + printf("newcon %s (task %p, oldsock %p, newsock %p, result %u)\n", + name, task, event->ev_sender, dev->newsocket, dev->result); + fflush(stdout); + + if (dev->result == ISC_R_SUCCESS) { + /* + * Queue another listen on this socket. + */ + RUNTIME_CHECK(isc_socket_accept(event->ev_sender, task, + my_listen, event->ev_arg) + == ISC_R_SUCCESS); + + region.base = isc_mem_get(mctx, 20); + region.length = 20; + + /* + * Create a new task for this socket, and queue up a + * recv on it. + */ + newtask = NULL; + RUNTIME_CHECK(isc_task_create(manager, 0, &newtask) + == ISC_R_SUCCESS); + isc_socket_recv(dev->newsocket, ®ion, 1, + newtask, my_recv, event->ev_arg); + isc_task_detach(&newtask); + } else { + printf("detaching from socket %p\n", event->ev_sender); + oldsock = event->ev_sender; + + isc_socket_detach(&oldsock); + + isc_event_free(&event); + isc_task_shutdown(task); + return; + } + + isc_event_free(&event); +} + +static void +timeout(isc_task_t *task, isc_event_t *event) { + isc_socket_t *sock = event->ev_arg; + + printf("Timeout, canceling IO on socket %p (task %p)\n", sock, task); + + isc_socket_cancel(sock, NULL, ISC_SOCKCANCEL_ALL); + isc_timer_detach((isc_timer_t **)&event->ev_sender); + isc_event_free(&event); +} + +static char one[] = "1"; +static char two[] = "2"; +static char xso1[] = "so1"; +static char xso2[] = "so2"; + +int +main(int argc, char *argv[]) { + isc_task_t *t1, *t2; + isc_timermgr_t *timgr; + isc_time_t expires; + isc_interval_t interval; + isc_timer_t *ti1; + unsigned int workers; + isc_socketmgr_t *socketmgr; + isc_socket_t *so1, *so2; + isc_sockaddr_t sockaddr; + struct in_addr ina; + struct in6_addr in6a; + isc_result_t result; + int pf; + + if (argc > 1) { + workers = atoi(argv[1]); + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else + workers = 2; + printf("%u workers\n", workers); + + if (isc_net_probeipv6() == ISC_R_SUCCESS) + pf = PF_INET6; + else + pf = PF_INET; + + /* + * EVERYTHING needs a memory context. + */ + mctx = NULL; + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + /* + * The task manager is independent (other than memory context) + */ + manager = NULL; + RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &manager) == + ISC_R_SUCCESS); + + /* + * Timer manager depends only on the memory context as well. + */ + timgr = NULL; + RUNTIME_CHECK(isc_timermgr_create(mctx, &timgr) == ISC_R_SUCCESS); + + t1 = NULL; + RUNTIME_CHECK(isc_task_create(manager, 0, &t1) == ISC_R_SUCCESS); + t2 = NULL; + RUNTIME_CHECK(isc_task_create(manager, 0, &t2) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, one) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, two) == + ISC_R_SUCCESS); + + printf("task 1 = %p\n", t1); + printf("task 2 = %p\n", t2); + + socketmgr = NULL; + RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); + + /* + * Open up a listener socket. + */ + so1 = NULL; + + if (pf == PF_INET6) { + in6a = in6addr_any; + isc_sockaddr_fromin6(&sockaddr, &in6a, 5544); + } else { + ina.s_addr = INADDR_ANY; + isc_sockaddr_fromin(&sockaddr, &ina, 5544); + } + RUNTIME_CHECK(isc_socket_create(socketmgr, pf, isc_sockettype_tcp, + &so1) == ISC_R_SUCCESS); + result = isc_socket_bind(so1, &sockaddr, ISC_SOCKET_REUSEADDRESS); + RUNTIME_CHECK(result == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_socket_listen(so1, 0) == ISC_R_SUCCESS); + + /* + * Queue up the first accept event. + */ + RUNTIME_CHECK(isc_socket_accept(so1, t1, my_listen, xso1) + == ISC_R_SUCCESS); + isc_time_settoepoch(&expires); + isc_interval_set(&interval, 10, 0); + ti1 = NULL; + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, &expires, + &interval, t1, timeout, so1, &ti1) == + ISC_R_SUCCESS); + + /* + * Open up a socket that will connect to www.flame.org, port 80. + * Why not. :) + */ + so2 = NULL; + ina.s_addr = inet_addr("204.152.184.97"); + if (0 && pf == PF_INET6) + isc_sockaddr_v6fromin(&sockaddr, &ina, 80); + else + isc_sockaddr_fromin(&sockaddr, &ina, 80); + RUNTIME_CHECK(isc_socket_create(socketmgr, isc_sockaddr_pf(&sockaddr), + isc_sockettype_tcp, + &so2) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_socket_connect(so2, &sockaddr, t2, + my_connect, xso2) == ISC_R_SUCCESS); + + /* + * Detaching these is safe, since the socket will attach to the + * task for any outstanding requests. + */ + isc_task_detach(&t1); + isc_task_detach(&t2); + + /* + * Wait a short while. + */ +#ifndef WIN32 + sleep(10); +#else + Sleep(10000); +#endif + + fprintf(stderr, "Destroying socket manager\n"); + isc_socketmgr_destroy(&socketmgr); + + fprintf(stderr, "Destroying timer manager\n"); + isc_timermgr_destroy(&timgr); + + fprintf(stderr, "Destroying task manager\n"); + isc_taskmgr_destroy(&manager); + + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/sym_test.c b/bin/tests/optional/sym_test.c new file mode 100644 index 0000000..4eeac18 --- /dev/null +++ b/bin/tests/optional/sym_test.c @@ -0,0 +1,121 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +isc_mem_t *mctx; +isc_symtab_t *st; + +static void +undefine_action(char *key, unsigned int type, isc_symvalue_t value, void *arg) +{ + UNUSED(arg); + + INSIST(type == 1); + isc_mem_free(mctx, key); + isc_mem_free(mctx, value.as_pointer); +} + +int +main(int argc, char *argv[]) { + char s[1000], *cp, *key; + size_t len; + isc_result_t result; + isc_symvalue_t value; + int trace = 0; + int c; + isc_symexists_t exists_policy = isc_symexists_reject; + bool case_sensitive = false; + + while ((c = isc_commandline_parse(argc, argv, "tarc")) != -1) { + switch (c) { + case 't': + trace = 1; + break; + case 'a': + exists_policy = isc_symexists_add; + break; + case 'r': + exists_policy = isc_symexists_replace; + break; + case 'c': + case_sensitive = true; + break; + } + } + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_symtab_create(mctx, 691, undefine_action, NULL, + case_sensitive, &st) == ISC_R_SUCCESS); + + while (fgets(s, sizeof(s), stdin) != NULL) { + len = strlen(s); + if (len > 0U && s[len - 1] == '\n') { + s[len - 1] = '\0'; + len--; + } + + cp = s; + + if (cp[0] == '!') { + cp++; + result = isc_symtab_undefine(st, cp, 1); + if (trace || result != ISC_R_SUCCESS) + printf("undefine('%s'): %s\n", cp, + isc_result_totext(result)); + } else { + key = cp; + while (*cp != '\0' && *cp != ' ' && *cp != '\t') + cp++; + if (*cp == '\0') { + result = isc_symtab_lookup(st, key, 0, &value); + if (trace || result != ISC_R_SUCCESS) { + printf("lookup('%s'): %s", key, + isc_result_totext(result)); + if (result == ISC_R_SUCCESS) { + cp = value.as_pointer; + printf(", value == '%s'", cp); + } + printf("\n"); + } + } else { + *cp++ = '\0'; + key = isc_mem_strdup(mctx, key); + value.as_pointer = isc_mem_strdup(mctx, cp); + result = isc_symtab_define(st, key, 1, value, + exists_policy); + if (trace || result != ISC_R_SUCCESS) { + printf("define('%s', '%s'): %s\n", + key, cp, + isc_result_totext(result)); + if (result != ISC_R_SUCCESS) + undefine_action(key, 1, + value, NULL); + } + } + } + } + + isc_symtab_destroy(&st); + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/task_test.c b/bin/tests/optional/task_test.c new file mode 100644 index 0000000..1088010 --- /dev/null +++ b/bin/tests/optional/task_test.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +isc_mem_t *mctx = NULL; + +static void +my_callback(isc_task_t *task, isc_event_t *event) { + int i, j; + char *name = event->ev_arg; + + j = 0; + for (i = 0; i < 1000000; i++) + j += 100; + printf("task %s (%p): %d\n", name, task, j); + isc_event_free(&event); +} + +static void +my_shutdown(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + + printf("shutdown %s (%p)\n", name, task); + isc_event_free(&event); +} + +static void +my_tick(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + + printf("task %p tick %s\n", task, name); + isc_event_free(&event); +} + +static char one[] = "1"; +static char two[] = "2"; +static char three[] = "3"; +static char four[] = "4"; +static char foo[] = "foo"; +static char bar[] = "bar"; + +int +main(int argc, char *argv[]) { + isc_taskmgr_t *manager = NULL; + isc_task_t *t1 = NULL, *t2 = NULL; + isc_task_t *t3 = NULL, *t4 = NULL; + isc_event_t *event; + unsigned int workers; + isc_timermgr_t *timgr; + isc_timer_t *ti1, *ti2; + struct isc_interval interval; + + if (argc > 1) { + workers = atoi(argv[1]); + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else + workers = 2; + printf("%u workers\n", workers); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, &manager) == + ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_task_create(manager, 0, &t1) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(manager, 0, &t2) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(manager, 0, &t3) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(manager, 0, &t4) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_task_onshutdown(t1, my_shutdown, one) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t2, my_shutdown, two) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t3, my_shutdown, three) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t4, my_shutdown, four) == + ISC_R_SUCCESS); + + timgr = NULL; + RUNTIME_CHECK(isc_timermgr_create(mctx, &timgr) == ISC_R_SUCCESS); + ti1 = NULL; + + isc_interval_set(&interval, 1, 0); + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, + &interval, t1, my_tick, foo, &ti1) == + ISC_R_SUCCESS); + + ti2 = NULL; + isc_interval_set(&interval, 1, 0); + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, + &interval, t2, my_tick, bar, &ti2) == + ISC_R_SUCCESS); + + printf("task 1 = %p\n", t1); + printf("task 2 = %p\n", t2); +#ifndef WIN32 + sleep(2); +#else + Sleep(2000); +#endif + + /* + * Note: (void *)1 is used as a sender here, since some compilers + * don't like casting a function pointer to a (void *). + * + * In a real use, it is more likely the sender would be a + * structure (socket, timer, task, etc) but this is just a test + * program. + */ + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, one, + sizeof(*event)); + isc_task_send(t1, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, two, + sizeof(*event)); + isc_task_send(t2, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, three, + sizeof(*event)); + isc_task_send(t3, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, four, + sizeof(*event)); + isc_task_send(t4, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, two, + sizeof(*event)); + isc_task_send(t2, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, three, + sizeof(*event)); + isc_task_send(t3, &event); + event = isc_event_allocate(mctx, (void *)1, 1, my_callback, four, + sizeof(*event)); + isc_task_send(t4, &event); + isc_task_purgerange(t3, + NULL, + ISC_EVENTTYPE_FIRSTEVENT, + ISC_EVENTTYPE_LASTEVENT, NULL); + + isc_task_detach(&t1); + isc_task_detach(&t2); + isc_task_detach(&t3); + isc_task_detach(&t4); + +#ifndef WIN32 + sleep(10); +#else + Sleep(10000); +#endif + printf("destroy\n"); + isc_timer_detach(&ti1); + isc_timer_detach(&ti2); + isc_timermgr_destroy(&timgr); + isc_taskmgr_destroy(&manager); + printf("destroyed\n"); + + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/optional/timer_test.c b/bin/tests/optional/timer_test.c new file mode 100644 index 0000000..53d3b35 --- /dev/null +++ b/bin/tests/optional/timer_test.c @@ -0,0 +1,181 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +isc_mem_t *mctx1, *mctx2, *mctx3; +isc_task_t *t1, *t2, *t3; +isc_timer_t *ti1, *ti2, *ti3; +int tick_count = 0; + +static void +shutdown_task(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + + printf("task %p shutdown %s\n", task, name); + isc_event_free(&event); +} + +static void +tick(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + + INSIST(event->ev_type == ISC_TIMEREVENT_TICK); + + printf("task %s (%p) tick\n", name, task); + + tick_count++; + if (ti3 != NULL && tick_count % 3 == 0) + isc_timer_touch(ti3); + + if (ti3 != NULL && tick_count == 7) { + isc_time_t expires; + isc_interval_t interval; + + isc_interval_set(&interval, 5, 0); + (void)isc_time_nowplusinterval(&expires, &interval); + isc_interval_set(&interval, 4, 0); + printf("*** resetting ti3 ***\n"); + RUNTIME_CHECK(isc_timer_reset(ti3, isc_timertype_once, + &expires, &interval, true) == + ISC_R_SUCCESS); + } + + isc_event_free(&event); +} + +static void +timeout(isc_task_t *task, isc_event_t *event) { + char *name = event->ev_arg; + const char *type; + + INSIST(event->ev_type == ISC_TIMEREVENT_IDLE || + event->ev_type == ISC_TIMEREVENT_LIFE); + + if (event->ev_type == ISC_TIMEREVENT_IDLE) + type = "idle"; + else + type = "life"; + printf("task %s (%p) %s timeout\n", name, task, type); + + if (strcmp(name, "3") == 0) { + printf("*** saving task 3 ***\n"); + isc_event_free(&event); + return; + } + + isc_event_free(&event); + isc_task_shutdown(task); +} + +static char one[] = "1"; +static char two[] = "2"; +static char three[] = "3"; + +int +main(int argc, char *argv[]) { + isc_taskmgr_t *manager = NULL; + isc_timermgr_t *timgr = NULL; + unsigned int workers; + isc_time_t expires, now; + isc_interval_t interval; + + if (argc > 1) { + workers = atoi(argv[1]); + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else + workers = 2; + printf("%u workers\n", workers); + + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx1) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_taskmgr_create(mctx1, workers, 0, &manager) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_timermgr_create(mctx1, &timgr) == ISC_R_SUCCESS); + + RUNTIME_CHECK(isc_task_create(manager, 0, &t1) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(manager, 0, &t2) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_create(manager, 0, &t3) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t1, shutdown_task, one) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t2, shutdown_task, two) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_task_onshutdown(t3, shutdown_task, three) == + ISC_R_SUCCESS); + + printf("task 1: %p\n", t1); + printf("task 2: %p\n", t2); + printf("task 3: %p\n", t3); + + TIME_NOW(&now); + + isc_interval_set(&interval, 2, 0); + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, NULL, + &interval, t2, timeout, two, &ti2) == + ISC_R_SUCCESS); + + isc_interval_set(&interval, 1, 0); + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_ticker, NULL, + &interval, t1, tick, one, &ti1) == + ISC_R_SUCCESS); + + isc_interval_set(&interval, 10, 0); + RUNTIME_CHECK(isc_time_add(&now, &interval, &expires) == + ISC_R_SUCCESS); + isc_interval_set(&interval, 2, 0); + RUNTIME_CHECK(isc_timer_create(timgr, isc_timertype_once, &expires, + &interval, t3, timeout, three, &ti3) == + ISC_R_SUCCESS); + + isc_task_detach(&t1); + isc_task_detach(&t2); + isc_task_detach(&t3); + +#ifndef WIN32 + sleep(15); +#else + Sleep(15000); +#endif + printf("destroy\n"); + isc_timer_detach(&ti1); + isc_timer_detach(&ti2); + isc_timer_detach(&ti3); +#ifndef WIN32 + sleep(2); +#else + Sleep(2000); +#endif + isc_timermgr_destroy(&timgr); + isc_taskmgr_destroy(&manager); + printf("destroyed\n"); + + printf("Statistics for mctx1:\n"); + isc_mem_stats(mctx1, stdout); + isc_mem_destroy(&mctx1); + + return (0); +} diff --git a/bin/tests/optional/zone_test.c b/bin/tests/optional/zone_test.c new file mode 100644 index 0000000..5ab46f1 --- /dev/null +++ b/bin/tests/optional/zone_test.c @@ -0,0 +1,309 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +#include + +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef ISC_PLATFORM_NEEDSYSSELECTH +#include +#endif + +static int debug = 0; +static int quiet = 0; +static int stats = 0; +static isc_mem_t *mctx = NULL; +dns_zone_t *zone = NULL; +isc_taskmgr_t *taskmgr = NULL; +isc_timermgr_t *timermgr = NULL; +isc_socketmgr_t *socketmgr = NULL; +dns_zonemgr_t *zonemgr = NULL; +dns_zonetype_t zonetype = dns_zone_master; +isc_sockaddr_t addr; + +#define ERRRET(result, function) \ + do { \ + if (result != ISC_R_SUCCESS) { \ + fprintf(stderr, "%s() returned %s\n", \ + function, dns_result_totext(result)); \ + return; \ + } \ + } while (0) + +#define ERRCONT(result, function) \ + if (result != ISC_R_SUCCESS) { \ + fprintf(stderr, "%s() returned %s\n", \ + function, dns_result_totext(result)); \ + continue; \ + } else \ + (void)NULL + +static void +usage(void) { + fprintf(stderr, + "usage: zone_test [-dqsSM] [-c class] [-f file] zone\n"); + exit(1); +} + +static void +setup(const char *zonename, const char *filename, const char *classname) { + isc_result_t result; + dns_rdataclass_t rdclass; + isc_consttextregion_t region; + isc_buffer_t buffer; + dns_fixedname_t fixorigin; + dns_name_t *origin; + const char *rbt = "rbt"; + + if (debug) + fprintf(stderr, "loading \"%s\" from \"%s\" class \"%s\"\n", + zonename, filename, classname); + result = dns_zone_create(&zone, mctx); + ERRRET(result, "dns_zone_new"); + + dns_zone_settype(zone, zonetype); + + isc_buffer_constinit(&buffer, zonename, strlen(zonename)); + isc_buffer_add(&buffer, strlen(zonename)); + dns_fixedname_init(&fixorigin); + result = dns_name_fromtext(dns_fixedname_name(&fixorigin), + &buffer, dns_rootname, 0, NULL); + ERRRET(result, "dns_name_fromtext"); + origin = dns_fixedname_name(&fixorigin); + + result = dns_zone_setorigin(zone, origin); + ERRRET(result, "dns_zone_setorigin"); + + result = dns_zone_setdbtype(zone, 1, &rbt); + ERRRET(result, "dns_zone_setdatabase"); + + result = dns_zone_setfile(zone, filename); + ERRRET(result, "dns_zone_setfile"); + + region.base = classname; + region.length = strlen(classname); + result = dns_rdataclass_fromtext(&rdclass, + (isc_textregion_t *)(void*)®ion); + ERRRET(result, "dns_rdataclass_fromtext"); + + dns_zone_setclass(zone, rdclass); + + if (zonetype == dns_zone_slave) + dns_zone_setmasters(zone, &addr, 1); + + result = dns_zone_load(zone); + ERRRET(result, "dns_zone_load"); + + result = dns_zonemgr_managezone(zonemgr, zone); + ERRRET(result, "dns_zonemgr_managezone"); +} + +static void +print_rdataset(dns_name_t *name, dns_rdataset_t *rdataset) { + isc_buffer_t text; + char t[1000]; + isc_result_t result; + isc_region_t r; + + isc_buffer_init(&text, t, sizeof(t)); + result = dns_rdataset_totext(rdataset, name, false, false, + &text); + isc_buffer_usedregion(&text, &r); + if (result == ISC_R_SUCCESS) + printf("%.*s", (int)r.length, (char *)r.base); + else + printf("%s\n", dns_result_totext(result)); +} + +static void +query(void) { + char buf[1024]; + dns_fixedname_t name; + dns_fixedname_t found; + dns_db_t *db; + char *s; + isc_buffer_t buffer; + isc_result_t result; + dns_rdataset_t rdataset; + dns_rdataset_t sigset; + fd_set rfdset; + + db = NULL; + result = dns_zone_getdb(zone, &db); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "%s() returned %s\n", "dns_zone_getdb", + dns_result_totext(result)); + return; + } + + dns_fixedname_init(&found); + dns_rdataset_init(&rdataset); + dns_rdataset_init(&sigset); + + do { + + fprintf(stdout, "zone_test "); + fflush(stdout); + FD_ZERO(&rfdset); + FD_SET(0, &rfdset); + select(1, &rfdset, NULL, NULL, NULL); + if (fgets(buf, sizeof(buf), stdin) == NULL) { + fprintf(stdout, "\n"); + break; + } + buf[sizeof(buf) - 1] = '\0'; + + s = strchr(buf, '\n'); + if (s != NULL) + *s = '\0'; + s = strchr(buf, '\r'); + if (s != NULL) + *s = '\0'; + if (strcmp(buf, "dump") == 0) { + dns_zone_dumptostream(zone, stdout); + continue; + } + if (strlen(buf) == 0U) + continue; + dns_fixedname_init(&name); + isc_buffer_init(&buffer, buf, strlen(buf)); + isc_buffer_add(&buffer, strlen(buf)); + result = dns_name_fromtext(dns_fixedname_name(&name), + &buffer, dns_rootname, 0, NULL); + ERRCONT(result, "dns_name_fromtext"); + + result = dns_db_find(db, dns_fixedname_name(&name), + NULL /*vesion*/, + dns_rdatatype_a, + 0 /*options*/, + 0 /*time*/, + NULL /*nodep*/, + dns_fixedname_name(&found), + &rdataset, &sigset); + fprintf(stderr, "%s() returned %s\n", "dns_db_find", + dns_result_totext(result)); + switch (result) { + case DNS_R_DELEGATION: + print_rdataset(dns_fixedname_name(&found), &rdataset); + break; + case ISC_R_SUCCESS: + print_rdataset(dns_fixedname_name(&name), &rdataset); + break; + default: + break; + } + + if (dns_rdataset_isassociated(&rdataset)) + dns_rdataset_disassociate(&rdataset); + if (dns_rdataset_isassociated(&sigset)) + dns_rdataset_disassociate(&sigset); + } while (1); + dns_rdataset_invalidate(&rdataset); + dns_db_detach(&db); +} + +int +main(int argc, char **argv) { + int c; + char *filename = NULL; + const char *classname = "IN"; + + while ((c = isc_commandline_parse(argc, argv, "cdf:m:qsMS")) != EOF) { + switch (c) { + case 'c': + classname = isc_commandline_argument; + break; + case 'd': + debug++; + break; + case 'f': + if (filename != NULL) + usage(); + filename = isc_commandline_argument; + break; + case 'm': + memset(&addr, 0, sizeof(addr)); + addr.type.sin.sin_family = AF_INET; + if (inet_pton(AF_INET, isc_commandline_argument, + &addr.type.sin.sin_addr) != 1) { + fprintf(stderr, "bad master address '%s'\n", + isc_commandline_argument); + exit(1); + } + addr.type.sin.sin_port = htons(53); + break; + case 'q': + quiet++; + break; + case 's': + stats++; + break; + case 'S': + zonetype = dns_zone_slave; + break; + case 'M': + zonetype = dns_zone_master; + break; + default: + usage(); + } + } + + if (argv[isc_commandline_index] == NULL) + usage(); + + RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_mem_create(0, 0, &mctx) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, &taskmgr) == + ISC_R_SUCCESS); + RUNTIME_CHECK(isc_timermgr_create(mctx, &timermgr) == ISC_R_SUCCESS); + RUNTIME_CHECK(isc_socketmgr_create(mctx, &socketmgr) == ISC_R_SUCCESS); + RUNTIME_CHECK(dns_zonemgr_create(mctx, taskmgr, timermgr, socketmgr, + &zonemgr) == ISC_R_SUCCESS); + if (filename == NULL) + filename = argv[isc_commandline_index]; + setup(argv[isc_commandline_index], filename, classname); + query(); + if (zone != NULL) + dns_zone_detach(&zone); + dns_zonemgr_shutdown(zonemgr); + dns_zonemgr_detach(&zonemgr); + isc_socketmgr_destroy(&socketmgr); + isc_taskmgr_destroy(&taskmgr); + isc_timermgr_destroy(&timermgr); + if (!quiet && stats) + isc_mem_stats(mctx, stdout); + isc_mem_destroy(&mctx); + + return (0); +} diff --git a/bin/tests/pkcs11/Makefile.in b/bin/tests/pkcs11/Makefile.in new file mode 100644 index 0000000..73e0596 --- /dev/null +++ b/bin/tests/pkcs11/Makefile.in @@ -0,0 +1,44 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +@BIND9_MAKE_INCLUDES@ + +PROVIDER = @PKCS11_PROVIDER@ + +CINCLUDES = ${ISC_INCLUDES} + +CDEFINES = -DPK11_LIB_LOCATION=\"${PROVIDER}\" + +ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ + +LIBS = ${ISCLIBS} @LIBS@ + +SUBDIRS = benchmarks + +TARGETS = pkcs11-md5sum@EXEEXT@ pkcs11-hmacmd5@EXEEXT@ +SRCS = pkcs11-md5sum.c pkcs11-hmacmd5.c + +@BIND9_MAKE_RULES@ + +pkcs11-md5sum@EXEEXT@: @srcdir@/pkcs11-md5sum.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/pkcs11-md5sum.c ${LIBS} + +pkcs11-hmacmd5@EXEEXT@: @srcdir@/pkcs11-hmacmd5.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/pkcs11-hmacmd5.c ${LIBS} + +test: + +clean distclean:: + rm -f ${TARGETS} diff --git a/bin/tests/pkcs11/README b/bin/tests/pkcs11/README new file mode 100644 index 0000000..2b594d9 --- /dev/null +++ b/bin/tests/pkcs11/README @@ -0,0 +1,15 @@ +"pkcs11-hmacmd5" is here to check for the presence of a known bug in +the Thales nCipher PKCS#11 provider library. To test for the bug, use +pkcs11-hmacmd5 to hash a test vector from RFC 2104, and determine +whether the resulting digest is is correct. For instance: + + echo -n "Hi There" | \ + ./pkcs11-hmacmd5 -p -k '0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b' + +...must return "9294727a3638bb1c13f48ef8158bfc9d". + +If any other value is returned, then the provider library is buggy, +and theflag PK11_MD5_HMAC_REPLACE must be defined in +lib/isc/include/pk11/site.h +However, if the correct value is returned, then it is safe to turn +off PK11_MD5_HMAC_REPLACE. (It is on by default.) diff --git a/bin/tests/pkcs11/benchmarks/Makefile.in b/bin/tests/pkcs11/benchmarks/Makefile.in new file mode 100644 index 0000000..15f5460 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/Makefile.in @@ -0,0 +1,83 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +@BIND9_MAKE_INCLUDES@ + +PROVIDER = @PKCS11_PROVIDER@ + +CINCLUDES = ${ISC_INCLUDES} + +CDEFINES = -DPK11_LIB_LOCATION=\"${PROVIDER}\" + +ISCLIBS = ../../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ + +LIBS = ${ISCLIBS} @LIBS@ + +SUBDIRS = + +TARGETS = session@EXEEXT@ login@EXEEXT@ random@EXEEXT@ \ + sha1@EXEEXT@ create@EXEEXT@ find@EXEEXT@ \ + pubrsa@EXEEXT@ privrsa@EXEEXT@ genrsa@EXEEXT@ \ + sign@EXEEXT@ verify@EXEEXT@ + +SRCS = session.c login.c random.c sha1.c create.c find.c \ + pubrsa.c privrsa.c genrsa.c sign.c verify.c + +@BIND9_MAKE_RULES@ + +session@EXEEXT@: @srcdir@/session.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/session.c ${LIBS} + +login@EXEEXT@: @srcdir@/login.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/login.c ${LIBS} + +random@EXEEXT@: @srcdir@/random.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/random.c ${LIBS} + +sha1@EXEEXT@: @srcdir@/sha1.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/sha1.c ${LIBS} + +create@EXEEXT@: @srcdir@/create.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/create.c ${LIBS} + +find@EXEEXT@: @srcdir@/find.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/find.c ${LIBS} + +pubrsa@EXEEXT@: @srcdir@/pubrsa.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/pubrsa.c ${LIBS} + +privrsa@EXEEXT@: @srcdir@/privrsa.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/privrsa.c ${LIBS} + +genrsa@EXEEXT@: @srcdir@/genrsa.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/genrsa.c ${LIBS} + +sign@EXEEXT@: @srcdir@/sign.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/sign.c ${LIBS} + +verify@EXEEXT@: @srcdir@/verify.c + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ + -o $@ @srcdir@/verify.c ${LIBS} + +clean distclean:: + rm -f ${TARGETS} diff --git a/bin/tests/pkcs11/benchmarks/create.c b/bin/tests/pkcs11/benchmarks/create.c new file mode 100644 index 0000000..683aa40 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/create.c @@ -0,0 +1,263 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* create [-m module] [-s $slot] [-p pin] [-t] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE buf[1024]; +char label[16]; + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_OBJECT_HANDLE *hKey; + CK_OBJECT_CLASS kClass = CKO_DATA; + CK_ULONG len = sizeof(buf); + CK_ATTRIBUTE kTemplate[] = + { + { CKA_CLASS, &kClass, (CK_ULONG) sizeof(kClass) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_LABEL, (CK_BYTE_PTR) label, (CK_ULONG) sizeof(label) }, + { CKA_VALUE, buf, (CK_ULONG) sizeof(buf) } + }; + pk11_context_t pctx; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tn:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + break; + case 't': + ontoken = 1; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tcreate [-m module] [-s slot] [-t] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Allocate hanles */ + hKey = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (hKey == NULL) { + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) + hKey[i] = CK_INVALID_HANDLE; + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, OP_ANY, true, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + /* Randomize the buffer */ + rv = pkcs_C_GenerateRandom(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, "C_GenerateRandom: Error = 0x%.8lX\n", rv); + goto exit_objects; + } + + if (ontoken) + kTemplate[1].pValue = &truevalue; + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_objects; + } + + for (i = 0; i < count; i++) { + (void) snprintf(label, sizeof(label), "obj%u", i); + kTemplate[3].ulValueLen = strlen(label); + rv = pkcs_C_CreateObject(hSession, kTemplate, 5, &hKey[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_CreateObject[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_objects; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_objects; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u created objects in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g created objects/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_objects: + for (i = 0; i < count; i++) { + /* Destroy objects */ + if (hKey[i] == CK_INVALID_HANDLE) + continue; + rv = pkcs_C_DestroyObject(hSession, hKey[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_DestroyObject[%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + } + + free(hKey); + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/find.c b/bin/tests/pkcs11/benchmarks/find.c new file mode 100644 index 0000000..08d065a --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/find.c @@ -0,0 +1,232 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* find [-m module] [-s $slot] [-p pin] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE label[] = "foo??bar!!"; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_ATTRIBUTE sTemplate[] = + { + { CKA_LABEL, label, (CK_ULONG) sizeof(label) }, + }; + CK_OBJECT_HANDLE sKey = CK_INVALID_HANDLE; + CK_ULONG found = 0; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tfind [-m module] [-s slot] [-p pin] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, false, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_objects; + } + + for (i = 0; !error && (i < count); i++) { + rv = pkcs_C_FindObjectsInit(hSession, sTemplate, 1); + if (rv != CKR_OK) { + fprintf(stderr, + "C_FindObjectsInit[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + + rv = pkcs_C_FindObjects(hSession, &sKey, 1, &found); + if (rv != CKR_OK) { + fprintf(stderr, + "C_FindObjects[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + /* no break here! */ + } + + rv = pkcs_C_FindObjectsFinal(hSession); + if (rv != CKR_OK) { + fprintf(stderr, + "C_FindObjectsFinal[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_objects; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u object searches in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g object searches/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_objects: + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/genrsa.c b/bin/tests/pkcs11/benchmarks/genrsa.c new file mode 100644 index 0000000..c642586 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/genrsa.c @@ -0,0 +1,298 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* genrsa [-m module] [-s $slot] [-p pin] [-t] [-b bits] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_MECHANISM mech = { CKM_RSA_PKCS_KEY_PAIR_GEN, NULL, 0 }; + CK_OBJECT_HANDLE *pubKey; + CK_OBJECT_HANDLE *privKey; + CK_OBJECT_CLASS pubClass = CKO_PUBLIC_KEY; + CK_OBJECT_CLASS privClass = CKO_PRIVATE_KEY; + CK_KEY_TYPE kType = CKK_RSA; + CK_ULONG bits = 1024; + CK_BYTE exponent[] = { 0x01, 0x00, 0x01 }; + CK_ATTRIBUTE pubTemplate[] = + { + { CKA_CLASS, &pubClass, (CK_ULONG) sizeof(pubClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_VERIFY, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_MODULUS_BITS, &bits, (CK_ULONG) sizeof(bits) }, + { CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG) sizeof(exponent) } + }; + CK_ATTRIBUTE privTemplate[] = + { + { CKA_CLASS, &privClass, (CK_ULONG) sizeof(privClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_SIGN, &truevalue, (CK_ULONG) sizeof(truevalue) }, + }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tb:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 't': + ontoken = 1; + break; + case 'b': + bits = (CK_ULONG)atoi(isc_commandline_argument); + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tgenrsa [-m module] [-s slot] [-p pin] " + "[-t] [-b bits] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Allocate hanles */ + pubKey = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (pubKey == NULL) { + perror("malloc"); + exit(1); + } + privKey = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (privKey == NULL) { + free(pubKey); + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) { + pubKey[i] = CK_INVALID_HANDLE; + privKey[i] = CK_INVALID_HANDLE; + } + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + if (ontoken) { + pubTemplate[2].pValue = &truevalue; + privTemplate[2].pValue = &truevalue; + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_keys; + } + + for (i = 0; i < count; i++) { + rv = pkcs_C_GenerateKeyPair(hSession, &mech, + pubTemplate, 7, + privTemplate, 5, + &pubKey[i], &privKey[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_GenerateKeyPair[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_keys; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_keys; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u generated RSA in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g generated RSA/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_keys: + for (i = 0; i < count; i++) { + /* Destroy keys */ + if (pubKey[i] == CK_INVALID_HANDLE) + goto destroy_priv; + rv = pkcs_C_DestroyObject(hSession, pubKey[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_DestroyObject[pub%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + destroy_priv: + if (privKey[i] == CK_INVALID_HANDLE) + continue; + rv = pkcs_C_DestroyObject(hSession, privKey[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_DestroyObject[priv%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + } + + free(pubKey); + free(privKey); + + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/login.c b/bin/tests/pkcs11/benchmarks/login.c new file mode 100644 index 0000000..280e983 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/login.c @@ -0,0 +1,252 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* login [-m module] [-s $slot] [-p pin] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +int +main(int argc, char *argv[]) { + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE *hSession; + CK_UTF8CHAR *pin = NULL; + char *lib_name = NULL; + int error = 0; + int c, errflg = 0; + unsigned int count = 1000; + unsigned int i, j; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + break; + case 'p': + pin = (CK_UTF8CHAR *)isc_commandline_argument; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tlogin [-m module] [-s slot] [-p pin] [-n count]\n"); + exit(1); + } + + /* allocate sessions */ + hSession = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (hSession == NULL) { + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) + hSession[i] = CK_INVALID_HANDLE; + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = (CK_UTF8CHAR *)getpassphrase("Enter Pin: "); + + rv = pkcs_C_Initialize(NULL_PTR); + if (rv != CKR_OK) { + if (rv == 0xfe) + fprintf(stderr, + "Can't load or link module \"%s\"\n", + pk11_get_lib_name()); + else + fprintf(stderr, "C_Initialize: Error = 0x%.8lX\n", rv); + free(hSession); + exit(1); + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_program; + } + + /* loop */ + for (i = 0; i < count; i++) { + /* Open sessions */ + rv = pkcs_C_OpenSession(slot, CKF_SERIAL_SESSION, + NULL_PTR, NULL_PTR, &hSession[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_OpenSession[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_program; + break; + } + + /* Logon */ + rv = pkcs_C_Login(hSession[i], CKU_USER, + pin, strlen((char *)pin)); + if (rv != CKR_OK) { + fprintf(stderr, + "C_Login[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_program; + break; + } + + /* Logoff */ + rv = pkcs_C_Logout(hSession[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_Logout[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_program; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_program; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u logins in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g logins/s\n", + i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + for (j = 0; j < i; j++) { + if (hSession[j] == CK_INVALID_HANDLE) + continue; + /* Close sessions */ + rv = pkcs_C_CloseSession(hSession[j]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_CloseSession[%u]: Error = 0x%.8lX\n", + j, rv); + errflg = 1; + } + } + + exit_program: + free(hSession); + + rv = pkcs_C_Finalize(NULL_PTR); + if (rv != CKR_OK) + fprintf(stderr, "C_Finalize: Error = 0x%.8lX\n", rv); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/privrsa.c b/bin/tests/pkcs11/benchmarks/privrsa.c new file mode 100644 index 0000000..791a9a0 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/privrsa.c @@ -0,0 +1,363 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* privrsa [-m module] [-s $slot] [-p pin] [-t] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE modulus[] = { + 0x00, 0xb7, 0x9c, 0x1f, 0x05, 0xa3, 0xc2, 0x99, + 0x44, 0x82, 0x20, 0x78, 0x43, 0x7f, 0x5f, 0x3b, + 0x10, 0xd7, 0x9e, 0x61, 0x42, 0xd2, 0x7a, 0x90, + 0x50, 0x8a, 0x99, 0x33, 0xe7, 0xca, 0xc8, 0x5f, + 0x16, 0x1c, 0x56, 0xf8, 0xc1, 0x06, 0x2f, 0x96, + 0xe7, 0x54, 0xf2, 0x85, 0x89, 0x41, 0x36, 0xf5, + 0x4c, 0xa4, 0x0d, 0x62, 0xd3, 0x42, 0x51, 0x6b, + 0x9f, 0xdc, 0x36, 0xcb, 0xad, 0x56, 0xf4, 0xbd, + 0x2a, 0x60, 0x33, 0xb1, 0x7a, 0x99, 0xad, 0x08, + 0x9f, 0x95, 0xe8, 0xe5, 0x14, 0xd9, 0x68, 0x79, + 0xca, 0x4e, 0x72, 0xeb, 0xfb, 0x2c, 0xf1, 0x45, + 0xd3, 0x33, 0x65, 0xe7, 0xc5, 0x11, 0xdd, 0xe7, + 0x09, 0x83, 0x13, 0xd5, 0x17, 0x1b, 0xf4, 0xbd, + 0x49, 0xdd, 0x8a, 0x3c, 0x3c, 0xf7, 0xa1, 0x5d, + 0x7b, 0xb4, 0xd3, 0x80, 0x25, 0xf4, 0x05, 0x8f, + 0xbc, 0x2c, 0x2a, 0x47, 0xff, 0xd1, 0xc8, 0x34, + 0xbf +}; +CK_BYTE pubexp[] = { 0x01, 0x00, 0x01 }; +CK_BYTE privexp[] = { + 0x00, 0xae, 0x02, 0xf1, 0x47, 0xa8, 0x07, 0x02, + 0xb8, 0xf1, 0xd6, 0x92, 0x03, 0xee, 0x50, 0x33, + 0xab, 0x67, 0x9e, 0x3b, 0xb1, 0x57, 0xc7, 0x3e, + 0xc4, 0x86, 0x46, 0x61, 0xf1, 0xf8, 0xb6, 0x63, + 0x9f, 0x91, 0xe6, 0x3f, 0x44, 0xb8, 0x77, 0x1b, + 0xbe, 0x4c, 0x3c, 0xb8, 0x9f, 0xf7, 0x45, 0x7d, + 0xbf, 0x4f, 0xef, 0x3b, 0xcc, 0xda, 0x1a, 0x4e, + 0x34, 0xa8, 0x40, 0xea, 0x51, 0x72, 0x8a, 0xea, + 0x47, 0x06, 0x04, 0xd0, 0x62, 0x31, 0xa0, 0x6c, + 0x09, 0x60, 0xf9, 0xc7, 0x95, 0x88, 0x4a, 0xd7, + 0x19, 0xce, 0x89, 0x08, 0x87, 0x14, 0xef, 0xcc, + 0x0a, 0xef, 0x72, 0xb9, 0x21, 0xf5, 0xf0, 0xcd, + 0x6d, 0xe5, 0xfa, 0x15, 0x7f, 0xae, 0x33, 0x9f, + 0x26, 0xac, 0x2e, 0x52, 0x02, 0x07, 0xfb, 0x1d, + 0x4b, 0xec, 0x9a, 0x6b, 0x3b, 0x26, 0x1f, 0x52, + 0xfc, 0x47, 0xf8, 0x66, 0x33, 0xfa, 0x50, 0x6c, + 0x41 +}; +CK_BYTE prime1[] = { + 0x00, 0xe8, 0x98, 0xeb, 0xa1, 0xf0, 0xce, 0xde, + 0xc2, 0x74, 0x01, 0x18, 0x2b, 0xd3, 0x8f, 0x58, + 0xcd, 0xe9, 0x8e, 0x97, 0xbe, 0xfe, 0xe8, 0x6f, + 0xd6, 0x0c, 0x0a, 0x47, 0xf8, 0x56, 0x84, 0x36, + 0x15, 0xe6, 0x75, 0x1c, 0x69, 0x48, 0x8b, 0xf5, + 0x0f, 0x84, 0xd2, 0x60, 0x8b, 0xa2, 0x2a, 0xa1, + 0xeb, 0xed, 0xbe, 0x2d, 0xe9, 0x41, 0x0b, 0xed, + 0x17, 0x7c, 0xd3, 0xa6, 0x35, 0x6e, 0xa6, 0xd8, + 0x21 +}; +CK_BYTE prime2[] = { + 0x00, 0xca, 0x15, 0x6a, 0x43, 0x5e, 0x83, 0xc9, + 0x09, 0xeb, 0x14, 0x1e, 0x46, 0x46, 0x97, 0xfa, + 0xfa, 0x3c, 0x61, 0x7e, 0xc1, 0xf8, 0x8c, 0x5e, + 0xcb, 0xbf, 0xe4, 0xb9, 0x78, 0x7f, 0x4f, 0xab, + 0x82, 0x15, 0x53, 0xaa, 0x04, 0xee, 0x11, 0x21, + 0x2e, 0x23, 0x08, 0xa0, 0x14, 0x6d, 0x3a, 0x88, + 0xe6, 0xf8, 0xbe, 0x61, 0x38, 0x99, 0xca, 0x36, + 0x0d, 0x3e, 0x42, 0x0f, 0x63, 0x4d, 0x73, 0xf0, + 0xdf +}; +CK_BYTE exp_1[] = { + 0x66, 0x2d, 0xb7, 0x65, 0xbe, 0x99, 0xc2, 0x35, + 0xfe, 0x2b, 0xf4, 0xe8, 0x5b, 0xd9, 0xdf, 0x13, + 0x26, 0x04, 0xe4, 0x18, 0x9d, 0x76, 0x92, 0x9a, + 0x9f, 0x53, 0x6c, 0xe6, 0x65, 0x6b, 0x53, 0x2f, + 0x2f, 0xbc, 0x46, 0xac, 0xe1, 0x97, 0xca, 0x21, + 0xf5, 0x21, 0x4e, 0x14, 0x49, 0x3b, 0x1d, 0x42, + 0xbd, 0x80, 0x0c, 0x3f, 0x29, 0xba, 0x09, 0x7f, + 0x85, 0xf0, 0x9c, 0x55, 0x60, 0xb4, 0x9e, 0xc1 +}; +CK_BYTE exp_2[] = { + 0x00, 0x87, 0x22, 0x74, 0xf1, 0xe2, 0x15, 0x3c, + 0x6d, 0xde, 0x7e, 0x90, 0x94, 0x2c, 0x06, 0xdb, + 0xb5, 0x54, 0x85, 0x59, 0xcf, 0x7a, 0x56, 0xdb, + 0xd9, 0x62, 0x54, 0x20, 0x56, 0xdc, 0xc3, 0xb9, + 0x0b, 0xff, 0x18, 0xf8, 0x7b, 0xdd, 0x7b, 0x24, + 0xf6, 0x06, 0x45, 0x71, 0x4e, 0xd7, 0x90, 0x2a, + 0x16, 0x52, 0x46, 0x75, 0x1a, 0xf5, 0x74, 0x8c, + 0x5a, 0xa4, 0xc4, 0x66, 0x27, 0xe0, 0x96, 0x64, + 0x7f +}; +CK_BYTE coeff[] = { + 0x00, 0xd0, 0x1f, 0xb3, 0x47, 0x40, 0x93, 0x8b, + 0x99, 0xd7, 0xb5, 0xc6, 0x09, 0x82, 0x65, 0x94, + 0x9d, 0x56, 0x0a, 0x05, 0x55, 0x7d, 0x93, 0x04, + 0xa4, 0x26, 0xee, 0x42, 0x86, 0xa3, 0xf1, 0xd5, + 0x7a, 0x42, 0x84, 0x3c, 0x21, 0x96, 0x9a, 0xd9, + 0x36, 0xd4, 0x62, 0x01, 0xb0, 0x8b, 0x77, 0xe5, + 0xcc, 0x1b, 0xd2, 0x12, 0xd2, 0x9c, 0x89, 0x67, + 0x0c, 0x00, 0x09, 0x56, 0x8c, 0x33, 0x57, 0xf9, + 0x8c +}; + +char label[16]; + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_OBJECT_HANDLE *hKey; + CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY; + CK_KEY_TYPE kType = CKK_RSA; + CK_ATTRIBUTE kTemplate[] = + { + { CKA_CLASS, &kClass, (CK_ULONG) sizeof(kClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_LABEL, (CK_BYTE_PTR) label, (CK_ULONG) sizeof(label) }, + { CKA_SIGN, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_MODULUS, modulus, (CK_ULONG) sizeof(modulus) }, + { CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG) sizeof(pubexp) }, + { CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG) sizeof(privexp) }, + { CKA_PRIME_1, prime1, (CK_ULONG) sizeof(prime1) }, + { CKA_PRIME_2, prime2, (CK_ULONG) sizeof(prime2) }, + { CKA_EXPONENT_1, exp_1, (CK_ULONG) sizeof(exp_1) }, + { CKA_EXPONENT_2, exp_2, (CK_ULONG) sizeof(exp_2) }, + { CKA_COEFFICIENT, coeff, (CK_ULONG) sizeof(coeff) } + }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tn:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 't': + ontoken = 1; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tprivrsa [-m module] [-s slot] [-p pin] " + "[-t] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Allocate hanles */ + hKey = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (hKey == NULL) { + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) + hKey[i] = CK_INVALID_HANDLE; + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + free(hKey); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + if (ontoken) + kTemplate[2].pValue = &truevalue; + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_objects; + } + + for (i = 0; i < count; i++) { + (void) snprintf(label, sizeof(label), "obj%u", i); + kTemplate[4].ulValueLen = strlen(label); + rv = pkcs_C_CreateObject(hSession, kTemplate, 14, &hKey[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_CreateObject[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_objects; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_objects; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u private RSA keys in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g private RSA keys/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_objects: + for (i = 0; i < count; i++) { + /* Destroy objects */ + if (hKey[i] == CK_INVALID_HANDLE) + continue; + rv = pkcs_C_DestroyObject(hSession, hKey[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_DestroyObject[%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + } + + free(hKey); + + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/pubrsa.c b/bin/tests/pkcs11/benchmarks/pubrsa.c new file mode 100644 index 0000000..9a40b53 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/pubrsa.c @@ -0,0 +1,284 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* pubrsa [-m module] [-s $slot] [-p pin] [-t] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE modulus[] = { + 0x00, 0xb7, 0x9c, 0x1f, 0x05, 0xa3, 0xc2, 0x99, + 0x44, 0x82, 0x20, 0x78, 0x43, 0x7f, 0x5f, 0x3b, + 0x10, 0xd7, 0x9e, 0x61, 0x42, 0xd2, 0x7a, 0x90, + 0x50, 0x8a, 0x99, 0x33, 0xe7, 0xca, 0xc8, 0x5f, + 0x16, 0x1c, 0x56, 0xf8, 0xc1, 0x06, 0x2f, 0x96, + 0xe7, 0x54, 0xf2, 0x85, 0x89, 0x41, 0x36, 0xf5, + 0x4c, 0xa4, 0x0d, 0x62, 0xd3, 0x42, 0x51, 0x6b, + 0x9f, 0xdc, 0x36, 0xcb, 0xad, 0x56, 0xf4, 0xbd, + 0x2a, 0x60, 0x33, 0xb1, 0x7a, 0x99, 0xad, 0x08, + 0x9f, 0x95, 0xe8, 0xe5, 0x14, 0xd9, 0x68, 0x79, + 0xca, 0x4e, 0x72, 0xeb, 0xfb, 0x2c, 0xf1, 0x45, + 0xd3, 0x33, 0x65, 0xe7, 0xc5, 0x11, 0xdd, 0xe7, + 0x09, 0x83, 0x13, 0xd5, 0x17, 0x1b, 0xf4, 0xbd, + 0x49, 0xdd, 0x8a, 0x3c, 0x3c, 0xf7, 0xa1, 0x5d, + 0x7b, 0xb4, 0xd3, 0x80, 0x25, 0xf4, 0x05, 0x8f, + 0xbc, 0x2c, 0x2a, 0x47, 0xff, 0xd1, 0xc8, 0x34, + 0xbf +}; +CK_BYTE exponent[] = { 0x01, 0x00, 0x01 }; + +char label[16]; + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_OBJECT_HANDLE *hKey; + CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY; + CK_KEY_TYPE kType = CKK_RSA; + CK_ATTRIBUTE kTemplate[] = + { + { CKA_CLASS, &kClass, (CK_ULONG) sizeof(kClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_LABEL, (CK_BYTE_PTR) label, (CK_ULONG) sizeof(label) }, + { CKA_VERIFY, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_MODULUS, modulus, (CK_ULONG) sizeof(modulus) }, + { CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG) sizeof(exponent) } + }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tn:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 't': + ontoken = 1; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tpubrsa [-m module] [-s slot] [-p pin] " + "[-t] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Allocate hanles */ + hKey = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (hKey == NULL) { + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) + hKey[i] = CK_INVALID_HANDLE; + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + free(hKey); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + if (ontoken) + kTemplate[2].pValue = &truevalue; + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_objects; + } + + for (i = 0; i < count; i++) { + (void) snprintf(label, sizeof(label), "obj%u", i); + kTemplate[4].ulValueLen = strlen(label); + rv = pkcs_C_CreateObject(hSession, kTemplate, 8, &hKey[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_CreateObject[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_objects; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_objects; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u public RSA keys in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g public RSA keys/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_objects: + for (i = 0; i < count; i++) { + /* Destroy objects */ + if (hKey[i] == CK_INVALID_HANDLE) + continue; + rv = pkcs_C_DestroyObject(hSession, hKey[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_DestroyObject[%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + } + + free(hKey); + + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/random.c b/bin/tests/pkcs11/benchmarks/random.c new file mode 100644 index 0000000..144cfa8 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/random.c @@ -0,0 +1,194 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* random [-m module] [-s $slot] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE buf[1024]; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_ULONG len = sizeof(buf); + pk11_context_t pctx; + pk11_optype_t op_type = OP_RAND; + char *lib_name = NULL; + int error = 0; + int c, errflg = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\trandom [-m module] [-s slot] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + result = pk11_get_session(&pctx, op_type, false, false, + false, NULL, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + hSession = pctx.session; + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_session; + } + + for (i = 0; i < count; i++) { + /* Get random bytes */ + rv = pkcs_C_GenerateRandom(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, + "C_GenerateRandom[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_session; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%uK random bytes in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g random bytes/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_session: + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/session.c b/bin/tests/pkcs11/benchmarks/session.c new file mode 100644 index 0000000..2b576f3 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/session.c @@ -0,0 +1,216 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* session [-m module] [-s $slot] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +int +main(int argc, char *argv[]) { + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE *hSession; + char *lib_name = NULL; + int error = 0; + int c, errflg = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tsession [-m module] [-s slot] [-n count]\n"); + exit(1); + } + + /* Allocate sessions */ + hSession = (CK_SESSION_HANDLE *) + malloc(count * sizeof(CK_SESSION_HANDLE)); + if (hSession == NULL) { + perror("malloc"); + exit(1); + } + for (i = 0; i < count; i++) + hSession[i] = CK_INVALID_HANDLE; + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + rv = pkcs_C_Initialize(NULL_PTR); + if (rv != CKR_OK) { + if (rv == 0xfe) + fprintf(stderr, + "Can't load or link module \"%s\"\n", + pk11_get_lib_name()); + else + fprintf(stderr, "C_Initialize: Error = 0x%.8lX\n", rv); + free(hSession); + exit(1); + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_program; + } + + /* loop */ + for (i = 0; i < count; i++) { + /* Open sessions */ + rv = pkcs_C_OpenSession(slot, CKF_SERIAL_SESSION, + NULL_PTR, NULL_PTR, &hSession[i]); + if (rv != CKR_OK) { + fprintf(stderr, + "C_OpenSession[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + if (i == 0) + goto exit_program; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_program; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u sessions in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g sessions/s\n", + i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + for (i = 0; i < count; i++) { + /* Close sessions */ + if (hSession[i] == CK_INVALID_HANDLE) + continue; + rv = pkcs_C_CloseSession(hSession[i]); + if ((rv != CKR_OK) && !errflg) { + fprintf(stderr, + "C_CloseSession[%u]: Error = 0x%.8lX\n", + i, rv); + errflg = 1; + } + } + + exit_program: + free(hSession); + + rv = pkcs_C_Finalize(NULL_PTR); + if (rv != CKR_OK) + fprintf(stderr, "C_Finalize: Error = 0x%.8lX\n", rv); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/sha1.c b/bin/tests/pkcs11/benchmarks/sha1.c new file mode 100644 index 0000000..cc8ca45 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/sha1.c @@ -0,0 +1,217 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* sha1 [-m module] [-s $slot] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE buf[1024]; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_MECHANISM mech = { CKM_SHA_1, NULL, 0 }; + CK_ULONG len = sizeof(buf); + pk11_context_t pctx; + pk11_optype_t op_type = OP_DIGEST; + char *lib_name = NULL; + int error = 0; + int c, errflg = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:n:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tssha1 [-m module] [-s slot] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + result = pk11_get_session(&pctx, op_type, false, false, + false, NULL, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + hSession = pctx.session; + + /* Randomize the buffer */ + rv = pkcs_C_GenerateRandom(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, "C_GenerateRandom: Error = 0x%.8lX\n", rv); + goto exit_session; + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_session; + } + + /* Initialize Digest */ + rv = pkcs_C_DigestInit(hSession, &mech); + if (rv != CKR_OK) { + fprintf(stderr, "C_DigestInit: Error = 0x%.8lX\n", rv); + goto exit_session; + } + + + for (i = 0; i < count; i++) { + /* Digest buffer */ + rv = pkcs_C_DigestUpdate(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, + "C_DigestUpdate[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + } + + /* Finalize Digest (unconditionally) */ + len = 20U; + rv = pkcs_C_DigestFinal(hSession, buf, &len); + if ((rv != CKR_OK) && !error) + fprintf(stderr, "C_DigestFinal: Error = 0x%.8lX\n", rv); + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_session; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%uK digested bytes in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g digested bytes/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_session: + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/sign.c b/bin/tests/pkcs11/benchmarks/sign.c new file mode 100644 index 0000000..e9cdd6b --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/sign.c @@ -0,0 +1,371 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* signrsa [-m module] [-s $slot] [-p pin] [-t] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE modulus[] = { + 0x00, 0xb7, 0x9c, 0x1f, 0x05, 0xa3, 0xc2, 0x99, + 0x44, 0x82, 0x20, 0x78, 0x43, 0x7f, 0x5f, 0x3b, + 0x10, 0xd7, 0x9e, 0x61, 0x42, 0xd2, 0x7a, 0x90, + 0x50, 0x8a, 0x99, 0x33, 0xe7, 0xca, 0xc8, 0x5f, + 0x16, 0x1c, 0x56, 0xf8, 0xc1, 0x06, 0x2f, 0x96, + 0xe7, 0x54, 0xf2, 0x85, 0x89, 0x41, 0x36, 0xf5, + 0x4c, 0xa4, 0x0d, 0x62, 0xd3, 0x42, 0x51, 0x6b, + 0x9f, 0xdc, 0x36, 0xcb, 0xad, 0x56, 0xf4, 0xbd, + 0x2a, 0x60, 0x33, 0xb1, 0x7a, 0x99, 0xad, 0x08, + 0x9f, 0x95, 0xe8, 0xe5, 0x14, 0xd9, 0x68, 0x79, + 0xca, 0x4e, 0x72, 0xeb, 0xfb, 0x2c, 0xf1, 0x45, + 0xd3, 0x33, 0x65, 0xe7, 0xc5, 0x11, 0xdd, 0xe7, + 0x09, 0x83, 0x13, 0xd5, 0x17, 0x1b, 0xf4, 0xbd, + 0x49, 0xdd, 0x8a, 0x3c, 0x3c, 0xf7, 0xa1, 0x5d, + 0x7b, 0xb4, 0xd3, 0x80, 0x25, 0xf4, 0x05, 0x8f, + 0xbc, 0x2c, 0x2a, 0x47, 0xff, 0xd1, 0xc8, 0x34, + 0xbf +}; +CK_BYTE pubexp[] = { 0x01, 0x00, 0x01 }; +CK_BYTE privexp[] = { + 0x00, 0xae, 0x02, 0xf1, 0x47, 0xa8, 0x07, 0x02, + 0xb8, 0xf1, 0xd6, 0x92, 0x03, 0xee, 0x50, 0x33, + 0xab, 0x67, 0x9e, 0x3b, 0xb1, 0x57, 0xc7, 0x3e, + 0xc4, 0x86, 0x46, 0x61, 0xf1, 0xf8, 0xb6, 0x63, + 0x9f, 0x91, 0xe6, 0x3f, 0x44, 0xb8, 0x77, 0x1b, + 0xbe, 0x4c, 0x3c, 0xb8, 0x9f, 0xf7, 0x45, 0x7d, + 0xbf, 0x4f, 0xef, 0x3b, 0xcc, 0xda, 0x1a, 0x4e, + 0x34, 0xa8, 0x40, 0xea, 0x51, 0x72, 0x8a, 0xea, + 0x47, 0x06, 0x04, 0xd0, 0x62, 0x31, 0xa0, 0x6c, + 0x09, 0x60, 0xf9, 0xc7, 0x95, 0x88, 0x4a, 0xd7, + 0x19, 0xce, 0x89, 0x08, 0x87, 0x14, 0xef, 0xcc, + 0x0a, 0xef, 0x72, 0xb9, 0x21, 0xf5, 0xf0, 0xcd, + 0x6d, 0xe5, 0xfa, 0x15, 0x7f, 0xae, 0x33, 0x9f, + 0x26, 0xac, 0x2e, 0x52, 0x02, 0x07, 0xfb, 0x1d, + 0x4b, 0xec, 0x9a, 0x6b, 0x3b, 0x26, 0x1f, 0x52, + 0xfc, 0x47, 0xf8, 0x66, 0x33, 0xfa, 0x50, 0x6c, + 0x41 +}; +CK_BYTE prime1[] = { + 0x00, 0xe8, 0x98, 0xeb, 0xa1, 0xf0, 0xce, 0xde, + 0xc2, 0x74, 0x01, 0x18, 0x2b, 0xd3, 0x8f, 0x58, + 0xcd, 0xe9, 0x8e, 0x97, 0xbe, 0xfe, 0xe8, 0x6f, + 0xd6, 0x0c, 0x0a, 0x47, 0xf8, 0x56, 0x84, 0x36, + 0x15, 0xe6, 0x75, 0x1c, 0x69, 0x48, 0x8b, 0xf5, + 0x0f, 0x84, 0xd2, 0x60, 0x8b, 0xa2, 0x2a, 0xa1, + 0xeb, 0xed, 0xbe, 0x2d, 0xe9, 0x41, 0x0b, 0xed, + 0x17, 0x7c, 0xd3, 0xa6, 0x35, 0x6e, 0xa6, 0xd8, + 0x21 +}; +CK_BYTE prime2[] = { + 0x00, 0xca, 0x15, 0x6a, 0x43, 0x5e, 0x83, 0xc9, + 0x09, 0xeb, 0x14, 0x1e, 0x46, 0x46, 0x97, 0xfa, + 0xfa, 0x3c, 0x61, 0x7e, 0xc1, 0xf8, 0x8c, 0x5e, + 0xcb, 0xbf, 0xe4, 0xb9, 0x78, 0x7f, 0x4f, 0xab, + 0x82, 0x15, 0x53, 0xaa, 0x04, 0xee, 0x11, 0x21, + 0x2e, 0x23, 0x08, 0xa0, 0x14, 0x6d, 0x3a, 0x88, + 0xe6, 0xf8, 0xbe, 0x61, 0x38, 0x99, 0xca, 0x36, + 0x0d, 0x3e, 0x42, 0x0f, 0x63, 0x4d, 0x73, 0xf0, + 0xdf +}; +CK_BYTE exp_1[] = { + 0x66, 0x2d, 0xb7, 0x65, 0xbe, 0x99, 0xc2, 0x35, + 0xfe, 0x2b, 0xf4, 0xe8, 0x5b, 0xd9, 0xdf, 0x13, + 0x26, 0x04, 0xe4, 0x18, 0x9d, 0x76, 0x92, 0x9a, + 0x9f, 0x53, 0x6c, 0xe6, 0x65, 0x6b, 0x53, 0x2f, + 0x2f, 0xbc, 0x46, 0xac, 0xe1, 0x97, 0xca, 0x21, + 0xf5, 0x21, 0x4e, 0x14, 0x49, 0x3b, 0x1d, 0x42, + 0xbd, 0x80, 0x0c, 0x3f, 0x29, 0xba, 0x09, 0x7f, + 0x85, 0xf0, 0x9c, 0x55, 0x60, 0xb4, 0x9e, 0xc1 +}; +CK_BYTE exp_2[] = { + 0x00, 0x87, 0x22, 0x74, 0xf1, 0xe2, 0x15, 0x3c, + 0x6d, 0xde, 0x7e, 0x90, 0x94, 0x2c, 0x06, 0xdb, + 0xb5, 0x54, 0x85, 0x59, 0xcf, 0x7a, 0x56, 0xdb, + 0xd9, 0x62, 0x54, 0x20, 0x56, 0xdc, 0xc3, 0xb9, + 0x0b, 0xff, 0x18, 0xf8, 0x7b, 0xdd, 0x7b, 0x24, + 0xf6, 0x06, 0x45, 0x71, 0x4e, 0xd7, 0x90, 0x2a, + 0x16, 0x52, 0x46, 0x75, 0x1a, 0xf5, 0x74, 0x8c, + 0x5a, 0xa4, 0xc4, 0x66, 0x27, 0xe0, 0x96, 0x64, + 0x7f +}; +CK_BYTE coeff[] = { + 0x00, 0xd0, 0x1f, 0xb3, 0x47, 0x40, 0x93, 0x8b, + 0x99, 0xd7, 0xb5, 0xc6, 0x09, 0x82, 0x65, 0x94, + 0x9d, 0x56, 0x0a, 0x05, 0x55, 0x7d, 0x93, 0x04, + 0xa4, 0x26, 0xee, 0x42, 0x86, 0xa3, 0xf1, 0xd5, + 0x7a, 0x42, 0x84, 0x3c, 0x21, 0x96, 0x9a, 0xd9, + 0x36, 0xd4, 0x62, 0x01, 0xb0, 0x8b, 0x77, 0xe5, + 0xcc, 0x1b, 0xd2, 0x12, 0xd2, 0x9c, 0x89, 0x67, + 0x0c, 0x00, 0x09, 0x56, 0x8c, 0x33, 0x57, 0xf9, + 0x8c +}; + +CK_BYTE buf[1024]; +CK_BYTE sig[128]; + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_ULONG len; + CK_ULONG slen; + CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE; + CK_OBJECT_CLASS kClass = CKO_PRIVATE_KEY; + CK_KEY_TYPE kType = CKK_RSA; + CK_ATTRIBUTE kTemplate[] = + { + { CKA_CLASS, &kClass, (CK_ULONG) sizeof(kClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_SIGN, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_MODULUS, modulus, (CK_ULONG) sizeof(modulus) }, + { CKA_PUBLIC_EXPONENT, pubexp, (CK_ULONG) sizeof(pubexp) }, + { CKA_PRIVATE_EXPONENT, privexp, (CK_ULONG) sizeof(privexp) }, + { CKA_PRIME_1, prime1, (CK_ULONG) sizeof(prime1) }, + { CKA_PRIME_2, prime2, (CK_ULONG) sizeof(prime2) }, + { CKA_EXPONENT_1, exp_1, (CK_ULONG) sizeof(exp_1) }, + { CKA_EXPONENT_2, exp_2, (CK_ULONG) sizeof(exp_2) }, + { CKA_COEFFICIENT, coeff, (CK_ULONG) sizeof(coeff) } + }; + CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tn:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 't': + ontoken = 1; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tsign [-m module] [-s slot] [-p pin] " + "[-t] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + /* Create the private RSA key */ + if (ontoken) + kTemplate[2].pValue = &truevalue; + + rv = pkcs_C_CreateObject(hSession, kTemplate, 13, &hKey); + if (rv != CKR_OK) { + fprintf(stderr, "C_CreateObject: Error = 0x%.8lX\n", rv); + goto exit_key; + } + + /* Randomize the buffer */ + len = (CK_ULONG) sizeof(buf); + rv = pkcs_C_GenerateRandom(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, "C_GenerateRandom: Error = 0x%.8lX\n", rv); + goto exit_key; + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_key; + } + + for (i = 0; i < count; i++) { + /* Initialize Sign */ + rv = pkcs_C_SignInit(hSession, &mech, hKey); + if (rv != CKR_OK) { + fprintf(stderr, + "C_SignInit[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + + /* Perform Sign */ + slen = (CK_ULONG) sizeof(sig); + rv = pkcs_C_Sign(hSession, buf, len, sig, &slen); + if (rv != CKR_OK) { + fprintf(stderr, + "C_Sign[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_key; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u RSA signs in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g RSA signs/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_key: + if (hKey != CK_INVALID_HANDLE) { + rv = pkcs_C_DestroyObject(hSession, hKey); + if (rv != CKR_OK) + fprintf(stderr, + "C_DestroyObject: Error = 0x%.8lX\n", + rv); + } + + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/benchmarks/verify.c b/bin/tests/pkcs11/benchmarks/verify.c new file mode 100644 index 0000000..b04b777 --- /dev/null +++ b/bin/tests/pkcs11/benchmarks/verify.c @@ -0,0 +1,295 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* verify [-m module] [-s $slot] [-p pin] [-t] [-n count] */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#ifndef HAVE_CLOCK_GETTIME + +#include + +#ifndef CLOCK_REALTIME +#define CLOCK_REALTIME 0 +#endif + +static int clock_gettime(int32_t id, struct timespec *tp); + +static int +clock_gettime(int32_t id, struct timespec *tp) +{ + struct timeval tv; + int result; + + UNUSED(id); + + result = gettimeofday(&tv, NULL); + if (result) + return (result); + tp->tv_sec = tv.tv_sec; + tp->tv_nsec = (long) tv.tv_usec * 1000; + return (result); +} +#endif + +CK_BYTE modulus[] = { + 0x00, 0xb7, 0x9c, 0x1f, 0x05, 0xa3, 0xc2, 0x99, + 0x44, 0x82, 0x20, 0x78, 0x43, 0x7f, 0x5f, 0x3b, + 0x10, 0xd7, 0x9e, 0x61, 0x42, 0xd2, 0x7a, 0x90, + 0x50, 0x8a, 0x99, 0x33, 0xe7, 0xca, 0xc8, 0x5f, + 0x16, 0x1c, 0x56, 0xf8, 0xc1, 0x06, 0x2f, 0x96, + 0xe7, 0x54, 0xf2, 0x85, 0x89, 0x41, 0x36, 0xf5, + 0x4c, 0xa4, 0x0d, 0x62, 0xd3, 0x42, 0x51, 0x6b, + 0x9f, 0xdc, 0x36, 0xcb, 0xad, 0x56, 0xf4, 0xbd, + 0x2a, 0x60, 0x33, 0xb1, 0x7a, 0x99, 0xad, 0x08, + 0x9f, 0x95, 0xe8, 0xe5, 0x14, 0xd9, 0x68, 0x79, + 0xca, 0x4e, 0x72, 0xeb, 0xfb, 0x2c, 0xf1, 0x45, + 0xd3, 0x33, 0x65, 0xe7, 0xc5, 0x11, 0xdd, 0xe7, + 0x09, 0x83, 0x13, 0xd5, 0x17, 0x1b, 0xf4, 0xbd, + 0x49, 0xdd, 0x8a, 0x3c, 0x3c, 0xf7, 0xa1, 0x5d, + 0x7b, 0xb4, 0xd3, 0x80, 0x25, 0xf4, 0x05, 0x8f, + 0xbc, 0x2c, 0x2a, 0x47, 0xff, 0xd1, 0xc8, 0x34, + 0xbf +}; +CK_BYTE exponent[] = { 0x01, 0x00, 0x01 }; + +CK_BYTE buf[1024]; +CK_BYTE sig[128]; + +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession = CK_INVALID_HANDLE; + CK_ULONG len; + CK_ULONG slen; + CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE; + CK_OBJECT_CLASS kClass = CKO_PUBLIC_KEY; + CK_KEY_TYPE kType = CKK_RSA; + CK_ATTRIBUTE kTemplate[] = + { + { CKA_CLASS, &kClass, (CK_ULONG) sizeof(kClass) }, + { CKA_KEY_TYPE, &kType, (CK_ULONG) sizeof(kType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_VERIFY, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_MODULUS, modulus, (CK_ULONG) sizeof(modulus) }, + { CKA_PUBLIC_EXPONENT, exponent, (CK_ULONG) sizeof(exponent) } + }; + CK_MECHANISM mech = { CKM_SHA1_RSA_PKCS, NULL, 0 }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_RSA; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + int c, errflg = 0; + int ontoken = 0; + unsigned int count = 1000; + unsigned int i; + struct timespec starttime; + struct timespec endtime; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:p:tn:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 't': + ontoken = 1; + break; + case 'n': + count = atoi(isc_commandline_argument); + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tverify [-m module] [-s slot] [-p pin] " + "[-t] [-n count]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, true, + true, (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NODIGESTSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + /* Create the private RSA key */ + if (ontoken) + kTemplate[2].pValue = &truevalue; + + rv = pkcs_C_CreateObject(hSession, kTemplate, 7, &hKey); + if (rv != CKR_OK) { + fprintf(stderr, "C_CreateObject: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_key; + } + + /* Randomize the buffer */ + len = (CK_ULONG) sizeof(buf); + rv = pkcs_C_GenerateRandom(hSession, buf, len); + if (rv != CKR_OK) { + fprintf(stderr, "C_GenerateRandom: Error = 0x%.8lX\n", rv); + goto exit_key; + } + + if (clock_gettime(CLOCK_REALTIME, &starttime) < 0) { + perror("clock_gettime(start)"); + goto exit_key; + } + + for (i = 0; i < count; i++) { + /* Initialize Verify */ + rv = pkcs_C_VerifyInit(hSession, &mech, hKey); + if (rv != CKR_OK) { + fprintf(stderr, + "C_VerifyInit[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + + /* Perform Verify */ + slen = (CK_ULONG) sizeof(sig); + rv = pkcs_C_Verify(hSession, buf, len, sig, slen); + if ((rv != CKR_OK) && (rv != CKR_SIGNATURE_INVALID)) { + fprintf(stderr, + "C_Verify[%u]: Error = 0x%.8lX\n", + i, rv); + error = 1; + break; + } + } + + if (clock_gettime(CLOCK_REALTIME, &endtime) < 0) { + perror("clock_gettime(end)"); + goto exit_key; + } + + endtime.tv_sec -= starttime.tv_sec; + endtime.tv_nsec -= starttime.tv_nsec; + while (endtime.tv_nsec < 0) { + endtime.tv_sec -= 1; + endtime.tv_nsec += 1000000000; + } + printf("%u RSA verify in %ld.%09lds\n", i, + endtime.tv_sec, endtime.tv_nsec); + if (i > 0) + printf("%g RSA verify/s\n", + 1024 * i / ((double) endtime.tv_sec + + (double) endtime.tv_nsec / 1000000000.)); + + exit_key: + if (hKey != CK_INVALID_HANDLE) { + rv = pkcs_C_DestroyObject(hSession, hKey); + if (rv != CKR_OK) { + fprintf(stderr, + "C_DestroyObject: Error = 0x%.8lX\n", + rv); + errflg = 1; + } + } + + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/pkcs11-hmacmd5.c b/bin/tests/pkcs11/pkcs11-hmacmd5.c new file mode 100644 index 0000000..ba4adb1 --- /dev/null +++ b/bin/tests/pkcs11/pkcs11-hmacmd5.c @@ -0,0 +1,327 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * pkcs11-hmacmd5 + * + * Prints the MD5 HMAC of the standard input, using the PKCS#11 device. + * + * Usage: + * pkcs11-hmacmd5 [-m module] [-s $slot] [-n] [-p $pin] + * -m: PKCS#11 provider module. This must be the full + * path to a shared library object implementing the + * PKCS#11 API for a device. + * -s: Slot + * -p: PIN + * -n: don't log in to the PKCS#11 device + * -k: key name for the HMAC + */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +/* Define static key template values */ +static CK_BBOOL truevalue = TRUE; +static CK_BBOOL falsevalue = FALSE; + +#define BLOCKSIZE 32768 + +char buffer[BLOCKSIZE + 72]; +char digest[16]; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession; + CK_MECHANISM mech = { CKM_MD5_HMAC, NULL, 0 }; + CK_ULONG len; + CK_OBJECT_HANDLE hKey = CK_INVALID_HANDLE; + CK_OBJECT_CLASS keyClass = CKO_SECRET_KEY; + CK_KEY_TYPE keyType = CKK_MD5_HMAC; + CK_ATTRIBUTE keyTemplate[] = + { + { CKA_CLASS, &keyClass, (CK_ULONG) sizeof(keyClass) }, + { CKA_KEY_TYPE, &keyType, (CK_ULONG) sizeof(keyType) }, + { CKA_TOKEN, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_PRIVATE, &falsevalue, (CK_ULONG) sizeof(falsevalue) }, + { CKA_SIGN, &truevalue, (CK_ULONG) sizeof(truevalue) }, + { CKA_VALUE, NULL, 0 } + }; + pk11_context_t pctx; + pk11_optype_t op_type = OP_DIGEST; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + bool logon = true; + int c, errflg = 0; + char *key = NULL; + size_t sum = 0; + unsigned int i; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:np:k:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'n': + logon = false; + break; + case 'p': + pin = isc_commandline_argument; + break; + case 'k': + key = isc_commandline_argument; + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg || (key == NULL)) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tpkcs11-hmacmd5 [-m module] [-s slot] " + "[-n|-p pin] -k key\n"); + exit(1); + } + + /* Decode the key */ + for (i = 0; i < BLOCKSIZE / 2; i++) { + switch (c = *key++) { + case 0: + goto key_done; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if ((i & 1) == 0) + buffer[i >> 1] = (c - '0') << 4; + else + buffer[i >> 1] |= c - '0'; + break; + case 'A': + case 'B': + case 'C': + case 'D': + case 'E': + case 'F': + if ((i & 1) == 0) + buffer[i >> 1] = (c - 'A' + 10) << 4; + else + buffer[i >> 1] |= c - 'A' + 10; + break; + case 'a': + case 'b': + case 'c': + case 'd': + case 'e': + case 'f': + if ((i & 1) == 0) + buffer[i >> 1] = (c - 'a' + 10) << 4; + else + buffer[i >> 1] |= c - 'a' + 10; + break; + default: + fprintf(stderr, "Not hexdigit '%c' in key\n", c); + exit(1); + } + } + key_done: + if ((i & 1) != 0) { + fprintf(stderr, "Even number of hexdigits in key\n"); + exit(1); + } + len = i >> 1; + keyTemplate[5].pValue = buffer; + keyTemplate[5].ulValueLen = (CK_ULONG) len; + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (logon && pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, false, logon, + (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + rv = pkcs_C_CreateObject(hSession, keyTemplate, (CK_ULONG) 6, &hKey); + if (rv != CKR_OK) { + fprintf(stderr, "C_CreateObject: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_session; + } + if (hKey == CK_INVALID_HANDLE) { + fprintf(stderr, "C_CreateObject failed\n"); + error = 1; + goto exit_session; + } + + rv = pkcs_C_SignInit(hSession, &mech, hKey); + if (rv != CKR_OK) { + fprintf(stderr, "C_SignInit: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_sign; + } + + for (;;) { + size_t n; + + for (;;) { + n = fread(buffer + sum, 1, BLOCKSIZE - sum, stdin); + sum += n; + if (sum == BLOCKSIZE) + break; + if (n == 0) { + if (ferror(stdin)) { + fprintf(stderr, "fread failed\n"); + error = 1; + goto exit_sign; + } + goto partial_block; + } + if (feof(stdin)) + goto partial_block; + } + + rv = pkcs_C_SignUpdate(hSession, (CK_BYTE_PTR) buffer, + (CK_ULONG) BLOCKSIZE); + if (rv != CKR_OK) { + fprintf(stderr, + "C_SignUpdate: Error = 0x%.8lX\n", + rv); + error = 1; + goto exit_sign; + } + } + +partial_block: + if (sum > 0) { + rv = pkcs_C_SignUpdate(hSession, (CK_BYTE_PTR) buffer, + (CK_ULONG) sum); + if (rv != CKR_OK) { + fprintf(stderr, + "C_SignUpdate: Error = 0x%.8lX\n", + rv); + error = 1; + goto exit_sign; + } + } + + len = 16; + rv = pkcs_C_SignFinal(hSession, (CK_BYTE_PTR) digest, &len); + if (rv != CKR_OK) { + fprintf(stderr, "C_SignFinal: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_sign; + } + if (len != 16) { + fprintf(stderr, "C_SignFinal: bad length = %lu\n", len); + error = 1; + } + + for (i = 0; i < 16; i++) + printf("%02x", digest[i] & 0xff); + printf("\n"); + + exit_sign: + rv = pkcs_C_DestroyObject(hSession, hKey); + if ((error == 0) && (rv != CKR_OK)) { + fprintf(stderr, "C_DestroyObject: Error = 0x%.8lX\n", rv); + error = 1; + } + + exit_session: + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/pkcs11/pkcs11-md5sum.c b/bin/tests/pkcs11/pkcs11-md5sum.c new file mode 100644 index 0000000..56f3a61 --- /dev/null +++ b/bin/tests/pkcs11/pkcs11-md5sum.c @@ -0,0 +1,230 @@ +/* + * Copyright (C) Internet Systems Consortium, Inc. ("ISC") + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * See the COPYRIGHT file distributed with this work for additional + * information regarding copyright ownership. + */ + +/* + * Portions copyright (c) 2008 Nominet UK. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * pkcs11-md5sum + * + * Prints the MD5 checksum of the standard input, using the PKCS#11 device. + * + * Usage: + * pkcs11-md5sum [-m module] [-s $slot] [-n] [-p $pin] + * -m: PKCS#11 provider module. This must be the full + * path to a shared library object implementing the + * PKCS#11 API for a device. + * -s: Slot + * -p: PIN + * -n: don't log in to the PKCS#11 device + */ + +/*! \file */ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#if !(defined(HAVE_GETPASSPHRASE) || (defined (__SVR4) && defined (__sun))) +#define getpassphrase(x) getpass(x) +#endif + +#define BLOCKSIZE 32768 + +char buffer[BLOCKSIZE + 72]; +char digest[16]; + +int +main(int argc, char *argv[]) { + isc_result_t result; + CK_RV rv; + CK_SLOT_ID slot = 0; + CK_SESSION_HANDLE hSession; + CK_MECHANISM mech = { CKM_MD5, NULL, 0 }; + CK_ULONG len; + pk11_context_t pctx; + pk11_optype_t op_type = OP_DIGEST; + char *lib_name = NULL; + char *pin = NULL; + int error = 0; + bool logon = true; + int c, errflg = 0; + size_t sum = 0; + unsigned int i; + + while ((c = isc_commandline_parse(argc, argv, ":m:s:np:")) != -1) { + switch (c) { + case 'm': + lib_name = isc_commandline_argument; + break; + case 's': + slot = atoi(isc_commandline_argument); + op_type = OP_ANY; + break; + case 'n': + logon = false; + break; + case 'p': + pin = isc_commandline_argument; + break; + case ':': + fprintf(stderr, + "Option -%c requires an operand\n", + isc_commandline_option); + errflg++; + break; + case '?': + default: + fprintf(stderr, "Unrecognised option: -%c\n", + isc_commandline_option); + errflg++; + } + } + + if (errflg) { + fprintf(stderr, "Usage:\n"); + fprintf(stderr, + "\tpkcs11-md5sum [-m module] [-s slot] [-n|-p pin]\n"); + exit(1); + } + + pk11_result_register(); + + /* Initialize the CRYPTOKI library */ + if (lib_name != NULL) + pk11_set_lib_name(lib_name); + + if (logon && pin == NULL) + pin = getpassphrase("Enter Pin: "); + + result = pk11_get_session(&pctx, op_type, false, false, logon, + (const char *) pin, slot); + if ((result != ISC_R_SUCCESS) && + (result != PK11_R_NORANDOMSERVICE) && + (result != PK11_R_NOAESSERVICE)) { + fprintf(stderr, "Error initializing PKCS#11: %s\n", + isc_result_totext(result)); + exit(1); + } + + if (pin != NULL) + memset(pin, 0, strlen((char *)pin)); + + hSession = pctx.session; + + rv = pkcs_C_DigestInit(hSession, &mech); + if (rv != CKR_OK) { + fprintf(stderr, "C_DigestInit: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_session; + } + + for (;;) { + size_t n; + + for (;;) { + n = fread(buffer + sum, 1, BLOCKSIZE - sum, stdin); + sum += n; + if (sum == BLOCKSIZE) + break; + if (n == 0) { + if (ferror(stdin)) { + fprintf(stderr, "fread failed\n"); + error = 1; + goto exit_session; + } + goto partial_block; + } + if (feof(stdin)) + goto partial_block; + } + + rv = pkcs_C_DigestUpdate(hSession, (CK_BYTE_PTR) buffer, + (CK_ULONG) BLOCKSIZE); + if (rv != CKR_OK) { + fprintf(stderr, + "C_DigestUpdate: Error = 0x%.8lX\n", + rv); + error = 1; + goto exit_session; + } + } + +partial_block: + if (sum > 0) { + rv = pkcs_C_DigestUpdate(hSession, (CK_BYTE_PTR) buffer, + (CK_ULONG) sum); + if (rv != CKR_OK) { + fprintf(stderr, + "C_DigestUpdate: Error = 0x%.8lX\n", + rv); + error = 1; + goto exit_session; + } + } + + len = 16; + rv = pkcs_C_DigestFinal(hSession, (CK_BYTE_PTR) digest, &len); + if (rv != CKR_OK) { + fprintf(stderr, "C_DigestFinal: Error = 0x%.8lX\n", rv); + error = 1; + goto exit_session; + } + if (len != 16) { + fprintf(stderr, "C_DigestFinal: bad length = %lu\n", len); + error = 1; + } + + for (i = 0; i < 16; i++) + printf("%02x", digest[i] & 0xff); + printf("\n"); + + exit_session: + pk11_return_session(&pctx); + (void) pk11_finalize(); + + exit(error); +} diff --git a/bin/tests/startperf/README b/bin/tests/startperf/README new file mode 100644 index 0000000..0b8185b --- /dev/null +++ b/bin/tests/startperf/README @@ -0,0 +1,17 @@ +These scripts generate a named.conf file with an arbitrary number of +small zones, for testing startup performance. + +To generate a test server with 1000 zones each of which contains 5 A +records, run: + + $ sh setup.sh 1000 5 > named.conf + +Zones are generated with random names, and the zone files are created +in the subdirectory "zones". + +Or, to generate a test server with 100 zones which all load from the same +generic file (smallzone.db): + + $ sh setup.sh -s 100 > named.conf + +The "number of records" argument is ignored if -s is used. diff --git a/bin/tests/startperf/clean.sh b/bin/tests/startperf/clean.sh new file mode 100644 index 0000000..4049ba3 --- /dev/null +++ b/bin/tests/startperf/clean.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +rm -rf zones +rm -f named.conf diff --git a/bin/tests/startperf/makenames.pl b/bin/tests/startperf/makenames.pl new file mode 100644 index 0000000..a2bb2cf --- /dev/null +++ b/bin/tests/startperf/makenames.pl @@ -0,0 +1,28 @@ +#!/usr/bin/perl +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +use strict; + +die "Usage: makenames.pl []" if (@ARGV == 0 || @ARGV > 2); +my $len = 10; +$len = @ARGV[1] if (@ARGV == 2); + +my @chars = split("", "abcdefghijklmnopqrstuvwxyz123456789"); + +srand; +for (my $i = 0; $i < @ARGV[0]; $i++) { + my $name = ""; + for (my $j = 0; $j < $len; $j++) { + my $r = rand 35; + $name .= $chars[$r]; + } + print "$name" . ".example\n"; +} diff --git a/bin/tests/startperf/mkzonefile.pl b/bin/tests/startperf/mkzonefile.pl new file mode 100644 index 0000000..f050535 --- /dev/null +++ b/bin/tests/startperf/mkzonefile.pl @@ -0,0 +1,45 @@ +#!/usr/bin/perl +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +use strict; + +die "Usage: makenames.pl zonename num_records" if (@ARGV != 2); +my $zname = @ARGV[0]; +my $nrecords = @ARGV[1]; + +my @chars = split("", "abcdefghijklmnopqrstuvwxyz"); + +print"\$TTL 300 ; 5 minutes +\$ORIGIN $zname. +@ IN SOA mname1. . ( + 2011080201 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 600 ; minimum (1 hour) + ) + NS ns +ns A 10.53.0.3\n"; + +srand; +for (my $i = 0; $i < $nrecords; $i++) { + my $name = ""; + for (my $j = 0; $j < 8; $j++) { + my $r = rand 25; + $name .= $chars[$r]; + } + print "$name" . "\tIN\tA\t"; + my $x = int rand 254; + my $y = int rand 254; + my $z = int rand 254; + print "10.$x.$y.$z\n"; +} + diff --git a/bin/tests/startperf/setup.sh b/bin/tests/startperf/setup.sh new file mode 100644 index 0000000..e784665 --- /dev/null +++ b/bin/tests/startperf/setup.sh @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +usage () { + echo "Usage: $0 [-s] []" + echo " -s: use the same zone file all zones" + exit 1 +} + +if [ "$#" -lt 1 -o "$#" -gt 3 ]; then + usage +fi + +single_file="" +if [ $1 = "-s" ]; then + single_file=yes + shift +fi + +nzones=$1 +shift + +nrecords=5 +[ "$#" -eq 1 ] && nrecords=$1 + +. ../system/conf.sh + +cat << EOF +options { + directory "`pwd`"; + listen-on { localhost; }; + listen-on-v6 { localhost; }; + port 5300; + allow-query { any; }; + allow-transfer { localhost; }; + allow-recursion { none; }; + recursion no; +}; + +key rndc_key { + secret "1234abcd8765"; + algorithm hmac-md5; +}; + +controls { + inet 127.0.0.1 port 9953 allow { any; } keys { rndc_key; }; +}; + +logging { + channel basic { + file "`pwd`/named.log" versions 3 size 100m; + severity info; + print-time yes; + print-severity no; + print-category no; + }; + category default { + basic; + }; +}; + +EOF + +$PERL makenames.pl $nzones | while read zonename; do + if [ $single_file ]; then + echo "zone $zonename { type master; file \"smallzone.db\"; };" + else + [ -d zones ] || mkdir zones + $PERL mkzonefile.pl $zonename $nrecords > zones/$zonename.db + echo "zone $zonename { type master; file \"zones/$zonename.db\"; };" + fi +done diff --git a/bin/tests/startperf/smallzone.db b/bin/tests/startperf/smallzone.db new file mode 100644 index 0000000..20a3b9d --- /dev/null +++ b/bin/tests/startperf/smallzone.db @@ -0,0 +1,26 @@ +; Copyright (C) Internet Systems Consortium, Inc. ("ISC") +; +; This Source Code Form is subject to the terms of the Mozilla Public +; License, v. 2.0. If a copy of the MPL was not distributed with this +; file, You can obtain one at http://mozilla.org/MPL/2.0/. +; +; See the COPYRIGHT file distributed with this work for additional +; information regarding copyright ownership. + +$TTL 300 ; 5 minutes +@ IN SOA mname1. . ( + 2000042407 ; serial + 20 ; refresh (20 seconds) + 20 ; retry (20 seconds) + 1814400 ; expire (3 weeks) + 3600 ; minimum (1 hour) + ) + NS ns +ns A 10.53.0.3 + +a A 10.0.0.1 +b A 10.0.0.2 +d A 10.0.0.4 +z A 10.0.0.26 +a.a.a.a A 10.0.0.3 +*.e A 10.0.0.6 diff --git a/bin/tests/system/Makefile.in b/bin/tests/system/Makefile.in new file mode 100644 index 0000000..c18b4c5 --- /dev/null +++ b/bin/tests/system/Makefile.in @@ -0,0 +1,140 @@ +# Copyright (C) Internet Systems Consortium, Inc. ("ISC") +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# See the COPYRIGHT file distributed with this work for additional +# information regarding copyright ownership. + +srcdir = @srcdir@ +VPATH = @srcdir@ +top_srcdir = @top_srcdir@ + +VERSION=@BIND9_VERSION@ + +@BIND9_MAKE_INCLUDES@ + +SUBDIRS = dlzexternal dyndb lwresd pipelined rndc rsabigexponent tkey + +CINCLUDES = ${ISC_INCLUDES} ${DNS_INCLUDES} + +CDEFINES = @USE_GSSAPI@ +CWARNINGS = + +DNSLIBS = +ISCLIBS = ../../../lib/isc/libisc.@A@ @ISC_OPENSSL_LIBS@ + +DNSDEPLIBS = +ISCDEPLIBS = + +DEPLIBS = + +LIBS = @LIBS@ + +OBJS = feature-test.@O@ +SRCS = feature-test.c + +TARGETS = feature-test@EXEEXT@ + +@BIND9_MAKE_RULES@ + +subdirs: ${TARGETS} + +feature-test@EXEEXT@: feature-test.@O@ + ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ feature-test.@O@ ${ISCLIBS} ${LIBS} + +# Running the scripts below is bypassed when a separate build directory is +# used. + +# Define the tests that can be run in parallel. This should be identical to +# the definition of PARALLELDIRS in conf.sh. Note: longer-running tests +# such as serve-stale and rpzrecurse are scheduled first to get more +# benefit from parallelism. +PARALLEL = rpzrecurse dnssec \ + acl additional addzone allow-query autosign \ + builtin cacheclean case catz chain \ + checkconf checknames checkzone \ + @CHECKDS@ @COVERAGE@ @KEYMGR@ \ + cookie database digdelv dlv dlz dlzexternal \ + dns64 @DNSTAP@ dscp dsdigest dyndb \ + ednscompliance emptyzones \ + fetchlimit filter-aaaa formerr forward \ + geoip glue idna inline integrity ixfr \ + legacy limits logfileconfig \ + masterfile masterformat metadata mkeys \ + names notify nslookup nsupdate nzd2nzf \ + pending pipelined \ + reclimit redirect resolver rndc rootkeysentinel rpz \ + rrchecker rrl rrsetorder rsabigexponent runtime \ + sfcache smartsign sortlist \ + spf staticstub statistics statschannel stub \ + tcp tsig tsiggss \ + unknown upforwd verify views wildcard \ + xfer xferquota zero zonechecks + +# Produce intermediate makefile that assigns unique port numbers to each +# parallel test. The start port number of 5,000 is arbitrary - it must just +# be greater than the highest privileged port, 1024. +# +# Test names need to be sanitized because Solaris make does not like +# underscores in target names and requires explicit differentiation +# between a target name and a directory name (.PHONY is not supported). + +.PHONY: parallel.mk + +parallel.mk: + @PARALLEL_SANITIZED=`echo $(PARALLEL) | sed "s|\([^ ][^ ]*\)|test-\1|g;" | tr _ -` ; \ + echo ".PHONY: $$PARALLEL_SANITIZED" > $@ ; \ + echo "" >> $@ ; \ + echo "check_interfaces:" >> $@ ; \ + echo " @${PERL} testsock.pl > /dev/null 2>&1 || { \\" >> $@ ; \ + echo " echo \"I:NOTE: System tests were skipped because they require that the\"; \\" >> $@ ; \ + echo " echo \"I: IP addresses 10.53.0.1 through 10.53.0.8 be configured\"; \\" >> $@ ; \ + echo " echo \"I: as alias addresses on the loopback interface. Please run\"; \\" >> $@ ; \ + echo " echo \"I: \"bin/tests/system/ifconfig.sh up\" as root to configure them.\"; \\" >> $@ ; \ + echo " exit 1; \\" >> $@ ; \ + echo " }" >> $@ ; \ + echo "" >> $@ ; \ + echo "test check: $$PARALLEL_SANITIZED" >> $@ ; \ + port=$${STARTPORT:-5000} ; \ + for directory in $(PARALLEL) ; do \ + echo "" >> $@ ; \ + echo "test-`echo $$directory | tr _ -`: check_interfaces" >> $@ ; \ + echo " @$(SHELL) ./run.sh -r -p $$port $$directory 2>&1 | tee $$directory/test.output" >> $@ ; \ + port=`expr $$port + 100` ; \ + done + +# Targets to run the tests. + +test: parallel.mk subdirs + @$(MAKE) -f parallel.mk check + @$(SHELL) ./runsequential.sh -r + @$(SHELL) ./testsummary.sh + +check: test + +# Other targets: +# +# testclean - delete files generated by running tests. +# clean - testclean + also delete files built for the tests by "make". +# distclean - clean + also delete test-related files generated by "configure". + +testclean clean distclean:: + if test -f ./cleanall.sh; then $(SHELL) ./cleanall.sh; fi + rm -f systests.output + rm -f random.data + rm -f parallel.mk + +clean distclean:: + rm -f ${TARGETS} + rm -f ${OBJS} + +distclean:: + rm -f conf.sh + +installdirs: + +install:: + +uninstall:: diff --git a/bin/tests/system/README b/bin/tests/system/README new file mode 100644 index 0000000..f527e79 --- /dev/null +++ b/bin/tests/system/README @@ -0,0 +1,773 @@ +Copyright (C) Internet Systems Consortium, Inc. ("ISC") + +See COPYRIGHT in the source root or http://isc.org/copyright.html for terms. + +Introduction +=== +This directory holds a simple test environment for running bind9 system tests +involving multiple name servers. + +With the exception of "common" (which holds configuration information common to +multiple tests) and "win32" (which holds files needed to run the tests in a +Windows environment), each directory holds a set of scripts and configuration +files to test different parts of BIND. The directories are named for the +aspect of BIND they test, for example: + + dnssec/ DNSSEC tests + forward/ Forwarding tests + glue/ Glue handling tests + +etc. + +Typically each set of tests sets up 2-5 name servers and then performs one or +more tests against them. Within the test subdirectory, each name server has a +separate subdirectory containing its configuration data. These subdirectories +are named "nsN" or "ansN" (where N is a number between 1 and 8, e.g. ns1, ans2 +etc.) + +The tests are completely self-contained and do not require access to the real +DNS. Generally, one of the test servers (usually ns1) is set up as a root +nameserver and is listed in the hints file of the others. + + +Preparing to Run the Tests +=== +To enable all servers to run on the same machine, they bind to separate virtual +IP addresses on the loopback interface. ns1 runs on 10.53.0.1, ns2 on +10.53.0.2, etc. Before running any tests, you must set up these addresses by +running the command + + sh ifconfig.sh up + +as root. The interfaces can be removed by executing the command: + + sh ifconfig.sh down + +... also as root. + +The servers use unprivileged ports (above 1024) instead of the usual port 53, +so they can be run without root privileges once the interfaces have been set +up. + + +Note for MacOS Users +--- +If you wish to make the interfaces survive across reboots, copy +org.isc.bind.system and org.isc.bind.system.plist to /Library/LaunchDaemons +then run + + launchctl load /Library/LaunchDaemons/org.isc.bind.system.plist + +... as root. + + +Running the System Tests +=== + +Running an Individual Test +--- +The tests can be run individually using the following command: + + sh run.sh [flags] [] + +e.g. + + sh run.sh [flags] notify + +Optional flags are: + + -k Keep servers running after the test completes. Each test + usually starts a number of nameservers, either instances + of the "named" being tested, or custom servers (written in + Python or Perl) that feature test-specific behavior. The + servers are automatically started before the test is run + and stopped after it ends. This flag leaves them running + at the end of the test, so that additional queries can be + sent by hand. To stop the servers afterwards, use the + command "sh stop.sh ". + + -n Noclean - do not remove the output files if the test + completes successfully. By default, files created by the + test are deleted if it passes; they are not deleted if the + test fails. + + -p Sets the range of ports used by the test. A block of 100 + ports is available for each test, the number given to the + "-p" switch being the number of the start of that block + (e.g. "-p 7900" will mean that the test is able to use + ports 7900 through 7999). If not specified, the test will + have ports 5000 to 5099 available to it. + + -r The "runall" flag. This is related to cleaning up after + the tests (see "Maintenance Notes" below). If specified, + it prevents a copy of the test's output listing from being + deleted when the directory is cleaned up after the test + completes. (The test's output listing comprises messages + produced by the test during its execution; it does not + include the output files produced by utilities such as + "dig" or "rndc", nor any logging output from named itself.) + It is usually only used when "run.sh" is being called + during a run of the entire test suite. Note that if "-n" + is specified on the "run.sh" command line, the test output + is retained even if this option is omitted. + +Arguments are: + + test-name Mandatory. The name of the test, which is the name of the + subdirectory in bin/tests/system holding the test files. + + test-arguments Optional arguments that are passed to each of the test's + scripts. + + +Running All The System Tests +--- +To run all the system tests, enter the command: + + sh runall.sh [-c] [-n] [numproc] + +The optional flag "-c" forces colored output (by default system test output is +not printed in color due to run.sh being piped through "tee"). + +The optional flag "-n" has the same effect as it does for "run.sh" - it causes +the retention of all output files from all tests. + +The optional "numproc" argument specifies the maximum number of tests that can +run in parallel. The default is 1, which means that all of the tests run +sequentially. If greater than 1, up to "numproc" tests will run simultaneously, +new tests being started as tests finish. Each test will get a unique set of +ports, so there is no danger of tests interfering with one another. Parallel +running will reduce the total time taken to run the BIND system tests, but will +mean that the output from all the tests sent to the screen will be mixed up +with one another. However, the systests.output file produced at the end of the +run (in the bin/tests/system directory) will contain the output from each test +in sequential order. + +Note that it is not possible to pass arguments to tests though the "runall.sh" +script. + +A run of all the system tests can also be initiated via make: + + make [-j numproc] test + +In this case, retention of the output files after a test completes successfully +is specified by setting the environment variable SYSTEMTEST_NO_CLEAN to 1 prior +to running make, e.g. + + SYSTEMTEST_NO_CLEAN=1 make [-j numproc] test + +while setting environment variable SYSTEMTEST_FORCE_COLOR to 1 forces system +test output to be printed in color. + + +Running Multiple System Test Suites Simultaneously +--- +In some cases it may be desirable to have multiple instances of the system test +suite running simultaneously (e.g. from different terminal windows). To do +this: + +1. Each installation must have its own directory tree. The system tests create +files in the test directories, so separate directory trees are required to +avoid interference between the same test running in the different +installations. + +2. For one of the test suites, the starting port number must be specified by +setting the environment variable STARTPORT before starting the test suite. +Each test suite comprises about 100 tests, each being allocated a set of 100 +ports. The port ranges for each test are allocated sequentially, so each test +suite requires about 10,000 ports to itself. By default, the port allocation +starts at 5,000. So the following set of commands: + + Terminal Window 1: + cd /bin/tests/system + sh runall.sh 4 + + Terminal Window 2: + cd /bin/tests/system + STARTPORT=20000 sh runall.sh 4 + +... will start the test suite for installation-1 using the default base port +of 5,000, so the test suite will use ports 5,000 through 15,000 (or there +abouts). The use of "STARTPORT=20000" to prefix the run of the test suite for +installation-2 will mean the test suite uses ports 20,000 through 30,000 or so. + + +Format of Test Output +--- +All output from the system tests is in the form of lines with the following +structure: + + :: [()] + +e.g. + + I:catz:checking that dom1.example is not served by master (1) + +The meanings of the fields are as follows: + + +This indicates the type of message. This is one of: + + S Start of the test + A Start of test (retained for backwards compatibility) + T Start of test (retained for backwards compatibility) + E End of the test + I Information. A test will typically output many of these messages + during its run, indicating test progress. Note that such a message may + be of the form "I:testname:failed", indicating that a sub-test has + failed. + R Result. Each test will result in one such message, which is of the + form: + + R:: + + where is one of: + + PASS The test passed + FAIL The test failed + SKIPPED The test was not run, usually because some + prerequisites required to run the test are missing. + UNTESTED The test was not run for some other reason, e.g. a + prerequisite is available but is not compatible with + the platform on which the test is run. + + +This is the name of the test from which the message emanated, which is also the +name of the subdirectory holding the test files. + + +This is text output by the test during its execution. + +() +If present, this will correlate with a file created by the test. The tests +execute commands and route the output of each command to a file. The name of +this file depends on the command and the test, but will usually be of the form: + + .out. + +e.g. nsupdate.out.test28, dig.out.q3. This aids diagnosis of problems by +allowing the output that caused the problem message to be identified. + + +Re-Running the Tests +--- +If there is a requirement to re-run a test (or the entire test suite), the +files produced by the tests should be deleted first. Normally, these files are +deleted if the test succeeds but are retained on error. + +Deletion of files produced by an individual test can be done with the command: + + sh clean.sh [-r] + +The optional flag is: + + -r The "runall" flag. This is related to cleaning up after + the tests (see "Maintenance Notes" below). If specified, + it prevents a copy of the test's output listing from being + deleted when the directory is cleaned after the test + completes. + +Deletion of the files produced by the set of tests (e.g. after the execution +of "runall.sh") can be deleted by the command: + + sh cleanall.sh + +or + + make testclean + +(Note that the Makefile has two other targets for cleaning up files: "clean" +will delete all the files produced by the tests, as well as the object and +executable files used by the tests. "distclean" does all the work of "clean" +as well as deleting configuration files produced by "configure".) + + +Developer Notes +=== +This section is intended for developers writing new tests. + + +Overview +--- +As noted above, each test is in a separate directory. To interact with the +test framework, the directories contain the following standard files: + +prereq.sh Run at the beginning to determine whether the test can be run at + all; if not, we see a result of R:SKIPPED or R:UNTESTED. This file + is optional: if not present, the test is assumed to have all its + prerequisites met. + +setup.sh Run after prereq.sh, this sets up the preconditions for the tests. + Although optional, virtually all tests will require such a file to + set up the ports they should use for the test. + +tests.sh Runs the actual tests. This file is mandatory. + +clean.sh Run at the end to clean up temporary files, but only if the test + was completed successfully and its running was not inhibited by the + "-n" switch being passed to "run.sh". Otherwise the temporary + files are left in place for inspection. + +ns These subdirectories contain test name servers that can be queried + or can interact with each other. The value of N indicates the + address the server listens on: for example, ns2 listens on + 10.53.0.2, and ns4 on 10.53.0.4. All test servers use an + unprivileged port, so they don't need to run as root. These + servers log at the highest debug level and the log is captured in + the file "named.run". + +ans Like ns[X], but these are simple mock name servers implemented in + Perl or Python. They are generally programmed to misbehave in ways + named would not so as to exercise named's ability to interoperate + with badly behaved name servers. + + +Port Usage +--- +In order for the tests to run in parallel, each test requires a unique set of +ports. These are specified by the "-p" option passed to "run.sh", which sets +environment variables that the scripts listed above can reference. + +The convention used in the system tests is that the number passed is the start +of a range of 100 ports. The test is free to use the ports as required, +although the first ten ports in the block are named and generally tests use the +named ports for their intended purpose. The names of the environment variables +are: + + PORT Number to be used for the query port. + CONTROLPORT Number to be used as the RNDC control port. + EXTRAPORT1 - EXTRAPORT8 Eight port numbers that can be used as needed. + +Two other environment variables are defined: + + LOWPORT The lowest port number in the range. + HIGHPORT The highest port number in the range. + +Since port ranges usually start on a boundary of 10, the variables are set such +that the last digit of the port number corresponds to the number of the +EXTRAPORTn variable. For example, if the port range were to start at 5200, the +port assignments would be: + + PORT = 5200 + EXTRAPORT1 = 5201 + : + EXTRAPORT8 = 5208 + CONTROLPORT = 5209 + LOWPORT = 5200 + HIGHPORT = 5299 + +When running tests in parallel (i.e. giving a value of "numproc" greater than 1 +in the "make" or "runall.sh" commands listed above), it is guaranteed that each +test will get a set of unique port numbers. + + +Writing a Test +--- +The test framework requires up to four shell scripts (listed above) as well as +a number of nameserver instances to run. Certain expectations are put on each +script: + + +General +--- +1. Each of the four scripts will be invoked with the command + + (cd ; sh