diff --git a/.gitignore b/.gitignore index bb2e9e9a88..71607aa297 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,13 @@ *.gcno *.la *.lo +*.log *.o *.orig *.plist/ # ccc-analyzer store its results in .plist directories *.rej *.so +*.trs *_test *.ipch # vscode/intellisense precompiled header *~ @@ -63,3 +65,4 @@ timestamp /cppcheck.results /tsan /util/check-make-install +/INSTALL diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3792643c44..0245affc04 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -32,6 +32,7 @@ variables: TARBALL_EXTENSION: xz stages: + - autoconf - precheck - build - unit @@ -168,7 +169,7 @@ stages: .autoconf: &autoconf_job <<: *release_branch_triggering_rules <<: *base_image - stage: precheck + stage: autoconf script: - autoreconf -fi artifacts: @@ -186,6 +187,7 @@ stages: --with-json-c \ --prefix=$HOME/.local \ --without-make-clean \ + --with-python=python3 \ $EXTRA_CONFIGURE \ || cat config.log @@ -253,8 +255,8 @@ stages: - *setup_interfaces - *setup_softhsm script: - - ( cd bin/tests/system && make -j${TEST_PARALLEL_JOBS:-1} -k test V=1 ) - - test -s bin/tests/system/systests.output + - ( cd bin/tests/system && make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 ) || cat bin/tests/system/test-suite.log + - test -s bin/tests/system/test-suite.log .system_test: &system_test_job <<: *system_test_common @@ -313,9 +315,7 @@ stages: before_script: - *setup_softhsm script: - - make unit - after_script: - - *kyua_report_html + - cd lib && make -j${TEST_PARALLEL_JOBS:-1} -k check V=1 .unit_test: &unit_test_job <<: *unit_test_common @@ -328,16 +328,12 @@ stages: <<: *unit_test_common allow_failure: true after_script: - - *kyua_report_html - find lib -name 'tsan.*' -exec python3 util/parse_tsan.py {} \; artifacts: expire_in: "1 day" paths: - lib/*/tests/tsan.* - tsan/ - - kyua.log - - kyua.results - - kyua_html/ when: on_failure .cppcheck_args: &run_cppcheck | @@ -377,7 +373,6 @@ autoreconf: misc: <<: *precheck_job script: - - sh util/check-ans-prereq.sh - sh util/checklibs.sh > checklibs.out - sh util/tabify-changes < CHANGES > CHANGES.tmp - diff -urNap CHANGES CHANGES.tmp @@ -451,16 +446,14 @@ tarball-create: stage: precheck <<: *base_image script: - - source version - - export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}" - - git archive --prefix="${BIND_DIRECTORY}/" --output="${BIND_DIRECTORY}.tar" HEAD - - mkdir "${BIND_DIRECTORY}" - - echo "SRCID=$(git rev-list --max-count=1 HEAD | cut -b1-7)" > "${BIND_DIRECTORY}/srcid" - - tar --append --file="${BIND_DIRECTORY}.tar" "${BIND_DIRECTORY}/srcid" - - ${TARBALL_COMPRESSOR} "${BIND_DIRECTORY}.tar" + - *configure + - make -j${BUILD_PARALLEL_JOBS:-1} dist V=1 artifacts: paths: - - bind-*.tar.${TARBALL_EXTENSION} + - bind-*.tar.* + needs: + - job: autoreconf + artifacts: true only: - tags @@ -477,6 +470,7 @@ docs: needs: - job: autoreconf artifacts: true + allow_failure: true artifacts: paths: - doc/arm/ @@ -524,7 +518,7 @@ gcc:centos6:amd64: variables: CC: gcc CFLAGS: "${CFLAGS_COMMON}" - EXTRA_CONFIGURE: "--with-libidn2 --disable-warn-error" + EXTRA_CONFIGURE: "--with-libidn2 --disable-warn-error --without-python" <<: *centos_centos6_amd64_image <<: *build_job @@ -805,7 +799,7 @@ gcc:tumbleweed:amd64: variables: CC: gcc CFLAGS: "${CFLAGS_COMMON}" - EXTRA_CONFIGURE: "--with-libidn2" + EXTRA_CONFIGURE: "--with-libidn2 --with-python" <<: *tumbleweed_latest_amd64_image <<: *build_job @@ -1152,77 +1146,17 @@ system:clang:openbsd6.6:amd64: - schedules - web -# Jobs for Visual Studio 2017 builds on Windows (amd64) - -msvc:windows:amd64: - <<: *windows_build_job - <<: *default_triggering_rules - variables: - VSCONF: Release - -system:msvc:windows:amd64: - <<: *windows_system_test_job - variables: - VSCONF: Release - needs: - - job: msvc:windows:amd64 - artifacts: true - -msvc-debug:windows:amd64: - <<: *windows_build_job - variables: - VSCONF: Debug - only: - - schedules - - tags - - web - -system:msvc-debug:windows:amd64: - <<: *windows_system_test_job - variables: - VSCONF: Debug - needs: - - job: msvc-debug:windows:amd64 - artifacts: true - # Job producing a release tarball release: <<: *base_image stage: release script: - # Determine BIND version - - source version - - export BIND_DIRECTORY="bind-${MAJORVER}.${MINORVER}.${PATCHVER}${RELEASETYPE}${RELEASEVER}" - # Remove redundant files and system test utilities from Windows build artifacts - - find Build/Release/ -name "*.pdb" -print -delete - - find Build/Debug/ \( -name "*.bsc" -o -name "*.idb" \) -print -delete - - find Build/ -regextype posix-extended -regex "Build/.*/($(find bin/tests/ -type f | sed -nE "s|^bin/tests(/system)?/win32/(.*)\.vcxproj$|\2|p" | paste -d"|" -s))\..*" -print -delete - # Create Windows zips - - openssl dgst -sha256 "${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" | tee Build/Release/SHA256 Build/Debug/SHA256 - - ( cd Build/Release; zip "../../BIND${BIND_DIRECTORY#bind-}.x64.zip" * ) - - ( cd Build/Debug; zip "../../BIND${BIND_DIRECTORY#bind-}.debug.x64.zip" * ) - # Prepare release tarball contents (tarballs + zips + documentation) - - mkdir -p release/doc/arm - - pushd release - - mv "../${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" ../BIND*.zip . - - tar --extract --file="${BIND_DIRECTORY}.tar.${TARBALL_EXTENSION}" - - mv "${BIND_DIRECTORY}"/{CHANGES*,COPYRIGHT,LICENSE,README,srcid} . - - mv "${BIND_DIRECTORY}"/doc/arm/{Bv9ARM{*.html,.pdf},man.*,notes.{html,pdf,txt}} doc/arm/ - - rm -rf "${BIND_DIRECTORY}" - - cp doc/arm/notes.html "RELEASE-NOTES-${BIND_DIRECTORY}.html" - - cp doc/arm/notes.pdf "RELEASE-NOTES-${BIND_DIRECTORY}.pdf" - - cp doc/arm/notes.txt "RELEASE-NOTES-${BIND_DIRECTORY}.txt" - - popd # Create release tarball - tar --create --file="${CI_COMMIT_TAG}.tar.gz" --gzip release/ needs: - job: tarball-create artifacts: true - - job: msvc:windows:amd64 - artifacts: true - - job: msvc-debug:windows:amd64 - artifacts: true only: - tags artifacts: diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000000..6943d5a575 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,53 @@ +Mark Andrews +Andreas Gustafsson +Evan Hunt +Brian Wellington +Bob Halley +David Lawrence +Michael Graff +Michael Sawyer +Ondřej Surý +James Brister +Tatuya JINMEI 神明達哉 +Francis Dupont +Michał Kępień +Danny Mayer +Mukund Sivaraman +Jeremy C. Reed +William King +Stephen Morris +Witold Kręcicki +Curtis Blackburn +Scott Mann +Rob Austein +Jim Reid +Eric Luce +Olafur Gudmundsson +Stephen Jacob +Damien Neil +Tony Finch +Jakob Schlyter +Petr Menšík +Vernon Schryver +Matt Nelson +Shane Kerr +Paul Ebersman +Ray Bellis +Shawn Routhier +Ben Cottrell +Tomas Hozza +johnd +Bill Parker +李昶 +Kevin Chen +Jonathan Casey +Mary Stahl +Mathieu Arnold +David Hankins +Paul Hoffman +Paul Vixie +Brian Conry +Anay Panvalkar +colleen +Robert Edmonds +João Damas diff --git a/CODE_OF_CONDUCT b/CODE_OF_CONDUCT deleted file mode 100644 index b5a630af4e..0000000000 --- a/CODE_OF_CONDUCT +++ /dev/null @@ -1,79 +0,0 @@ -CODE OF CONDUCT - -BIND 9 Code of Conduct - -Like the technical community as a whole, the BIND 9 team and community is -made up of a mixture of professionals and volunteers from all over the -world, working on every aspect of the mission - including mentorship, -teaching, and connecting people. - -Diversity is one of our huge strengths, but it can also lead to -communication issues and unhappiness. To that end, we have a few ground -rules that we ask people to adhere to. This code applies equally to the -core development team, open source contributors and those seeking help and -guidance. - -This isn't an exhaustive list of things that you can't do. Rather, take it -in the spirit in which it's intended - a guide to make it easier to enrich -all of us and the technical communities in which we participate. - -This code of conduct applies to all spaces managed by the BIND 9 project -or Internet Systems Consortium. This includes chat, the mailing lists, the -issue tracker, and any other fora created by the project team which the -community uses for communication. In addition, violations of this code -outside these spaces may affect a person's ability to participate within -them. - -If you believe someone is violating the code of conduct, we ask that you -report it by emailing conduct@isc.org. For more details please see our -Reporting Guidelines. - - * Be friendly and patient. - * Be welcoming. We strive to be a community that welcomes and supports - people of all backgrounds and identities. This includes, but is not - limited to members of any race, ethnicity, culture, national origin, - colour, immigration status, social and economic class, educational - level, sex, sexual orientation, gender identity and expression, age, - size, family status, political belief, religion, and mental and - physical ability. - * Be considerate. Your work will be used by other people, and you in - turn will depend on the work of others. Any decision you take will - affect users and colleagues, and you should take those consequences - into account when making decisions. Remember that we're a world-wide - community, so you might not be communicating in someone else's primary - language. - * Be respectful. Not all of us will agree all the time, but disagreement - is no excuse for poor behavior and poor manners. We might all - experience some frustration now and then, but we cannot allow that - frustration to turn into a personal attack. It's important to remember - that a community where people feel uncomfortable or threatened is not - a productive one. Members of the BIND 9 community should be respectful - when dealing with other members as well as with people outside the - BIND 9 community. - * Be careful in the words that you choose. We are a community of - professionals, and we conduct ourselves professionally. Be kind to - others. Do not insult or put down other participants. Harassment and - other exclusionary behavior aren't acceptable. This includes, but is - not limited to: - + Violent threats or language directed against another person. - + Discriminatory jokes and language. - + Posting sexually explicit or violent material. - + Posting (or threatening to post) other people's personally - identifying information ("doxing"). - + Personal insults, especially those using racist or sexist terms. - + Unwelcome sexual attention. - + Advocating for, or encouraging, any of the above behavior. - + Repeated harassment of others. In general, if someone asks you to - stop, then stop. - * When we disagree, try to understand why. Disagreements, both social - and technical, happen all the time and BIND 9 is no exception. It is - important that we resolve disagreements and differing views - constructively. Remember that we're different. The strength of BIND 9 - comes from its varied community, people from a wide range of - backgrounds. Different people have different perspectives on issues. - Being unable to understand why someone holds a viewpoint doesn't mean - that they're wrong. Don't forget that it is human to err and blaming - each other doesn't get us anywhere. Instead, focus on helping to - resolve issues and learning from mistakes. - -Original text courtesy of the Django Code of Conduct project. diff --git a/CONTRIBUTING b/CONTRIBUTING deleted file mode 100644 index 509c82c6f3..0000000000 --- a/CONTRIBUTING +++ /dev/null @@ -1,196 +0,0 @@ -CONTRIBUTING - -BIND Source Access and Contributor Guidelines - -Feb 22, 2018 - -Contents - - 1. Access to source code - 2. Reporting bugs - 3. Contributing code - -Introduction - -Thank you for using BIND! - -BIND is open source software that implements the Domain Name System (DNS) -protocols for the Internet. It is a reference implementation of those -protocols, but it is also production-grade software, suitable for use in -high-volume and high-reliability applications. It is by far the most -widely used DNS software, providing a robust and stable platform on top of -which organizations can build distributed computing systems with the -knowledge that those systems are fully compliant with published DNS -standards. - -BIND is and will always remain free and openly available. It can be used -and modified in any way by anyone. - -BIND is maintained by the Internet Systems Consortium, a public-benefit -501(c)(3) nonprofit, using a "managed open source" approach: anyone can -see the source, but only ISC employees have commit access. Until recently, -the source could only be seen once ISC had published a release: read -access to the source repository was restricted just as commit access was. -That's now changing, with the opening of a public git mirror to the BIND -source tree (see below). - -At Internet Systems Consortium, we're committed to building communities -that are welcoming and inclusive; environments where people are encouraged -to share ideas, treat each other with respect, and collaborate towards the -best solutions. To reinforce our commitment, the Internet Systems -Consortium has adopted the Contributor Covenant version 1.4 as our Code of -Conduct for BIND 9 project, as well as for the conduct of our developers -throughout the industry. - -Access to source code - -Public BIND releases are always available from the ISC FTP site. - -A public-access GIT repository is also available at https://gitlab.isc.org -. This repository is a mirror, updated several times per day, of the -source repository maintained by ISC. It contains all the public release -branches; upcoming releases can be viewed in their current state at any -time. It does not contain development branches or unreviewed work in -progress. Commits which address security vulnerablilities are withheld -until after public disclosure. - -You can browse the source online via https://gitlab.isc.org/isc-projects/ -bind9 - -To clone the repository, use: - - $ git clone https://gitlab.isc.org/isc-projects/bind9.git - -Release branch names are of the form v9_X, where X represents the second -number in the BIND 9 version number. So, to check out the BIND 9.12 -branch, use: - - $ git checkout v9_12 - -Whenever a branch is ready for publication, a tag will be placed of the -form v9_X_Y. The 9.12.0 release, for instance, is tagged as v9_12_0. - -The branch in which the next major release is being developed is called -master. - -Reporting bugs - -Reports of flaws in the BIND package, including software bugs, errors in -the documentation, missing files in the tarball, suggested changes or -requests for new features, etc, can be filed using https://gitlab.isc.org/ -isc-projects/bind9/issues. - -Due to a large ticket backlog, we are sometimes slow to respond, -especially if a bug is cosmetic or if a feature request is vague or low in -priority, but we will try at least to acknowledge legitimate bug reports -within a week. - -ISC's ticketing system is publicly readable; however, you must have an -account to file a new issue. You can either register locally or use -credentials from an existing account at GitHub, GitLab, Google, Twitter, -or Facebook. - -Reporting possible security issues - -If you think you may be seeing a potential security vulnerability in BIND -(for example, a crash with REQUIRE, INSIST, or ASSERT failure), please -report it immediately by emailing to security-officer@isc.org. Plain-text -e-mail is not a secure choice for communications concerning undisclosed -security issues so please encrypt your communications to us if possible, -using the ISC Security Officer public key. - -Do not discuss undisclosed security vulnerabilities on any public mailing -list. ISC has a long history of handling reported vulnerabilities promptly -and effectively and we respect and acknowledge responsible reporters. - -ISC's Security Vulnerability Disclosure Policy is documented at https:// -kb.isc.org/article/AA-00861/0. - -If you have a crash, you may want to consult ?What to do if your BIND or -DHCP server has crashed.? - -Contributing code - -BIND is licensed under the Mozilla Public License 2.0. Earier versions -(BIND 9.10 and earlier) were licensed under the ISC License - -ISC does not require an explicit copyright assignment for patch -contributions. However, by submitting a patch to ISC, you implicitly -certify that you are the author of the code, that you intend to reliquish -exclusive copyright, and that you grant permission to publish your work -under the open source license used for the BIND version(s) to which your -patch will be applied. - -BIND code - -Patches for BIND may be submitted directly via merge requests in ISC's -Gitlab source repository for BIND. - -Patches can also be submitted as diffs against a specific version of BIND --- preferably the current top of the master branch. Diffs may be generated -using either git format-patch or git diff. - -Those wanting to write code for BIND may be interested in the developer -information page, which includes information about BIND design and coding -practices, including discussion of internal APIs and overall system -architecture. (This is a work in progress, and still quite preliminary.) - -Every patch submitted will be reviewed by ISC engineers following our code -review process before it is merged. - -It may take considerable time to review patch submissions, especially if -they don't meet ISC style and quality guidelines. If a patch is a good -idea, we can and will do additional work to bring it up to par, but if -we're busy with other work, it may take us a long time to get to it. - -To ensure your patch is acted on as promptly as possible, please: - - * Try to adhere to the BIND 9 coding style. - * Run make check to ensure your change hasn't caused any functional - regressions. - * Document your work, both in the patch itself and in the accompanying - email. - * In patches that make non-trivial functional changes, include system - tests if possible; when introducing or substantially altering a - library API, include unit tests. See Testing for more information. - -Changes to configure - -If you need to make changes to configure, you should not edit it directly; -instead, edit configure.in, then run autoconf. Similarly, instead of -editing config.h.in directly, edit configure.in and run autoheader. - -When submitting a patch as a diff, it's fine to omit the configure diffs -to save space. Just send the configure.in diffs and we'll generate the new -configure during the review process. - -Documentation - -All functional changes should be documented. There are three types of -documentation in the BIND source tree: - - * Man pages are kept alongside the source code for the commands they - document, in files ending in .docbook; for example, the named man page - is bin/named/named.docbook. - * The BIND 9 Administrator Reference Manual is mostly in doc/arm/ - Bv9ARM-book.xml, plus a few other XML files that are included in it. - * API documentation is in the header file describing the API, in - Doxygen-formatted comments. - -It is not necessary to edit any documentation files other than these; all -PDF, HTML, and nroff-format man page files will be updated automatically -from the docbook and XML files after merging. - -Patches to improve existing documentation are also very welcome! - -Tests - -BIND is a large and complex project. We rely heavily on continuous -automated testing and cannot merge new code without adequate test -coverage. Please see the 'Testing' section of doc/dev/dev.md for more -information. - -Thanks - -Thank you for your interest in contributing to the ongoing development of -BIND. diff --git a/COPYING b/COPYING new file mode 120000 index 0000000000..7a694c9699 --- /dev/null +++ b/COPYING @@ -0,0 +1 @@ +LICENSE \ No newline at end of file diff --git a/ChangeLog b/ChangeLog new file mode 120000 index 0000000000..d67d252bf3 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +CHANGES \ No newline at end of file diff --git a/HISTORY b/HISTORY deleted file mode 100644 index 614e18d473..0000000000 --- a/HISTORY +++ /dev/null @@ -1,615 +0,0 @@ -HISTORY - -Functional enhancements from prior major releases of BIND 9 - -BIND 9.16 - -BIND 9.16 (a stable branch based on the 9.15 development branch) includes -a number of changes from BIND 9.14 and earlier releases. New features -include: - - * New dnssec-policy statement to configure a key and signing policy for - zones, enabling automatic key regeneration and rollover. - * New network manager based on libuv. - * Added support for the new GeoIP2 geolocation API, libmaxminddb. - * Improved DNSSEC trust anchor configuration using the trust-anchors - statement, permitting configuration of trust anchors in DS as well as - DNSKEY format. - * YAML output for dig, mdig, and delv. - -BIND 9.14 - -BIND 9.14 (a stable branch based on the 9.13 development branch) includes -a number of changes from BIND 9.12 and earlier releases. New features -include: - - * A new "plugin" mechanism has been added to allow query functionality - to be extended using dynamically loadable libraries. The "filter-aaaa" - feature has been removed from named and is now implemented as a - plugin. - * Socket and task code has been refactored to improve performance. - * QNAME minimization, as described in RFC 7816, is now supported. - * "Root key sentinel" support, enabling validating resolvers to indicate - via a special query which trust anchors are configured for the root - zone. - * Secondary zones can now be configured as "mirror" zones; their - contents are transferred in as with traditional slave zones, but are - subject to DNSSEC validation and are not treated as authoritative data - when answering. This makes it easier to configure a local copy of the - root zone as described in RFC 7706. - * The "validate-except" option allows configuration of domains below - which DNSSEC validation should not be performed. - * The default value of "dnssec-validation" is now "auto". - * IDNA2008 is now supported when linking with libidn2. - * "named -V" now outputs the default paths for files used by named and - other tools. - -In addition, workarounds that were formerly in place to enable resolution -of domains whose authoritative servers did not respond to EDNS queries -have been removed. See https://dnsflagday.net for more details. - -Cryptographic support has been modernized. BIND now uses the best -available pseudo-random number generator for the platform on which it's -built. Very old versions of OpenSSL are no longer supported. Cryptography -is now mandatory: building BIND without DNSSEC is no longer supported. - -Special code to support certain legacy operating systems has also been -removed; see the file PLATFORMS.md for details of supported platforms. In -addition to OpenSSL, BIND now requires support for IPv6, threads, and -standard atomic operations provided by the C compiler. - -BIND 9.12 - -BIND 9.12 includes a number of changes from BIND 9.11 and earlier -releases. New features include: - - * named and related libraries have been substantially refactored for - improved query performance -- particularly on delegation heavy zones - -- and for improved readability, maintainability, and testability. - * Code implementing the name server query processing logic has been - moved into a new libns library, for easier testing and use in tools - other than named. - * Cached, validated NSEC and other records can now be used to synthesize - NXDOMAIN responses. - * The DNS Response Policy Service API (DNSRPS) is now supported. - * Setting 'max-journal-size default' now limits the size of journal - files to twice the size of the zone. - * dnstap-read -x prints a hex dump of the wire format of each logged DNS - message. - * dnstap output files can now be configured to roll automatically when - reaching a given size. - * Log file timestamps can now also be formatted in ISO 8601 (local) or - ISO 8601 (UTC) formats. - * Logging channels and dnstap output files can now be configured to use - a timestamp as the suffix when rolling to a new file. - * 'named-checkconf -l' lists zones found in named.conf. - * Added support for the EDNS Padding and Keepalive options. - * 'new-zones-directory' option sets the location where the configuration - data for zones added by rndc addzone is stored. - * The default key algorithm in rndc-confgen is now hmac-sha256. - * filter-aaaa-on-v4 and filter-aaaa-on-v6 options are now available by - default without a configure option. - * The obsolete isc-hmac-fixup command has been removed. - -BIND 9.11 - -BIND 9.11.0 includes a number of changes from BIND 9.10 and earlier -releases. New features include: - - * Added support for Catalog Zones, a new method for provisioning - servers: a list of zones to be served is stored in a DNS zone, along - with their configuration parameters. Changes to the catalog zone are - propagated to slaves via normal AXFR/IXFR, whereupon the zones that - are listed in it are automatically added, deleted or reconfigured. - * Added support for "dnstap", a fast and flexible method of capturing - and logging DNS traffic. - * Added support for "dyndb", a new API for loading zone data from an - external database, developed by Red Hat for the FreeIPA project. - * "fetchlimit" quotas are now compiled in by default. These are for the - use of recursive resolvers that are are under high query load for - domains whose authoritative servers are nonresponsive or are - experiencing a denial of service attack: - + "fetches-per-server" limits the number of simultaneous queries - that can be sent to any single authoritative server. The - configured value is a starting point; it is automatically adjusted - downward if the server is partially or completely non-responsive. - The algorithm used to adjust the quota can be configured via the - "fetch-quota-params" option. - + "fetches-per-zone" limits the number of simultaneous queries that - can be sent for names within a single domain. (Note: Unlike - "fetches-per-server", this value is not self-tuning.) - + New stats counters have been added to count queries spilled due to - these quotas. - * Added a new "dnssec-keymgr" key mainenance utility, which can generate - or update keys as needed to ensure that a zone's keys match a defined - DNSSEC policy. - * The experimental "SIT" feature in BIND 9.10 has been renamed "COOKIE" - and is no longer optional. EDNS COOKIE is a mechanism enabling clients - to detect off-path spoofed responses, and servers to detect - spoofed-source queries. Clients that identify themselves using COOKIE - options are not subject to response rate limiting (RRL) and can - receive larger UDP responses. - * SERVFAIL responses can now be cached for a limited time (defaulting to - 1 second, with an upper limit of 30). This can reduce the frequency of - retries when a query is persistently failing. - * Added an "nsip-wait-recurse" switch to RPZ. This causes NSIP rules to - be skipped if a name server IP address isn't in the cache yet; the - address will be looked up and the rule will be applied on future - queries. - * Added a Python RNDC module. This allows multiple commands to sent over - a persistent RNDC channel, which saves time. - * The "controls" block in named.conf can now grant read-only "rndc" - access to specified clients or keys. Read-only clients could, for - example, check "rndc status" but could not reconfigure or shut down - the server. - * "rndc" commands can now return arbitrarily large amounts of text to - the caller. - * The zone serial number of a dynamically updatable zone can now be set - via "rndc signing -serial ". This allows inline-signing zones to be - set to a specific serial number. - * The new "rndc nta" command can be used to set a Negative Trust Anchor - (NTA), disabling DNSSEC validation for a specific domain; this can be - used when responses from a domain are known to be failing validation - due to administrative error rather than because of a spoofing attack. - Negative trust anchors are strictly temporary; by default they expire - after one hour, but can be configured to last up to one week. - * "rndc delzone" can now be used on zones that were not originally - created by "rndc addzone". - * "rndc modzone" reconfigures a single zone, without requiring the - entire server to be reconfigured. - * "rndc showzone" displays the current configuration of a zone. - * "rndc managed-keys" can be used to check the status of RFC 5011 - managed trust anchors, or to force trust anchors to be refreshed. - * "max-cache-size" can now be set to a percentage of available memory. - The default is 90%. - * Update forwarding performance has been improved by allowing a single - TCP connection to be shared by multiple updates. - * The EDNS Client Subnet (ECS) option is now supported for authoritative - servers; if a query contains an ECS option then ACLs containing - "geoip" or "ecs" elements can match against the the address encoded in - the option. This can be used to select a view for a query, so that - different answers can be provided depending on the client network. - * The EDNS EXPIRE option has been implemented on the client side, - allowing a slave server to set the expiration timer correctly when - transferring zone data from another slave server. - * The key generation and manipulation tools (dnssec-keygen, - dnssec-settime, dnssec-importkey, dnssec-keyfromlabel) now take - "-Psync" and "-Dsync" options to set the publication and deletion - times of CDS and CDNSKEY parent-synchronization records. Both named - and dnssec-signzone can now publish and remove these records at the - scheduled times. - * A new "minimal-any" option reduces the size of UDP responses for query - type ANY by returning a single arbitrarily selected RRset instead of - all RRsets. - * A new "masterfile-style" zone option controls the formatting of text - zone files: When set to "full", a zone file is dumped in - single-line-per-record format. - * "serial-update-method" can now be set to "date". On update, the serial - number will be set to the current date in YYYYMMDDNN format. - * "dnssec-signzone -N date" sets the serial number to YYYYMMDDNN. - * "named -L " causes named to send log messages to the specified file by - default instead of to the system log. - * "dig +ttlunits" prints TTL values with time-unit suffixes: w, d, h, m, - s for weeks, days, hours, minutes, and seconds. - * "dig +unknownformat" prints dig output in RFC 3597 "unknown record" - presentation format. - * "dig +ednsopt" allows dig to set arbitrary EDNS options on requests. - * "dig +ednsflags" allows dig to set yet-to-be-defined EDNS flags on - requests. - * "mdig" is an alternate version of dig which sends multiple pipelined - TCP queries to a server. Instead of waiting for a response after - sending a query, it sends all queries immediately and displays - responses in the order received. - * "serial-query-rate" no longer controls NOTIFY messages. These are - separately controlled by "notify-rate" and "startup-notify-rate". - * "nsupdate" now performs "check-names" processing by default on records - to be added. This can be disabled with "check-names no". - * The statistics channel now supports DEFLATE compression, reducing the - size of the data sent over the network when querying statistics. - * New counters have been added to the statistics channel to track the - sizes of incoming queries and outgoing responses in histogram buckets, - as specified in RSSAC002. - * A new NXDOMAIN redirect method (option "nxdomain-redirect") has been - added, allowing redirection to a specified DNS namespace instead of a - single redirect zone. - * When starting up, named now ensures that no other named process is - already running. - * Files created by named to store information, including "mkeys" and - "nzf" files, are now named after their corresponding views unless the - view name contains characters incompatible with use as a filename. Old - style filenames (based on the hash of the view name) will still work. - -BIND 9.10.0 - -BIND 9.10.0 includes a number of changes from BIND 9.9 and earlier -releases. New features include: - - * DNS Response-rate limiting (DNS RRL), which blunts the impact of - reflection and amplification attacks, is always compiled in and no - longer requires a compile-time option to enable it. - * An experimental "Source Identity Token" (SIT) EDNS option is now - available. Similar to DNS Cookies as invented by Donald Eastlake 3rd, - these are designed to enable clients to detect off-path spoofed - responses, and to enable servers to detect spoofed-source queries. - Servers can be configured to send smaller responses to clients that - have not identified themselves using a SIT option, reducing the - effectiveness of amplification attacks. RRL processing has also been - updated; clients proven to be legitimate via SIT are not subject to - rate limiting. Use "configure --enable-sit" to enable this feature in - BIND. - * A new zone file format, "map", stores zone data in a format that can - be mapped directly into memory, allowing significantly faster zone - loading. - * "delv" (domain entity lookup and validation) is a new tool with - dig-like semantics for looking up DNS data and performing internal - DNSSEC validation. This allows easy validation in environments where - the resolver may not be trustworthy, and assists with troubleshooting - of DNSSEC problems. (NOTE: In previous development releases of BIND - 9.10, this utility was called "delve". The spelling has been changed - to avoid confusion with the "delve" utility included with the Xapian - search engine.) - * Improved EDNS(0) processing for better resolver performance and - reliability over slow or lossy connections. - * A new "configure --with-tuning=large" option tunes certain compiled-in - constants and default settings to values better suited to large - servers with abundant memory. This can improve performance on such - servers, but will consume more memory and may degrade performance on - smaller systems. - * Substantial improvement in response-policy zone (RPZ) performance. Up - to 32 response-policy zones can be configured with minimal performance - loss. - * To improve recursive resolver performance, cache records which are - still being requested by clients can now be automatically refreshed - from the authoritative server before they expire, reducing or - eliminating the time window in which no answer is available in the - cache. - * New "rpz-client-ip" triggers and drop policies allowing response - policies based on the IP address of the client. - * ACLs can now be specified based on geographic location using the - MaxMind GeoIP databases. Use "configure --with-geoip" to enable. - * Zone data can now be shared between views, allowing multiple views to - serve the same zones authoritatively without storing multiple copies - in memory. - * New XML schema (version 3) for the statistics channel includes many - new statistics and uses a flattened XML tree for faster parsing. The - older schema is now deprecated. - * A new stylesheet, based on the Google Charts API, displays XML - statistics in charts and graphs on javascript-enabled browsers. - * The statistics channel can now provide data in JSON format as well as - XML. - * New stats counters track TCP and UDP queries received per zone, and - EDNS options received in total. - * The internal and export versions of the BIND libraries (libisc, - libdns, etc) have been unified so that external library clients can - use the same libraries as BIND itself. - * A new compile-time option, "configure --enable-native-pkcs11", allows - BIND 9 cryptography functions to use the PKCS#11 API natively, so that - BIND can drive a cryptographic hardware service module (HSM) directly - instead of using a modified OpenSSL as an intermediary. (Note: This - feature requires an HSM to have a full implementation of the PKCS#11 - API; many current HSMs only have partial implementations. The new - "pkcs11-tokens" command can be used to check API completeness. Native - PKCS#11 is known to work with the Thales nShield HSM and with SoftHSM - version 2 from the Open DNSSEC project.) - * The new "max-zone-ttl" option enforces maximum TTLs for zones. This - can simplify the process of rolling DNSSEC keys by guaranteeing that - cached signatures will have expired within the specified amount of - time. - * "dig +subnet" sends an EDNS CLIENT-SUBNET option when querying. - * "dig +expire" sends an EDNS EXPIRE option when querying. When this - option is sent with an SOA query to a server that supports it, it will - report the expiry time of a slave zone. - * New "dnssec-coverage" tool to check DNSSEC key coverage for a zone and - report if a lapse in signing coverage has been inadvertently - scheduled. - * Signing algorithm flexibility and other improvements for the "rndc" - control channel. - * "named-checkzone" and "named-compilezone" can now read journal files, - allowing them to process dynamic zones. - * Multiple DLZ databases can now be configured. Individual zones can be - configured to be served from a specific DLZ database. DLZ databases - now serve zones of type "master" and "redirect". - * "rndc zonestatus" reports information about a specified zone. - * "named" now listens on IPv6 as well as IPv4 interfaces by default. - * "named" now preserves the capitalization of names when responding to - queries: for instance, a query for "example.com" may be answered with - "example.COM" if the name was configured that way in the zone file. - Some clients have a bug causing them to depend on the older behavior, - in which the case of the answer always matched the case of the query, - rather than the case of the name configured in the DNS. Such clients - can now be specified in the new "no-case-compress" ACL; this will - restore the older behavior of "named" for those clients only. - * new "dnssec-importkey" command allows the use of offline DNSSEC keys - with automatic DNSKEY management. - * New "named-rrchecker" tool to verify the syntactic correctness of - individual resource records. - * When re-signing a zone, the new "dnssec-signzone -Q" option drops - signatures from keys that are still published but are no longer - active. - * "named-checkconf -px" will print the contents of configuration files - with the shared secrets obscured, making it easier to share - configuration (e.g. when submitting a bug report) without revealing - private information. - * "rndc scan" causes named to re-scan network interfaces for changes in - local addresses. - * On operating systems with support for routing sockets, network - interfaces are re-scanned automatically whenever they change. - * "tsig-keygen" is now available as an alternate command name to use for - "ddns-confgen". - -BIND 9.9.0 - -BIND 9.9.0 includes a number of changes from BIND 9.8 and earlier -releases. New features include: - - * Inline signing, allowing automatic DNSSEC signing of master zones - without modification of the zonefile, or "bump in the wire" signing in - slaves. - * NXDOMAIN redirection. - * New 'rndc flushtree' command clears all data under a given name from - the DNS cache. - * New 'rndc sync' command dumps pending changes in a dynamic zone to - disk without a freeze/thaw cycle. - * New 'rndc signing' command displays or clears signing status records - in 'auto-dnssec' zones. - * NSEC3 parameters for 'auto-dnssec' zones can now be set prior to - signing, eliminating the need to initially sign with NSEC. - * Startup time improvements on large authoritative servers. - * Slave zones are now saved in raw format by default. - * Several improvements to response policy zones (RPZ). - * Improved hardware scalability by using multiple threads to listen for - queries and using finer-grained client locking - * The 'also-notify' option now takes the same syntax as 'masters', so it - can used named masterlists and TSIG keys. - * 'dnssec-signzone -D' writes an output file containing only DNSSEC - data, which can be included by the primary zone file. - * 'dnssec-signzone -R' forces removal of signatures that are not expired - but were created by a key which no longer exists. - * 'dnssec-signzone -X' allows a separate expiration date to be specified - for DNSKEY signatures from other signatures. - * New '-L' option to dnssec-keygen, dnssec-settime, and - dnssec-keyfromlabel sets the default TTL for the key. - * dnssec-dsfromkey now supports reading from standard input, to make it - easier to convert DNSKEY to DS. - * RFC 1918 reverse zones have been added to the empty-zones table per - RFC 6303. - * Dynamic updates can now optionally set the zone's SOA serial number to - the current UNIX time. - * DLZ modules can now retrieve the source IP address of the querying - client. - * 'request-ixfr' option can now be set at the per-zone level. - * 'dig +rrcomments' turns on comments about DNSKEY records, indicating - their key ID, algorithm and function - * Simplified nsupdate syntax and added readline support - -BIND 9.8.0 - -BIND 9.8.0 includes a number of changes from BIND 9.7 and earlier -releases. New features include: - - * Built-in trust anchor for the root zone, which can be switched on via - "dnssec-validation auto;" - * Support for DNS64. - * Support for response policy zones (RPZ). - * Support for writable DLZ zones. - * Improved ease of configuration of GSS/TSIG for interoperability with - Active Directory - * Support for GOST signing algorithm for DNSSEC. - * Removed RTT Banding from server selection algorithm. - * New "static-stub" zone type. - * Allow configuration of resolver timeouts via "resolver-query-timeout" - option. - * The DLZ "dlopen" driver is now built by default. - * Added a new include file with function typedefs for the DLZ "dlopen" - driver. - * Made "--with-gssapi" default. - * More verbose error reporting from DLZ LDAP. - -BIND 9.7.0 - -BIND 9.7.0 includes a number of changes from BIND 9.6 and earlier -releases. Most are intended to simplify DNSSEC configuration. New features -include: - - * Fully automatic signing of zones by "named". - * Simplified configuration of DNSSEC Lookaside Validation (DLV). - * Simplified configuration of Dynamic DNS, using the "ddns-confgen" - command line tool or the "local" update-policy option. (As a side - effect, this also makes it easier to configure automatic zone - re-signing.) - * New named option "attach-cache" that allows multiple views to share a - single cache. - * DNS rebinding attack prevention. - * New default values for dnssec-keygen parameters. - * Support for RFC 5011 automated trust anchor maintenance - * Smart signing: simplified tools for zone signing and key maintenance. - * The "statistics-channels" option is now available on Windows. - * A new DNSSEC-aware libdns API for use by non-BIND9 applications - * On some platforms, named and other binaries can now print out a stack - backtrace on assertion failure, to aid in debugging. - * A "tools only" installation mode on Windows, which only installs dig, - host, nslookup and nsupdate. - * Improved PKCS#11 support, including Keyper support and explicit - OpenSSL engine selection. - -BIND 9.6.0 - - * Full NSEC3 support - * Automatic zone re-signing - * New update-policy methods tcp-self and 6to4-self - * The BIND 8 resolver library, libbind, has been removed from the BIND 9 - distribution and is now available as a separate download. - * Change the default pid file location from /var/run to /var/run/ - {named,lwresd} for improved chroot/setuid support. - -BIND 9.5.0 - - * GSS-TSIG support (RFC 3645). - * DHCID support. - * Experimental http server and statistics support for named via xml. - * More detailed statistics counters including those supported in BIND 8. - * Faster ACL processing. - * Use Doxygen to generate internal documentation. - * Efficient LRU cache-cleaning mechanism. - * NSID support. - -BIND 9.4.0 - - * Implemented "additional section caching (or acache)", an internal - cache framework for additional section content to improve response - performance. Several configuration options were provided to control - the behavior. - * New notify type 'master-only'. Enable notify for master zones only. - * Accept 'notify-source' style syntax for query-source. - * rndc now allows addresses to be set in the server clauses. - * New option "allow-query-cache". This lets "allow-query" be used to - specify the default zone access level rather than having to have every - zone override the global value. "allow-query-cache" can be set at both - the options and view levels. If "allow-query-cache" is not set then - "allow-recursion" is used if set, otherwise "allow-query" is used if - set unless "recursion no;" is set in which case "none;" is used, - otherwise the default (localhost; localnets;) is used. - * rndc: the source address can now be specified. - * ixfr-from-differences now takes master and slave in addition to yes - and no at the options and view levels. - * Allow the journal's name to be changed via named.conf. - * 'rndc notify zone [class [view]]' resend the NOTIFY messages for the - specified zone. - * 'dig +trace' now randomly selects the next servers to try. Report if - there is a bad delegation. - * Improve check-names error messages. - * Make public the function to read a key file, dst_key_read_public(). - * dig now returns the byte count for axfr/ixfr. - * allow-update is now settable at the options / view level. - * named-checkconf now checks the logging configuration. - * host now can turn on memory debugging flags with '-m'. - * Don't send notify messages to self. - * Perform sanity checks on NS records which refer to 'in zone' names. - * New zone option "notify-delay". Specify a minimum delay between sets - of NOTIFY messages. - * Extend adjusting TTL warning messages. - * Named and named-checkzone can now both check for non-terminal wildcard - records. - * "rndc freeze/thaw" now freezes/thaws all zones. - * named-checkconf now check acls to verify that they only refer to - existing acls. - * The server syntax has been extended to support a range of servers. - * Report differences between hints and real NS rrset and associated - address records. - * Preserve the case of domain names in rdata during zone transfers. - * Restructured the data locking framework using architecture dependent - atomic operations (when available), improving response performance on - multi-processor machines significantly. x86, x86_64, alpha, powerpc, - and mips are currently supported. - * UNIX domain controls are now supported. - * Add support for additional zone file formats for improving loading - performance. The masterfile-format option in named.conf can be used to - specify a non-default format. A separate command named-compilezone was - provided to generate zone files in the new format. Additionally, the - -I and -O options for dnssec-signzone specify the input and output - formats. - * dnssec-signzone can now randomize signature end times (dnssec-signzone - -j jitter). - * Add support for CH A record. - * Add additional zone data constancy checks. named-checkzone has - extended checking of NS, MX and SRV record and the hosts they - reference. named has extended post zone load checks. New zone options: - check-mx and integrity-check. - * edns-udp-size can now be overridden on a per server basis. - * dig can now specify the EDNS version when making a query. - * Added framework for handling multiple EDNS versions. - * Additional memory debugging support to track size and mctx arguments. - * Detect duplicates of UDP queries we are recursing on and drop them. - New stats category "duplicates". - * "USE INTERNAL MALLOC" is now runtime selectable. - * The lame cache is now done on a basis as some - servers only appear to be lame for certain query types. - * Limit the number of recursive clients that can be waiting for a single - query () to resolve. New options clients-per-query - and max-clients-per-query. - * dig: report the number of extra bytes still left in the packet after - processing all the records. - * Support for IPSECKEY rdata type. - * Raise the UDP receive buffer size to 32k if it is less than 32k. - * x86 and x86_64 now have separate atomic locking implementations. - * named-checkconf now validates update-policy entries. - * Attempt to make the amount of work performed in a iteration self - tuning. The covers nodes clean from the cache per iteration, nodes - written to disk when rewriting a master file and nodes destroyed per - iteration when destroying a zone or a cache. - * ISC string copy API. - * Automatic empty zone creation for D.F.IP6.ARPA and friends. Note: RFC - 1918 zones are not yet covered by this but are likely to be in a - future release. - * New options: empty-server, empty-contact, empty-zones-enable and - disable-empty-zone. - * dig now has a '-q queryname' and '+showsearch' options. - * host/nslookup now continue (default)/fail on SERVFAIL. - * dig now warns if 'RA' is not set in the answer when 'RD' was set in - the query. host/nslookup skip servers that fail to set 'RA' when 'RD' - is set unless a server is explicitly set. - * Integrate contributed DLZ code into named. - * Integrate contributed IDN code from JPNIC. - * libbind: corresponds to that from BIND 8.4.7. - -BIND 9.3.0 - - * DNSSEC is now DS based (RFC 3658). - * DNSSEC lookaside validation. - * check-names is now implemented. - * rrset-order is more complete. - * IPv4/IPv6 transition support, dual-stack-servers. - * IXFR deltas can now be generated when loading master files, - ixfr-from-differences. - * It is now possible to specify the size of a journal, max-journal-size. - * It is now possible to define a named set of master servers to be used - in masters clause, masters. - * The advertised EDNS UDP size can now be set, edns-udp-size. - * allow-v6-synthesis has been obsoleted. - * Zones containing MD and MF will now be rejected. - * dig, nslookup name. now report "Not Implemented" as NOTIMP rather than - NOTIMPL. This will have impact on scripts that are looking for - NOTIMPL. - * libbind: corresponds to that from BIND 8.4.5. - -BIND 9.2.0 - - * The size of the cache can now be limited using the "max-cache-size" - option. - * The server can now automatically convert RFC1886-style recursive - lookup requests into RFC2874-style lookups, when enabled using the new - option "allow-v6-synthesis". This allows stub resolvers that support - AAAA records but not A6 record chains or binary labels to perform - lookups in domains that make use of these IPv6 DNS features. - * Performance has been improved. - * The man pages now use the more portable "man" macros rather than the - "mandoc" macros, and are installed by "make install". - * The named.conf parser has been completely rewritten. It now supports - "include" directives in more places such as inside "view" statements, - and it no longer has any reserved words. - * The "rndc status" command is now implemented. - * rndc can now be configured automatically. - * A BIND 8 compatible stub resolver library is now included in lib/bind. - * OpenSSL has been removed from the distribution. This means that to use - DNSSEC, OpenSSL must be installed and the --with-openssl option must - be supplied to configure. This does not apply to the use of TSIG, - which does not require OpenSSL. - * The source distribution now builds on Windows. See win32utils/ - readme1.txt and win32utils/win32-build.txt for details. - * This distribution also includes a new lightweight stub resolver - library and associated resolver daemon that fully support forward and - reverse lookups of both IPv4 and IPv6 addresses. This library is - considered experimental and is not a complete replacement for the BIND - 8 resolver library. Applications that use the BIND 8 res_* functions - to perform DNS lookups or dynamic updates still need to be linked - against the BIND 8 libraries. For DNS lookups, they can also use the - new "getrrsetbyname()" API. - * BIND 9.2 is capable of acting as an authoritative server for DNSSEC - secured zones. This functionality is believed to be stable and - complete except for lacking support for verifications involving - wildcard records in secure zones. - * When acting as a caching server, BIND 9.2 can be configured to perform - DNSSEC secure resolution on behalf of its clients. This part of the - DNSSEC implementation is still considered experimental. For detailed - information about the state of the DNSSEC implementation, see the file - doc/misc/dnssec. diff --git a/Kyuafile b/Kyuafile deleted file mode 100644 index 70b2cffe17..0000000000 --- a/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('lib/Kyuafile') diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000000..77a8ad20fc --- /dev/null +++ b/Makefile.am @@ -0,0 +1,11 @@ +include $(top_srcdir)/Makefile.top + +SUBDIRS = . libltdl lib bin # doc + +BUILT_SOURCES = bind.keys.h +CLEANFILES = bind.keys.h + +bind.keys.h: bind.keys Makefile + ${PERL} ${top_srcdir}/util/bindkeys.pl < ${top_srcdir}/bind.keys > $@ + +dist_sysconf_DATA = bind.keys diff --git a/Makefile.tests b/Makefile.tests new file mode 100644 index 0000000000..3ff781df53 --- /dev/null +++ b/Makefile.tests @@ -0,0 +1,10 @@ +# Hey Emacs, this is -*- makefile-automake -*- file! +# vim: filetype=automake + +AM_CPPFLAGS += \ + $(CMOCKA_CFLAGS) \ + -DTESTS=\"$(abs_srcdir)\" \ + -DNAMED_PLUGINDIR=\"$(libdir)/named\" + +LDADD = \ + $(CMOCKA_LIBS) diff --git a/Makefile.top b/Makefile.top new file mode 100644 index 0000000000..b7d711c77c --- /dev/null +++ b/Makefile.top @@ -0,0 +1,79 @@ +# Hey Emacs, this is -*- makefile-automake -*- file! +# vim: filetype=automake + +ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4 + +AM_CFLAGS = \ + $(STD_CFLAGS) + +AM_CPPFLAGS = \ + $(STD_CPPFLAGS) \ + -include $(top_builddir)/config.h \ + -I$(srcdir)/include + +if HAVE_GSSAPI +AM_CPPFLAGS += \ + $(GSSAPI_CFLAGS) +endif + +LIBISC_CFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/lib/isc/unix/include \ + -I$(top_srcdir)/lib/isc/pthreads/include \ + -I$(top_srcdir)/lib/isc/include \ + -I$(top_builddir)/lib/isc/include + +if HAVE_JSON_C +LIBISC_CFLAGS += \ + $(JSON_C_CFLAGS) +endif HAVE_JSON_C + +if HAVE_LIBXML2 +LIBISC_CFLAGS += \ + $(LIBXML2_CFLAGS) +endif HAVE_LIBXML2 + +LIBISC_LIBS = $(top_builddir)/lib/isc/libisc.la + +LIBDNS_CFLAGS = \ + -I$(top_srcdir)/lib/dns/include \ + -I$(top_builddir)/lib/dns/include + +LIBDNS_LIBS = \ + $(top_builddir)/lib/dns/libdns.la + +LIBNS_CFLAGS = \ + -I$(top_srcdir)/lib/ns/include + +LIBNS_LIBS = \ + $(top_builddir)/lib/ns/libns.la + +LIBIRS_CFLAGS = \ + -I$(top_srcdir)/lib/irs/include + +LIBIRS_LIBS = \ + $(top_builddir)/lib/irs/libirs.la + +LIBISCCFG_CFLAGS = \ + -I$(top_srcdir)/lib/isccfg/include + +LIBISCCFG_LIBS = \ + $(top_builddir)/lib/isccfg/libisccfg.la + +LIBISCCC_CFLAGS = \ + -I$(top_srcdir)/lib/isccc/include/ + +LIBISCCC_LIBS = \ + $(top_builddir)/lib/isccc/libisccc.la + +LIBBIND9_CFLAGS = \ + -I$(top_srcdir)/lib/bind9/include + +LIBBIND9_LIBS = \ + $(top_builddir)/lib/bind9/libbind9.la + +LIBLTDL_CFLAGS = \ + -I$(top_srcdir)/libltdl + +LIBLTDL_LIBS = \ + $(top_builddir)/libltdl/libltdlc.la diff --git a/NEWS b/NEWS new file mode 120000 index 0000000000..d67d252bf3 --- /dev/null +++ b/NEWS @@ -0,0 +1 @@ +CHANGES \ No newline at end of file diff --git a/OPTIONS b/OPTIONS deleted file mode 100644 index 811cf7c867..0000000000 --- a/OPTIONS +++ /dev/null @@ -1,28 +0,0 @@ -OPTIONS - -Setting the STD_CDEFINES environment variable before running configure can -be used to enable certain compile-time options that are not explicitly -defined in configure. - -Some of these settings are: - - Setting Description - Overwrite memory with tag values when allocating --DISC_MEM_DEFAULTFILL=1 or freeing it; this impairs performance but - makes debugging of memory problems easier. - Don't track memory allocations by file and line --DISC_MEM_TRACKLINES=0 number; this improves performance but makes - debugging more difficult. --DISC_FACILITY=LOG_LOCAL0 Change the default syslog facility for named --DNS_CLIENT_DROPPORT=0 Disable dropping queries from particular - well-known ports: --DCHECK_SIBLING=0 Don't check sibling glue in named-checkzone --DCHECK_LOCAL=0 Don't check out-of-zone addresses in - named-checkzone --DNS_RUN_PID_DIR=0 Create default PID files in ${localstatedir}/run - rather than ${localstatedir}/run/named/ - Disable the use of inline functions to implement --DISC_BUFFER_USEINLINE=0 the isc_buffer API: this reduces performance but - may be useful when debugging --DISC_HEAP_CHECK Test heap consistency after every heap - operation; used when debugging diff --git a/PLATFORMS b/PLATFORMS deleted file mode 100644 index dd00403a30..0000000000 --- a/PLATFORMS +++ /dev/null @@ -1,99 +0,0 @@ -PLATFORMS - -Supported platforms - -In general, this version of BIND will build and run on any POSIX-compliant -system with a C11-compliant C compiler, BSD-style sockets with -RFC-compliant IPv6 support, POSIX-compliant threads, the libuv -asynchronous I/O library, and the OpenSSL cryptography library. - -The following C11 features are used in BIND 9: - - * Atomic operations support from the compiler is needed, either in the - form of builtin operations, C11 atomics, or the Interlocked family of - functions on Windows. - - * Thread Local Storage support from the compiler is needed, either in - the form of C11 _Thread_local/thread_local, the __thread GCC - extension, or the __declspec(thread) MSVC extension on Windows. - -BIND 9.17 requires a fairly recent version of libuv (at least 1.x). For -some of the older systems listed below, you will have to install an -updated libuv package from sources such as EPEL, PPA, or other native -sources for updated packages. The other option is to build and install -libuv from source. - -Certain optional BIND features have additional library dependencies. These -include libxml2 and libjson-c for statistics, libmaxminddb for -geolocation, libfstrm and libprotobuf-c for DNSTAP, and libidn2 for -internationalized domain name conversion. - -ISC regularly tests BIND on many operating systems and architectures, but -lacks the resources to test all of them. Consequently, ISC is only able to -offer support on a "best effort" basis for some. - -Regularly tested platforms - -As of Mar 2020, BIND 9.17 is fully supported and regularly tested on the -following systems: - - * Debian 9, 10 - * Ubuntu LTS 16.04, 18.04 - * Fedora 31 - * Red Hat Enterprise Linux / CentOS 7, 8 - * FreeBSD 11.3, 12.1 - * OpenBSD 6.6 - * Alpine Linux - -The amd64, i386, armhf and arm64 CPU architectures are all fully -supported. - -Best effort - -The following are platforms on which BIND is known to build and run. ISC -makes every effort to fix bugs on these platforms, but may be unable to do -so quickly due to lack of hardware, less familiarity on the part of -engineering staff, and other constraints. With the exception of Windows -Server 2012 R2, none of these are tested regularly by ISC. - - * Windows Server 2012 R2, 2016 / x64 - * Windows 10 / x64 - * macOS 10.12+ - * Solaris 11 - * NetBSD - * Other Linux distributions still supported by their vendors, such as: - + Ubuntu 19.04+ - + Gentoo - + Arch Linux - * OpenWRT/LEDE 17.01+ - * Other CPU architectures (mips, mipsel, sparc, ...) - -Community maintained - -These systems may not all have the required dependencies for building BIND -easily available, although it will be possible in many cases to compile -those directly from source. The community and interested parties may wish -to help with maintenance, and we welcome patch contributions, although we -cannot guarantee that we will accept them. All contributions will be -assessed against the risk of adverse effect on officially supported -platforms. - - * Platforms past or close to their respective EOL dates, such as: - + Ubuntu 14.04, 18.10 - + CentOS 6 - + Debian Jessie - + FreeBSD 10.x - -Unsupported platforms - -These are platforms on which BIND 9.17 is known not to build or run: - - * Platforms without at least OpenSSL 1.0.2 - * Windows 10 / x86 - * Windows Server 2012 and older - * Solaris 10 and older - * Platforms that don't support IPv6 Advanced Socket API (RFC 3542) - * Platforms that don't support atomic operations (via compiler or - library) - * Linux without NPTL (Native POSIX Thread Library) - * Platforms on which libuv cannot be compiled diff --git a/README b/README deleted file mode 100644 index 61a4764efe..0000000000 --- a/README +++ /dev/null @@ -1,369 +0,0 @@ -README - -BIND 9 - -Contents - - 1. Introduction - 2. Reporting bugs and getting help - 3. Contributing to BIND - 4. BIND 9.17 features - 5. Building BIND - 6. macOS - 7. Dependencies - 8. Compile-time options - 9. Automated testing -10. Documentation -11. Change log -12. Acknowledgments - -Introduction - -BIND (Berkeley Internet Name Domain) is a complete, highly portable -implementation of the DNS (Domain Name System) protocol. - -The BIND name server, named, is able to serve as an authoritative name -server, recursive resolver, DNS forwarder, or all three simultaneously. It -implements views for split-horizon DNS, automatic DNSSEC zone signing and -key management, catalog zones to facilitate provisioning of zone data -throughout a name server constellation, response policy zones (RPZ) to -protect clients from malicious data, response rate limiting (RRL) and -recursive query limits to reduce distributed denial of service attacks, -and many other advanced DNS features. BIND also includes a suite of -administrative tools, including the dig and delv DNS lookup tools, -nsupdate for dynamic DNS zone updates, rndc for remote name server -administration, and more. - -BIND 9 began as a complete re-write of the BIND architecture that was used -in versions 4 and 8. Internet Systems Consortium (https://www.isc.org), a -501(c)(3) public benefit corporation dedicated to providing software and -services in support of the Internet infrastructure, developed BIND 9 and -is responsible for its ongoing maintenance and improvement. BIND is open -source software licensed under the terms of the Mozilla Public License, -version 2.0. - -For a summary of features introduced in past major releases of BIND, see -the file HISTORY. - -For a detailed list of changes made throughout the history of BIND 9, see -the file CHANGES. See below for details on the CHANGES file format. - -For up-to-date versions and release notes, see https://www.isc.org/ -download/. - -For information about supported platforms, see PLATFORMS. - -Reporting bugs and getting help - -To report non-security-sensitive bugs or request new features, you may -open an Issue in the BIND 9 project on the ISC GitLab server at https:// -gitlab.isc.org/isc-projects/bind9. - -Please note that, unless you explicitly mark the newly created Issue as -"confidential", it will be publicly readable. Please do not include any -information in bug reports that you consider to be confidential unless the -issue has been marked as such. In particular, if submitting the contents -of your configuration file in a non-confidential Issue, it is advisable to -obscure key secrets: this can be done automatically by using -named-checkconf -px. - -If the bug you are reporting is a potential security issue, such as an -assertion failure or other crash in named, please do NOT use GitLab to -report it. Instead, send mail to security-officer@isc.org using our -OpenPGP key to secure your message. (Information about OpenPGP and links -to our key can be found at https://www.isc.org/pgpkey.) Please do not -discuss the bug on any public mailing list. - -For a general overview of ISC security policies, read the Knowledge Base -article at https://kb.isc.org/docs/aa-00861. - -Professional support and training for BIND are available from ISC at -https://www.isc.org/support. - -To join the BIND Users mailing list, or view the archives, visit https:// -lists.isc.org/mailman/listinfo/bind-users. - -If you're planning on making changes to the BIND 9 source code, you may -also want to join the BIND Workers mailing list, at https://lists.isc.org/ -mailman/listinfo/bind-workers. - -Contributing to BIND - -ISC maintains a public git repository for BIND; details can be found at -http://www.isc.org/git/. - -Information for BIND contributors can be found in the following files: - -General information: CONTRIBUTING.md - Code of Conduct: CODE_OF_CONDUCT.md -- BIND 9 code style: doc/dev/style.md - BIND architecture and developer -guide: doc/dev/dev.md - -Patches for BIND may be submitted as merge requests in the ISC GitLab -server at at https://gitlab.isc.org/isc-projects/bind9/merge_requests. - -By default, external contributors don't have ability to fork BIND in the -GitLab server, but if you wish to contribute code to BIND, you may request -permission to do so. Thereafter, you can create git branches and directly -submit requests that they be reviewed and merged. - -If you prefer, you may also submit code by opening a GitLab Issue and -including your patch as an attachment, preferably generated by git -format-patch. - -BIND 9.17 features - -BIND 9.17 is the newest development branch of BIND 9. It includes a number -of changes from BIND 9.16 and earlier releases. New features include: - - * New option "max-ixfr-ratio" to limit the size of outgoing IXFR - responses before falling back to full zone transfers. - * "rndc nta -d" and "rndc secroots" now include "validate-except" - entries when listing negative trust anchors. - -Building BIND - -Minimally, BIND requires a UNIX or Linux system with an ANSI C compiler, -basic POSIX support, and a 64-bit integer type. BIND also requires the -libuv asynchronous I/O library, and a cryptography provider library such -as OpenSSL or a hardware service module supporting PKCS#11. On Linux, BIND -requires the libcap library to set process privileges, though this -requirement can be overridden by disabling capability support at compile -time. See Compile-time options below for details on other libraries that -may be required to support optional features. - -Successful builds have been observed on many versions of Linux and UNIX, -including RHEL/CentOS, Fedora, Debian, Ubuntu, SLES, openSUSE, Slackware, -Alpine, FreeBSD, NetBSD, OpenBSD, macOS, Solaris, OpenIndiana, OmniOS CE, -HP-UX, and OpenWRT. - -BIND is also available for Windows Server 2012 R2 and higher. See -win32utils/build.txt for details on building for Windows systems. - -To build on a UNIX or Linux system, use: - - $ ./configure - $ make - -If you're planning on making changes to the BIND 9 source, you should run -make depend. If you're using Emacs, you might find make tags helpful. - -Several environment variables that can be set before running configure -will affect compilation. Significant ones are: - - Variable Description -CC The C compiler to use. configure tries to figure out the - right one for supported systems. - C compiler flags. Defaults to include -g and/or -O2 as -CFLAGS supported by the compiler. Please include '-g' if you need - to set CFLAGS. - System header file directories. Can be used to specify -STD_CINCLUDES where add-on thread or IPv6 support is, for example. - Defaults to empty string. - Any additional preprocessor symbols you want defined. -STD_CDEFINES Defaults to empty string. For a list of possible settings, - see the file OPTIONS. -LDFLAGS Linker flags. Defaults to empty string. -BUILD_CC Needed when cross-compiling: the native C compiler to use - when building for the target system. -BUILD_CFLAGS CFLAGS for the target system during cross-compiling. -BUILD_CPPFLAGS CPPFLAGS for the target system during cross-compiling. -BUILD_LDFLAGS LDFLAGS for the target system during cross-compiling. -BUILD_LIBS LIBS for the target system during cross-compiling. - -Additional environment variables affecting the build are listed at the end -of the configure help text, which can be obtained by running the command: - -$ ./configure --help - -macOS - -Building on macOS assumes that the "Command Tools for Xcode" is installed. -This can be downloaded from https://developer.apple.com/download/more/ or, -if you have Xcode already installed, you can run xcode-select --install. -(Note that an Apple ID may be required to access the download page.) - -Compile-time options - -To see a full list of configuration options, run configure --help. - -To build shared libraries, specify --with-libtool on the configure command -line. - -For the server to support DNSSEC, you need to build it with crypto -support. To use OpenSSL, you should have OpenSSL 1.0.2e or newer -installed. If the OpenSSL library is installed in a nonstandard location, -specify the prefix using --with-openssl= on the configure command -line. To use a PKCS#11 hardware service module for cryptographic -operations, specify the path to the PKCS#11 provider library using ---with-pkcs11=, and configure BIND with --enable-native-pkcs11. - -To support the HTTP statistics channel, the server must be linked with at -least one of the following libraries: libxml2 http://xmlsoft.org or json-c -https://github.com/json-c/json-c. If these are installed at a nonstandard -location, then: - - * for libxml2, specify the prefix using --with-libxml2=/prefix, - * for json-c, adjust PKG_CONFIG_PATH. - -To support compression on the HTTP statistics channel, the server must be -linked against libzlib. If this is installed in a nonstandard location, -specify the prefix using --with-zlib=/prefix. - -To support storing configuration data for runtime-added zones in an LMDB -database, the server must be linked with liblmdb. If this is installed in -a nonstandard location, specify the prefix using with-lmdb=/prefix. - -To support MaxMind GeoIP2 location-based ACLs, the server must be linked -with libmaxminddb. This is turned on by default if the library is found; -if the library is installed in a nonstandard location, specify the prefix -using --with-maxminddb=/prefix. GeoIP2 support can be switched off with ---disable-geoip. - -For DNSTAP packet logging, you must have installed libfstrm https:// -github.com/farsightsec/fstrm and libprotobuf-c https:// -developers.google.com/protocol-buffers, and BIND must be configured with ---enable-dnstap. - -Certain compiled-in constants and default settings can be decreased to -values better suited to small machines, e.g. OpenWRT boxes, by specifying ---with-tuning=small on the configure command line. This will decrease -memory usage by using smaller structures, but will degrade performance. - -On Linux, process capabilities are managed in user space using the libcap -library, which can be installed on most Linux systems via the libcap-dev -or libcap-devel package. Process capability support can also be disabled -by configuring with --disable-linux-caps. - -On some platforms it is necessary to explicitly request large file support -to handle files bigger than 2GB. This can be done by using ---enable-largefile on the configure command line. - -Support for the "fixed" rrset-order option can be enabled or disabled by -specifying --enable-fixed-rrset or --disable-fixed-rrset on the configure -command line. By default, fixed rrset-order is disabled to reduce memory -footprint. - -The --enable-querytrace option causes named to log every step of -processing every query. This should only be enabled when debugging, -because it has a significant negative impact on query performance. - -make install will install named and the various BIND 9 libraries. By -default, installation is into /usr/local, but this can be changed with the ---prefix option when running configure. - -You may specify the option --sysconfdir to set the directory where -configuration files like named.conf go by default, and --localstatedir to -set the default parent directory of run/named.pid. --sysconfdir defaults -to $prefix/etc and --localstatedir defaults to $prefix/var. - -Automated testing - -A system test suite can be run with make test. The system tests require -you to configure a set of virtual IP addresses on your system (this allows -multiple servers to run locally and communicate with one another). These -IP addresses can be configured by running the command bin/tests/system/ -ifconfig.sh up as root. - -Some tests require Perl and the Net::DNS and/or IO::Socket::INET6 modules, -and will be skipped if these are not available. Some tests require Python -and the dnspython module and will be skipped if these are not available. -See bin/tests/system/README for further details. - -Unit tests are implemented using the CMocka unit testing framework. To -build them, use configure --with-cmocka. Execution of tests is done by the -Kyua test execution engine; if the kyua command is available, then unit -tests can be run via make test or make unit. - -Documentation - -The BIND 9 Administrator Reference Manual is included with the source -distribution, in DocBook XML, HTML, and PDF format, in the doc/arm -directory. - -Some of the programs in the BIND 9 distribution have man pages in their -directories. In particular, the command line options of named are -documented in bin/named/named.8. - -Frequently (and not-so-frequently) asked questions and their answers can -be found in the ISC Knowledge Base at https://kb.isc.org. - -Additional information on various subjects can be found in other README -files throughout the source tree. - -Change log - -A detailed list of all changes that have been made throughout the -development BIND 9 is included in the file CHANGES, with the most recent -changes listed first. Change notes include tags indicating the category of -the change that was made; these categories are: - - Category Description -[func] New feature -[bug] General bug fix -[security] Fix for a significant security flaw -[experimental] Used for new features when the syntax or other aspects of - the design are still in flux and may change -[port] Portability enhancement -[maint] Updates to built-in data such as root server addresses and - keys -[tuning] Changes to built-in configuration defaults and constants to - improve performance -[performance] Other changes to improve server performance -[protocol] Updates to the DNS protocol such as new RR types -[test] Changes to the automatic tests, not affecting server - functionality -[cleanup] Minor corrections and refactoring -[doc] Documentation -[contrib] Changes to the contributed tools and libraries in the - 'contrib' subdirectory - Used in the master development branch to reserve change -[placeholder] numbers for use in other branches, e.g. when fixing a bug - that only exists in older releases - -In general, [func] and [experimental] tags will only appear in new-feature -releases (i.e., those with version numbers ending in zero). Some new -functionality may be backported to older releases on a case-by-case basis. -All other change types may be applied to all currently-supported releases. - -Bug report identifiers - -Most notes in the CHANGES file include a reference to a bug report or -issue number. Prior to 2018, these were usually of the form [RT #NNN] and -referred to entries in the "bind9-bugs" RT database, which was not open to -the public. More recent entries use the form [GL #NNN] or, less often, [GL -!NNN], which, respectively, refer to issues or merge requests in the -GitLab database. Most of these are publicly readable, unless they include -information which is confidential or security sensitive. - -To look up a GitLab issue by its number, use the URL https:// -gitlab.isc.org/isc-projects/bind9/issues/NNN. To look up a merge request, -use https://gitlab.isc.org/isc-projects/bind9/merge_requests/NNN. - -In rare cases, an issue or merge request number may be followed with the -letter "P". This indicates that the information is in the private ISC -GitLab instance, which is not visible to the public. - -Acknowledgments - - * The original development of BIND 9 was underwritten by the following - organizations: - - Sun Microsystems, Inc. - Hewlett Packard - Compaq Computer Corporation - IBM - Process Software Corporation - Silicon Graphics, Inc. - Network Associates, Inc. - U.S. Defense Information Systems Agency - USENIX Association - Stichting NLnet - NLnet Foundation - Nominum, Inc. - - * This product includes software developed by the OpenSSL Project for - use in the OpenSSL Toolkit. http://www.OpenSSL.org/ - - * This product includes cryptographic software written by Eric Young - (eay@cryptsoft.com) - - * This product includes software written by Tim Hudson - (tjh@cryptsoft.com) diff --git a/README.md b/README.md index 41b7bb7b57..c9e19a211d 100644 --- a/README.md +++ b/README.md @@ -171,14 +171,7 @@ affect compilation. Significant ones are: |--------------------|-----------------------------------------------| |`CC`|The C compiler to use. `configure` tries to figure out the right one for supported systems.| |`CFLAGS`|C compiler flags. Defaults to include -g and/or -O2 as supported by the compiler. Please include '-g' if you need to set `CFLAGS`. | -|`STD_CINCLUDES`|System header file directories. Can be used to specify where add-on thread or IPv6 support is, for example. Defaults to empty string.| -|`STD_CDEFINES`|Any additional preprocessor symbols you want defined. Defaults to empty string. For a list of possible settings, see the file [OPTIONS](OPTIONS.md).| |`LDFLAGS`|Linker flags. Defaults to empty string.| -|`BUILD_CC`|Needed when cross-compiling: the native C compiler to use when building for the target system.| -|`BUILD_CFLAGS`|`CFLAGS` for the target system during cross-compiling.| -|`BUILD_CPPFLAGS`|`CPPFLAGS` for the target system during cross-compiling.| -|`BUILD_LDFLAGS`|`LDFLAGS` for the target system during cross-compiling.| -|`BUILD_LIBS`|`LIBS` for the target system during cross-compiling.| Additional environment variables affecting the build are listed at the end of the `configure` help text, which can be obtained by running the @@ -273,7 +266,7 @@ defaults to `$prefix/etc` and `--localstatedir` defaults to `$prefix/var`. ### Automated testing -A system test suite can be run with `make test`. The system tests require +A system test suite can be run with `make check`. The system tests require you to configure a set of virtual IP addresses on your system (this allows multiple servers to run locally and communicate with one another). These IP addresses can be configured by running the command @@ -284,11 +277,9 @@ and will be skipped if these are not available. Some tests require Python and the `dnspython` module and will be skipped if these are not available. See bin/tests/system/README for further details. -Unit tests are implemented using the [CMocka unit testing framework](https://cmocka.org/). -To build them, use `configure --with-cmocka`. Execution of tests is done -by the [Kyua test execution engine](https://github.com/jmmv/kyua); if the -`kyua` command is available, then unit tests can be run via `make test` -or `make unit`. +Unit tests are implemented using the CMocka unit testing framework. To build +them, use `configure --with-cmocka`. Execution of tests is done by the automake +parallel test driver; unit tests are also run by `make check`. ### Documentation diff --git a/bin/Makefile.am b/bin/Makefile.am new file mode 100644 index 0000000000..296a0220f7 --- /dev/null +++ b/bin/Makefile.am @@ -0,0 +1,5 @@ +SUBDIRS = named rndc dig delv dnssec tools nsupdate check confgen tests plugins + +if HAVE_PKCS11 +SUBDIRS += pkcs11 +endif diff --git a/bin/check/Makefile.am b/bin/check/Makefile.am new file mode 100644 index 0000000000..dc0d52554d --- /dev/null +++ b/bin/check/Makefile.am @@ -0,0 +1,34 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBBIND9_CFLAGS) + +AM_CPPFLAGS += \ + -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" + +noinst_LTLIBRARIES = libcheck-tool.la + +libcheck_tool_la_SOURCES = \ + check-tool.h \ + check-tool.c + +LDADD = \ + libcheck-tool.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBBIND9_LIBS) + +sbin_PROGRAMS = named-checkconf named-checkzone + +install-exec-hook: + ln -f $(DESTDIR)$(sbindir)/named-checkzone \ + $(DESTDIR)$(sbindir)/named-compilezone + +uninstall-hook: + -rm -f $(DESTDIR)$(sbindir)/named-compilezone diff --git a/bin/check/named-checkconf.c b/bin/check/named-checkconf.c index a503c37086..444941db79 100644 --- a/bin/check/named-checkconf.c +++ b/bin/check/named-checkconf.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -56,8 +57,8 @@ isc_log_t *logc = NULL; } while (0) /*% usage */ -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -655,7 +656,7 @@ main(int argc, char **argv) { break; case 'v': - printf(VERSION "\n"); + printf("%s\n", PACKAGE_VERSION); exit(0); case 'x': diff --git a/bin/check/named-checkzone.c b/bin/check/named-checkzone.c index c44c1b96a9..0aa5a95e49 100644 --- a/bin/check/named-checkzone.c +++ b/bin/check/named-checkzone.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -63,8 +64,8 @@ static enum { progmode_check, progmode_compile } progmode; } \ } while (0) -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -354,7 +355,7 @@ main(int argc, char **argv) { break; case 'v': - printf(VERSION "\n"); + printf("%s\n", PACKAGE_VERSION); exit(0); case 'w': diff --git a/bin/confgen/Makefile.am b/bin/confgen/Makefile.am new file mode 100644 index 0000000000..d9e917bb10 --- /dev/null +++ b/bin/confgen/Makefile.am @@ -0,0 +1,30 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + -DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" + +LDADD = \ + libconfgen.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) + +noinst_LTLIBRARIES = libconfgen.la + +libconfgen_la_SOURCES = \ + include/confgen/os.h \ + keygen.h \ + keygen.c \ + util.h \ + util.c \ + unix/os.c + +sbin_PROGRAMS = rndc-confgen ddns-confgen + +install-exec-hook: + ln -f $(DESTDIR)$(sbindir)/ddns-confgen \ + $(DESTDIR)$(sbindir)/tsig-confgen + +uninstall-hook: + -rm -f $(DESTDIR)$(sbindir)/tsig-confgen diff --git a/bin/confgen/ddns-confgen.c b/bin/confgen/ddns-confgen.c index ac3e3d068a..02e3f72bc5 100644 --- a/bin/confgen/ddns-confgen.c +++ b/bin/confgen/ddns-confgen.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -57,8 +58,8 @@ const char *progname; static enum { progmode_keygen, progmode_confgen } progmode; bool verbose = false; /* needed by util.c but not used here */ -ISC_PLATFORM_NORETURN_PRE static void -usage(int status) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(int status); static void usage(int status) { diff --git a/bin/confgen/rndc-confgen.c b/bin/confgen/rndc-confgen.c index 90a1d7e999..2d79599550 100644 --- a/bin/confgen/rndc-confgen.c +++ b/bin/confgen/rndc-confgen.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -60,8 +61,8 @@ bool verbose = false; const char *keyfile, *keydef; -ISC_PLATFORM_NORETURN_PRE static void -usage(int status) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(int status); static void usage(int status) { diff --git a/bin/confgen/util.h b/bin/confgen/util.h index ec9b181780..21cc8de1e9 100644 --- a/bin/confgen/util.h +++ b/bin/confgen/util.h @@ -14,6 +14,7 @@ /*! \file */ +#include #include #include #include @@ -35,9 +36,8 @@ ISC_LANG_BEGINDECLS void notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2); -ISC_PLATFORM_NORETURN_PRE void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); ISC_LANG_ENDDECLS diff --git a/bin/delv/Makefile.am b/bin/delv/Makefile.am new file mode 100644 index 0000000000..54050232bf --- /dev/null +++ b/bin/delv/Makefile.am @@ -0,0 +1,21 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + -I$(top_builddir)/include \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBIRS_CFLAGS) + +AM_CPPFLAGS += \ + -DSYSCONFDIR=\"${sysconfdir}\" + +bin_PROGRAMS = delv + +delv_SOURCES = \ + delv.c +delv_LDADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBIRS_LIBS) diff --git a/bin/delv/delv.c b/bin/delv/delv.c index 0525b2c6fa..994e1558de 100644 --- a/bin/delv/delv.c +++ b/bin/delv/delv.c @@ -28,6 +28,7 @@ #include #include +#include #include #include #include @@ -205,9 +206,8 @@ usage(void) { exit(1); } -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void fatal(const char *format, ...) { @@ -1327,7 +1327,7 @@ dash_option(char *option, char *next, bool *open_type_class) { /* handled in preparse_args() */ break; case 'v': - fputs("delv " VERSION "\n", stderr); + fprintf(stderr, "delv %s\n", PACKAGE_VERSION); exit(0); /* NOTREACHED */ default: diff --git a/bin/dig/Makefile.am b/bin/dig/Makefile.am new file mode 100644 index 0000000000..7bcd2f5e65 --- /dev/null +++ b/bin/dig/Makefile.am @@ -0,0 +1,30 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBIRS_CFLAGS) \ + $(LIBBIND9_CFLAGS) \ + $(LIBIDN2_CFLAGS) + +LDADD = \ + libdighost.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBIRS_LIBS) \ + $(LIBBIND9_LIBS) \ + $(LIBIDN2_LIBS) + +noinst_LTLIBRARIES = libdighost.la + +libdighost_la_SOURCES = \ + dighost.h \ + dighost.c + +bin_PROGRAMS = dig host nslookup + +nslookup_LDADD = \ + $(LDADD) \ + $(READLINE_LIB) diff --git a/bin/dig/dig.c b/bin/dig/dig.c index cd01275181..4bf9084a24 100644 --- a/bin/dig/dig.c +++ b/bin/dig/dig.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -41,7 +42,7 @@ #include #include -#include +#include "dighost.h" #define ADD_STRING(b, s) \ { \ @@ -109,8 +110,8 @@ usage(void) { fprintf(stderr, "Press for complete list of options\n"); } #else /* if TARGET_OS_IPHONE */ -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -125,7 +126,7 @@ usage(void) { /*% version */ static void version(void) { - fputs("DiG " VERSION "\n", stderr); + fprintf(stderr, "DiG %s\n", PACKAGE_VERSION); } /*% help */ @@ -912,7 +913,8 @@ printgreeting(int argc, char **argv, dig_lookup_t *lookup) { if (printcmd) { snprintf(lookup->cmdline, sizeof(lookup->cmdline), - "%s; <<>> DiG " VERSION " <<>>", first ? "\n" : ""); + "%s; <<>> DiG %s <<>>", first ? "\n" : "", + PACKAGE_VERSION); i = 1; while (i < argc) { snprintf(append, sizeof(append), " %s", argv[i++]); @@ -2658,7 +2660,7 @@ dig_query_setup(bool is_batchfile, bool config_only, int argc, char **argv) { } void -dig_startup() { +dig_startup(void) { isc_result_t result; debug("dig_startup()"); @@ -2669,12 +2671,12 @@ dig_startup() { } void -dig_query_start() { +dig_query_start(void) { start_lookup(); } void -dig_shutdown() { +dig_shutdown(void) { destroy_lookup(default_lookup); if (atomic_load(&batchname) != 0) { if (batchfp != stdin) { diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index 4a4d0b6773..7d403e9b3c 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -84,7 +84,7 @@ #include -#include +#include "dighost.h" #if USE_PKCS11 #include diff --git a/bin/dig/include/dig/dig.h b/bin/dig/dighost.h similarity index 75% rename from bin/dig/include/dig/dig.h rename to bin/dig/dighost.h index 6460dd13c0..9b482ce3de 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/dighost.h @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -77,7 +78,7 @@ ISC_LANG_BEGINDECLS typedef struct dig_lookup dig_lookup_t; -typedef struct dig_query dig_query_t; +typedef struct dig_query dig_query_t; typedef struct dig_server dig_server_t; typedef ISC_LIST(dig_server_t) dig_serverlist_t; typedef struct dig_searchlist dig_searchlist_t; @@ -112,76 +113,76 @@ struct dig_lookup { * sources. */ char textname[MXNAME]; /*% Name we're going to be * looking up */ - char cmdline[MXNAME]; - dns_rdatatype_t rdtype; - dns_rdatatype_t qrdtype; + char cmdline[MXNAME]; + dns_rdatatype_t rdtype; + dns_rdatatype_t qrdtype; dns_rdataclass_t rdclass; - bool rdtypeset; - bool rdclassset; - char name_space[BUFSIZE]; - char oname_space[BUFSIZE]; - isc_buffer_t namebuf; - isc_buffer_t onamebuf; - isc_buffer_t renderbuf; - char * sendspace; - dns_name_t * name; - isc_interval_t interval; - dns_message_t * sendmsg; - dns_name_t * oname; + bool rdtypeset; + bool rdclassset; + char name_space[BUFSIZE]; + char oname_space[BUFSIZE]; + isc_buffer_t namebuf; + isc_buffer_t onamebuf; + isc_buffer_t renderbuf; + char *sendspace; + dns_name_t *name; + isc_interval_t interval; + dns_message_t *sendmsg; + dns_name_t *oname; ISC_LINK(dig_lookup_t) link; ISC_LIST(dig_query_t) q; ISC_LIST(dig_query_t) connecting; - dig_query_t * current_query; - dig_serverlist_t my_server_list; + dig_query_t *current_query; + dig_serverlist_t my_server_list; dig_searchlist_t *origin; - dig_query_t * xfr_q; - uint32_t retries; - int nsfound; - uint16_t udpsize; - int16_t edns; - int16_t padding; - uint32_t ixfr_serial; - isc_buffer_t rdatabuf; - char rdatastore[MXNAME]; - dst_context_t * tsigctx; - isc_buffer_t * querysig; - uint32_t msgcounter; - dns_fixedname_t fdomain; - isc_sockaddr_t * ecs_addr; - char * cookie; - dns_ednsopt_t * ednsopts; - unsigned int ednsoptscnt; - isc_dscp_t dscp; - unsigned int ednsflags; - dns_opcode_t opcode; - int rrcomments; - unsigned int eoferr; + dig_query_t *xfr_q; + uint32_t retries; + int nsfound; + uint16_t udpsize; + int16_t edns; + int16_t padding; + uint32_t ixfr_serial; + isc_buffer_t rdatabuf; + char rdatastore[MXNAME]; + dst_context_t *tsigctx; + isc_buffer_t *querysig; + uint32_t msgcounter; + dns_fixedname_t fdomain; + isc_sockaddr_t *ecs_addr; + char *cookie; + dns_ednsopt_t *ednsopts; + unsigned int ednsoptscnt; + isc_dscp_t dscp; + unsigned int ednsflags; + dns_opcode_t opcode; + int rrcomments; + unsigned int eoferr; }; /*% The dig_query structure */ struct dig_query { - unsigned int magic; + unsigned int magic; dig_lookup_t *lookup; bool waiting_connect, pending_free, waiting_senddone, first_pass, first_soa_rcvd, second_rr_rcvd, first_repeat_rcvd, recv_made, warn_id, timedout; - uint32_t first_rr_serial; - uint32_t second_rr_serial; - uint32_t msg_count; - uint32_t rr_count; - bool ixfr_axfr; - char * servname; - char * userarg; - isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf; - char * recvspace, *tmpsendspace, lengthspace[4]; + uint32_t first_rr_serial; + uint32_t second_rr_serial; + uint32_t msg_count; + uint32_t rr_count; + bool ixfr_axfr; + char *servname; + char *userarg; + isc_buffer_t recvbuf, lengthbuf, tmpsendbuf, sendbuf; + char *recvspace, *tmpsendspace, lengthspace[4]; isc_socket_t *sock; ISC_LINK(dig_query_t) link; ISC_LINK(dig_query_t) clink; isc_sockaddr_t sockaddr; - isc_time_t time_sent; - isc_time_t time_recv; - uint64_t byte_count; - isc_timer_t * timer; + isc_time_t time_sent; + isc_time_t time_recv; + uint64_t byte_count; + isc_timer_t *timer; }; struct dig_server { @@ -202,38 +203,38 @@ typedef ISC_LIST(dig_lookup_t) dig_lookuplist_t; * Externals from dighost.c */ -extern dig_lookuplist_t lookup_list; -extern dig_serverlist_t server_list; +extern dig_lookuplist_t lookup_list; +extern dig_serverlist_t server_list; extern dig_searchlistlist_t search_list; -extern unsigned int extrabytes; +extern unsigned int extrabytes; extern bool check_ra, have_ipv4, have_ipv6, specified_source, usesearch, showsearch, yaml; -extern in_port_t port; -extern unsigned int timeout; -extern isc_mem_t * mctx; -extern int sendcount; -extern int ndots; -extern int lookup_counter; -extern int exitcode; -extern isc_sockaddr_t bind_address; -extern char keynametext[MXNAME]; -extern char keyfile[MXNAME]; -extern char keysecret[MXNAME]; +extern in_port_t port; +extern unsigned int timeout; +extern isc_mem_t *mctx; +extern int sendcount; +extern int ndots; +extern int lookup_counter; +extern int exitcode; +extern isc_sockaddr_t bind_address; +extern char keynametext[MXNAME]; +extern char keyfile[MXNAME]; +extern char keysecret[MXNAME]; extern const dns_name_t *hmacname; -extern unsigned int digestbits; -extern dns_tsigkey_t * tsigkey; -extern bool validated; -extern isc_taskmgr_t * taskmgr; -extern isc_task_t * global_task; -extern bool free_now; -extern bool debugging, debugtiming, memdebugging; -extern bool keep_open; +extern unsigned int digestbits; +extern dns_tsigkey_t *tsigkey; +extern bool validated; +extern isc_taskmgr_t *taskmgr; +extern isc_task_t *global_task; +extern bool free_now; +extern bool debugging, debugtiming, memdebugging; +extern bool keep_open; extern char *progname; -extern int tries; -extern int fatalexit; -extern bool verbose; +extern int tries; +extern int fatalexit; +extern bool verbose; /* * Routines in dighost.c. @@ -247,15 +248,14 @@ getaddresses(dig_lookup_t *lookup, const char *host, isc_result_t *resultp); isc_result_t get_reverse(char *reverse, size_t len, char *value, bool strict); -ISC_PLATFORM_NORETURN_PRE void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); void warn(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); -ISC_PLATFORM_NORETURN_PRE void -digexit(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +digexit(void); void debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); @@ -333,7 +333,7 @@ set_search_domain(char *domain); * Routines to be defined in dig.c, host.c, and nslookup.c. and * then assigned to the appropriate function pointer */ -extern isc_result_t (*dighost_printmessage)(dig_query_t * query, +extern isc_result_t (*dighost_printmessage)(dig_query_t *query, const isc_buffer_t *msgbuf, dns_message_t *msg, bool headers); diff --git a/bin/dig/host.c b/bin/dig/host.c index c94c2de012..ad88f8bf1b 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -21,6 +21,7 @@ #endif /* ifdef HAVE_LOCALE_H */ #include +#include #include #include #include @@ -38,7 +39,7 @@ #include #include -#include +#include "dighost.h" static bool short_form = true, listed_server = false; static bool default_lookups = true; @@ -101,8 +102,8 @@ rcode_totext(dns_rcode_t rcode) { return (totext.deconsttext); } -ISC_PLATFORM_NORETURN_PRE static void -show_usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +show_usage(void); static void show_usage(void) { @@ -581,7 +582,7 @@ static const char *optstring = "46aAc:dilnm:p:rst:vVwCDN:R:TUW:"; /*% version */ static void version(void) { - fputs("host " VERSION "\n", stderr); + fprintf(stderr, "host %s\n", PACKAGE_VERSION); } static void diff --git a/bin/dig/nslookup.c b/bin/dig/nslookup.c index 1bc5798f64..5a5a14b12a 100644 --- a/bin/dig/nslookup.c +++ b/bin/dig/nslookup.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -35,7 +36,7 @@ #include #include -#include +#include "dighost.h" #if defined(HAVE_READLINE) #if defined(HAVE_EDIT_READLINE_READLINE_H) @@ -629,7 +630,7 @@ set_ndots(const char *value) { static void version(void) { - fputs("nslookup " VERSION "\n", stderr); + fprintf(stderr, "nslookup %s\n", PACKAGE_VERSION); } static void @@ -879,8 +880,8 @@ get_next_command(void) { isc_mem_free(mctx, buf); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/bin/dnssec/Makefile.am b/bin/dnssec/Makefile.am new file mode 100644 index 0000000000..993d704400 --- /dev/null +++ b/bin/dnssec/Makefile.am @@ -0,0 +1,38 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) + +AM_CPPFLAGS += \ + -DNAMED_CONFFILE=\"${sysconfdir}/named.conf\" + +noinst_LTLIBRARIES = libdnssectool.la + +LDADD = \ + libdnssectool.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) + +sbin_PROGRAMS = \ + dnssec-cds \ + dnssec-dsfromkey \ + dnssec-importkey \ + dnssec-keyfromlabel \ + dnssec-keygen \ + dnssec-revoke \ + dnssec-settime \ + dnssec-signzone \ + dnssec-verify + +libdnssectool_la_SOURCES = \ + dnssectool.h \ + dnssectool.c + +dnssec_keygen_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISCCFG_CFLAGS) + +dnssec_keygen_LDADD = \ + $(LDADD) \ + $(LIBISCCFG_LIBS) diff --git a/bin/dnssec/dnssec-cds.c b/bin/dnssec/dnssec-cds.c index a9ba59d4f2..e730e0ef20 100644 --- a/bin/dnssec/dnssec-cds.c +++ b/bin/dnssec/dnssec-cds.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -1020,8 +1021,8 @@ nsdiff(uint32_t ttl, dns_rdataset_t *oldset, dns_rdataset_t *newset) { } } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -1029,7 +1030,7 @@ usage(void) { fprintf(stderr, " %s options [options] -f -d \n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "Options:\n" " -a digest algorithm (SHA-1 / " "SHA-256 / SHA-384)\n" diff --git a/bin/dnssec/dnssec-dsfromkey.c b/bin/dnssec/dnssec-dsfromkey.c index f2a989c5fe..dacb871619 100644 --- a/bin/dnssec/dnssec-dsfromkey.c +++ b/bin/dnssec/dnssec-dsfromkey.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -320,8 +321,8 @@ emits(bool showall, bool cds, dns_rdata_t *rdata) { } } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/bin/dnssec/dnssec-importkey.c b/bin/dnssec/dnssec-importkey.c index f271c67c86..80553005bb 100644 --- a/bin/dnssec/dnssec-importkey.c +++ b/bin/dnssec/dnssec-importkey.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -264,15 +265,15 @@ emit(const char *dir, dns_rdata_t *rdata) { dst_key_free(&key); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s options [-K dir] keyfile\n\n", program); fprintf(stderr, " %s options -f file [keyname]\n\n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "Options:\n"); fprintf(stderr, " -f file: read key from zone file\n"); fprintf(stderr, " -K : directory in which to store " diff --git a/bin/dnssec/dnssec-keyfromlabel.c b/bin/dnssec/dnssec-keyfromlabel.c index 3d2d24eae8..9508345b2a 100644 --- a/bin/dnssec/dnssec-keyfromlabel.c +++ b/bin/dnssec/dnssec-keyfromlabel.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -47,14 +48,14 @@ const char *program = "dnssec-keyfromlabel"; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s -l label [options] name\n\n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "Required options:\n"); fprintf(stderr, " -l label: label of the key pair\n"); fprintf(stderr, " name: owner of the key\n"); diff --git a/bin/dnssec/dnssec-keygen.c b/bin/dnssec/dnssec-keygen.c index 36724bec96..696892d438 100644 --- a/bin/dnssec/dnssec-keygen.c +++ b/bin/dnssec/dnssec-keygen.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -70,8 +71,8 @@ const char *program = "dnssec-keygen"; isc_log_t *lctx = NULL; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void progress(int p); @@ -136,7 +137,7 @@ static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s [options] name\n\n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, " name: owner of the key\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, " -K : write keys into directory\n"); diff --git a/bin/dnssec/dnssec-revoke.c b/bin/dnssec/dnssec-revoke.c index af191012a8..6fb1d708a5 100644 --- a/bin/dnssec/dnssec-revoke.c +++ b/bin/dnssec/dnssec-revoke.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -40,14 +41,14 @@ const char *program = "dnssec-revoke"; static isc_mem_t *mctx = NULL; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s [options] keyfile\n\n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); #if USE_PKCS11 fprintf(stderr, " -E engine: specify PKCS#11 provider " diff --git a/bin/dnssec/dnssec-settime.c b/bin/dnssec/dnssec-settime.c index 01d37186e1..bf76b97873 100644 --- a/bin/dnssec/dnssec-settime.c +++ b/bin/dnssec/dnssec-settime.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -44,14 +45,14 @@ const char *program = "dnssec-settime"; static isc_mem_t *mctx = NULL; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { fprintf(stderr, "Usage:\n"); fprintf(stderr, " %s [options] keyfile\n\n", program); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "General options:\n"); #if USE_PKCS11 fprintf(stderr, diff --git a/bin/dnssec/dnssec-signzone.c b/bin/dnssec/dnssec-signzone.c index 4c5d28221d..5d6212b0a5 100644 --- a/bin/dnssec/dnssec-signzone.c +++ b/bin/dnssec/dnssec-signzone.c @@ -33,6 +33,7 @@ #include #include +#include #include #include #include @@ -3125,11 +3126,11 @@ print_version(FILE *fp) { return; } - fprintf(fp, "; dnssec_signzone version " VERSION "\n"); + fprintf(fp, "; dnssec_signzone version %s\n", PACKAGE_VERSION); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -3138,7 +3139,7 @@ usage(void) { fprintf(stderr, "\n"); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "Options: (default value in parenthesis) \n"); fprintf(stderr, "\t-S:\tsmart signing: automatically finds key files\n" diff --git a/bin/dnssec/dnssec-verify.c b/bin/dnssec/dnssec-verify.c index ac003ad58a..8a46ebfa09 100644 --- a/bin/dnssec/dnssec-verify.c +++ b/bin/dnssec/dnssec-verify.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -137,8 +138,8 @@ loadzone(char *file, char *origin, dns_rdataclass_t rdclass, dns_db_t **db) { } } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -147,7 +148,7 @@ usage(void) { fprintf(stderr, "\n"); - fprintf(stderr, "Version: %s\n", VERSION); + fprintf(stderr, "Version: %s\n", PACKAGE_VERSION); fprintf(stderr, "Options: (default value in parenthesis) \n"); fprintf(stderr, "\t-v debuglevel (0)\n"); diff --git a/bin/dnssec/dnssectool.c b/bin/dnssec/dnssectool.c index 265f557e5a..d6039c3255 100644 --- a/bin/dnssec/dnssectool.c +++ b/bin/dnssec/dnssectool.c @@ -112,7 +112,7 @@ vbprintf(int level, const char *fmt, ...) { void version(const char *name) { - fprintf(stderr, "%s %s\n", name, VERSION); + fprintf(stderr, "%s %s\n", name, PACKAGE_VERSION); exit(0); } diff --git a/bin/dnssec/dnssectool.h b/bin/dnssec/dnssectool.h index 9471f96807..483cdafdbe 100644 --- a/bin/dnssec/dnssectool.h +++ b/bin/dnssec/dnssectool.h @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -42,9 +43,8 @@ extern uint8_t dtype[8]; typedef void(fatalcallback_t)(void); -ISC_PLATFORM_NORETURN_PRE void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); void setfatalcallback(fatalcallback_t *callback); @@ -55,8 +55,8 @@ check_result(isc_result_t result, const char *message); void vbprintf(int level, const char *fmt, ...) ISC_FORMAT_PRINTF(2, 3); -ISC_PLATFORM_NORETURN_PRE void -version(const char *program) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +version(const char *program); void sig_format(dns_rdata_rrsig_t *sig, char *cp, unsigned int size); diff --git a/bin/named/.gitignore b/bin/named/.gitignore index f522c74834..ea7fb96479 100644 --- a/bin/named/.gitignore +++ b/bin/named/.gitignore @@ -1,3 +1,3 @@ .libs /named -named-symtbl.c +/xsl.c diff --git a/bin/named/Makefile.am b/bin/named/Makefile.am new file mode 100644 index 0000000000..07d65c304b --- /dev/null +++ b/bin/named/Makefile.am @@ -0,0 +1,109 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + -I$(srcdir)/unix/include \ + -I$(top_builddir)/include \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBISCCC_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBBIND9_CFLAGS) \ + $(LIBLTDL_CFLAGS) \ + $(OPENSSL_CFLAGS) \ + $(LIBCAP_CFLAGS) \ + $(LMDB_CFLAGS) \ + $(MAXMINDDB_CFLAGS) \ + $(DNSTAP_CFLAGS) \ + $(ZLIB_CFLAGS) + +if HAVE_JSON_C +AM_CPPFLAGS += \ + $(JSON_C_CFLAGS) +endif HAVE_JSON_C + +if HAVE_LIBXML2 +AM_CPPFLAGS += \ + $(LIBXML2_CFLAGS) +endif HAVE_LIBXML2 + +AM_CPPFLAGS += \ + -DNAMED_LOCALSTATEDIR=\"${localstatedir}\" \ + -DNAMED_SYSCONFDIR=\"${sysconfdir}\" + +sbin_PROGRAMS = named + +nodist_named_SOURCES = xsl.c +BUILT_SOURCES = xsl.c +CLEANFILES = xsl.c + +xsl.c: bind9.xsl Makefile + (echo 'const char xslmsg[] =' && \ + $(SED) -e 's,\",\\\",g' \ + -e 's,^,\",' \ + -e 's,$$,\",' && \ + echo ";") \ + < "${srcdir}/bind9.xsl" > $@ + +named_SOURCES = \ + builtin.c \ + config.c \ + control.c \ + controlconf.c \ + fuzz.c \ + log.c \ + logconf.c \ + main.c \ + server.c \ + statschannel.c \ + tkeyconf.c \ + tsigconf.c \ + zoneconf.c \ + unix/dlz_dlopen_driver.c \ + unix/os.c \ + include/named/builtin.h \ + include/named/config.h \ + include/named/control.h \ + include/named/fuzz.h \ + include/named/geoip.h \ + include/named/globals.h \ + include/named/log.h \ + include/named/logconf.h \ + include/named/main.h \ + include/named/server.h \ + include/named/smf_globals.h \ + include/named/statschannel.h \ + include/named/tkeyconf.h \ + include/named/tsigconf.h \ + include/named/types.h \ + include/named/zoneconf.h \ + unix/include/named/os.h \ + xsl_p.h + +if HAVE_GEOIP2 +AM_CPPFLAGS += \ + -DMAXMINDDB_PREFIX=\"@MAXMINDDB_PREFIX@\" +named_SOURCES += \ + geoip.c +endif + +named_LDADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) \ + $(LIBISCCC_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBBIND9_LIBS) \ + $(LIBLTDL_LIBS) \ + $(OPENSSL_LIBS) \ + $(LIBCAP_LIBS) \ + $(LMDB_LIBS) \ + $(MAXMINDDB_LIBS) \ + $(DNSTAP_LIBS) \ + $(LIBXML2_LIBS) \ + $(ZLIB_LIBS) + +if HAVE_JSON_C +named_LDADD += \ + $(JSON_C_LIBS) +endif HAVE_JSON_C diff --git a/bin/named/bind9.xsl.h b/bin/named/bind9.xsl.h deleted file mode 100644 index 2769147be5..0000000000 --- a/bin/named/bind9.xsl.h +++ /dev/null @@ -1,1272 +0,0 @@ -/* - * Generated by convertxsl.pl 1.14 2008/07/17 23:43:26 jinmei Exp - * From unknown - */ -static char xslmsg[] = - "\n" - "\n" - "\n" - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " ISC BIND 9 Statistics\n" - " \n" - " \n" - "
\n" - "

ISC Bind 9 Configuration and Statistics

\n" - "
\n" - "

Alternate statistics views: All,\n" - " Status,\n" - " Server,\n" - " Zones,\n" - " Network,\n" - " Tasks,\n" - " Memory and\n" - " Traffic Size

\n" - "
\n" - "

Server Status

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
Boot time:\n" - " \n" - "
Last reconfigured:\n" - " \n" - "
Current time:\n" - " \n" - "
Server version:\n" - " \n" - "
\n" - "
\n" - " \n" - " \n" - "

Incoming Requests by DNS Opcode

\n" - " \n" - "
\n" - " [cannot display chart]\n" - "
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
Total:\n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - " \n" - "

Incoming Queries by Query Type

\n" - "
\n" - " [cannot display chart]\n" - "
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
Total:\n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Outgoing Queries per view

\n" - " \n" - "

View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
[no " - "data to display]
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "
\n" - " \n" - "

Server Statistics

\n" - " \n" - " \n" - " \n" - "
[no data to " - "display]
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - "

Zone Maintenance Statistics

\n" - " \n" - " \n" - "
[no data to " - "display]
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - " \n" - "

Resolver Statistics (Common)

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - " \n" - " \n" - "

Resolver Statistics for View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - "

ADB Statistics for View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - "

Cache Statistics for View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - "

Cache DB RRsets for View

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "
\n" - " \n" - "

Traffic Size Statistics

\n" - "
\n" - " \n" - "

UDP Requests Received

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

UDP Responses Sent

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

TCP Requests Received

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

TCP Responses Sent

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Socket I/O Statistics

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - " \n" - "

Zones for View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
NameClassTypeSerial
\n" - "
\n" - "
\n" - " \n" - "

Received QTYPES per view/zone

\n" - " \n" - "

View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - "

Zone

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
[no data " - "to display]
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "
\n" - "
\n" - " \n" - "

Response Codes per view/zone

\n" - " \n" - "

View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - "

Zone

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
[no " - "data to display]
\n" - "
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "
\n" - "
\n" - " \n" - "

Glue cache statistics

\n" - " \n" - "

View

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - "

Zone

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "
\n" - "
\n" - " \n" - "

Network Status

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
IDNameTypeReferencesLocalAddressPeerAddressState
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Task Manager Configuration

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
Thread-Model\n" - " \n" - "
Worker Threads\n" - " \n" - "
Default Quantum\n" - " \n" - "
Tasks Running\n" - " \n" - "
Tasks Ready\n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Tasks

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
IDNameReferencesStateQuantumEvents
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Memory Usage Summary

\n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - " \n" - "

Memory Contexts

\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " even\n" - " odd\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
IDNameReferencesTotalUseInUseMaxUseMallocedMaxMallocedBlockSizePoolsHiWaterLoWater
\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - "
\n" - "
\n" - "
\n" - "

Internet Systems Consortium Inc.
http://www.isc.org

\n" - " \n" - " \n" - " \n" - "\n"; diff --git a/bin/named/builtin.c b/bin/named/builtin.c index d3ab9ad480..6a27e5c9d2 100644 --- a/bin/named/builtin.c +++ b/bin/named/builtin.c @@ -347,7 +347,7 @@ do_version_lookup(dns_sdblookup_t *lookup) { return (put_txt(lookup, named_g_server->version)); } } else { - return (put_txt(lookup, named_g_version)); + return (put_txt(lookup, PACKAGE_VERSION)); } } diff --git a/bin/named/controlconf.c b/bin/named/controlconf.c index 4c0127b7a6..a3fda486d3 100644 --- a/bin/named/controlconf.c +++ b/bin/named/controlconf.c @@ -1191,9 +1191,9 @@ add_listener(named_controls_t *cp, controllistener_t **listenerp, if (result == ISC_R_SUCCESS) { int pf = isc_sockaddr_pf(&listener->address); if ((pf == AF_INET && isc_net_probeipv4() != ISC_R_SUCCESS) || -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 (pf == AF_UNIX && isc_net_probeunix() != ISC_R_SUCCESS) || -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif (pf == AF_INET6 && isc_net_probeipv6() != ISC_R_SUCCESS)) { result = ISC_R_FAMILYNOSUPPORT; diff --git a/bin/named/convertxsl.pl b/bin/named/convertxsl.pl deleted file mode 100755 index 8f78be323d..0000000000 --- a/bin/named/convertxsl.pl +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env 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; -use warnings; - -my $rev = '$Id: convertxsl.pl,v 1.14 2008/07/17 23:43:26 jinmei Exp $'; -$rev =~ s/\$//g; -$rev =~ s/,v//g; -$rev =~ s/Id: //; - -my $xsl = "unknown"; -my $lines = ''; - -while (<>) { - chomp; - # pickout the id for comment. - $xsl = $_ if (//); - # convert Id string to a form not recognisable by cvs. - $_ =~ s///; - s/[\ \t]+/ /g; - s/\>\ \\.*//; -$xsl =~ s/,v//; - -print "/*\n * Generated by $rev \n * From $xsl\n */\n"; -print 'static char xslmsg[] =',"\n"; -print $lines; - -print ';', "\n"; diff --git a/bin/named/include/named/globals.h b/bin/named/include/named/globals.h index eb38625f44..3b6e8d7d65 100644 --- a/bin/named/include/named/globals.h +++ b/bin/named/include/named/globals.h @@ -65,12 +65,12 @@ EXTERN isc_socketmgr_t *named_g_socketmgr INIT(NULL); EXTERN isc_nm_t *named_g_nm INIT(NULL); EXTERN cfg_parser_t *named_g_parser INIT(NULL); EXTERN cfg_parser_t *named_g_addparser INIT(NULL); -EXTERN const char *named_g_version INIT(VERSION); -EXTERN const char *named_g_product INIT(PRODUCT); -EXTERN const char *named_g_description INIT(DESCRIPTION); -EXTERN const char *named_g_srcid INIT(SRCID); -EXTERN const char *named_g_configargs INIT(CONFIGARGS); -EXTERN const char *named_g_builder INIT(BUILDER); +EXTERN const char *named_g_version INIT(PACKAGE_VERSION); +EXTERN const char *named_g_product INIT(PACKAGE_NAME); +EXTERN const char *named_g_description INIT(PACKAGE_DESCRIPTION); +EXTERN const char *named_g_srcid INIT(PACKAGE_SRCID); +EXTERN const char *named_g_configargs INIT(PACKAGE_CONFIGARGS); +EXTERN const char *named_g_builder INIT(PACKAGE_BUILDER); EXTERN in_port_t named_g_port INIT(0); EXTERN isc_dscp_t named_g_dscp INIT(-1); diff --git a/bin/named/include/named/main.h b/bin/named/include/named/main.h index 27b7624046..ffd26429e8 100644 --- a/bin/named/include/named/main.h +++ b/bin/named/include/named/main.h @@ -9,8 +9,9 @@ * information regarding copyright ownership. */ -#ifndef NAMED_MAIN_H -#define NAMED_MAIN_H 1 +#pragma once + +#include /*! \file */ @@ -23,14 +24,11 @@ */ #define NAMED_MAIN_ARGS "46A:c:d:D:E:fFgL:M:m:n:N:p:sS:t:T:U:u:vVx:X:" -ISC_PLATFORM_NORETURN_PRE void -named_main_earlyfatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +named_main_earlyfatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); void named_main_earlywarning(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); void named_main_setmemstats(const char *); - -#endif /* NAMED_MAIN_H */ diff --git a/bin/named/main.c b/bin/named/main.c index ec8d22100f..b03b30c072 100644 --- a/bin/named/main.c +++ b/bin/named/main.c @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -189,9 +190,9 @@ named_main_earlyfatal(const char *format, ...) { exit(1); } -ISC_PLATFORM_NORETURN_PRE static void +ISC_NORETURN static void assertion_failed(const char *file, int line, isc_assertiontype_t type, - const char *cond) ISC_PLATFORM_NORETURN_POST; + const char *cond); static void assertion_failed(const char *file, int line, isc_assertiontype_t type, @@ -254,10 +255,9 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type, exit(1); } -ISC_PLATFORM_NORETURN_PRE static void +ISC_NORETURN static void library_fatal_error(const char *file, int line, const char *format, - va_list args) - ISC_FORMAT_PRINTF(3, 0) ISC_PLATFORM_NORETURN_POST; + va_list args) ISC_FORMAT_PRINTF(3, 0); static void library_fatal_error(const char *file, int line, const char *format, @@ -487,16 +487,15 @@ printversion(bool verbose) { const cfg_obj_t *defaults = NULL, *obj = NULL; #endif /* if defined(HAVE_GEOIP2) */ - printf("%s %s%s%s \n", named_g_product, named_g_version, - (*named_g_description != '\0') ? " " : "", named_g_description, - named_g_srcid); + printf("%s%s \n", PACKAGE_STRING, PACKAGE_DESCRIPTION, + PACKAGE_SRCID); if (!verbose) { return; } printf("running on %s\n", named_os_uname()); - printf("built by %s with %s\n", named_g_builder, named_g_configargs); + printf("built by %s with %s\n", PACKAGE_BUILDER, PACKAGE_CONFIGARGS); #ifdef __clang__ printf("compiled by CLANG %s\n", __VERSION__); #else /* ifdef __clang__ */ @@ -1049,9 +1048,8 @@ setup(void) { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, - "starting %s %s%s%s ", named_g_product, - named_g_version, *named_g_description ? " " : "", - named_g_description, named_g_srcid); + "starting %s%s ", PACKAGE_STRING, + PACKAGE_DESCRIPTION, PACKAGE_SRCID); isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "running on %s", @@ -1059,7 +1057,7 @@ setup(void) { isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "built with %s", - named_g_configargs); + PACKAGE_CONFIGARGS); isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, @@ -1228,7 +1226,6 @@ setup(void) { */ /* xxdb_init(); */ -#ifdef ISC_DLZ_DLOPEN /* * Register the DLZ "dlopen" driver. */ @@ -1237,7 +1234,6 @@ setup(void) { named_main_earlyfatal("dlz_dlopen_init() failed: %s", isc_result_totext(result)); } -#endif /* ifdef ISC_DLZ_DLOPEN */ #if CONTRIB_DLZ /* @@ -1321,12 +1317,10 @@ cleanup(void) { */ dlz_drivers_clear(); #endif /* ifdef CONTRIB_DLZ */ -#ifdef ISC_DLZ_DLOPEN /* * Unregister "dlopen" DLZ driver. */ dlz_dlopen_clear(); -#endif /* ifdef ISC_DLZ_DLOPEN */ isc_log_write(named_g_lctx, NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_MAIN, ISC_LOG_NOTICE, "exiting"); @@ -1454,10 +1448,11 @@ main(int argc, char *argv[]) { */ strlcat(version, #if defined(NO_VERSION_DATE) || !defined(__DATE__) - "named version: BIND " VERSION " <" SRCID ">", -#else /* if defined(NO_VERSION_DATE) || !defined(__DATE__) */ - "named version: BIND " VERSION " <" SRCID "> (" __DATE__ ")", -#endif /* if defined(NO_VERSION_DATE) || !defined(__DATE__) */ + "named version: BIND " PACKAGE_VERSION " <" PACKAGE_SRCID ">", +#else + "named version: BIND " PACKAGE_VERSION " <" PACKAGE_SRCID + "> (" __DATE__ ")", +#endif sizeof(version)); result = isc_file_progname(*argv, program_name, sizeof(program_name)); if (result != ISC_R_SUCCESS) { diff --git a/bin/named/server.c b/bin/named/server.c index 3c4f8cf9a6..c1851eded8 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -381,9 +382,8 @@ const char *empty_zones[] = { NULL }; -ISC_PLATFORM_NORETURN_PRE static void -fatal(named_server_t *server, const char *msg, - isc_result_t result) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(named_server_t *server, const char *msg, isc_result_t result); static void named_server_reload(isc_task_t *task, isc_event_t *event); @@ -1633,7 +1633,6 @@ cleanup: return (result); } -#ifdef HAVE_DLOPEN static isc_result_t configure_dyndb(const cfg_obj_t *dyndb, isc_mem_t *mctx, const dns_dyndbctx_t *dctx) { @@ -1660,7 +1659,6 @@ configure_dyndb(const cfg_obj_t *dyndb, isc_mem_t *mctx, } return (result); } -#endif /* ifdef HAVE_DLOPEN */ static isc_result_t disable_algorithms(const cfg_obj_t *disabled, dns_resolver_t *resolver) { @@ -3760,7 +3758,7 @@ configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) { result = named_config_get(maps, "dnstap-version", &obj); if (result != ISC_R_SUCCESS) { /* not specified; use the product and version */ - dns_dt_setversion(named_g_server->dtenv, PRODUCT " " VERSION); + dns_dt_setversion(named_g_server->dtenv, PACKAGE_STRING); } else if (result == ISC_R_SUCCESS && !cfg_obj_isvoid(obj)) { /* Quoted string */ dns_dt_setversion(named_g_server->dtenv, cfg_obj_asstring(obj)); @@ -3817,7 +3815,6 @@ create_mapped_acl(void) { return (result); } -#ifdef HAVE_DLOPEN /*% * A callback for the cfg_pluginlist_foreach() call in configure_view() below. * If registering any plugin fails, registering subsequent ones is not @@ -3855,11 +3852,10 @@ register_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, return (result); } -#endif /* ifdef HAVE_DLOPEN */ /* - * Configure 'view' according to 'vconfig', taking defaults from 'config' - * where values are missing in 'vconfig'. + * Configure 'view' according to 'vconfig', taking defaults from + * 'config' where values are missing in 'vconfig'. * * When configuring the default view, 'vconfig' will be NULL and the * global defaults in 'config' used exclusively. @@ -5412,7 +5408,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, (void)cfg_map_get(config, "dyndb", &dyndb_list); } -#ifdef HAVE_DLOPEN for (element = cfg_list_first(dyndb_list); element != NULL; element = cfg_list_next(element)) { @@ -5428,7 +5423,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, CHECK(configure_dyndb(dyndb, mctx, dctx)); } -#endif /* ifdef HAVE_DLOPEN */ /* * Load plugins. @@ -5440,7 +5434,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, (void)cfg_map_get(config, "plugin", &plugin_list); } -#ifdef HAVE_DLOPEN if (plugin_list != NULL) { INSIST(view->hooktable == NULL); CHECK(ns_hooktable_create(view->mctx, @@ -5453,7 +5446,6 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config, CHECK(cfg_pluginlist_foreach(config, plugin_list, named_g_lctx, register_one_plugin, view)); } -#endif /* ifdef HAVE_DLOPEN */ /* * Setup automatic empty zones. If recursion is off then @@ -11744,10 +11736,9 @@ named_server_status(named_server_t *server, isc_buffer_t **text) { isc_time_formathttptimestamp(&named_g_configtime, configtime, sizeof(configtime)); - snprintf(line, sizeof(line), "version: %s %s%s%s %s%s%s\n", - named_g_product, named_g_version, - (*named_g_description != '\0') ? " " : "", named_g_description, - named_g_srcid, ob, alt, cb); + snprintf(line, sizeof(line), "version: %s%s %s%s%s\n", + PACKAGE_STRING, PACKAGE_DESCRIPTION, PACKAGE_SRCID, ob, alt, + cb); CHECK(putstr(text, line)); result = named_os_gethostname(hostname, sizeof(hostname)); diff --git a/bin/named/statschannel.c b/bin/named/statschannel.c index 25bec658bf..b702915ada 100644 --- a/bin/named/statschannel.c +++ b/bin/named/statschannel.c @@ -52,7 +52,7 @@ #define ISC_XMLCHAR (const xmlChar *) #endif /* HAVE_LIBXML2 */ -#include "bind9.xsl.h" +#include "xsl_p.h" struct named_statschannel { /* Unlocked */ @@ -1988,7 +1988,7 @@ generatexml(named_server_t *server, uint32_t flags, int *buflen, TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR nowstr)); TRY0(xmlTextWriterEndElement(writer)); /* current-time */ TRY0(xmlTextWriterStartElement(writer, ISC_XMLCHAR "version")); - TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR named_g_version)); + TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR PACKAGE_VERSION)); TRY0(xmlTextWriterEndElement(writer)); /* version */ if ((flags & STATS_XML_SERVER) != 0) { @@ -2825,7 +2825,7 @@ generatejson(named_server_t *server, size_t *msglen, const char **msg, obj = json_object_new_string(nowstr); CHECKMEM(obj); json_object_object_add(bindstats, "current-time", obj); - obj = json_object_new_string(named_g_version); + obj = json_object_new_string(PACKAGE_VERSION); CHECKMEM(obj); json_object_object_add(bindstats, "version", obj); @@ -3472,6 +3472,7 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo, const char *querystring, isc_httpdfree_t **freecb, void **freecb_args) { isc_result_t result; char *_headers = NULL; + char *p; UNUSED(url); UNUSED(querystring); @@ -3530,7 +3531,8 @@ render_xsl(const char *url, isc_httpdurl_t *urlinfo, const char *querystring, send: *retcode = 200; *retmsg = "OK"; - isc_buffer_reinit(b, xslmsg, strlen(xslmsg)); + DE_CONST(xslmsg, p); + isc_buffer_reinit(b, p, strlen(xslmsg)); isc_buffer_add(b, strlen(xslmsg)); end: free(_headers); diff --git a/bin/named/unix/dlz_dlopen_driver.c b/bin/named/unix/dlz_dlopen_driver.c index 5b0e7a5507..605055f66a 100644 --- a/bin/named/unix/dlz_dlopen_driver.c +++ b/bin/named/unix/dlz_dlopen_driver.c @@ -10,13 +10,11 @@ */ #include +#include #include #include #include #include -#if HAVE_DLFCN_H -#include -#endif /* if HAVE_DLFCN_H */ #include #include @@ -30,7 +28,6 @@ #include #include -#ifdef ISC_DLZ_DLOPEN static dns_sdlzimplementation_t *dlz_dlopen = NULL; typedef struct dlopen_data { @@ -183,13 +180,21 @@ dlopen_dlz_lookup(const char *zone, const char *name, void *driverarg, */ static void * dl_load_symbol(dlopen_data_t *cd, const char *symbol, bool mandatory) { - void *ptr = dlsym(cd->dl_handle, symbol); - if (ptr == NULL && mandatory) { - dlopen_log(ISC_LOG_ERROR, - "dlz_dlopen: library '%s' is missing " - "required symbol '%s'", - cd->dl_path, symbol); + void *ptr = lt_dlsym((lt_dlhandle)cd->dl_handle, symbol); + if (ptr == NULL) { + const char *errmsg = lt_dlerror(); + if (errmsg == NULL) { + errmsg = "returned function pointer is NULL"; + } + if (mandatory) { + dlopen_log(ISC_LOG_ERROR, + "dlz_dlopen: library '%s' is missing " + "required symbol '%s': %s", + cd->dl_path, symbol, errmsg); + } } + /* Cleanup any errors */ + (void)lt_dlerror(); return (ptr); } @@ -202,7 +207,6 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], dlopen_data_t *cd; isc_mem_t *mctx = NULL; isc_result_t result = ISC_R_FAILURE; - int dlopen_flags = 0; UNUSED(driverarg); @@ -214,45 +218,33 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], return (ISC_R_FAILURE); } - isc_mem_create(&mctx); + if (lt_dlinit() != 0) { + return (ISC_R_FAILURE); + } + isc_mem_create(&mctx); cd = isc_mem_get(mctx, sizeof(*cd)); memset(cd, 0, sizeof(*cd)); cd->mctx = mctx; cd->dl_path = isc_mem_strdup(cd->mctx, argv[1]); - cd->dlzname = isc_mem_strdup(cd->mctx, dlzname); /* Initialize the lock */ isc_mutex_init(&cd->lock); - /* Open the library */ - dlopen_flags = RTLD_NOW | RTLD_GLOBAL; - -#if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ - /* - * If RTLD_DEEPBIND is available then use it. This can avoid - * issues with a module using a different version of a system - * library than one that bind9 uses. For example, bind9 may link - * to MIT kerberos, but the module may use Heimdal. If we don't - * use RTLD_DEEPBIND then we could end up with Heimdal functions - * calling MIT functions, which leads to bizarre results (usually - * a segfault). - */ - dlopen_flags |= RTLD_DEEPBIND; -#endif /* if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ */ - - cd->dl_handle = dlopen(cd->dl_path, dlopen_flags); + cd->dl_handle = lt_dlopenext(cd->dl_path); if (cd->dl_handle == NULL) { dlopen_log(ISC_LOG_ERROR, - "dlz_dlopen failed to open library '%s' - %s", - cd->dl_path, dlerror()); + "dlz_dlopen failed to open library '%s': %s", + cd->dl_path, lt_dlerror()); result = ISC_R_FAILURE; goto failed; } + (void)lt_dlerror(); + /* Find the symbols */ cd->dlz_version = (dlz_dlopen_version_t *)dl_load_symbol(cd, "dlz_version", true); @@ -330,20 +322,14 @@ dlopen_dlz_create(const char *dlzname, unsigned int argc, char *argv[], failed: dlopen_log(ISC_LOG_ERROR, "dlz_dlopen of '%s' failed", dlzname); - if (cd->dl_path != NULL) { - isc_mem_free(mctx, cd->dl_path); - } - if (cd->dlzname != NULL) { - isc_mem_free(mctx, cd->dlzname); - } - if (dlopen_flags != 0) { - isc_mutex_destroy(&cd->lock); - } -#ifdef HAVE_DLCLOSE + + isc_mem_free(mctx, cd->dl_path); + isc_mem_free(mctx, cd->dlzname); + + isc_mutex_destroy(&cd->lock); if (cd->dl_handle) { - dlclose(cd->dl_handle); + (void)lt_dlclose(cd->dl_handle); } -#endif /* ifdef HAVE_DLCLOSE */ isc_mem_put(mctx, cd, sizeof(*cd)); isc_mem_destroy(&mctx); return (result); @@ -372,11 +358,9 @@ dlopen_dlz_destroy(void *driverarg, void *dbdata) { isc_mem_free(cd->mctx, cd->dlzname); } -#ifdef HAVE_DLCLOSE if (cd->dl_handle) { - dlclose(cd->dl_handle); + lt_dlclose(cd->dl_handle); } -#endif /* ifdef HAVE_DLCLOSE */ isc_mutex_destroy(&cd->lock); @@ -547,17 +531,12 @@ static dns_sdlzmethods_t dlz_dlopen_methods = { dlopen_dlz_configure, dlopen_dlz_ssumatch, dlopen_dlz_addrdataset, dlopen_dlz_subrdataset, dlopen_dlz_delrdataset }; -#endif /* ifdef ISC_DLZ_DLOPEN */ /* * Register driver with BIND */ isc_result_t dlz_dlopen_init(isc_mem_t *mctx) { -#ifndef ISC_DLZ_DLOPEN - UNUSED(mctx); - return (ISC_R_NOTIMPLEMENTED); -#else /* ifndef ISC_DLZ_DLOPEN */ isc_result_t result; dlopen_log(2, "Registering DLZ_dlopen driver"); @@ -576,7 +555,6 @@ dlz_dlopen_init(isc_mem_t *mctx) { } return (result); -#endif /* ifndef ISC_DLZ_DLOPEN */ } /* @@ -584,10 +562,8 @@ dlz_dlopen_init(isc_mem_t *mctx) { */ void dlz_dlopen_clear(void) { -#ifdef ISC_DLZ_DLOPEN dlopen_log(2, "Unregistering DLZ_dlopen driver"); if (dlz_dlopen != NULL) { dns_sdlzunregister(&dlz_dlopen); } -#endif /* ifdef ISC_DLZ_DLOPEN */ } diff --git a/bin/named/win32/dlz_dlopen_driver.c b/bin/named/win32/dlz_dlopen_driver.c index 1a9c85e14a..cf18fc3318 100644 --- a/bin/named/win32/dlz_dlopen_driver.c +++ b/bin/named/win32/dlz_dlopen_driver.c @@ -28,7 +28,6 @@ #include #include -#ifdef ISC_DLZ_DLOPEN static dns_sdlzimplementation_t *dlz_dlopen = NULL; typedef struct dlopen_data { @@ -530,17 +529,12 @@ static dns_sdlzmethods_t dlz_dlopen_methods = { dlopen_dlz_configure, dlopen_dlz_ssumatch, dlopen_dlz_addrdataset, dlopen_dlz_subrdataset, dlopen_dlz_delrdataset }; -#endif /* ifdef ISC_DLZ_DLOPEN */ /* * Register driver with BIND */ isc_result_t dlz_dlopen_init(isc_mem_t *mctx) { -#ifndef ISC_DLZ_DLOPEN - UNUSED(mctx); - return (ISC_R_NOTIMPLEMENTED); -#else /* ifndef ISC_DLZ_DLOPEN */ isc_result_t result; dlopen_log(2, "Registering DLZ_dlopen driver"); @@ -559,7 +553,6 @@ dlz_dlopen_init(isc_mem_t *mctx) { } return (result); -#endif /* ifndef ISC_DLZ_DLOPEN */ } /* @@ -567,10 +560,8 @@ dlz_dlopen_init(isc_mem_t *mctx) { */ void dlz_dlopen_clear(void) { -#ifdef ISC_DLZ_DLOPEN dlopen_log(2, "Unregistering DLZ_dlopen driver"); if (dlz_dlopen != NULL) { dns_sdlzunregister(&dlz_dlopen); } -#endif /* ifdef ISC_DLZ_DLOPEN */ } diff --git a/bin/named/win32/include/named/ntservice.h b/bin/named/win32/include/named/ntservice.h index 8fe6f5b32e..42c980170a 100644 --- a/bin/named/win32/include/named/ntservice.h +++ b/bin/named/win32/include/named/ntservice.h @@ -18,12 +18,12 @@ #define BIND_SERVICE_NAME "named" void - ntservice_init(); + ntservice_init(void); void UpdateSCM(DWORD); void ServiceControl(DWORD dwCtrlCode); void -ntservice_shutdown(); +ntservice_shutdown(void); BOOL -ntservice_isservice(); +ntservice_isservice(void); #endif /* ifndef NTSERVICE_H */ diff --git a/bin/named/win32/ntservice.c b/bin/named/win32/ntservice.c index 2aa9b812c9..d89a746c59 100644 --- a/bin/named/win32/ntservice.c +++ b/bin/named/win32/ntservice.c @@ -50,8 +50,8 @@ ntservice_init(void) { } UpdateSCM(SERVICE_RUNNING); } else { - strlcpy(ConsoleTitle, "BIND Version ", sizeof(ConsoleTitle)); - strlcat(ConsoleTitle, VERSION, sizeof(ConsoleTitle)); + snprintf(ConsoleTitle, sizeof(ConsoleTitle), "%s Version %s", + PACKAGE_NAME, PACKAGE_VERSION); SetConsoleTitle(ConsoleTitle); } } diff --git a/lib/ns/version.c b/bin/named/xsl_p.h similarity index 64% rename from lib/ns/version.c rename to bin/named/xsl_p.h index 7df021564c..d4d8a8ce38 100644 --- a/lib/ns/version.c +++ b/bin/named/xsl_p.h @@ -9,12 +9,6 @@ * information regarding copyright ownership. */ -/*! \file */ +#pragma once -#include - -const char ns_version[] = VERSION; - -const unsigned int ns_libinterface = LIBINTERFACE; -const unsigned int ns_librevision = LIBREVISION; -const unsigned int ns_libage = LIBAGE; +extern const char xslmsg[]; diff --git a/bin/nsupdate/Makefile.am b/bin/nsupdate/Makefile.am new file mode 100644 index 0000000000..8e2cbaa6ef --- /dev/null +++ b/bin/nsupdate/Makefile.am @@ -0,0 +1,25 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBIRS_CFLAGS) \ + $(LIBBIND9_CFLAGS) \ + $(GSSAPI_CFLAGS) \ + $(KRB5_CFLAGS) + +AM_CPPFLAGS += \ + -DSESSION_KEYFILE=\"${localstatedir}/run/named/session.key\" + +LDADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBIRS_LIBS) \ + $(LIBBIND9_LIBS) \ + $(READLINE_LIB) \ + $(GSSAPI_LIBS) \ + $(KRB5_LIBS) + +bin_PROGRAMS = nsupdate diff --git a/bin/nsupdate/nsupdate.c b/bin/nsupdate/nsupdate.c index ce3798968d..549df9979c 100644 --- a/bin/nsupdate/nsupdate.c +++ b/bin/nsupdate/nsupdate.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -74,14 +75,23 @@ #include -#ifdef GSSAPI +#if HAVE_GSSAPI #include -#ifdef WIN32 + +#if HAVE_KRB5_KRB5_H #include -#else /* ifdef WIN32 */ -#include ISC_PLATFORM_KRB5HEADER -#endif /* ifdef WIN32 */ -#endif /* ifdef GSSAPI */ +#elif HAVE_KRB5_H +#include +#endif + +#if HAVE_GSSAPI_GSSAPI_H +#include +#elif HAVE_GSSAPI_H +#include +#endif + +#endif /* HAVE_GSSAPI */ + #include #if defined(HAVE_READLINE) @@ -189,9 +199,8 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, static void send_update(dns_name_t *zonename, isc_sockaddr_t *master); -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); @@ -199,7 +208,7 @@ debug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void ddebug(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); -#ifdef GSSAPI +#if HAVE_GSSAPI static dns_fixedname_t fkname; static isc_sockaddr_t *kserver = NULL; static char *realm = NULL; @@ -212,7 +221,7 @@ typedef struct nsu_gssinfo { } nsu_gssinfo_t; static void -failed_gssrequest(); +failed_gssrequest(void); static void start_gssrequest(dns_name_t *master); static void @@ -220,7 +229,7 @@ send_gssrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, dns_request_t **request, gss_ctx_id_t context); static void recvgss(isc_task_t *task, isc_event_t *event); -#endif /* GSSAPI */ +#endif /* HAVE_GSSAPI */ static void error(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); @@ -1005,7 +1014,7 @@ get_addresses(char *host, in_port_t port, isc_sockaddr_t *sockaddr, static void version(void) { - fputs("nsupdate " VERSION "\n", stderr); + fprintf(stderr, "nsupdate %s\n", PACKAGE_VERSION); } #define PARSE_ARGS_FMT "46dDML:y:ghilovk:p:Pr:R::t:Tu:V" @@ -1228,13 +1237,13 @@ parse_args(int argc, char **argv) { exit(1); } -#ifdef GSSAPI +#if HAVE_GSSAPI if (usegsstsig && (keyfile != NULL || keystr != NULL)) { fprintf(stderr, "%s: cannot specify -g with -k or -y\n", argv[0]); exit(1); } -#else /* ifdef GSSAPI */ +#else /* HAVE_GSSAPI */ if (usegsstsig) { fprintf(stderr, "%s: cannot specify -g or -o, " @@ -1242,7 +1251,7 @@ parse_args(int argc, char **argv) { argv[0]); exit(1); } -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ if (argv[isc_commandline_index] != NULL) { if (strcmp(argv[isc_commandline_index], "-") == 0) { @@ -1698,7 +1707,7 @@ evaluate_zone(char *cmdline) { static uint16_t evaluate_realm(char *cmdline) { -#ifdef GSSAPI +#if HAVE_GSSAPI char *word; char buf[1024]; int n; @@ -1720,10 +1729,10 @@ evaluate_realm(char *cmdline) { } realm = isc_mem_strdup(gmctx, buf); return (STATUS_MORE); -#else /* ifdef GSSAPI */ +#else /* HAVE_GSSAPI */ UNUSED(cmdline); return (STATUS_SYNTAX); -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ } static uint16_t @@ -2201,25 +2210,25 @@ do_next_command(char *cmdline) { return (evaluate_checknames(cmdline)); } if (strcasecmp(word, "gsstsig") == 0) { -#ifdef GSSAPI +#if HAVE_GSSAPI usegsstsig = true; use_win2k_gsstsig = false; -#else /* ifdef GSSAPI */ +#else /* HAVE_GSSAPI */ fprintf(stderr, "gsstsig not supported\n"); -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ return (STATUS_MORE); } if (strcasecmp(word, "oldgsstsig") == 0) { -#ifdef GSSAPI +#if HAVE_GSSAPI usegsstsig = true; use_win2k_gsstsig = true; -#else /* ifdef GSSAPI */ +#else /* HAVE_GSSAPI */ fprintf(stderr, "gsstsig not supported\n"); -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ return (STATUS_MORE); } if (strcasecmp(word, "help") == 0) { - fprintf(stdout, "nsupdate " VERSION ":\n" + fprintf(stdout, "nsupdate " PACKAGE_VERSION ":\n" "local address [port] (set local " "resolver)\n" "server address [port] (set master server " @@ -2261,7 +2270,7 @@ do_next_command(char *cmdline) { return (STATUS_MORE); } if (strcasecmp(word, "version") == 0) { - fprintf(stdout, "nsupdate " VERSION "\n"); + fprintf(stdout, "nsupdate " PACKAGE_VERSION "\n"); return (STATUS_MORE); } fprintf(stderr, "incorrect section name: %s\n", word); @@ -2770,7 +2779,7 @@ lookforsoa: } dns_rdata_freestruct(&soa); -#ifdef GSSAPI +#if HAVE_GSSAPI if (usegsstsig) { dns_name_init(&tmpzonename, NULL); dns_name_dup(zname, gmctx, &tmpzonename); @@ -2781,10 +2790,10 @@ lookforsoa: send_update(zname, &master_servers[master_inuse]); setzoneclass(dns_rdataclass_none); } -#else /* ifdef GSSAPI */ +#else /* HAVE_GSSAPI */ send_update(zname, &master_servers[master_inuse]); setzoneclass(dns_rdataclass_none); -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ dns_message_destroy(&soaquery); dns_request_destroy(&request); @@ -2838,7 +2847,7 @@ sendrequest(isc_sockaddr_t *destaddr, dns_message_t *msg, requests++; } -#ifdef GSSAPI +#if HAVE_GSSAPI /* * Get the realm from the users kerberos ticket if possible @@ -2893,7 +2902,7 @@ get_ticket_realm(isc_mem_t *mctx) { } static void -failed_gssrequest() { +failed_gssrequest(void) { seenerror = true; dns_name_free(&tmpzonename, gmctx); @@ -3199,7 +3208,7 @@ done: dns_message_destroy(&rcvmsg); ddebug("Out of recvgss"); } -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ static void start_update(void) { @@ -3298,7 +3307,7 @@ cleanup(void) { dns_message_destroy(&answer); } -#ifdef GSSAPI +#if HAVE_GSSAPI if (tsigkey != NULL) { ddebug("detach tsigkey x%p", tsigkey); dns_tsigkey_detach(&tsigkey); @@ -3321,7 +3330,7 @@ cleanup(void) { if (dns_name_dynamic(&restart_master)) { dns_name_free(&restart_master, gmctx); } -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ if (sig0key != NULL) { dst_key_free(&sig0key); diff --git a/bin/pkcs11/Makefile.am b/bin/pkcs11/Makefile.am new file mode 100644 index 0000000000..1bcd014980 --- /dev/null +++ b/bin/pkcs11/Makefile.am @@ -0,0 +1,13 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) + +LDADD = \ + $(LIBISC_LIBS) + +bin_PROGRAMS = \ + pkcs11-list \ + pkcs11-destroy \ + pkcs11-keygen \ + pkcs11-tokens diff --git a/bin/plugins/Makefile.am b/bin/plugins/Makefile.am new file mode 100644 index 0000000000..c29b2615db --- /dev/null +++ b/bin/plugins/Makefile.am @@ -0,0 +1,12 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) + +pkglib_LTLIBRARIES = filter-aaaa.la + +filter_aaaa_la_SOURCES = filter-aaaa.c +filter_aaaa_la_LDFLAGS = -avoid-version -module -shared -export-dynamic diff --git a/bin/plugins/filter-aaaa.c b/bin/plugins/filter-aaaa.c index e787b43471..d34e0754ea 100644 --- a/bin/plugins/filter-aaaa.c +++ b/bin/plugins/filter-aaaa.c @@ -11,6 +11,13 @@ /*! \file */ +/* aliases for the exported symbols */ + +#define plugin_destroy filter_aaaa_LTX_plugin_destroy +#define plugin_register filter_aaaa_LTX_plugin_register +#define plugin_version filter_aaaa_LTX_plugin_version +#define plugin_check filter_aaaa_LTX_plugin_check + #include #include #include diff --git a/bin/rndc/Makefile.am b/bin/rndc/Makefile.am new file mode 100644 index 0000000000..a668522bc2 --- /dev/null +++ b/bin/rndc/Makefile.am @@ -0,0 +1,26 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBISCCC_CFLAGS) \ + $(LIBBIND9_CFLAGS) + +AM_CPPFLAGS += \ + -DRNDC_CONFFILE=\"${sysconfdir}/rndc.conf\" \ + -DRNDC_KEYFILE=\"${sysconfdir}/rndc.key\" + +sbin_PROGRAMS = rndc + +rndc_SOURCES = \ + rndc.c \ + util.c \ + util.h + +rndc_LDADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCC_LIBS) \ + $(LIBISCCFG_LIBS) \ + $(LIBBIND9_LIBS) diff --git a/bin/rndc/rndc.c b/bin/rndc/rndc.c index f238b1d584..ba91747657 100644 --- a/bin/rndc/rndc.c +++ b/bin/rndc/rndc.c @@ -17,6 +17,7 @@ #include #include +#include #include #include #include @@ -59,7 +60,7 @@ bool verbose; static const char *admin_conffile; static const char *admin_keyfile; -static const char *version = VERSION; +static const char *version = PACKAGE_VERSION; static const char *servername = NULL; static isc_sockaddr_t serveraddrs[SERVERADDRS]; static isc_sockaddr_t local4, local6; @@ -89,8 +90,8 @@ static bool showresult = false; static void rndc_startconnect(isc_sockaddr_t *addr, isc_task_t *task); -ISC_PLATFORM_NORETURN_PRE static void -usage(int status) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(int status); static void usage(int status) { diff --git a/bin/rndc/util.h b/bin/rndc/util.h index ec9b181780..21cc8de1e9 100644 --- a/bin/rndc/util.h +++ b/bin/rndc/util.h @@ -14,6 +14,7 @@ /*! \file */ +#include #include #include #include @@ -35,9 +36,8 @@ ISC_LANG_BEGINDECLS void notify(const char *fmt, ...) ISC_FORMAT_PRINTF(1, 2); -ISC_PLATFORM_NORETURN_PRE void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); ISC_LANG_ENDDECLS diff --git a/bin/tests/.gitignore b/bin/tests/.gitignore index 3b0c4b29cc..7ec87dd31a 100644 --- a/bin/tests/.gitignore +++ b/bin/tests/.gitignore @@ -9,4 +9,3 @@ dlopen keycreate keydelete gssapi_krb -makejournal diff --git a/bin/tests/Makefile.am b/bin/tests/Makefile.am new file mode 100644 index 0000000000..d4008c0dd0 --- /dev/null +++ b/bin/tests/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = system diff --git a/bin/tests/bigtest/README b/bin/tests/bigtest/README deleted file mode 100644 index 0daea5c933..0000000000 --- a/bin/tests/bigtest/README +++ /dev/null @@ -1,18 +0,0 @@ -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 deleted file mode 100644 index f8d531a789..0000000000 --- a/bin/tests/bigtest/buildzones.sh +++ /dev/null @@ -1,267 +0,0 @@ -#!/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 deleted file mode 100644 index f279e14c1a..0000000000 --- a/bin/tests/bigtest/rndc.key +++ /dev/null @@ -1,5 +0,0 @@ -key "rndc-key" { - algorithm hmac-md5; - secret "xxxxxxxxxxxxxxxxxxxxHg=="; -}; - diff --git a/bin/tests/bigtest/tests.sh b/bin/tests/bigtest/tests.sh deleted file mode 100644 index 7b3bd8f04e..0000000000 --- a/bin/tests/bigtest/tests.sh +++ /dev/null @@ -1,76 +0,0 @@ -#!/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 deleted file mode 100644 index 0bdcdfe23f..0000000000 --- a/bin/tests/bigtest/zones +++ /dev/null @@ -1,18 +0,0 @@ -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/optional/.gitignore b/bin/tests/optional/.gitignore deleted file mode 100644 index 0d89a8600c..0000000000 --- a/bin/tests/optional/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/backtrace_test.dSYM/ -/backtrace_test0.dSYM/ -/nsecify diff --git a/bin/tests/optional/Kchild.example.+005+33180.key b/bin/tests/optional/Kchild.example.+005+33180.key deleted file mode 100644 index ab92a6af4d..0000000000 --- a/bin/tests/optional/Kchild.example.+005+33180.key +++ /dev/null @@ -1,5 +0,0 @@ -; This is a zone-signing key, keyid 33180, for child.example. -; Created: 20181025104746 (Thu Oct 25 12:47:46 2018) -; Publish: 20181025104746 (Thu Oct 25 12:47:46 2018) -; Activate: 20181025104746 (Thu Oct 25 12:47:46 2018) -child.example. IN DNSKEY 256 3 5 AwEAAb9eatC8ASzDnRApcZuxyBrvJRANRQjCXQ1FWK+8vEyXV5NIE9Km hKIV2wbq2tLBPfjNQz4BTJ9RmDINf1RayDlt6L+IQV1JCaDaMjd1zU3n SQK18Y7fMu0ww4AMKOnoVRbkIxa3zlA0chImXcfPE0q2AvKBYLzPfkPO cfplAuRkLcGUxdADCipNzCOakpcd5gfm9Sa2HlaXcw3gyI1WcE8= diff --git a/bin/tests/optional/Kchild.example.+005+33180.private b/bin/tests/optional/Kchild.example.+005+33180.private deleted file mode 100644 index 83a50dfe42..0000000000 --- a/bin/tests/optional/Kchild.example.+005+33180.private +++ /dev/null @@ -1,13 +0,0 @@ -Private-key-format: v1.3 -Algorithm: 5 (RSASHA1) -Modulus: v15q0LwBLMOdEClxm7HIGu8lEA1FCMJdDUVYr7y8TJdXk0gT0qaEohXbBura0sE9+M1DPgFMn1GYMg1/VFrIOW3ov4hBXUkJoNoyN3XNTedJArXxjt8y7TDDgAwo6ehVFuQjFrfOUDRyEiZdx88TSrYC8oFgvM9+Q85x+mUC5GQtwZTF0AMKKk3MI5qSlx3mB+b1JrYeVpdzDeDIjVZwTw== -PublicExponent: AQAB -PrivateExponent: WDsn9GU6BXGLENCK2MX3BLQN2oDDu24hiOTYJu5VwtpkPjuVKCIuNKzu9xmBGnqOIBBDWGsw8KOmEC247yOL/S53iRdBS8lI7yiqznc52RhlmrdPKXbNpVnPwil8wocw+oQYa7uvdPYxI2Yy3B/tRgUxlxSlc/LW/dr0BX2L7qr/aeOBeGSRUlCpc7tYU9a2RUaLpVxF6SlqicCpC91MAQ== -Prime1: 466f+JL66Bl4qYnkj0s9+1N3pYmdcM9Ja1AN66X4VLslA9Cm1JEaC5V9HOptfcXUk0XYEVnKeKM2lIQnvcLG0yuQHIa+pGi7P8vgQfdaRUE= -Prime2: 1yuUkTVRSbUWeUreEcHgeeBBJ61UshX7t07gnGgIr3artGdo2CVEb5//+2Mvj5bgjCQBvjBbmHNZrR0jKDRBTIGtqbBerOuhEN4AXdAEgY8= -Exponent1: KzUXbJ/P973ltR7S/hKEV66WVRbRhvf/cdsGWULs5n+BXcD59/r1W19qF9OxJZ4mYjBt+ZT1pIEsuXB+7jcJbkelGJTFlwO9DTVOgJZFTkE= -Exponent2: FTPsLertGbBIiKdB/sn2Dsx0Xy6LXAkihsu1AnSV9oRhIyPVhwcVGVLQ7Lq3YxThB648pbsqK3miapamcj3D+YAF1uTUT4Hgm0LlEll/OC0= -Coefficient: Vulw9kmmjKc+wmOukLdzheoA2hNPDVtgiynfzHybyXdqvapCoK+ZVmNFzjO0M41ATcpvya3iX0bekMQqYnBhLURNZUIyqz2nGskOjV8I5Jg= -Created: 20181025104746 -Publish: 20181025104746 -Activate: 20181025104746 diff --git a/bin/tests/optional/adb_test.c b/bin/tests/optional/adb_test.c deleted file mode 100644 index b232914574..0000000000 --- a/bin/tests/optional/adb_test.c +++ /dev/null @@ -1,413 +0,0 @@ -/* - * 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 - -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_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, NULL, &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, &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, mctx, taskmgr, timermgr, - dns_rdataclass_in, "", "rbt", 0, NULL, - &cache); - check_result(result, "dns_cache_create"); - dns_view_setcache(view, cache, false); - 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); - - dns_name_dup(&name, mctx, &client->name); - - 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, 0, NULL, &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); - - isc_mutex_init(&client_lock); - - ISC_LIST_INIT(clients); - - /* - * EVERYTHING needs a memory context. - */ - isc_mem_create(&mctx); - - cmp = NULL; - isc_mempool_create(mctx, sizeof(client_t), &cmp); - isc_mempool_setname(cmp, "adb test clients"); - - 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; - isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC, - ISC_LOG_DYNAMIC, &destination, ISC_LOG_PRINTTIME); - - 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("nonexistent.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("nonexistent.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_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 deleted file mode 100644 index 5527835eee..0000000000 --- a/bin/tests/optional/backtrace_test.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 - -static int -func3() { - void *tracebuf[16]; - int nframes; - isc_result_t result; - - 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) { - printf("Unexpected result:\n"); - printf(" # of frames: %d (expected: at least 4)\n", nframes); - return (1); - } - - return (0); -} - -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 deleted file mode 100644 index b629d68663..0000000000 --- a/bin/tests/optional/byaddr_test.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * 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 - -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; - isc_mem_create(&mctx); - - 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, NULL, &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, &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, 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, false); - 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 deleted file mode 100644 index 1d6ab599c1..0000000000 --- a/bin/tests/optional/byname_test.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * 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 isc_mem_t *mctx = 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. - */ - 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; - flags = ISC_LOG_PRINTTIME; - isc_log_createchannel(lcfg, "_default", ISC_LOG_TOFILEDESC, - ISC_LOG_DYNAMIC, &destination, flags); - - 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, - 0, NULL, &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; - isc_mem_create(&mctx); - - 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, NULL, &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, &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, 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); - - REQUIRE(DNS_VIEW_VALID(view)); - RUNTIME_CHECK(dns_fwdtable_add(view->fwdtable, dns_rootname, - &sal, dns_fwdpolicy_only) == - ISC_R_SUCCESS); - } - - dns_view_setcache(view, cache, false); - 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); - - 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 deleted file mode 100644 index f4325ba171..0000000000 --- a/bin/tests/optional/db_test.c +++ /dev/null @@ -1,978 +0,0 @@ -/* - * 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 - -#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)); - - 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, dns_masterformat_text, 0); - 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; - const dns_name_t *origin; - dns_trust_t trust = 0; - unsigned int addopts; - isc_log_t *lctx = NULL; - size_t n; - - dns_result_register(); - - isc_mem_create(&mctx); - 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': - isc_log_create(mctx, &lctx, NULL); - 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 '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, NULL, - &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/fsaccess_test.c b/bin/tests/optional/fsaccess_test.c deleted file mode 100644 index 5a422105b3..0000000000 --- a/bin/tests/optional/fsaccess_test.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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 /* 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 deleted file mode 100644 index dfc1052435..0000000000 --- a/bin/tests/optional/gsstest.c +++ /dev/null @@ -1,562 +0,0 @@ -/* - * 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 - -#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_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; - isc_mem_create(&mctx); - - 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; - 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); - - RUNCHECK(dst_lib_init(mctx, NULL)); - - taskmgr = NULL; - RUNCHECK(isc_taskmgr_create(mctx, 1, 0, NULL, &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, &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_mem_stats(mctx, stdout); - isc_mem_destroy(&mctx); - - isc_app_finish(); - - return (0); -} -#else /* ifdef GSSAPI */ -int -main(int argc, char *argv[]) { - UNUSED(argc); - UNUSED(argv); - fprintf(stderr, "R:GSSAPIONLY\n"); - return (0); -} -#endif /* ifdef GSSAPI */ diff --git a/bin/tests/optional/inter_test.c b/bin/tests/optional/inter_test.c deleted file mode 100644 index 3d1ab921a7..0000000000 --- a/bin/tests/optional/inter_test.c +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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 - -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); - - isc_mem_create(&mctx); - 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/lex_test.c b/bin/tests/optional/lex_test.c deleted file mode 100644 index 95aada0815..0000000000 --- a/bin/tests/optional/lex_test.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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 - -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; - } - } - - isc_mem_create(&mctx); - 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 deleted file mode 100644 index e9d2481fab..0000000000 --- a/bin/tests/optional/lfsr_test.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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 - -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 reproducible. - */ - 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 deleted file mode 100644 index 750bcccc5c..0000000000 --- a/bin/tests/optional/log_test.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * 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 - -#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; - - isc_mem_create(&mctx); - isc_log_create(mctx, &lctx, &lcfg); - - 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; - - 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; - - 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/master_test.c b/bin/tests/optional/master_test.c deleted file mode 100644 index 50ced0fc7f..0000000000 --- a/bin/tests/optional/master_test.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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; - -static isc_result_t -print_dataset(void *arg, const 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); - - isc_mem_create(&mctx); - - 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, 0, - &callbacks, NULL, NULL, mctx, dns_masterformat_text, 0); - 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 deleted file mode 100644 index 485443c909..0000000000 --- a/bin/tests/optional/mempool_test.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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 - -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; - - isc_mutex_init(&lock); - - mctx = NULL; - isc_mem_create(&mctx); - - mp1 = NULL; - isc_mempool_create(mctx, 24, &mp1); - - mp2 = NULL; - isc_mempool_create(mctx, 31, &mp2); - - 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); - - isc_mutex_destroy(&lock); - - return (0); -} diff --git a/bin/tests/optional/name_test.c b/bin/tests/optional/name_test.c deleted file mode 100644 index 06afedf938..0000000000 --- a/bin/tests/optional/name_test.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * 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 - -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, *comp, *down; - const dns_name_t *origin; - 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); - dns_fixedname_init(&oname); - result = dns_name_fromtext(dns_fixedname_name(&oname), - &source, dns_rootname, 0, - NULL); - if (result != 0) { - fprintf(stderr, - "dns_name_fromtext() failed: %s\n", - dns_result_totext(result)); - exit(1); - } - origin = dns_fixedname_name(&oname); - } - } 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 deleted file mode 100644 index c762003376..0000000000 --- a/bin/tests/optional/nsecify.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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 - -static isc_mem_t *mctx = NULL; - -ISC_PLATFORM_NORETURN_PRE static inline void -fatal(const char *message) ISC_PLATFORM_NORETURN_POST; - -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, dns_masterformat_text, 0); - 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; - - dns_result_register(); - - isc_mem_create(&mctx); - - 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 deleted file mode 100644 index fd2111565b..0000000000 --- a/bin/tests/optional/ratelimiter_test.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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_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); - - isc_mem_create(&mctx); - RUNTIME_CHECK(isc_taskmgr_create(mctx, 3, 0, NULL, &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 deleted file mode 100644 index 4bba6553f1..0000000000 --- a/bin/tests/optional/rbt_test.c +++ /dev/null @@ -1,429 +0,0 @@ -/* - * 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 - -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); - - 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); - - 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); - - 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("UNEXPECTED 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; - - isc_mem_create(&mctx); - - 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 deleted file mode 100644 index 95bf4f9835..0000000000 --- a/bin/tests/optional/rbt_test.out +++ /dev/null @@ -1,395 +0,0 @@ -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 deleted file mode 100644 index 4821c34c0f..0000000000 --- a/bin/tests/optional/rbt_test.txt +++ /dev/null @@ -1,85 +0,0 @@ -# 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 deleted file mode 100644 index 587f025ae5..0000000000 --- a/bin/tests/optional/rwlock_test.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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 - -#ifdef WIN32 -#define sleep(x) Sleep(1000 * x) -#endif /* ifdef WIN32 */ - -isc_rwlock_t lock; - -static isc_threadresult_t -#ifdef WIN32 - WINAPI -#endif /* ifdef WIN32 */ - 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 /* ifdef WIN32 */ - 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) { - isc_thread_create(run1, dupname, &workers[i]); - } else { - isc_thread_create(run2, dupname, &workers[i]); - } - } - - for (i = 0; i < nworkers; i++) { - isc_thread_join(workers[i], NULL); - } - - isc_rwlock_destroy(&lock); - - return (0); -} diff --git a/bin/tests/optional/serial_test.c b/bin/tests/optional/serial_test.c deleted file mode 100644 index bd901fdd86..0000000000 --- a/bin/tests/optional/serial_test.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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 - -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 deleted file mode 100644 index 234b8867be..0000000000 --- a/bin/tests/optional/shutdown_test.c +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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 - -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) { - isc_app_shutdown(); - } 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; - isc_mem_create(&mctx); - mctx2 = NULL; - isc_mem_create(&mctx2); - RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, NULL, - &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 deleted file mode 100644 index 233fc5914d..0000000000 --- a/bin/tests/optional/sig0_test.c +++ /dev/null @@ -1,288 +0,0 @@ -/* - * 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 - -#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_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); - - isc_mutex_init(&lock); - - mctx = NULL; - isc_mem_create(&mctx); - - 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(dst_lib_init(mctx, NULL) == ISC_R_SUCCESS); - - dns_result_register(); - dst_result_register(); - - taskmgr = NULL; - RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, NULL, &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); - - isc_log_create(mctx, &lctx, &logconfig); - - 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, 33180, DNS_KEYALG_RSASHA1, - 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_log_destroy(&lctx); - - if (verbose) { - isc_mem_stats(mctx, stdout); - } - isc_mem_destroy(&mctx); - - isc_mutex_destroy(&lock); - - isc_app_finish(); - - return (0); -} diff --git a/bin/tests/optional/sock_test.c b/bin/tests/optional/sock_test.c deleted file mode 100644 index 4cdec293bd..0000000000 --- a/bin/tests/optional/sock_test.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * 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 *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); - { - region.length = strlen(buf) + 1; - strlcpy((char *)region.base, buf, region.length); - } - 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); - { - region.length = strlen(buf) + 1; - strlcpy((char *)region.base, buf, region.length); - } - - 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; - isc_mem_create(&mctx); - - /* - * The task manager is independent (other than memory context) - */ - manager = NULL; - RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, NULL, &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 /* ifndef WIN32 */ - Sleep(10000); -#endif /* ifndef WIN32 */ - - 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 deleted file mode 100644 index 3221892907..0000000000 --- a/bin/tests/optional/sym_test.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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 - -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; - } - } - - isc_mem_create(&mctx); - 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 deleted file mode 100644 index 68adfbb497..0000000000 --- a/bin/tests/optional/task_test.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * 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 = 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); - - isc_mem_create(&mctx); - - RUNTIME_CHECK(isc_taskmgr_create(mctx, workers, 0, NULL, &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 /* ifndef WIN32 */ - Sleep(2000); -#endif /* ifndef WIN32 */ - - /* - * 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 /* ifndef WIN32 */ - Sleep(10000); -#endif /* ifndef WIN32 */ - 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 deleted file mode 100644 index 39dc84093b..0000000000 --- a/bin/tests/optional/timer_test.c +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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 *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); - - isc_mem_create(&mctx1); - RUNTIME_CHECK(isc_taskmgr_create(mctx1, workers, 0, NULL, &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 /* ifndef WIN32 */ - Sleep(15000); -#endif /* ifndef WIN32 */ - printf("destroy\n"); - isc_timer_detach(&ti1); - isc_timer_detach(&ti2); - isc_timer_detach(&ti3); -#ifndef WIN32 - sleep(2); -#else /* ifndef WIN32 */ - Sleep(2000); -#endif /* ifndef WIN32 */ - 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 deleted file mode 100644 index e250aab941..0000000000 --- a/bin/tests/optional/zone_test.c +++ /dev/null @@ -1,313 +0,0 @@ -/* - * 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 - -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"); - - dns_zone_setdbtype(zone, 1, &rbt); - - result = dns_zone_setfile(zone, filename, dns_masterformat_text, - &dns_master_style_default); - 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, false); - 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; - isc_buffer_t buffer; - isc_result_t result; - dns_rdataset_t rdataset; - dns_rdataset_t sigset; - fd_set rfdset = { { 0 } }; - - 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 { - char *s; - 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, - dns_masterformat_text, - &dns_master_style_default, 0); - 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 /*version*/, 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); - isc_mem_create(&mctx); - RUNTIME_CHECK(isc_taskmgr_create(mctx, 2, 0, NULL, &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/.gitignore b/bin/tests/pkcs11/.gitignore deleted file mode 100644 index a259902b21..0000000000 --- a/bin/tests/pkcs11/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -create -find -genrsa -login -privrsa -pubrsa -random -session -sha1 -sign -verify -pkcs11-hmacmd5 -pkcs11-md5sum diff --git a/bin/tests/pkcs11/README b/bin/tests/pkcs11/README deleted file mode 100644 index 2b594d9a7d..0000000000 --- a/bin/tests/pkcs11/README +++ /dev/null @@ -1,15 +0,0 @@ -"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/.gitignore b/bin/tests/pkcs11/benchmarks/.gitignore deleted file mode 100644 index 08c0a263bc..0000000000 --- a/bin/tests/pkcs11/benchmarks/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/*.dSYM/ diff --git a/bin/tests/pkcs11/benchmarks/create.c b/bin/tests/pkcs11/benchmarks/create.c deleted file mode 100644 index 954b81c19b..0000000000 --- a/bin/tests/pkcs11/benchmarks/create.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 handles */ - 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 = getpass("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 deleted file mode 100644 index 2fb8968040..0000000000 --- a/bin/tests/pkcs11/benchmarks/find.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 = getpass("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 deleted file mode 100644 index 7431598a4f..0000000000 --- a/bin/tests/pkcs11/benchmarks/genrsa.c +++ /dev/null @@ -1,294 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 handles */ - 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 = getpass("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 deleted file mode 100644 index aecbfa9cea..0000000000 --- a/bin/tests/pkcs11/benchmarks/login.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 *)getpass("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 deleted file mode 100644 index 545e4f62bb..0000000000 --- a/bin/tests/pkcs11/benchmarks/privrsa.c +++ /dev/null @@ -1,329 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 handles */ - 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 = getpass("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 deleted file mode 100644 index 045f01d6da..0000000000 --- a/bin/tests/pkcs11/benchmarks/pubrsa.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 handles */ - 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 = getpass("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/session.c b/bin/tests/pkcs11/benchmarks/session.c deleted file mode 100644 index 22c13ec9a1..0000000000 --- a/bin/tests/pkcs11/benchmarks/session.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 deleted file mode 100644 index 578932fc40..0000000000 --- a/bin/tests/pkcs11/benchmarks/sha1.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 deleted file mode 100644 index 047c92c5e3..0000000000 --- a/bin/tests/pkcs11/benchmarks/sign.c +++ /dev/null @@ -1,334 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 = getpass("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 deleted file mode 100644 index e559d01c94..0000000000 --- a/bin/tests/pkcs11/benchmarks/verify.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * 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 - -#ifndef HAVE_CLOCK_GETTIME - -#include - -#ifndef CLOCK_REALTIME -#define CLOCK_REALTIME 0 -#endif /* ifndef CLOCK_REALTIME */ - -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 == 0) { - tp->tv_sec = tv.tv_sec; - tp->tv_nsec = (long)tv.tv_usec * 1000; - } - return (result); -} -#endif /* ifndef HAVE_CLOCK_GETTIME */ - -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 = getpass("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); - error = 1; - } - } - - pk11_return_session(&pctx); - (void)pk11_finalize(); - - exit(error); -} diff --git a/bin/tests/system/.gitignore b/bin/tests/system/.gitignore index f51188bc28..998718e758 100644 --- a/bin/tests/system/.gitignore +++ b/bin/tests/system/.gitignore @@ -6,6 +6,16 @@ named.pid named.run /feature-test /test.output.* +/makejournal /systests.output /random.data parallel.mk +/*.log +/*.trs +/get_base_port.state +/get_base_port.lock +/run.sh +/start.sh +/stop.sh +/system-test-driver.sh +/ifconfig.sh diff --git a/bin/tests/system/Makefile.am b/bin/tests/system/Makefile.am new file mode 100644 index 0000000000..17fa9d1205 --- /dev/null +++ b/bin/tests/system/Makefile.am @@ -0,0 +1,155 @@ +include $(top_srcdir)/Makefile.top + +SUBDIRS = dyndb/driver dlzexternal/driver + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) + +LDADD = \ + $(LIBISC_LIBS) + +if HAVE_PERL + +check_PROGRAMS = \ + feature-test \ + makejournal \ + pipelined/pipequeries \ + rndc/gencheck \ + rpz/dnsrps \ + tkey/keycreate \ + tkey/keydelete + +feature_test_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBDNS_CFLAGS) + +makejournal_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBDNS_CFLAGS) + +makejournal_LDADD = \ + $(LDADD) \ + $(LIBDNS_LIBS) + +pipelined_pipequeries_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBDNS_CFLAGS) + +pipelined_pipequeries_LDADD = \ + $(LDADD) \ + $(LIBDNS_LIBS) + +tkey_keycreate_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBDNS_CFLAGS) + +tkey_keycreate_LDADD = \ + $(LDADD) \ + $(LIBDNS_LIBS) + +tkey_keydelete_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBDNS_CFLAGS) + +tkey_keydelete_LDADD = \ + $(LDADD) \ + $(LIBDNS_LIBS) + +TESTS = \ + acl additional addzone allow-query auth autosign \ + builtin cacheclean case catz cds \ + checkconf checknames checkzone \ + cookie database dlz dlzexternal \ + dns64 dscp dsdigest dyndb \ + ednscompliance emptyzones \ + filter-aaaa formerr \ + geoip2 glue idna inline integrity keepalive \ + legacy limits logfileconfig \ + masterfile masterformat metadata mirror mkeys \ + names notify nslookup \ + padding pending \ + redirect rndc rootkeysentinel rpz \ + rrchecker rrl rrsetorder rsabigexponent runtime \ + sfcache smartsign sortlist \ + spf staticstub stub synthfromdnssec \ + tools tsig tsiggss \ + unknown verify views wildcard \ + xferquota zonechecks \ + ecdsa tkey + +# eddsa test is broken +# TESTS += eddsa + +# The "stress" test is not run by default since it creates enough +# load on the machine to make it unusable to other users. +# The "dialup", "delzone", and "dupsigs" tests are also not run by +# default because they take a very long time to complete. +# TESTS += delzone dialup dupsigs stress + +if HAVE_LMDB +TESTS += nzd2nzf +endif # HAVE_LMDB + +if HAVE_PERLMOD_NET_DNS + +TESTS += \ + zero \ + digdelv \ + dnssec \ + fetchlimit \ + forward \ + ixfr \ + nsupdate \ + resolver \ + rpzrecurse \ + statistics \ + upforwd + +if HAVE_DNSTAP +TESTS += dnstap +endif + +if HAVE_PERLMOD_FILE_FETCH +TESTS += statschannel +endif HAVE_PERLMOD_FILE_FETCH + +if HAVE_PERLMOD_DIGEST_HMAC +TESTS += xfer +endif HAVE_PERLMOD_DIGEST_HMAC + +if HAVE_PERLMOD_TIME_HIRES +TESTS += serve-stale +endif HAVE_PERLMOD_TIME_HIRES + +if HAVE_PERLMOD_NET_DNS_NAMESERVER +TESTS += reclimit +endif HAVE_PERLMOD_NET_DNS_NAMESERVER + +endif HAVE_PERLMOD_NET_DNS + +if HAVE_PYTHON +TESTS += tcp pipelined + +if HAVE_PYMOD_DNS +TESTS += qmin + +if HAVE_PERLMOD_NET_DNS +if HAVE_PERLMOD_NET_DNS_NAMESERVER +TESTS += chain +endif HAVE_PERLMOD_NET_DNS_NAMESERVER +endif HAVE_PERLMOD_NET_DNS + +endif HAVE_PYMOD_DNS + +endif HAVE_PYTHON + +else !HAVE_PERL +check: + echo Perl is not available, no tests were ran + exit 1 +endif !HAVE_PERL + +LOG_COMPILER = $(builddir)/system-test-driver.sh + +clean-local: + -rm -f get_base_port.state get_base_port.lock diff --git a/bin/tests/system/README b/bin/tests/system/README index 2c338e1268..068c1107bd 100644 --- a/bin/tests/system/README +++ b/bin/tests/system/README @@ -374,7 +374,6 @@ a run of the full test suite (e.g. the tests are started with "runall.sh"). 3. Each script should start with the following lines: - SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh "conf.sh" defines a series of environment variables together with functions diff --git a/bin/tests/system/acl/setup.sh b/bin/tests/system/acl/setup.sh index e410e03df2..aff35aa2be 100644 --- a/bin/tests/system/acl/setup.sh +++ b/bin/tests/system/acl/setup.sh @@ -9,12 +9,11 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh -$SHELL ../genzone.sh 2 3 >ns2/example.db -$SHELL ../genzone.sh 2 3 >ns2/tsigzone.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/example.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/tsigzone.db copy_setports ns2/named1.conf.in ns2/named.conf copy_setports ns3/named.conf.in ns3/named.conf copy_setports ns4/named.conf.in ns4/named.conf diff --git a/bin/tests/system/acl/tests.sh b/bin/tests/system/acl/tests.sh index fe49a86a0e..6f291bfc61 100644 --- a/bin/tests/system/acl/tests.sh +++ b/bin/tests/system/acl/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/additional/setup.sh b/bin/tests/system/additional/setup.sh index 5f43253079..557a16243c 100644 --- a/bin/tests/system/additional/setup.sh +++ b/bin/tests/system/additional/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/additional/tests.sh b/bin/tests/system/additional/tests.sh index 51c09fc99d..1221e0c6c3 100644 --- a/bin/tests/system/additional/tests.sh +++ b/bin/tests/system/additional/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/addzone/setup.sh b/bin/tests/system/addzone/setup.sh index 1a65797287..e8310f60f0 100644 --- a/bin/tests/system/addzone/setup.sh +++ b/bin/tests/system/addzone/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp -f ns1/redirect.db.1 ns1/redirect.db diff --git a/bin/tests/system/addzone/tests.sh b/bin/tests/system/addzone/tests.sh index cfaee81c32..4ecfd73275 100755 --- a/bin/tests/system/addzone/tests.sh +++ b/bin/tests/system/addzone/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p ${PORT}" @@ -720,8 +719,8 @@ $RNDCCMD 10.53.0.3 addzone "test4.baz" '{ type master; file "e.db"; };' > /dev/n $RNDCCMD 10.53.0.3 addzone "test5.baz" '{ type master; file "e.db"; };' > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.3 addzone '"test/.baz"' '{ type master; check-names ignore; file "e.db"; };' > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.3 addzone '"test\".baz"' '{ type master; check-names ignore; file "e.db"; };' > /dev/null 2>&1 || ret=1 -$PERL $SYSTEMTESTTOP/stop.pl addzone ns3 -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} addzone ns3 || ret=1 +stop addzone ns3 +start --noclean --restart --port ${PORT} addzone ns3 || ret=1 retry_quiet 10 _check_version_bind || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` diff --git a/bin/tests/system/allow-query/setup.sh b/bin/tests/system/allow-query/setup.sh index e23de36012..7c6dfe1fa5 100644 --- a/bin/tests/system/allow-query/setup.sh +++ b/bin/tests/system/allow-query/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ../common/controls.conf.in ns2/controls.conf diff --git a/bin/tests/system/allow-query/tests.sh b/bin/tests/system/allow-query/tests.sh index 479910c825..a119220c42 100644 --- a/bin/tests/system/allow-query/tests.sh +++ b/bin/tests/system/allow-query/tests.sh @@ -50,7 +50,6 @@ # as necessary. # -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p ${PORT}" diff --git a/bin/tests/system/auth/setup.sh b/bin/tests/system/auth/setup.sh index f3826d8683..9fa04998da 100644 --- a/bin/tests/system/auth/setup.sh +++ b/bin/tests/system/auth/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/auth/tests.sh b/bin/tests/system/auth/tests.sh index fb76d0043f..0cd1b721be 100644 --- a/bin/tests/system/auth/tests.sh +++ b/bin/tests/system/auth/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp -p ${PORT}" diff --git a/bin/tests/system/autosign/ns1/keygen.sh b/bin/tests/system/autosign/ns1/keygen.sh index 47d3eefe10..79637acd96 100644 --- a/bin/tests/system/autosign/ns1/keygen.sh +++ b/bin/tests/system/autosign/ns1/keygen.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/autosign/ns2/keygen.sh b/bin/tests/system/autosign/ns2/keygen.sh index 9d40b7fa34..e4b91838c1 100644 --- a/bin/tests/system/autosign/ns2/keygen.sh +++ b/bin/tests/system/autosign/ns2/keygen.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh # Have the child generate subdomain keys and pass DS sets to us. diff --git a/bin/tests/system/autosign/ns3/keygen.sh b/bin/tests/system/autosign/ns3/keygen.sh index a60e852d30..fd26f28b4e 100644 --- a/bin/tests/system/autosign/ns3/keygen.sh +++ b/bin/tests/system/autosign/ns3/keygen.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh SYSTESTDIR=autosign diff --git a/bin/tests/system/autosign/setup.sh b/bin/tests/system/autosign/setup.sh index 1db502d8dc..e6099c1472 100644 --- a/bin/tests/system/autosign/setup.sh +++ b/bin/tests/system/autosign/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/autosign/tests.sh b/bin/tests/system/autosign/tests.sh index eadf2a7f54..5bde55e287 100755 --- a/bin/tests/system/autosign/tests.sh +++ b/bin/tests/system/autosign/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/builtin/setup.sh b/bin/tests/system/builtin/setup.sh index def2a615ac..e683db06d9 100644 --- a/bin/tests/system/builtin/setup.sh +++ b/bin/tests/system/builtin/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/builtin/tests.sh b/bin/tests/system/builtin/tests.sh index d400f38d4a..e4dfc60023 100644 --- a/bin/tests/system/builtin/tests.sh +++ b/bin/tests/system/builtin/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/cacheclean/setup.sh b/bin/tests/system/cacheclean/setup.sh index f3826d8683..9fa04998da 100644 --- a/bin/tests/system/cacheclean/setup.sh +++ b/bin/tests/system/cacheclean/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/cacheclean/tests.sh b/bin/tests/system/cacheclean/tests.sh index ed9707a511..302c621eb3 100755 --- a/bin/tests/system/cacheclean/tests.sh +++ b/bin/tests/system/cacheclean/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/case/setup.sh b/bin/tests/system/case/setup.sh index bc5d9de9bd..1d467ac638 100644 --- a/bin/tests/system/case/setup.sh +++ b/bin/tests/system/case/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp -f ns1/dynamic.db.in ns1/dynamic.db diff --git a/bin/tests/system/case/tests.sh b/bin/tests/system/case/tests.sh index 8160ad8d2e..1d75acb888 100644 --- a/bin/tests/system/case/tests.sh +++ b/bin/tests/system/case/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/catz/setup.sh b/bin/tests/system/catz/setup.sh index 19e11c9dae..285cacf7f7 100644 --- a/bin/tests/system/catz/setup.sh +++ b/bin/tests/system/catz/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/catz/tests.sh b/bin/tests/system/catz/tests.sh index d534b150fd..db533fc7a9 100644 --- a/bin/tests/system/catz/tests.sh +++ b/bin/tests/system/catz/tests.sh @@ -12,7 +12,6 @@ set -e # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" dig_with_opts() { diff --git a/bin/tests/system/cds/setup.sh b/bin/tests/system/cds/setup.sh index d720ec3554..75f4a8eb1f 100644 --- a/bin/tests/system/cds/setup.sh +++ b/bin/tests/system/cds/setup.sh @@ -11,7 +11,6 @@ set -eu -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh touch empty diff --git a/bin/tests/system/cds/tests.sh b/bin/tests/system/cds/tests.sh index 35b864e72b..717af19353 100644 --- a/bin/tests/system/cds/tests.sh +++ b/bin/tests/system/cds/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/chain/ns2/sign.sh b/bin/tests/system/chain/ns2/sign.sh index d8c95d19da..a1ea0e33ad 100644 --- a/bin/tests/system/chain/ns2/sign.sh +++ b/bin/tests/system/chain/ns2/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=example. diff --git a/bin/tests/system/chain/prereq.sh b/bin/tests/system/chain/prereq.sh deleted file mode 100644 index 964360a3f8..0000000000 --- a/bin/tests/system/chain/prereq.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if test -n "$PYTHON" -then - if $PYTHON -c "import dns" 2> /dev/null - then - : - else - echo_i "This test requires the dnspython module." >&2 - exit 1 - fi -else - echo_i "This test requires Python and the dnspython module." >&2 - exit 1 -fi - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.74);' 2>/dev/null - then - : - else - echo_i "Net::DNS versions 0.69 to 0.74 have bugs that cause this test to fail: please update." >&2 - exit 1 - fi -else - echo_i "This test requires the perl Net::DNS library." >&2 - exit 1 -fi -if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null -then - : -else - echo_i "This test requires the Net::DNS::Nameserver library." >&2 - exit 1 -fi diff --git a/bin/tests/system/chain/setup.sh b/bin/tests/system/chain/setup.sh index ae271925f7..a557b44afe 100644 --- a/bin/tests/system/chain/setup.sh +++ b/bin/tests/system/chain/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/chain/tests.sh b/bin/tests/system/chain/tests.sh index dc83fbf224..d8b17cfd0a 100644 --- a/bin/tests/system/chain/tests.sh +++ b/bin/tests/system/chain/tests.sh @@ -7,12 +7,15 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" -SEND="$PERL $SYSTEMTESTTOP/send.pl 10.53.0.4 ${EXTRAPORT1}" + +sendcmd() { + send 10.53.0.4 "${EXTRAPORT1}" +} + status=0 n=0 @@ -174,29 +177,29 @@ n=`expr $n + 1` echo_i "checking CNAME chains in various orders ($n)" ret=0 $RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | $SEND +echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.1.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|1,1,2,2,3,4,s4,s3,s1" | $SEND +echo "cname,cname,cname|1,1,2,2,3,4,s4,s3,s1" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.2.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|2,1,3,4,s3,s1,s2,s4" | $SEND +echo "cname,cname,cname|2,1,3,4,s3,s1,s2,s4" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 grep 'status: NOERROR' dig.out.3.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.3.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 4 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | $SEND +echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.4.$n 2>&1 grep 'status: NOERROR' dig.out.4.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.4.$n > /dev/null 2>&1 || ret=1 -echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | $SEND +echo "cname,cname,cname|4,3,2,1,s4,s3,s2,s1" | sendcmd $RNDCCMD 10.53.0.7 null --- start test$n - step 5 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.5.$n 2>&1 @@ -204,7 +207,7 @@ grep 'status: NOERROR' dig.out.5.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.5.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 6 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|4,3,3,3,s1,s1,1,3,4" | $SEND +echo "cname,cname,cname|4,3,3,3,s1,s1,1,3,4" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.6.$n 2>&1 grep 'status: NOERROR' dig.out.6.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.6.$n > /dev/null 2>&1 || ret=1 @@ -215,7 +218,7 @@ n=`expr $n + 1` echo_i "checking that only the initial CNAME is cached ($n)" ret=0 $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | $SEND +echo "cname,cname,cname|1,2,3,4,s1,s2,s3,s4" | sendcmd $RNDCCMD 10.53.0.7 null --- start test$n --- 2>&1 | sed 's/^/ns7 /' | cat_i $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 sleep 1 @@ -230,19 +233,19 @@ echo_i "checking DNAME chains in various orders ($n)" ret=0 $RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | $SEND +echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 3' dig.out.1.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | $SEND +echo "dname,dname|5,4,3,2,1,s5,s4,s3,s2,s1" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 3' dig.out.2.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "dname,dname|2,3,s1,s2,s3,s4,1" | $SEND +echo "dname,dname|2,3,s1,s2,s3,s4,1" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 grep 'status: NOERROR' dig.out.3.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 3' dig.out.3.$n > /dev/null 2>&1 || ret=1 @@ -254,19 +257,19 @@ n=`expr $n + 1` echo_i "checking external CNAME/DNAME chains in various orders ($n)" ret=0 $RNDCCMD 10.53.0.7 null --- start test$n - step 1 --- 2>&1 | sed 's/^/ns7 /' | cat_i -echo "xname,dname|1,2,3,4,s1,s2,s3,s4" | $SEND +echo "xname,dname|1,2,3,4,s1,s2,s3,s4" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.1.$n 2>&1 grep 'status: NOERROR' dig.out.1.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.1.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 2 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "xname,dname|s2,2,s1,1,4,s4,3" | $SEND +echo "xname,dname|s2,2,s1,1,4,s4,3" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.2.$n 2>&1 grep 'status: NOERROR' dig.out.2.$n > /dev/null 2>&1 || ret=1 grep 'ANSWER: 2' dig.out.2.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 null --- start test$n - step 3 --- 2>&1 | sed 's/^/ns7 /' | cat_i $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i -echo "xname,dname|s2,2,2,2" | $SEND +echo "xname,dname|s2,2,2,2" | sendcmd $DIG $DIGOPTS @10.53.0.7 test.domain.nil > dig.out.3.$n 2>&1 grep 'status: SERVFAIL' dig.out.3.$n > /dev/null 2>&1 || ret=1 $RNDCCMD 10.53.0.7 flush 2>&1 | sed 's/^/ns7 /' | cat_i diff --git a/bin/tests/system/checkconf/tests.sh b/bin/tests/system/checkconf/tests.sh index 270975bfe6..0b62e27b71 100644 --- a/bin/tests/system/checkconf/tests.sh +++ b/bin/tests/system/checkconf/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/checknames/setup.sh b/bin/tests/system/checknames/setup.sh index 28d0c44825..15f597c829 100644 --- a/bin/tests/system/checknames/setup.sh +++ b/bin/tests/system/checknames/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/checknames/tests.sh b/bin/tests/system/checknames/tests.sh index 74f783e4d3..39c91ddebf 100644 --- a/bin/tests/system/checknames/tests.sh +++ b/bin/tests/system/checknames/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/checkzone/setup.sh b/bin/tests/system/checkzone/setup.sh index 6814431805..96f32bb596 100644 --- a/bin/tests/system/checkzone/setup.sh +++ b/bin/tests/system/checkzone/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh ln -s $CHECKZONE named-compilezone diff --git a/bin/tests/system/checkzone/tests.sh b/bin/tests/system/checkzone/tests.sh index 0ba9d5dc46..3735689f71 100644 --- a/bin/tests/system/checkzone/tests.sh +++ b/bin/tests/system/checkzone/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/conf.sh.common b/bin/tests/system/conf.sh.common index f34f86e728..992df57421 100644 --- a/bin/tests/system/conf.sh.common +++ b/bin/tests/system/conf.sh.common @@ -12,7 +12,7 @@ testsock6() { if test -n "$PERL" && $PERL -e "use IO::Socket::INET6;" 2> /dev/null then - $PERL "$TOP/bin/tests/system/testsock6.pl" "$@" + $PERL "$TOP_SRCDIR/bin/tests/system/testsock6.pl" "$@" else false fi @@ -20,7 +20,6 @@ testsock6() { export LANG=C -. ${TOP}/version # # Common lists of system tests to run. @@ -187,12 +186,24 @@ cat_d() { } digcomp() { - output=`$PERL $SYSTEMTESTTOP/digcomp.pl "$@"` + output=`$PERL $TOP_SRCDIR/bin/tests/system/digcomp.pl "$@"` result=$? [ -n "$output" ] && { echo "digcomp failed:"; echo "$output"; } | cat_i return $result } +start() { + $PERL "$TOP_SRCDIR/bin/tests/system/start.pl" "$@" +} + +stop() { + $PERL "$TOP_SRCDIR/bin/tests/system/stop.pl" "$@" +} + +send() { + $PERL "$TOP_SRCDIR/bin/tests/system/send.pl" "$@" +} + # # Useful variables in test scripts # diff --git a/bin/tests/system/conf.sh.in b/bin/tests/system/conf.sh.in index 5bd08cc8d6..65dbdeddb2 100644 --- a/bin/tests/system/conf.sh.in +++ b/bin/tests/system/conf.sh.in @@ -15,7 +15,8 @@ # # Find the top of the BIND9 tree. -TOP=@abs_top_builddir@ +TOP_BUILDDIR=@abs_top_builddir@ +TOP_SRCDIR=@abs_top_srcdir@ # Provide TMPDIR variable for tests that need it. TMPDIR=${TMPDIR:-/tmp} @@ -24,51 +25,51 @@ TMPDIR=${TMPDIR:-/tmp} CYGWIN="" # Load common values shared between windows and unix/linux. -. $TOP/bin/tests/system/conf.sh.common +. $TOP_SRCDIR/bin/tests/system/conf.sh.common -ARPANAME=$TOP/bin/tools/arpaname -CDS=$TOP/bin/dnssec/dnssec-cds -CHECKCONF=$TOP/bin/check/named-checkconf -CHECKZONE=$TOP/bin/check/named-checkzone -DDNSCONFGEN=$TOP/bin/confgen/ddns-confgen -DELV=$TOP/bin/delv/delv -DIG=$TOP/bin/dig/dig -DNSTAPREAD=$TOP/bin/tools/dnstap-read -DSFROMKEY=$TOP/bin/dnssec/dnssec-dsfromkey -FEATURETEST=$TOP/bin/tests/system/feature-test +ARPANAME=$TOP_BUILDDIR/bin/tools/arpaname +CDS=$TOP_BUILDDIR/bin/dnssec/dnssec-cds +CHECKCONF=$TOP_BUILDDIR/bin/check/named-checkconf +CHECKZONE=$TOP_BUILDDIR/bin/check/named-checkzone +DDNSCONFGEN=$TOP_BUILDDIR/bin/confgen/ddns-confgen +DELV=$TOP_BUILDDIR/bin/delv/delv +DIG=$TOP_BUILDDIR/bin/dig/dig +DNSTAPREAD=$TOP_BUILDDIR/bin/tools/dnstap-read +DSFROMKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-dsfromkey +FEATURETEST=$TOP_BUILDDIR/bin/tests/system/feature-test FSTRM_CAPTURE=@FSTRM_CAPTURE@ -HOST=$TOP/bin/dig/host -IMPORTKEY=$TOP/bin/dnssec/dnssec-importkey -JOURNALPRINT=$TOP/bin/tools/named-journalprint -KEYFRLAB=$TOP/bin/dnssec/dnssec-keyfromlabel -KEYGEN=$TOP/bin/dnssec/dnssec-keygen -MDIG=$TOP/bin/tools/mdig -NAMED=$TOP/bin/named/named -NSEC3HASH=$TOP/bin/tools/nsec3hash -NSLOOKUP=$TOP/bin/dig/nslookup -NSUPDATE=$TOP/bin/nsupdate/nsupdate -NZD2NZF=$TOP/bin/tools/named-nzd2nzf -PK11DEL="$TOP/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0" -PK11GEN="$TOP/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}" -PK11LIST="$TOP/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}" -RESOLVE=$TOP/lib/samples/resolve -REVOKE=$TOP/bin/dnssec/dnssec-revoke -RNDC=$TOP/bin/rndc/rndc -RNDCCONFGEN=$TOP/bin/confgen/rndc-confgen -RRCHECKER=$TOP/bin/tools/named-rrchecker -SETTIME=$TOP/bin/dnssec/dnssec-settime -SIGNER=$TOP/bin/dnssec/dnssec-signzone -TSIGKEYGEN=$TOP/bin/confgen/tsig-keygen -VERIFY=$TOP/bin/dnssec/dnssec-verify -WIRETEST=$TOP/bin/tests/wire_test +HOST=$TOP_BUILDDIR/bin/dig/host +IMPORTKEY=$TOP_BUILDDIR/bin/dnssec/dnssec-importkey +JOURNALPRINT=$TOP_BUILDDIR/bin/tools/named-journalprint +KEYFRLAB=$TOP_BUILDDIR/bin/dnssec/dnssec-keyfromlabel +KEYGEN=$TOP_BUILDDIR/bin/dnssec/dnssec-keygen +MDIG=$TOP_BUILDDIR/bin/tools/mdig +NAMED=$TOP_BUILDDIR/bin/named/named +NSEC3HASH=$TOP_BUILDDIR/bin/tools/nsec3hash +NSLOOKUP=$TOP_BUILDDIR/bin/dig/nslookup +NSUPDATE=$TOP_BUILDDIR/bin/nsupdate/nsupdate +NZD2NZF=$TOP_BUILDDIR/bin/tools/named-nzd2nzf +PK11DEL="$TOP_BUILDDIR/bin/pkcs11/pkcs11-destroy -s ${SLOT:-0} -p ${HSMPIN:-1234} -w 0" +PK11GEN="$TOP_BUILDDIR/bin/pkcs11/pkcs11-keygen -q -s ${SLOT:-0} -p ${HSMPIN:-1234}" +PK11LIST="$TOP_BUILDDIR/bin/pkcs11/pkcs11-list -s ${SLOT:-0} -p ${HSMPIN:-1234}" +RESOLVE=$TOP_BUILDDIR/lib/samples/resolve +REVOKE=$TOP_BUILDDIR/bin/dnssec/dnssec-revoke +RNDC=$TOP_BUILDDIR/bin/rndc/rndc +RNDCCONFGEN=$TOP_BUILDDIR/bin/confgen/rndc-confgen +RRCHECKER=$TOP_BUILDDIR/bin/tools/named-rrchecker +SETTIME=$TOP_BUILDDIR/bin/dnssec/dnssec-settime +SIGNER=$TOP_BUILDDIR/bin/dnssec/dnssec-signzone +TSIGKEYGEN=$TOP_BUILDDIR/bin/confgen/tsig-keygen +VERIFY=$TOP_BUILDDIR/bin/dnssec/dnssec-verify +WIRETEST=$TOP_BUILDDIR/bin/tests/wire_test -BIGKEY=$TOP/bin/tests/system/rsabigexponent/bigkey -GENCHECK=$TOP/bin/tests/system/rndc/gencheck -KEYCREATE=$TOP/bin/tests/system/tkey/keycreate -KEYDELETE=$TOP/bin/tests/system/tkey/keydelete -MAKEJOURNAL=$TOP/bin/tests/makejournal -PIPEQUERIES=$TOP/bin/tests/system/pipelined/pipequeries -SAMPLEUPDATE=$TOP/lib/samples/sample-update +BIGKEY=$TOP_BUILDDIR/bin/tests/system/rsabigexponent/bigkey +GENCHECK=$TOP_BUILDDIR/bin/tests/system/rndc/gencheck +KEYCREATE=$TOP_BUILDDIR/bin/tests/system/tkey/keycreate +KEYDELETE=$TOP_BUILDDIR/bin/tests/system/tkey/keydelete +MAKEJOURNAL=$TOP_BUILDDIR/bin/tests/system/makejournal +PIPEQUERIES=$TOP_BUILDDIR/bin/tests/system/pipelined/pipequeries +SAMPLEUPDATE=$TOP_BUILDDIR/lib/samples/sample-update # we don't want a KRB5_CONFIG setting breaking the tests KRB5_CONFIG=/dev/null @@ -123,5 +124,6 @@ MAXMINDDB_LIBS="@MAXMINDDB_LIBS@" HAVEGEOIP2=${MAXMINDDB_LIBS:+1} ZLIB_LIBS="@ZLIB_LIBS@" HAVEZLIB=${ZLIB_LIBS:+1} -NZD=@NZD_TOOLS@ +LMDB_LIBS="@LMDB_LIBS@" +NZD=${LMDB_LIBS:+1} CRYPTO=@CRYPTO@ diff --git a/bin/tests/system/cookie/setup.sh b/bin/tests/system/cookie/setup.sh index 137db93e51..ecc72c0276 100644 --- a/bin/tests/system/cookie/setup.sh +++ b/bin/tests/system/cookie/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/cookie/tests.sh b/bin/tests/system/cookie/tests.sh index 8e71103942..3871fd37f9 100755 --- a/bin/tests/system/cookie/tests.sh +++ b/bin/tests/system/cookie/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/database/setup.sh b/bin/tests/system/database/setup.sh index 8aa0d68bc1..303e87e5ea 100644 --- a/bin/tests/system/database/setup.sh +++ b/bin/tests/system/database/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named1.conf.in ns1/named.conf diff --git a/bin/tests/system/database/tests.sh b/bin/tests/system/database/tests.sh index 7fa9337bca..e70de1ac0c 100644 --- a/bin/tests/system/database/tests.sh +++ b/bin/tests/system/database/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/delzone/setup.sh b/bin/tests/system/delzone/setup.sh index 1405375c03..20a115a4d0 100644 --- a/bin/tests/system/delzone/setup.sh +++ b/bin/tests/system/delzone/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/delzone/tests.sh b/bin/tests/system/delzone/tests.sh index dd0a2dec18..9a94212e11 100755 --- a/bin/tests/system/delzone/tests.sh +++ b/bin/tests/system/delzone/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noauth +noadd +nostats +dnssec -p 5300" diff --git a/bin/tests/system/dialup/tests.sh b/bin/tests/system/dialup/tests.sh index a910783f5c..a0f622fe84 100644 --- a/bin/tests/system/dialup/tests.sh +++ b/bin/tests/system/dialup/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/digdelv/clean.sh b/bin/tests/system/digdelv/clean.sh index f895977f29..7e0f861086 100644 --- a/bin/tests/system/digdelv/clean.sh +++ b/bin/tests/system/digdelv/clean.sh @@ -26,3 +26,4 @@ rm -f ./ns*/named.lock rm -f ./ns*/managed-keys.bind* rm -f ./ns2/example.db ./ns2/K* ./ns2/keyid ./ns2/keydata rm -f ./*/anchor.* +rm -f ./ns2/dsset-example. diff --git a/bin/tests/system/digdelv/prereq.sh b/bin/tests/system/digdelv/prereq.sh deleted file mode 100644 index 3db8235fde..0000000000 --- a/bin/tests/system/digdelv/prereq.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/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. - -# shellcheck source=conf.sh -. "$SYSTEMTESTTOP/conf.sh" - -set -e - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/digdelv/tests.sh b/bin/tests/system/digdelv/tests.sh index 13950f9111..bd8aab4c44 100644 --- a/bin/tests/system/digdelv/tests.sh +++ b/bin/tests/system/digdelv/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" set -e @@ -19,7 +18,7 @@ status=0 n=0 sendcmd() { - "$PERL" "$SYSTEMTESTTOP/send.pl" "${1}" "$EXTRAPORT1" + send "${1}" "$EXTRAPORT1" } dig_with_opts() { diff --git a/bin/tests/system/dlz/prereq.sh b/bin/tests/system/dlz/prereq.sh index fb3328e409..c45c2b2c4c 100644 --- a/bin/tests/system/dlz/prereq.sh +++ b/bin/tests/system/dlz/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh if ! $FEATURETEST --with-dlz-filesystem; then diff --git a/bin/tests/system/dlz/setup.sh b/bin/tests/system/dlz/setup.sh index 7e606316f4..bf1af390f2 100644 --- a/bin/tests/system/dlz/setup.sh +++ b/bin/tests/system/dlz/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/dlz/tests.sh b/bin/tests/system/dlz/tests.sh index 78f74dc0c6..e0be7c0a75 100644 --- a/bin/tests/system/dlz/tests.sh +++ b/bin/tests/system/dlz/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/dlzexternal/driver/Makefile.am b/bin/tests/system/dlzexternal/driver/Makefile.am new file mode 100644 index 0000000000..418ec59de0 --- /dev/null +++ b/bin/tests/system/dlzexternal/driver/Makefile.am @@ -0,0 +1,13 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) + +dlzexternal_LTLIBRARIES = dlzexternal.la +dlzexternaldir = $(abs_builddir) + +dlzexternal_la_SOURCES = \ + driver.c + +dlzexternal_la_LDFLAGS = -avoid-version -module -shared -export-dynamic diff --git a/bin/tests/system/dlzexternal/driver.c b/bin/tests/system/dlzexternal/driver/driver.c similarity index 93% rename from bin/tests/system/dlzexternal/driver.c rename to bin/tests/system/dlzexternal/driver/driver.c index 443f22a223..1287d79564 100644 --- a/bin/tests/system/dlzexternal/driver.c +++ b/bin/tests/system/dlzexternal/driver/driver.c @@ -30,6 +30,38 @@ #include #include +/* aliases for exported symbols */ + +#define dlz_version dlzexternal_LTX_dlz_version +#define dlz_create dlzexternal_LTX_dlz_create +#define dlz_destroy dlzexternal_LTX_dlz_destroy +#define dlz_findzonedb dlzexternal_LTX_dlz_findzonedb +#define dlz_lookup dlzexternal_LTX_dlz_lookup +#define dlz_allowzonexfr dlzexternal_LTX_dlz_allowzonexfr +#define dlz_allnodes dlzexternal_LTX_dlz_allnodes +#define dlz_newversion dlzexternal_LTX_dlz_newversion +#define dlz_closeversion dlzexternal_LTX_dlz_closeversion +#define dlz_configure dlzexternal_LTX_dlz_configure +#define dlz_ssumatch dlzexternal_LTX_dlz_ssumatch +#define dlz_addrdataset dlzexternal_LTX_dlz_addrdataset +#define dlz_sbrdataset dlzexternal_LTX_dlz_sbrdataset +#define dlz_delrdataset dlzexternal_LTX_dlz_delrdataset + +dlz_dlopen_version_t dlz_version; +dlz_dlopen_create_t dlz_create; +dlz_dlopen_destroy_t dlz_destroy; +dlz_dlopen_findzonedb_t dlz_findzonedb; +dlz_dlopen_lookup_t dlz_lookup; +dlz_dlopen_allowzonexfr_t dlz_allowzonexfr; +dlz_dlopen_allnodes_t dlz_allnodes; +dlz_dlopen_newversion_t dlz_newversion; +dlz_dlopen_closeversion_t dlz_closeversion; +dlz_dlopen_configure_t dlz_configure; +dlz_dlopen_ssumatch_t dlz_ssumatch; +dlz_dlopen_addrdataset_t dlz_addrdataset; +dlz_dlopen_subrdataset_t dlz_subrdataset; +dlz_dlopen_delrdataset_t dlz_delrdataset; + #define CHECK(x) \ do { \ result = (x); \ diff --git a/bin/tests/system/dlzexternal/driver.h b/bin/tests/system/dlzexternal/driver/driver.h similarity index 100% rename from bin/tests/system/dlzexternal/driver.h rename to bin/tests/system/dlzexternal/driver/driver.h diff --git a/bin/tests/system/dlzexternal/ns1/dlzs.conf.in b/bin/tests/system/dlzexternal/ns1/dlzs.conf.in deleted file mode 100644 index 07bf329b50..0000000000 --- a/bin/tests/system/dlzexternal/ns1/dlzs.conf.in +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ - -dlz "example one" { - database "dlopen ../driver.@SO@ example.nil"; -}; - -dlz "example two" { - database "dlopen ../driver.@SO@ alternate.nil"; -}; - -dlz "example three" { - database "dlopen ../driver.@SO@ example.org"; -}; - -dlz "unsearched1" { - database "dlopen ../driver.@SO@ other.nil"; - search no; -}; - -dlz "unsearched2" { - database "dlopen ../driver.@SO@ zone.nil"; - search no; -}; - -dlz redzone { - database "dlopen ../driver.@SO@ ."; - search no; -}; diff --git a/bin/tests/system/dlzexternal/ns1/named.conf.in b/bin/tests/system/dlzexternal/ns1/named.conf.in index 591061cb85..89b21812fb 100644 --- a/bin/tests/system/dlzexternal/ns1/named.conf.in +++ b/bin/tests/system/dlzexternal/ns1/named.conf.in @@ -34,7 +34,32 @@ controls { inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; -include "dlzs.conf"; +dlz "example one" { + database "dlopen ../driver/dlzexternal.la example.nil"; +}; + +dlz "example two" { + database "dlopen ../driver/dlzexternal.la alternate.nil"; +}; + +dlz "example three" { + database "dlopen ../driver/dlzexternal.la example.org"; +}; + +dlz "unsearched1" { + database "dlopen ../driver/dlzexternal.la other.nil"; + search no; +}; + +dlz "unsearched2" { + database "dlopen ../driver/dlzexternal.la zone.nil"; + search no; +}; + +dlz redzone { + database "dlopen ../driver/dlzexternal.la ."; + search no; +}; zone zone.nil { type master; diff --git a/bin/tests/system/dlzexternal/prereq.sh b/bin/tests/system/dlzexternal/prereq.sh index b3c73c33b5..a0ef5dfc90 100644 --- a/bin/tests/system/dlzexternal/prereq.sh +++ b/bin/tests/system/dlzexternal/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $FEATURETEST --have-dlopen || { diff --git a/bin/tests/system/dlzexternal/setup.sh b/bin/tests/system/dlzexternal/setup.sh index 6efd940092..063cdba5ab 100644 --- a/bin/tests/system/dlzexternal/setup.sh +++ b/bin/tests/system/dlzexternal/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $DDNSCONFGEN -q -z example.nil > ns1/ddns.key diff --git a/bin/tests/system/dlzexternal/tests.sh b/bin/tests/system/dlzexternal/tests.sh index b9d44057be..d843fa117b 100644 --- a/bin/tests/system/dlzexternal/tests.sh +++ b/bin/tests/system/dlzexternal/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/dns64/ns1/sign.sh b/bin/tests/system/dns64/ns1/sign.sh index 17688fc772..c0c32e0418 100644 --- a/bin/tests/system/dns64/ns1/sign.sh +++ b/bin/tests/system/dns64/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=signed diff --git a/bin/tests/system/dns64/setup.sh b/bin/tests/system/dns64/setup.sh index e088b804d9..f2c1131a1d 100644 --- a/bin/tests/system/dns64/setup.sh +++ b/bin/tests/system/dns64/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/dns64/tests.sh b/bin/tests/system/dns64/tests.sh index ce5287efc6..fbe9ad71dc 100644 --- a/bin/tests/system/dns64/tests.sh +++ b/bin/tests/system/dns64/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/dnssec/prereq.sh b/bin/tests/system/dnssec/prereq.sh deleted file mode 100644 index b2e8ff200c..0000000000 --- a/bin/tests/system/dnssec/prereq.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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. - -# shellcheck source=conf.sh -. "$SYSTEMTESTTOP/conf.sh" - -set -e - -if "$PERL" -e 'use Net::DNS;' 2>/dev/null -then - # shellcheck disable=SC2016 - if "$PERL" -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.70);' 2>/dev/null - then - : - else - echo_i "Net::DNS versions 0.69 to 0.70 have bugs that cause this test to fail: please update." >&2 - exit 1 - fi -fi - -exit 0 diff --git a/bin/tests/system/dnssec/tests.sh b/bin/tests/system/dnssec/tests.sh index 03dd256589..7d70abac1e 100644 --- a/bin/tests/system/dnssec/tests.sh +++ b/bin/tests/system/dnssec/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" set -e @@ -2058,7 +2057,7 @@ echo_i "waiting till 14s have passed since NTAs were added before restarting ns4 $PERL -e 'my $delay = '"$start"' + 14 - time(); select(undef, undef, undef, $delay) if ($delay > 0);' if - $PERL "$SYSTEMTESTTOP/start.pl" --noclean --restart --port "$PORT" dnssec ns4 + start --noclean --restart --port "$PORT" dnssec ns4 then echo_i "restarted server ns4" else @@ -2124,7 +2123,7 @@ echo "secure.example. regular $future" > ns4/_default.nta start=$($PERL -e 'print time()."\n";') if - $PERL "$SYSTEMTESTTOP/start.pl" --noclean --restart --port "$PORT" dnssec ns4 + start --noclean --restart --port "$PORT" dnssec ns4 then echo_i "restarted server ns4" else @@ -2180,7 +2179,7 @@ echo "secure.example. forced $future" > ns4/_default.nta start=$($PERL -e 'print time()."\n";') if - $PERL "$SYSTEMTESTTOP/start.pl" --noclean --restart --port "$PORT" dnssec ns4 + start --noclean --restart --port "$PORT" dnssec ns4 then echo_i "restarted server ns4" else @@ -2228,7 +2227,7 @@ echo "secure.example. forced $future" > ns4/_default.nta added=$($PERL -e 'print time()."\n";') if - $PERL "$SYSTEMTESTTOP/start.pl" --noclean --restart --port "$PORT" dnssec ns4 + start --noclean --restart --port "$PORT" dnssec ns4 then echo_i "restarted server ns4" else @@ -3789,7 +3788,7 @@ grep "trust-anchor-telemetry './IN' from .* 65534" ns1/named.run > /dev/null || grep "trust-anchor-telemetry './IN' from .* 65533" ns1/named.run > /dev/null && ret=1 $PERL $SYSTEMTESTTOP/stop.pl dnssec ns1 || ret=1 nextpart ns1/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} dnssec ns1 || ret=1 +start --noclean --restart --port ${PORT} dnssec ns1 || ret=1 n=$(($n+1)) test "$ret" -eq 0 || echo_i "failed" status=$((status+ret)) diff --git a/bin/tests/system/dnstap/setup.sh b/bin/tests/system/dnstap/setup.sh index f44ffc68c9..53c207eedb 100644 --- a/bin/tests/system/dnstap/setup.sh +++ b/bin/tests/system/dnstap/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/dnstap/tests.sh b/bin/tests/system/dnstap/tests.sh index 9fe748d3f6..d7d80a6134 100644 --- a/bin/tests/system/dnstap/tests.sh +++ b/bin/tests/system/dnstap/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+short -p ${PORT}" diff --git a/bin/tests/system/dscp/setup.sh b/bin/tests/system/dscp/setup.sh index 87951d7c9c..60ed4a345d 100644 --- a/bin/tests/system/dscp/setup.sh +++ b/bin/tests/system/dscp/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/dscp/tests.sh b/bin/tests/system/dscp/tests.sh index e8a20f5b50..2d2d6d240d 100644 --- a/bin/tests/system/dscp/tests.sh +++ b/bin/tests/system/dscp/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest -p ${PORT}" diff --git a/bin/tests/system/dsdigest/ns1/sign.sh b/bin/tests/system/dsdigest/ns1/sign.sh index 9f0ef6b036..ccf14bcd8e 100644 --- a/bin/tests/system/dsdigest/ns1/sign.sh +++ b/bin/tests/system/dsdigest/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/dsdigest/ns2/sign.sh b/bin/tests/system/dsdigest/ns2/sign.sh index 814a8c7143..4d2ea08dff 100644 --- a/bin/tests/system/dsdigest/ns2/sign.sh +++ b/bin/tests/system/dsdigest/ns2/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone1=good diff --git a/bin/tests/system/dsdigest/setup.sh b/bin/tests/system/dsdigest/setup.sh index e8a39a0196..e7308b015a 100644 --- a/bin/tests/system/dsdigest/setup.sh +++ b/bin/tests/system/dsdigest/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/dsdigest/tests.sh b/bin/tests/system/dsdigest/tests.sh index 8f9eb58138..b254fd970c 100644 --- a/bin/tests/system/dsdigest/tests.sh +++ b/bin/tests/system/dsdigest/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/dupsigs/ns1/reset_keys.sh b/bin/tests/system/dupsigs/ns1/reset_keys.sh index 7e0f5a421d..984d68ba97 100644 --- a/bin/tests/system/dupsigs/ns1/reset_keys.sh +++ b/bin/tests/system/dupsigs/ns1/reset_keys.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=signing.test diff --git a/bin/tests/system/dupsigs/setup.sh b/bin/tests/system/dupsigs/setup.sh index ba7af73c47..e35a82962e 100644 --- a/bin/tests/system/dupsigs/setup.sh +++ b/bin/tests/system/dupsigs/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/dupsigs/tests.sh b/bin/tests/system/dupsigs/tests.sh index 80ddaeaf11..5ea9279ea7 100644 --- a/bin/tests/system/dupsigs/tests.sh +++ b/bin/tests/system/dupsigs/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/dyndb/driver/Makefile.am b/bin/tests/system/dyndb/driver/Makefile.am new file mode 100644 index 0000000000..c8751239d8 --- /dev/null +++ b/bin/tests/system/dyndb/driver/Makefile.am @@ -0,0 +1,19 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) + +dyndb_LTLIBRARIES = sample.la +dyndbdir = $(abs_builddir) + +sample_la_SOURCES = \ + db.c \ + driver.c \ + instance.c \ + lock.c \ + log.c \ + syncptr.c \ + zone.c + +sample_la_LDFLAGS = -avoid-version -module -shared -export-dynamic diff --git a/bin/tests/system/dyndb/driver/driver.c b/bin/tests/system/dyndb/driver/driver.c index 4d287e0c82..0ed2937bce 100644 --- a/bin/tests/system/dyndb/driver/driver.c +++ b/bin/tests/system/dyndb/driver/driver.c @@ -31,6 +31,12 @@ #include "log.h" #include "util.h" +/* aliases for the exported symbols */ + +#define dyndb_init sample_LTX_dyndb_init +#define dyndb_destroy sample_LTX_dyndb_destroy +#define dyndb_version sample_LTX_dyndb_version + dns_dyndb_destroy_t dyndb_destroy; dns_dyndb_register_t dyndb_init; dns_dyndb_version_t dyndb_version; diff --git a/bin/tests/system/dyndb/ns1/named.conf.in b/bin/tests/system/dyndb/ns1/named.conf.in index dde4a4de1c..49828ef620 100644 --- a/bin/tests/system/dyndb/ns1/named.conf.in +++ b/bin/tests/system/dyndb/ns1/named.conf.in @@ -33,5 +33,5 @@ controls { inet 10.53.0.1 port @CONTROLPORT@ allow { any; } keys { rndc_key; }; }; -dyndb sample "../driver/lib/sample.so" { ipv4.example.nil. in-addr.arpa. }; -dyndb sample2 "../driver/lib/sample.so" { ipv6.example.nil. 8.b.d.0.1.0.0.2.ip6.arpa. }; +dyndb sample "../driver/sample.la" { ipv4.example.nil. in-addr.arpa. }; +dyndb sample2 "../driver/sample.la" { ipv6.example.nil. 8.b.d.0.1.0.0.2.ip6.arpa. }; diff --git a/bin/tests/system/dyndb/prereq.sh b/bin/tests/system/dyndb/prereq.sh index 76af4655f8..dcdb4b9b85 100644 --- a/bin/tests/system/dyndb/prereq.sh +++ b/bin/tests/system/dyndb/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $FEATURETEST --have-dlopen || { diff --git a/bin/tests/system/dyndb/setup.sh b/bin/tests/system/dyndb/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/dyndb/setup.sh +++ b/bin/tests/system/dyndb/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/dyndb/tests.sh b/bin/tests/system/dyndb/tests.sh index 4215b1d40e..313204c00c 100644 --- a/bin/tests/system/dyndb/tests.sh +++ b/bin/tests/system/dyndb/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/ednscompliance/setup.sh b/bin/tests/system/ednscompliance/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/ednscompliance/setup.sh +++ b/bin/tests/system/ednscompliance/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/ednscompliance/tests.sh b/bin/tests/system/ednscompliance/tests.sh index 186dcd1bfe..515db8aaf5 100644 --- a/bin/tests/system/ednscompliance/tests.sh +++ b/bin/tests/system/ednscompliance/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+norec -p ${PORT}" diff --git a/bin/tests/system/emptyzones/setup.sh b/bin/tests/system/emptyzones/setup.sh index e842d2c158..69eebf319a 100644 --- a/bin/tests/system/emptyzones/setup.sh +++ b/bin/tests/system/emptyzones/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/emptyzones/tests.sh b/bin/tests/system/emptyzones/tests.sh index cf53e0a2dd..93ee6334ae 100644 --- a/bin/tests/system/emptyzones/tests.sh +++ b/bin/tests/system/emptyzones/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index 204d612bd7..65a588f47e 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -33,7 +33,7 @@ #endif /* ifndef MAXHOSTNAMELEN */ static void -usage() { +usage(void) { fprintf(stderr, "usage: feature-test \n"); fprintf(stderr, "args:\n"); fprintf(stderr, " --edns-version\n"); @@ -103,19 +103,15 @@ main(int argc, char **argv) { } if (strcmp(argv[1], "--gssapi") == 0) { -#if defined(GSSAPI) +#if HAVE_GSSAPI return (0); -#else /* if defined(GSSAPI) */ +#else /* HAVE_GSSAPI */ return (1); -#endif /* if defined(GSSAPI) */ +#endif /* HAVE_GSSAPI */ } if (strcmp(argv[1], "--have-dlopen") == 0) { -#if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN) return (0); -#else /* if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN) */ - return (1); -#endif /* if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN) */ } if (strcmp(argv[1], "--have-geoip2") == 0) { diff --git a/bin/tests/system/fetchlimit/prereq.sh b/bin/tests/system/fetchlimit/prereq.sh deleted file mode 100644 index de147a4c2a..0000000000 --- a/bin/tests/system/fetchlimit/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/fetchlimit/setup.sh b/bin/tests/system/fetchlimit/setup.sh index 25d8b5d861..c4e16dd4bd 100644 --- a/bin/tests/system/fetchlimit/setup.sh +++ b/bin/tests/system/fetchlimit/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/fetchlimit/tests.sh b/bin/tests/system/fetchlimit/tests.sh index 6d928eebc4..027a439976 100644 --- a/bin/tests/system/fetchlimit/tests.sh +++ b/bin/tests/system/fetchlimit/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGCMD="$DIG @10.53.0.3 -p ${PORT} +tcp +tries=1 +time=1" diff --git a/bin/tests/system/filter-aaaa/conf/bad1.conf b/bin/tests/system/filter-aaaa/conf/bad1.conf index 3e117325e2..97ce0dcad7 100644 --- a/bin/tests/system/filter-aaaa/conf/bad1.conf +++ b/bin/tests/system/filter-aaaa/conf/bad1.conf @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { none; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/bad2.conf b/bin/tests/system/filter-aaaa/conf/bad2.conf index 3298bd3232..a9410aa523 100644 --- a/bin/tests/system/filter-aaaa/conf/bad2.conf +++ b/bin/tests/system/filter-aaaa/conf/bad2.conf @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { /* * While this matches the defaults, it is not a good configuration * to have in named.conf as the two options contradict each other diff --git a/bin/tests/system/filter-aaaa/conf/bad3.conf b/bin/tests/system/filter-aaaa/conf/bad3.conf index 202091fe6a..091cf147aa 100644 --- a/bin/tests/system/filter-aaaa/conf/bad3.conf +++ b/bin/tests/system/filter-aaaa/conf/bad3.conf @@ -10,7 +10,7 @@ */ view myview { - plugin query "../../../plugins/lib/filter-aaaa.so" { + plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 no; filter-aaaa { any; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/bad4.conf b/bin/tests/system/filter-aaaa/conf/bad4.conf index 759fbf7c5e..a21ac4fdfb 100644 --- a/bin/tests/system/filter-aaaa/conf/bad4.conf +++ b/bin/tests/system/filter-aaaa/conf/bad4.conf @@ -10,7 +10,7 @@ */ view myview { - plugin query "../../../plugins/lib/filter-aaaa.so" { + plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { none; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/bad5.conf b/bin/tests/system/filter-aaaa/conf/bad5.conf index ea807d3fbd..54c3abb9ee 100644 --- a/bin/tests/system/filter-aaaa/conf/bad5.conf +++ b/bin/tests/system/filter-aaaa/conf/bad5.conf @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { 1.0.0.0/8; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/good1.conf b/bin/tests/system/filter-aaaa/conf/good1.conf index 953e975825..9f29bfd15b 100644 --- a/bin/tests/system/filter-aaaa/conf/good1.conf +++ b/bin/tests/system/filter-aaaa/conf/good1.conf @@ -9,6 +9,6 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; }; diff --git a/bin/tests/system/filter-aaaa/conf/good2.conf b/bin/tests/system/filter-aaaa/conf/good2.conf index 997d5e9fcb..93c7abdb48 100644 --- a/bin/tests/system/filter-aaaa/conf/good2.conf +++ b/bin/tests/system/filter-aaaa/conf/good2.conf @@ -9,6 +9,6 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 break-dnssec; }; diff --git a/bin/tests/system/filter-aaaa/conf/good3.conf b/bin/tests/system/filter-aaaa/conf/good3.conf index 2fa677fa10..853f341aa1 100644 --- a/bin/tests/system/filter-aaaa/conf/good3.conf +++ b/bin/tests/system/filter-aaaa/conf/good3.conf @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 break-dnssec; filter-aaaa { 1.0.0.0/8; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/good4.conf b/bin/tests/system/filter-aaaa/conf/good4.conf index 92c7be6288..dad7b5bfc3 100644 --- a/bin/tests/system/filter-aaaa/conf/good4.conf +++ b/bin/tests/system/filter-aaaa/conf/good4.conf @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -plugin query "../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { 1.0.0.0/8; }; }; diff --git a/bin/tests/system/filter-aaaa/conf/good5.conf b/bin/tests/system/filter-aaaa/conf/good5.conf index e88c515789..c26e57a5d6 100644 --- a/bin/tests/system/filter-aaaa/conf/good5.conf +++ b/bin/tests/system/filter-aaaa/conf/good5.conf @@ -10,7 +10,7 @@ */ view myview { - plugin query "../../../plugins/lib/filter-aaaa.so" { + plugin query "../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { 1.0.0.0/8; }; }; diff --git a/bin/tests/system/filter-aaaa/ns1/named1.conf.in b/bin/tests/system/filter-aaaa/ns1/named1.conf.in index 3941dd67cd..31ea7a5828 100644 --- a/bin/tests/system/filter-aaaa/ns1/named1.conf.in +++ b/bin/tests/system/filter-aaaa/ns1/named1.conf.in @@ -25,7 +25,7 @@ options { acl filterees { 10.53.0.1; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { filterees; }; }; diff --git a/bin/tests/system/filter-aaaa/ns1/named2.conf.in b/bin/tests/system/filter-aaaa/ns1/named2.conf.in index cd28f03056..72e10c4fb0 100644 --- a/bin/tests/system/filter-aaaa/ns1/named2.conf.in +++ b/bin/tests/system/filter-aaaa/ns1/named2.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v6 yes; filter-aaaa { fd92:7065:b8e:ffff::1; }; }; diff --git a/bin/tests/system/filter-aaaa/ns1/sign.sh b/bin/tests/system/filter-aaaa/ns1/sign.sh index 3223ffd4fa..adc29af4a3 100755 --- a/bin/tests/system/filter-aaaa/ns1/sign.sh +++ b/bin/tests/system/filter-aaaa/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh SYSTESTDIR=filter-aaaa diff --git a/bin/tests/system/filter-aaaa/ns2/named1.conf.in b/bin/tests/system/filter-aaaa/ns2/named1.conf.in index 446279fba5..bd20634170 100644 --- a/bin/tests/system/filter-aaaa/ns2/named1.conf.in +++ b/bin/tests/system/filter-aaaa/ns2/named1.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 yes; filter-aaaa { 10.53.0.2; }; }; diff --git a/bin/tests/system/filter-aaaa/ns2/named2.conf.in b/bin/tests/system/filter-aaaa/ns2/named2.conf.in index 4fc0cab29a..831e017f6f 100644 --- a/bin/tests/system/filter-aaaa/ns2/named2.conf.in +++ b/bin/tests/system/filter-aaaa/ns2/named2.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v6 yes; filter-aaaa { fd92:7065:b8e:ffff::2; }; }; diff --git a/bin/tests/system/filter-aaaa/ns3/named1.conf.in b/bin/tests/system/filter-aaaa/ns3/named1.conf.in index e757e8878b..db30e0b469 100644 --- a/bin/tests/system/filter-aaaa/ns3/named1.conf.in +++ b/bin/tests/system/filter-aaaa/ns3/named1.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 break-dnssec; filter-aaaa { 10.53.0.3; }; }; diff --git a/bin/tests/system/filter-aaaa/ns3/named2.conf.in b/bin/tests/system/filter-aaaa/ns3/named2.conf.in index 216a85aef6..48dc568cf1 100644 --- a/bin/tests/system/filter-aaaa/ns3/named2.conf.in +++ b/bin/tests/system/filter-aaaa/ns3/named2.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v6 break-dnssec; filter-aaaa { fd92:7065:b8e:ffff::3; }; }; diff --git a/bin/tests/system/filter-aaaa/ns4/named1.conf.in b/bin/tests/system/filter-aaaa/ns4/named1.conf.in index 804ed0ae3b..69b7ac47d2 100644 --- a/bin/tests/system/filter-aaaa/ns4/named1.conf.in +++ b/bin/tests/system/filter-aaaa/ns4/named1.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 break-dnssec; filter-aaaa { 10.53.0.4; }; }; diff --git a/bin/tests/system/filter-aaaa/ns4/named2.conf.in b/bin/tests/system/filter-aaaa/ns4/named2.conf.in index 87874d1375..68b43c4cee 100644 --- a/bin/tests/system/filter-aaaa/ns4/named2.conf.in +++ b/bin/tests/system/filter-aaaa/ns4/named2.conf.in @@ -23,7 +23,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v6 break-dnssec; filter-aaaa { fd92:7065:b8e:ffff::4; }; }; diff --git a/bin/tests/system/filter-aaaa/ns4/sign.sh b/bin/tests/system/filter-aaaa/ns4/sign.sh index a5019690b2..05780cf4c6 100755 --- a/bin/tests/system/filter-aaaa/ns4/sign.sh +++ b/bin/tests/system/filter-aaaa/ns4/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh SYSTESTDIR=filter-aaaa diff --git a/bin/tests/system/filter-aaaa/ns5/named.conf.in b/bin/tests/system/filter-aaaa/ns5/named.conf.in index 88bdf805b9..4712c5aef4 100644 --- a/bin/tests/system/filter-aaaa/ns5/named.conf.in +++ b/bin/tests/system/filter-aaaa/ns5/named.conf.in @@ -28,7 +28,7 @@ options { minimal-responses no; }; -plugin query "../../../../plugins/lib/filter-aaaa.so" { +plugin query "../../../../plugins/filter-aaaa.la" { filter-aaaa-on-v4 break-dnssec; filter-aaaa { any; }; }; diff --git a/bin/tests/system/filter-aaaa/prereq.sh b/bin/tests/system/filter-aaaa/prereq.sh index 7b8a7f4a91..ac5219b61c 100644 --- a/bin/tests/system/filter-aaaa/prereq.sh +++ b/bin/tests/system/filter-aaaa/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $FEATURETEST --have-dlopen || { diff --git a/bin/tests/system/filter-aaaa/setup.sh b/bin/tests/system/filter-aaaa/setup.sh index 9e00d77cc8..21a33fb482 100644 --- a/bin/tests/system/filter-aaaa/setup.sh +++ b/bin/tests/system/filter-aaaa/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named1.conf.in ns1/named.conf diff --git a/bin/tests/system/filter-aaaa/tests.sh b/bin/tests/system/filter-aaaa/tests.sh index 662c20459e..0d7a1271df 100644 --- a/bin/tests/system/filter-aaaa/tests.sh +++ b/bin/tests/system/filter-aaaa/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/formerr/setup.sh b/bin/tests/system/formerr/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/formerr/setup.sh +++ b/bin/tests/system/formerr/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/formerr/tests.sh b/bin/tests/system/formerr/tests.sh index d8b91e8754..51e29ea696 100644 --- a/bin/tests/system/formerr/tests.sh +++ b/bin/tests/system/formerr/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/forward/prereq.sh b/bin/tests/system/forward/prereq.sh deleted file mode 100644 index 0e299f4db8..0000000000 --- a/bin/tests/system/forward/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/forward/setup.sh b/bin/tests/system/forward/setup.sh index 285ecc9de9..5d4894ead4 100644 --- a/bin/tests/system/forward/setup.sh +++ b/bin/tests/system/forward/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/forward/tests.sh b/bin/tests/system/forward/tests.sh index bbfaa10243..cdd18b018e 100644 --- a/bin/tests/system/forward/tests.sh +++ b/bin/tests/system/forward/tests.sh @@ -8,7 +8,6 @@ # information regarding copyright ownership. #shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" dig_with_opts() ( @@ -16,7 +15,7 @@ dig_with_opts() ( ) sendcmd() ( - "$PERL" ../send.pl 10.53.0.6 "$EXTRAPORT1" + send 10.53.0.6 "$EXTRAPORT1" ) root=10.53.0.1 @@ -105,10 +104,10 @@ echo_i "checking for negative caching of forwarder response ($n)" ret=0 dig_with_opts nonexist. txt @10.53.0.5 > dig.out.$n.f2 || ret=1 grep "status: NXDOMAIN" dig.out.$n.f2 > /dev/null || ret=1 -$PERL ../stop.pl forward ns4 || ret=1 +stop forward ns4 || ret=1 dig_with_opts nonexist. txt @10.53.0.5 > dig.out.$n.f2 || ret=1 grep "status: NXDOMAIN" dig.out.$n.f2 > /dev/null || ret=1 -$PERL ../start.pl --restart --noclean --port "${PORT}" forward ns4 || ret=1 +start --restart --noclean --port "${PORT}" forward ns4 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) diff --git a/bin/tests/system/geoip2/prereq.sh b/bin/tests/system/geoip2/prereq.sh index 2e38b774b0..8178c2a9f2 100644 --- a/bin/tests/system/geoip2/prereq.sh +++ b/bin/tests/system/geoip2/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $FEATURETEST --have-geoip2 || { diff --git a/bin/tests/system/geoip2/setup.sh b/bin/tests/system/geoip2/setup.sh index fb51a0a0dd..ef08a2152e 100644 --- a/bin/tests/system/geoip2/setup.sh +++ b/bin/tests/system/geoip2/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/geoip2/tests.sh b/bin/tests/system/geoip2/tests.sh index 0b2a9ab6c0..8147edb811 100644 --- a/bin/tests/system/geoip2/tests.sh +++ b/bin/tests/system/geoip2/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/get_base_port.sh b/bin/tests/system/get_base_port.sh new file mode 100755 index 0000000000..7c1b2d3887 --- /dev/null +++ b/bin/tests/system/get_base_port.sh @@ -0,0 +1,58 @@ +#!/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. + +# This script is a 'port' broker. It keeps track of ports given to the +# individual system subtests, so every test is given a unique port range. + +lockfile=get_base_port.lock +statefile=get_base_port.state + +ephemeral_port_min=49152 +ephemeral_port_max=65535 + +get_base_port() { + if ( set -o noclobber; echo "$$" > "${lockfile}" ) 2> /dev/null; then + trap 'rm -f "${lockfile}"; exit $?' INT TERM EXIT + + base_port=$(cat "${statefile}" 2>/dev/null) + + if [ -z "${base_port}" ]; then + base_port="${ephemeral_port_min}" + fi + + if [ "$((base_port+100))" -gt "${ephemeral_port_max}" ]; then + base_port="${ephemeral_port_min}" + fi + + echo $((base_port+100)) > get_base_port.state + + # clean up after yourself, and release your trap + rm -f "${lockfile}" + trap - INT TERM EXIT + echo "${base_port}" + else + echo 0 + fi +} + +tries=10 + +while [ "${tries}" -gt 0 ]; do + base_port=$(get_base_port) + if [ "${base_port}" -gt 0 ]; then + echo "${base_port}" + exit 0 + fi + sleep 1 + tries=$((tries-1)) +done + +exit 1 diff --git a/bin/tests/system/glue/setup.sh b/bin/tests/system/glue/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/glue/setup.sh +++ b/bin/tests/system/glue/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/glue/tests.sh b/bin/tests/system/glue/tests.sh index 157e5fd409..2bb2f7166e 100644 --- a/bin/tests/system/glue/tests.sh +++ b/bin/tests/system/glue/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # diff --git a/bin/tests/system/idna/setup.sh b/bin/tests/system/idna/setup.sh index 7e606316f4..bf1af390f2 100644 --- a/bin/tests/system/idna/setup.sh +++ b/bin/tests/system/idna/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/idna/tests.sh b/bin/tests/system/idna/tests.sh index 486216662d..45350ae5b8 100644 --- a/bin/tests/system/idna/tests.sh +++ b/bin/tests/system/idna/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # Set known locale for the tests diff --git a/bin/tests/system/ifconfig.sh b/bin/tests/system/ifconfig.sh.in similarity index 96% rename from bin/tests/system/ifconfig.sh rename to bin/tests/system/ifconfig.sh.in index fe410ecd5a..537eb176a9 100755 --- a/bin/tests/system/ifconfig.sh +++ b/bin/tests/system/ifconfig.sh.in @@ -20,12 +20,9 @@ # fd92:7065:b8e:ff::{1..2} # -SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -. "$SYSTEMTESTTOP/conf.sh" +top_builddir=@abs_top_builddir@ -export SYSTEMTESTTOP - -sys=$($SHELL "$TOP/config.guess") +sys=$($SHELL "$top_builddir/config.guess") use_ip= case "$sys" in @@ -227,9 +224,9 @@ case "$1" in fd92:7065:b8e:${ipv6}ff::$ns delete ;; *-cygwin*) - echo "Please run ifconfig.bat as Administrator." - exit 1 - ;; + echo "Please run ifconfig.bat as Administrator." + exit 1 + ;; *) echo "Don't know how to destroy interface. Giving up." exit 1 diff --git a/bin/tests/system/include-multiplecfg/setup.sh b/bin/tests/system/include-multiplecfg/setup.sh index 96c061bd3d..44b0179e14 100644 --- a/bin/tests/system/include-multiplecfg/setup.sh +++ b/bin/tests/system/include-multiplecfg/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/include-multiplecfg/tests.sh b/bin/tests/system/include-multiplecfg/tests.sh index 5651536e0a..f2ce745b67 100644 --- a/bin/tests/system/include-multiplecfg/tests.sh +++ b/bin/tests/system/include-multiplecfg/tests.sh @@ -12,7 +12,6 @@ # Test of include statement with glob expression. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +nocmd +norec +noques +noadd +nostats -p ${PORT}" diff --git a/bin/tests/system/inline/ns1/sign.sh b/bin/tests/system/inline/ns1/sign.sh index 72fc52eb4b..587266d64a 100644 --- a/bin/tests/system/inline/ns1/sign.sh +++ b/bin/tests/system/inline/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/inline/ns3/sign.sh b/bin/tests/system/inline/ns3/sign.sh index 7dc0bd09c1..cd4fc846a8 100755 --- a/bin/tests/system/inline/ns3/sign.sh +++ b/bin/tests/system/inline/ns3/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh # Fake an unsupported key diff --git a/bin/tests/system/inline/ns7/sign.sh b/bin/tests/system/inline/ns7/sign.sh index 6ba5466407..462cd29e2e 100755 --- a/bin/tests/system/inline/ns7/sign.sh +++ b/bin/tests/system/inline/ns7/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh # NOTE: The number of signing keys generated below is not coincidental. More diff --git a/bin/tests/system/inline/ns8/sign.sh b/bin/tests/system/inline/ns8/sign.sh index 5d36cb9650..4e8a8df038 100755 --- a/bin/tests/system/inline/ns8/sign.sh +++ b/bin/tests/system/inline/ns8/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh for zone in example01.com example02.com example03.com example04.com \ diff --git a/bin/tests/system/inline/setup.sh b/bin/tests/system/inline/setup.sh index 3411a66ba8..dd1a5f33c5 100644 --- a/bin/tests/system/inline/setup.sh +++ b/bin/tests/system/inline/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp ns1/root.db.in ns1/root.db diff --git a/bin/tests/system/inline/tests.sh b/bin/tests/system/inline/tests.sh index 47cc07a372..b325137c52 100755 --- a/bin/tests/system/inline/tests.sh +++ b/bin/tests/system/inline/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +dnssec -p ${PORT}" @@ -469,14 +468,14 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "stop bump in the wire signer server ($n)" ret=0 -$PERL ../stop.pl inline ns3 || ret=1 +stop inline ns3 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` n=`expr $n + 1` echo_i "restart bump in the wire signer server ($n)" ret=0 -$PERL ../start.pl --noclean --restart --port ${PORT} inline ns3 || ret=1 +start --noclean --restart --port ${PORT} inline ns3 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -883,7 +882,7 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "stop bump in the wire signer server ($n)" ret=0 -$PERL ../stop.pl inline ns3 || ret=1 +stop inline ns3 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -894,7 +893,7 @@ rm ns3/master.db.jnl n=`expr $n + 1` echo_i "restart bump in the wire signer server ($n)" ret=0 -$PERL ../start.pl --noclean --restart --port ${PORT} inline ns3 || ret=1 +start --noclean --restart --port ${PORT} inline ns3 || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` @@ -1343,7 +1342,7 @@ retry_quiet 10 check_done_signing || ret=1 # flushed upon shutdown since we specifically want to avoid it. $PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} inline ns3 ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} inline ns3 +start --noclean --restart --port ${PORT} inline ns3 # At this point, the raw zone journal will not have a source serial set. Upon # server startup, receive_secure_serial() will rectify that, update SOA, resign # it, and schedule its future resign. This will cause "rndc zonestatus" to @@ -1353,7 +1352,7 @@ $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} inline ns3 $PERL $SYSTEMTESTTOP/stop.pl --use-rndc --halt --port ${CONTROLPORT} inline ns3 ensure_sigs_only_in_journal delayedkeys ns3/delayedkeys.db.signed nextpart ns3/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} inline ns3 +start --noclean --restart --port ${PORT} inline ns3 # We can now test whether the secure zone journal was correctly processed: # unless the records contained in it were scheduled for resigning, no resigning # event will be scheduled at all since the secure zone master file contains no diff --git a/bin/tests/system/integrity/setup.sh b/bin/tests/system/integrity/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/integrity/setup.sh +++ b/bin/tests/system/integrity/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/integrity/tests.sh b/bin/tests/system/integrity/tests.sh index 8d494d92dc..f125ddc4a2 100644 --- a/bin/tests/system/integrity/tests.sh +++ b/bin/tests/system/integrity/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/ixfr/prereq.sh b/bin/tests/system/ixfr/prereq.sh deleted file mode 100644 index 0e299f4db8..0000000000 --- a/bin/tests/system/ixfr/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/ixfr/setup.sh b/bin/tests/system/ixfr/setup.sh index 8c8c5fccc7..8f216ee591 100644 --- a/bin/tests/system/ixfr/setup.sh +++ b/bin/tests/system/ixfr/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh @@ -60,7 +59,7 @@ testdb sub.test. 3 61 > ns3/subtest1.db # Set up a large zone i=0 -$SHELL ../genzone.sh 3 > ns3/large.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 3 > ns3/large.db while [ $i -lt 10000 ]; do echo "record$i 10 IN TXT this is record %i" >> ns3/large.db i=$((i+1)) diff --git a/bin/tests/system/ixfr/tests.sh b/bin/tests/system/ixfr/tests.sh index 6d1fe1f2d1..ed63537b30 100644 --- a/bin/tests/system/ixfr/tests.sh +++ b/bin/tests/system/ixfr/tests.sh @@ -15,7 +15,6 @@ # in the log file - need a better approach - until then, # if you add any tests above that point, you will break the test. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh wait_for_serial() ( @@ -28,14 +27,18 @@ status=0 n=0 DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" -SENDCMD="$PERL ../send.pl 10.53.0.2 ${EXTRAPORT1}" RNDCCMD="$RNDC -p ${CONTROLPORT} -c ../common/rndc.conf -s" +sendcmd() { + send 10.53.0.2 "${EXTRAPORT1}" +} + + n=$((n+1)) echo_i "testing initial AXFR ($n)" ret=0 -$SENDCMD < ns3/verify-load.db.mirror nextpart ns3/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3 +start --noclean --restart --port ${PORT} mirror ns3 wait_for_load verify-load ${UPDATED_SERIAL_GOOD} ns3/named.run $DIG $DIGOPTS @10.53.0.3 +norec verify-load SOA > dig.out.ns3.test$n 2>&1 || ret=1 grep "ANSWER: 0" dig.out.ns3.test$n > /dev/null && ret=1 @@ -239,7 +238,7 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "checking that loading a journal for an incorrectly signed mirror zone fails ($n)" ret=0 -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3 +stop --use-rndc --port ${CONTROLPORT} mirror ns3 cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror cp ns3/verify-journal.db.bad.mirror.jnl ns3/verify-ixfr.db.mirror.jnl # Temporarily disable transfers of the "verify-ixfr" zone on ns2. This is @@ -254,7 +253,7 @@ sed '/^zone "verify-ixfr" {$/,/^};$/ { mv ns2/named.conf.modified ns2/named.conf rndc_reconfig ns2 10.53.0.2 nextpart ns3/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3 +start --noclean --restart --port ${PORT} mirror ns3 wait_for_load verify-ixfr ${UPDATED_SERIAL_BAD} ns3/named.run $DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1 grep "ANSWER: 0" dig.out.ns3.test$n > /dev/null || ret=1 @@ -274,11 +273,11 @@ status=`expr $status + $ret` n=`expr $n + 1` echo_i "checking that loading a journal for a correctly signed mirror zone succeeds ($n)" ret=0 -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3 +stop --use-rndc --port ${CONTROLPORT} mirror ns3 cp ns3/verify-journal.db.mirror ns3/verify-ixfr.db.mirror cp ns3/verify-journal.db.good.mirror.jnl ns3/verify-ixfr.db.mirror.jnl nextpart ns3/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3 +start --noclean --restart --port ${PORT} mirror ns3 wait_for_load verify-ixfr ${UPDATED_SERIAL_GOOD} ns3/named.run $DIG $DIGOPTS @10.53.0.3 +norec verify-ixfr SOA > dig.out.ns3.test$n 2>&1 || ret=1 grep "ANSWER: 0" dig.out.ns3.test$n > /dev/null && ret=1 @@ -416,10 +415,10 @@ mv ns2/named.conf.modified ns2/named.conf rndc_reconfig ns2 10.53.0.2 # Stop ns3, update the timestamp of the zone file to one far in the past, then # restart ns3. -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port ${CONTROLPORT} mirror ns3 +stop --use-rndc --port ${CONTROLPORT} mirror ns3 touch -t 200001010000 ns3/initially-unavailable.db.mirror nextpart ns3/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} mirror ns3 +start --noclean --restart --port ${PORT} mirror ns3 # Ensure named attempts to retransfer the zone due to its expiry. wait_for_transfer initially-unavailable # Ensure the expected messages were logged. diff --git a/bin/tests/system/mkeys/ns1/sign.sh b/bin/tests/system/mkeys/ns1/sign.sh index 483ed4ed55..f640a6e86c 100644 --- a/bin/tests/system/mkeys/ns1/sign.sh +++ b/bin/tests/system/mkeys/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/mkeys/ns6/setup.sh b/bin/tests/system/mkeys/ns6/setup.sh index 3fead4bcf7..c2ef857d58 100644 --- a/bin/tests/system/mkeys/ns6/setup.sh +++ b/bin/tests/system/mkeys/ns6/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/mkeys/setup.sh b/bin/tests/system/mkeys/setup.sh index eb50fc726b..8341bcdb45 100644 --- a/bin/tests/system/mkeys/setup.sh +++ b/bin/tests/system/mkeys/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named1.conf.in ns1/named.conf diff --git a/bin/tests/system/mkeys/tests.sh b/bin/tests/system/mkeys/tests.sh index 9cb68b0e39..42915bfdb2 100644 --- a/bin/tests/system/mkeys/tests.sh +++ b/bin/tests/system/mkeys/tests.sh @@ -11,7 +11,6 @@ set -e -SYSTEMTESTTOP=.. #shellcheck source=conf.sh . "$SYSTEMTESTTOP/conf.sh" @@ -299,11 +298,11 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) echo_i "reinitialize trust anchors, add second key to bind.keys" -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns2 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns2 rm -f ns2/managed-keys.bind* keyfile_to_initial_ds ns1/"$original" ns1/"$standby1" > ns2/managed.conf nextpart ns2/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns2 +start --noclean --restart --port "${PORT}" mkeys ns2 n=$((n+1)) echo_i "check that no key from bind.keys is marked as an initializing key ($n)" @@ -315,11 +314,11 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) echo_i "reinitialize trust anchors, revert to one key in bind.keys" -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns2 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns2 rm -f ns2/managed-keys.bind* mv ns2/managed1.conf ns2/managed.conf nextpart ns2/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns2 +start --noclean --restart --port "${PORT}" mkeys ns2 n=$((n+1)) echo_i "check that standby key is now trusted ($n)" @@ -473,10 +472,10 @@ rm -f ns1/root.db.signed.jnl mkeys_reconfig_on 1 || ret=1 echo_i "reinitialize trust anchors" -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns2 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns2 rm -f ns2/managed-keys.bind* nextpart ns2/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns2 +start --noclean --restart --port "${PORT}" mkeys ns2 n=$((n+1)) echo_i "check positive validation ($n)" @@ -572,11 +571,11 @@ ret=0 mkeys_refresh_on 2 || ret=1 mkeys_status_on 2 > rndc.out.1.$n 2>&1 || ret=1 t1=$(grep 'next refresh:' rndc.out.1.$n) || true -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns1 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns1 rm -f ns1/root.db.signed.jnl cp ns1/root.db ns1/root.db.signed nextpart ns1/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns1 +start --noclean --restart --port "${PORT}" mkeys ns1 wait_for_log 20 "all zones loaded" ns1/named.run || ret=1 mkeys_refresh_on 2 || ret=1 mkeys_status_on 2 > rndc.out.2.$n 2>&1 || ret=1 @@ -606,11 +605,11 @@ ret=0 mkeys_refresh_on 2 || ret=1 mkeys_status_on 2 > rndc.out.1.$n 2>&1 || ret=1 t1=$(grep 'next refresh:' rndc.out.1.$n) || true -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns1 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns1 rm -f ns1/root.db.signed.jnl cat ns1/K*.key >> ns1/root.db.signed nextpart ns1/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns1 +start --noclean --restart --port "${PORT}" mkeys ns1 wait_for_log 20 "all zones loaded" ns1/named.run || ret=1 # Less than a second may have passed since the last time ns2 received a # ./DNSKEY response from ns1. Ensure keys are refreshed at a different @@ -708,9 +707,9 @@ ret=0 # ensure key refresh retry will be scheduled to one actual hour after the first # key refresh failure instead of just a few seconds, in order to prevent races # between the next scheduled key refresh time and startup time of restarted ns5. -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns5 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns5 nextpart ns5/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns5 +start --noclean --restart --port "${PORT}" mkeys ns5 wait_for_log 20 "Returned from key fetch in keyfetch_done()" ns5/named.run || ret=1 # ns5/named.run will contain logs from both the old instance and the new # instance. In order for the test to pass, both must attempt a fetch. @@ -722,14 +721,14 @@ status=$((status+ret)) n=$((n+1)) echo_i "check key refreshes are resumed after root servers become available ($n)" ret=0 -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns5 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns5 # Prevent previous check from affecting this one rm -f ns5/managed-keys.bind* # named2.args adds "-T mkeytimers=2/20/40" to named1.args as we need to wait for # an "hour" until keys are refreshed again after initial failure cp ns5/named2.args ns5/named.args nextpart ns5/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns5 +start --noclean --restart --port "${PORT}" mkeys ns5 wait_for_log 20 "Returned from key fetch in keyfetch_done() for '.': failure" ns5/named.run || ret=1 mkeys_secroots_on 5 || ret=1 grep '; initializing managed' ns5/named.secroots > /dev/null 2>&1 || ret=1 @@ -758,10 +757,10 @@ status=$((status+ret)) n=$((n+1)) echo_i "reinitialize trust anchors, add unsupported algorithm ($n)" ret=0 -$PERL $SYSTEMTESTTOP/stop.pl --use-rndc --port "${CONTROLPORT}" mkeys ns6 +stop --use-rndc --port "${CONTROLPORT}" mkeys ns6 rm -f ns6/managed-keys.bind* nextpart ns6/named.run > /dev/null -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port "${PORT}" mkeys ns6 +start --noclean --restart --port "${PORT}" mkeys ns6 # log when an unsupported algorithm is encountered during startup wait_for_log 20 "ignoring initial-key for 'unsupported.': algorithm is unsupported" ns6/named.run || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi diff --git a/bin/tests/system/names/setup.sh b/bin/tests/system/names/setup.sh index 3a45a70648..86e4e43549 100644 --- a/bin/tests/system/names/setup.sh +++ b/bin/tests/system/names/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/names/tests.sh b/bin/tests/system/names/tests.sh index 8b88ed8243..62046b346e 100644 --- a/bin/tests/system/names/tests.sh +++ b/bin/tests/system/names/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+nosea +stat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/notify/setup.sh b/bin/tests/system/notify/setup.sh index e2cd0a37c0..c371293d70 100644 --- a/bin/tests/system/notify/setup.sh +++ b/bin/tests/system/notify/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/notify/tests.sh b/bin/tests/system/notify/tests.sh index d54ab0d7ce..568639dee9 100644 --- a/bin/tests/system/notify/tests.sh +++ b/bin/tests/system/notify/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" @@ -141,12 +140,12 @@ digcomp dig.out.ns2.test$n dig.out.ns3.test$n || ret=1 status=`expr $ret + $status` echo_i "stopping master and restarting with example4 then waiting up to 45 seconds" -$PERL $SYSTEMTESTTOP/stop.pl notify ns2 +stop notify ns2 rm -f ns2/example.db cp -f ns2/example4.db ns2/example.db -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} notify ns2 +start --noclean --restart --port ${PORT} notify ns2 try=0 while test $try -lt 45 diff --git a/bin/tests/system/nslookup/setup.sh b/bin/tests/system/nslookup/setup.sh index 8134fb6ff3..e7a21a6da1 100644 --- a/bin/tests/system/nslookup/setup.sh +++ b/bin/tests/system/nslookup/setup.sh @@ -9,11 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh -$SHELL ../genzone.sh 1 >ns1/example.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 1 >ns1/example.db copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/nslookup/tests.sh b/bin/tests/system/nslookup/tests.sh index 863043454f..a055bc4b07 100644 --- a/bin/tests/system/nslookup/tests.sh +++ b/bin/tests/system/nslookup/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/nsupdate/ns3/sign.sh b/bin/tests/system/nsupdate/ns3/sign.sh index 7d627ae7ce..02dd6deda0 100644 --- a/bin/tests/system/nsupdate/ns3/sign.sh +++ b/bin/tests/system/nsupdate/ns3/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=nsec3param.test. diff --git a/bin/tests/system/nsupdate/prereq.sh b/bin/tests/system/nsupdate/prereq.sh deleted file mode 100644 index f08c31da6d..0000000000 --- a/bin/tests/system/nsupdate/prereq.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.70);' 2>/dev/null - then - : - else - echo_i "Net::DNS versions 0.69 to 0.70 have bugs that cause this test to fail: please update." >&2 - exit 1 - fi -fi - -exit 0 diff --git a/bin/tests/system/nsupdate/setup.sh b/bin/tests/system/nsupdate/setup.sh index 5d701149b9..f0ccd9ef3e 100644 --- a/bin/tests/system/nsupdate/setup.sh +++ b/bin/tests/system/nsupdate/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # diff --git a/bin/tests/system/nsupdate/tests.sh b/bin/tests/system/nsupdate/tests.sh index 72a282a31c..3877ea62e6 100755 --- a/bin/tests/system/nsupdate/tests.sh +++ b/bin/tests/system/nsupdate/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" @@ -338,7 +337,7 @@ rm named.pid cd .. sleep 10 if - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nsupdate ns1 + start --noclean --restart --port ${PORT} nsupdate ns1 then echo_i "restarted server ns1" else @@ -520,7 +519,7 @@ sleep 3 # that the data served by the new server process are exactly # those dumped to the master file by "rndc stop". rm -f ns1/*jnl -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nsupdate ns1 +start --noclean --restart --port ${PORT} nsupdate ns1 for try in 0 1 2 3 4 5 6 7 8 9; do iret=0 $DIG $DIGOPTS +tcp +noadd +nosea +nostat +noquest +nocomm +nocmd \ diff --git a/bin/tests/system/nzd2nzf/clean.sh b/bin/tests/system/nzd2nzf/clean.sh index 3a6ad6d9b9..44d4f4fec4 100644 --- a/bin/tests/system/nzd2nzf/clean.sh +++ b/bin/tests/system/nzd2nzf/clean.sh @@ -9,9 +9,9 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -rm -f */named.conf -rm -f */named.run -rm -f */named.memstats +rm -f ./*/named.conf +rm -f ./*/named.run +rm -f ./*/named.memstats rm -f dig.out.* rm -f rndc.out* rm -f ns*/*.nzf diff --git a/bin/tests/system/nzd2nzf/prereq.sh b/bin/tests/system/nzd2nzf/prereq.sh deleted file mode 100644 index 85e03606f0..0000000000 --- a/bin/tests/system/nzd2nzf/prereq.sh +++ /dev/null @@ -1,18 +0,0 @@ -# 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=.. -. $SYSTEMTESTTOP/conf.sh - -if [ -z "$NZD" ]; then - echo_i "This test requires LMDB support (--with-lmdb)" - exit 255 -fi - -exit 0 diff --git a/bin/tests/system/nzd2nzf/setup.sh b/bin/tests/system/nzd2nzf/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/nzd2nzf/setup.sh +++ b/bin/tests/system/nzd2nzf/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/nzd2nzf/tests.sh b/bin/tests/system/nzd2nzf/tests.sh index 34ede6e4e7..b70a6ffe3b 100644 --- a/bin/tests/system/nzd2nzf/tests.sh +++ b/bin/tests/system/nzd2nzf/tests.sh @@ -7,71 +7,74 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh -DIGOPTS="-p ${PORT}" -RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" +dig_with_opts() { + "$DIG" -p "${PORT}" "$@" +} + +rndccmd() { + "$RNDC" -c "$SYSTEMTESTTOP/common/rndc.conf" -p "${CONTROLPORT}" -s "$@" +} status=0 n=0 -n=`expr $n + 1` +n=$((n+1)) echo_i "querying for non-existing zone data ($n)" ret=0 -$DIG $DIGOPTS @10.53.0.1 a.added.example a > dig.out.ns1.$n || ret=1 +dig_with_opts @10.53.0.1 a.added.example a > dig.out.ns1.$n || ret=1 grep 'status: REFUSED' dig.out.ns1.$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` +status=$((status+ret)) -n=`expr $n + 1` +n=$((n+1)) echo_i "adding a new zone into default NZD using rndc addzone ($n)" -$RNDCCMD 10.53.0.1 addzone "added.example { type master; file \"added.db\"; +rndccmd 10.53.0.1 addzone "added.example { type master; file \"added.db\"; };" 2>&1 | sed 's/^/I:ns1 /' | cat_i sleep 2 -n=`expr $n + 1` +n=$((n+1)) echo_i "querying for existing zone data ($n)" ret=0 -$DIG $DIGOPTS @10.53.0.1 a.added.example a > dig.out.ns1.$n || ret=1 +dig_with_opts @10.53.0.1 a.added.example a > dig.out.ns1.$n || ret=1 grep 'status: NOERROR' dig.out.ns1.$n > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` +status=$((status+ret)) echo_i "stopping ns1" $PERL $SYSTEMTESTTOP/stop.pl nzd2nzf ns1 -n=`expr $n + 1` +n=$((n+1)) echo_i "dumping _default.nzd to _default.nzf ($n)" $NZD2NZF ns1/_default.nzd > ns1/_default.nzf || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` +status=$((status+ret)) -n=`expr $n + 1` +n=$((n+1)) echo_i "checking that _default.nzf contains the expected content ($n)" grep 'zone "added.example" { type master; file "added.db"; };' ns1/_default.nzf > /dev/null || ret=1 if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` +status=$((status+ret)) echo_i "deleting _default.nzd database" rm -f ns1/_default.nzd echo_i "starting ns1 which should migrate the .nzf to .nzd" -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} nzd2nzf ns1 +start --noclean --restart --port ${PORT} nzd2nzf ns1 -n=`expr $n + 1` +n=$((n+1)) echo_i "querying for zone data from migrated zone config ($n)" # retry loop in case the server restart above causes transient failures -for try in 0 1 2 3 4 5 6 7 8 9; do - ret=0 - $DIG $DIGOPTS @10.53.0.1 a.added.example a > dig.out.ns1.$n || ret=1 - grep 'status: NOERROR' dig.out.ns1.$n > /dev/null || ret=1 - [ "$ret" -eq 0 ] && break - sleep 1 -done -n=`expr $n + 1` +_do_query() ( + dig_with_opts @10.53.0.1 a.added.example a > dig.out.ns1.$n && + grep 'status: NOERROR' dig.out.ns1.$n > /dev/null +) +ret=0 +retry_quiet "10" _do_query || ret=1 +n=$((n+1)) if [ $ret != 0 ]; then echo_i "failed"; fi -status=`expr $status + $ret` +status=$((status+ret)) echo_i "exit status: $status" exit $status diff --git a/bin/tests/system/padding/setup.sh b/bin/tests/system/padding/setup.sh index 2252b7f0f8..a968818c78 100644 --- a/bin/tests/system/padding/setup.sh +++ b/bin/tests/system/padding/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL ./clean.sh diff --git a/bin/tests/system/padding/tests.sh b/bin/tests/system/padding/tests.sh index 52b60c5a03..4815bf954a 100644 --- a/bin/tests/system/padding/tests.sh +++ b/bin/tests/system/padding/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh n=0 diff --git a/bin/tests/system/pending/ns1/sign.sh b/bin/tests/system/pending/ns1/sign.sh index aa6bf6ee32..d63fa0371c 100644 --- a/bin/tests/system/pending/ns1/sign.sh +++ b/bin/tests/system/pending/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/pending/ns2/sign.sh b/bin/tests/system/pending/ns2/sign.sh index 53659fc02e..0d8baf3a3a 100644 --- a/bin/tests/system/pending/ns2/sign.sh +++ b/bin/tests/system/pending/ns2/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh for domain in example example.com; do diff --git a/bin/tests/system/pending/setup.sh b/bin/tests/system/pending/setup.sh index 9037f435ab..183fcc36ec 100644 --- a/bin/tests/system/pending/setup.sh +++ b/bin/tests/system/pending/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/pending/tests.sh b/bin/tests/system/pending/tests.sh index e93475874b..529ea1bf34 100644 --- a/bin/tests/system/pending/tests.sh +++ b/bin/tests/system/pending/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # replace_data dname RR old_data new_data diff --git a/bin/tests/system/pipelined/prereq.sh b/bin/tests/system/pipelined/prereq.sh deleted file mode 100644 index 81c05c5989..0000000000 --- a/bin/tests/system/pipelined/prereq.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if test -n "$PYTHON" -then - if $PYTHON -c "import dns" 2> /dev/null - then - : - else - echo_i "This test requires the dnspython module." >&2 - exit 1 - fi -else - echo_i "This test requires Python and the dnspython module." >&2 - exit 1 -fi - -exit 0 diff --git a/bin/tests/system/pipelined/setup.sh b/bin/tests/system/pipelined/setup.sh index 4563f04145..64eb4ef2ad 100644 --- a/bin/tests/system/pipelined/setup.sh +++ b/bin/tests/system/pipelined/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/pipelined/tests.sh b/bin/tests/system/pipelined/tests.sh index 61f1ff70cd..3f3468004a 100644 --- a/bin/tests/system/pipelined/tests.sh +++ b/bin/tests/system/pipelined/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh MDIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/pkcs11/setup.sh b/bin/tests/system/pkcs11/setup.sh index fd642d9e5d..946edb1b34 100644 --- a/bin/tests/system/pkcs11/setup.sh +++ b/bin/tests/system/pkcs11/setup.sh @@ -11,7 +11,6 @@ set -e -SYSTEMTESTTOP=.. # shellcheck source=conf.sh . $SYSTEMTESTTOP/conf.sh diff --git a/bin/tests/system/pkcs11/tests.sh b/bin/tests/system/pkcs11/tests.sh index a85a08e535..1bb115cb0c 100644 --- a/bin/tests/system/pkcs11/tests.sh +++ b/bin/tests/system/pkcs11/tests.sh @@ -11,7 +11,6 @@ set -e -SYSTEMTESTTOP=.. # shellcheck source=conf.sh . $SYSTEMTESTTOP/conf.sh diff --git a/bin/tests/system/qmin/prereq.sh b/bin/tests/system/qmin/prereq.sh deleted file mode 100644 index 81c05c5989..0000000000 --- a/bin/tests/system/qmin/prereq.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if test -n "$PYTHON" -then - if $PYTHON -c "import dns" 2> /dev/null - then - : - else - echo_i "This test requires the dnspython module." >&2 - exit 1 - fi -else - echo_i "This test requires Python and the dnspython module." >&2 - exit 1 -fi - -exit 0 diff --git a/bin/tests/system/qmin/setup.sh b/bin/tests/system/qmin/setup.sh index 009d606ade..0ad125d62b 100644 --- a/bin/tests/system/qmin/setup.sh +++ b/bin/tests/system/qmin/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/qmin/tests.sh b/bin/tests/system/qmin/tests.sh index ecd2bc86e9..afb73603d9 100755 --- a/bin/tests/system/qmin/tests.sh +++ b/bin/tests/system/qmin/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/reclimit/prereq.sh b/bin/tests/system/reclimit/prereq.sh deleted file mode 100644 index 3c854d2da0..0000000000 --- a/bin/tests/system/reclimit/prereq.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION <= 0.78);' 2>/dev/null - then - : - else - echo_i "Net::DNS versions up to 0.78 have a bug that causes this test to fail: please update." >&2 - exit 1 - fi -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi - -if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null -then - : -else - echo_i "This test requires the Net::DNS::Nameserver library." >&2 - exit 1 -fi diff --git a/bin/tests/system/reclimit/setup.sh b/bin/tests/system/reclimit/setup.sh index d09a01250f..c80a5c79a3 100644 --- a/bin/tests/system/reclimit/setup.sh +++ b/bin/tests/system/reclimit/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/reclimit/tests.sh b/bin/tests/system/reclimit/tests.sh index 9a30a20445..9ee737ec5b 100644 --- a/bin/tests/system/reclimit/tests.sh +++ b/bin/tests/system/reclimit/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/redirect/ns1/sign.sh b/bin/tests/system/redirect/ns1/sign.sh index 719da48363..cf295c42e8 100644 --- a/bin/tests/system/redirect/ns1/sign.sh +++ b/bin/tests/system/redirect/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=signed diff --git a/bin/tests/system/redirect/ns3/sign.sh b/bin/tests/system/redirect/ns3/sign.sh index 719da48363..cf295c42e8 100644 --- a/bin/tests/system/redirect/ns3/sign.sh +++ b/bin/tests/system/redirect/ns3/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=signed diff --git a/bin/tests/system/redirect/ns5/sign.sh b/bin/tests/system/redirect/ns5/sign.sh index ee8197eeb3..2236dfc931 100644 --- a/bin/tests/system/redirect/ns5/sign.sh +++ b/bin/tests/system/redirect/ns5/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh # We sign the zone here and move the signed zone to ns6. diff --git a/bin/tests/system/redirect/setup.sh b/bin/tests/system/redirect/setup.sh index 2445f5711b..3b35510a2f 100644 --- a/bin/tests/system/redirect/setup.sh +++ b/bin/tests/system/redirect/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/redirect/tests.sh b/bin/tests/system/redirect/tests.sh index 810e43e8d8..e720db3b1e 100644 --- a/bin/tests/system/redirect/tests.sh +++ b/bin/tests/system/redirect/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/resolver/ns6/keygen.sh b/bin/tests/system/resolver/ns6/keygen.sh index 34ca7dc01a..5b6ad516d7 100644 --- a/bin/tests/system/resolver/ns6/keygen.sh +++ b/bin/tests/system/resolver/ns6/keygen.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=ds.example.net diff --git a/bin/tests/system/resolver/prereq.sh b/bin/tests/system/resolver/prereq.sh deleted file mode 100644 index 171926bc2c..0000000000 --- a/bin/tests/system/resolver/prereq.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION eq "0.76" || $Net::DNS::VERSION eq "0.77");' 2>/dev/null - then - : - else - echo_i "Net::DNS version 0.76 and 0.77 have a bug that causes this test to fail: please update." >&2 - exit 1 - fi -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi - -exit 0 diff --git a/bin/tests/system/resolver/setup.sh b/bin/tests/system/resolver/setup.sh index 1e9456a327..cf1f0f4591 100644 --- a/bin/tests/system/resolver/setup.sh +++ b/bin/tests/system/resolver/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp ns4/tld1.db ns4/tld.db diff --git a/bin/tests/system/resolver/tests.sh b/bin/tests/system/resolver/tests.sh index 8f9e1369ec..5a1faa2971 100755 --- a/bin/tests/system/resolver/tests.sh +++ b/bin/tests/system/resolver/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh echo . diff --git a/bin/tests/system/rndc/setup.sh b/bin/tests/system/rndc/setup.sh index 6b539d1781..c15ac085fb 100644 --- a/bin/tests/system/rndc/setup.sh +++ b/bin/tests/system/rndc/setup.sh @@ -9,14 +9,13 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh -$SHELL ../genzone.sh 2 >ns2/nil.db -$SHELL ../genzone.sh 2 >ns2/other.db -$SHELL ../genzone.sh 2 >ns2/static.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/nil.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/other.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns2/static.db -$SHELL ../genzone.sh 2 >ns6/huge.zone.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 >ns6/huge.zone.db awk 'END { for (i = 1; i <= 1000000; i++) printf "host%d IN A 10.53.0.6\n", i; }' < /dev/null >> ns6/huge.zone.db diff --git a/bin/tests/system/rndc/tests.sh b/bin/tests/system/rndc/tests.sh index 2af855aa28..8b1534b623 100644 --- a/bin/tests/system/rndc/tests.sh +++ b/bin/tests/system/rndc/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd" @@ -645,23 +644,6 @@ sleep 1 if [ $ret != 0 ]; then echo_i "failed"; fi status=`expr $status + $ret` -if [ -x "$PYTHON" ]; then - n=`expr $n + 1` - echo_i "test rndc python bindings ($n)" - ret=0 - $PYTHON > python.out.1.test$n << EOF -import sys -sys.path.insert(0, '../../../../bin/python') -from isc import * -r = rndc(('10.53.0.5', ${CONTROLPORT}), 'hmac-sha256', '1234abcd8765') -result = r.call('status') -print(result['text']) -EOF - grep 'server is up and running' python.out.1.test$n > /dev/null 2>&1 || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=`expr $status + $ret` -fi - n=`expr $n + 1` echo_i "check 'rndc \"\"' is handled ($n)" ret=0 diff --git a/bin/tests/system/rootkeysentinel/ns1/sign.sh b/bin/tests/system/rootkeysentinel/ns1/sign.sh index cfbed026ba..340e02407f 100644 --- a/bin/tests/system/rootkeysentinel/ns1/sign.sh +++ b/bin/tests/system/rootkeysentinel/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/rootkeysentinel/ns2/sign.sh b/bin/tests/system/rootkeysentinel/ns2/sign.sh index 6501ce5dba..e847ac33fe 100644 --- a/bin/tests/system/rootkeysentinel/ns2/sign.sh +++ b/bin/tests/system/rootkeysentinel/ns2/sign.sh @@ -15,7 +15,6 @@ newid=`expr "0000${newid}" : '.*\(.....\)$'` badid=`expr \( ${oldid} + 7777 \) % 65536` badid=`expr "0000${badid}" : '.*\(.....\)$'` -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=example. diff --git a/bin/tests/system/rootkeysentinel/setup.sh b/bin/tests/system/rootkeysentinel/setup.sh index d5c20bb5e1..43b159c8c7 100644 --- a/bin/tests/system/rootkeysentinel/setup.sh +++ b/bin/tests/system/rootkeysentinel/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/rootkeysentinel/tests.sh b/bin/tests/system/rootkeysentinel/tests.sh index 76b3db899b..8aa5ba8d91 100644 --- a/bin/tests/system/rootkeysentinel/tests.sh +++ b/bin/tests/system/rootkeysentinel/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/rpz/ckdnsrps.sh b/bin/tests/system/rpz/ckdnsrps.sh index 154ba0945f..adb8f7da9b 100644 --- a/bin/tests/system/rpz/ckdnsrps.sh +++ b/bin/tests/system/rpz/ckdnsrps.sh @@ -17,7 +17,6 @@ set -e # and differ from dnsrpz.conf which is used by dnsrpzd. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DNSRPS_CMD=../rpz/dnsrps diff --git a/bin/tests/system/rpz/setup.sh b/bin/tests/system/rpz/setup.sh index 0763ed9ace..2ad1d44513 100644 --- a/bin/tests/system/rpz/setup.sh +++ b/bin/tests/system/rpz/setup.sh @@ -13,7 +13,6 @@ set -e -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh QPERF=`$SHELL qperf.sh` diff --git a/bin/tests/system/rpz/tests.sh b/bin/tests/system/rpz/tests.sh index 15ae5e245b..5a08f5e955 100644 --- a/bin/tests/system/rpz/tests.sh +++ b/bin/tests/system/rpz/tests.sh @@ -14,7 +14,6 @@ # touch dnsrps-off to not test with DNSRPS # touch dnsrps-only to not test with classic RPZ -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh ns=10.53.0 @@ -216,7 +215,7 @@ restart () { done fi fi - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpz ns$1 + start --noclean --restart --port ${PORT} rpz ns$1 load_db dnsrps_loaded sleep 1 @@ -483,7 +482,7 @@ for mode in native dnsrps; do continue else echo_i "running DNSRPS sub-test" - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpz + start --noclean --restart --port ${PORT} rpz sleep 3 fi ;; diff --git a/bin/tests/system/rpzrecurse/prereq.sh b/bin/tests/system/rpzrecurse/prereq.sh deleted file mode 100644 index 20388be837..0000000000 --- a/bin/tests/system/rpzrecurse/prereq.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi - -exit 0 diff --git a/bin/tests/system/rpzrecurse/setup.sh b/bin/tests/system/rpzrecurse/setup.sh index 9ab709fc9d..267f5dc21b 100644 --- a/bin/tests/system/rpzrecurse/setup.sh +++ b/bin/tests/system/rpzrecurse/setup.sh @@ -13,7 +13,6 @@ set -e -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh USAGE="$0: [-DNx]" diff --git a/bin/tests/system/rpzrecurse/tests.sh b/bin/tests/system/rpzrecurse/tests.sh index 7b1f206389..9637a8278f 100644 --- a/bin/tests/system/rpzrecurse/tests.sh +++ b/bin/tests/system/rpzrecurse/tests.sh @@ -12,7 +12,6 @@ # touch dnsrps-off to not test with DNSRPS # touch dnsrps-only to not test with classic RPZ -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 @@ -52,7 +51,7 @@ run_server() { echo_i "starting resolver using named.$TESTNAME.conf" cp -f ns2/named.$TESTNAME.conf ns2/named.conf - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpzrecurse ns2 + start --noclean --restart --port ${PORT} rpzrecurse ns2 sleep 3 } @@ -134,7 +133,7 @@ for mode in native dnsrps; do continue else echo_i "running DNSRPS sub-test" - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} rpzrecurse + start --noclean --restart --port ${PORT} rpzrecurse sleep 3 fi ;; diff --git a/bin/tests/system/rrchecker/tests.sh b/bin/tests/system/rrchecker/tests.sh index 29440161b5..e5b4fe84cc 100644 --- a/bin/tests/system/rrchecker/tests.sh +++ b/bin/tests/system/rrchecker/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 @@ -39,7 +38,7 @@ EOF n=`expr $n + 1` echo_i "check conversions to canonical format ($n)" ret=0 -$SHELL ../genzone.sh 0 > tempzone +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 0 > tempzone $CHECKZONE -Dq . tempzone | sed '/^;/d' > checkzone.out$n while read -r name tt cl ty rest do diff --git a/bin/tests/system/rrl/setup.sh b/bin/tests/system/rrl/setup.sh index 4563f04145..64eb4ef2ad 100644 --- a/bin/tests/system/rrl/setup.sh +++ b/bin/tests/system/rrl/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/rrl/tests.sh b/bin/tests/system/rrl/tests.sh index 977950f713..dd526d7b2c 100644 --- a/bin/tests/system/rrl/tests.sh +++ b/bin/tests/system/rrl/tests.sh @@ -9,7 +9,6 @@ # test response rate limiting -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" diff --git a/bin/tests/system/rrsetorder/setup.sh b/bin/tests/system/rrsetorder/setup.sh index c63aeb10d2..f3c0bd3519 100644 --- a/bin/tests/system/rrsetorder/setup.sh +++ b/bin/tests/system/rrsetorder/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/rrsetorder/tests.sh b/bin/tests/system/rrsetorder/tests.sh index 5ff9541a38..08266af6f1 100644 --- a/bin/tests/system/rrsetorder/tests.sh +++ b/bin/tests/system/rrsetorder/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+nosea +nocomm +nocmd +noquest +noadd +noauth +nocomm +nostat +short +nocookie" @@ -251,7 +250,7 @@ fi echo_i "Re-starting slave" -$PERL $SYSTEMTESTTOP/start.pl --noclean --port ${PORT} rrsetorder ns2 +start --noclean --port ${PORT} rrsetorder ns2 # # diff --git a/bin/tests/system/rsabigexponent/ns1/sign.sh b/bin/tests/system/rsabigexponent/ns1/sign.sh index cdc61327b8..a50cb40767 100755 --- a/bin/tests/system/rsabigexponent/ns1/sign.sh +++ b/bin/tests/system/rsabigexponent/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=. diff --git a/bin/tests/system/rsabigexponent/ns2/sign.sh b/bin/tests/system/rsabigexponent/ns2/sign.sh index 0c5cbdd084..fa7aea80dc 100755 --- a/bin/tests/system/rsabigexponent/ns2/sign.sh +++ b/bin/tests/system/rsabigexponent/ns2/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=example. diff --git a/bin/tests/system/rsabigexponent/prereq.sh b/bin/tests/system/rsabigexponent/prereq.sh deleted file mode 100644 index 2ee132d669..0000000000 --- a/bin/tests/system/rsabigexponent/prereq.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $BIGKEY > /dev/null 2>&1 -then - rm -f Kexample.* -else - echo_i "This test requires OpenSSL cryptography provider" >&2 - echo_i "configure with --with-openssl, and make sure you disable --with-pkcs11 and --enable-native-pkcs11" >&2 - exit 255 -fi diff --git a/bin/tests/system/rsabigexponent/setup.sh b/bin/tests/system/rsabigexponent/setup.sh index 46653f5b0c..1c6233eac0 100644 --- a/bin/tests/system/rsabigexponent/setup.sh +++ b/bin/tests/system/rsabigexponent/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/rsabigexponent/tests.sh b/bin/tests/system/rsabigexponent/tests.sh index b53052892e..80b618b923 100644 --- a/bin/tests/system/rsabigexponent/tests.sh +++ b/bin/tests/system/rsabigexponent/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/run.sh b/bin/tests/system/run.sh.in old mode 100755 new mode 100644 similarity index 58% rename from bin/tests/system/run.sh rename to bin/tests/system/run.sh.in index 37eb737eef..1f38dc45a3 --- a/bin/tests/system/run.sh +++ b/bin/tests/system/run.sh.in @@ -13,15 +13,25 @@ # Run a system test. # -SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -. $SYSTEMTESTTOP/conf.sh +top_builddir=@top_builddir@ +builddir=@abs_builddir@ +srcdir=@abs_srcdir@ +. ${builddir}/conf.sh + +SYSTEMTESTTOP="$(cd -P -- "${builddir}" && pwd -P)" export SYSTEMTESTTOP +export builddir +export srcdir + +date_with_args() ( + date -R +) stopservers=true baseport=5300 -if [ ${SYSTEMTEST_NO_CLEAN:-0} -eq 1 ]; then +if [ "${SYSTEMTEST_NO_CLEAN:-0}" -eq 1 ]; then clean=false else clean=true @@ -37,19 +47,36 @@ while getopts "knp:r-:" flag; do k) stopservers=false ;; n) clean=false ;; p) baseport=$OPTARG ;; + *) echo "invalid option" >&2; exit 1 ;; esac done -shift `expr $OPTIND - 1` +shift $((OPTIND-1)) if [ $# -eq 0 ]; then echofail "Usage: $0 [-k] [-n] [-p ] test-directory [test-options]" >&2; exit 1 fi -systest=${1%%/} +systest=$(basename "${1%%/}") shift -if [ ! -d $systest ]; then +if [ ! -d "${srcdir}/$systest" ]; then + echofail "$0: $systest: no such test" >&2 + exit 1 +fi + +if [ "${srcdir}" != "${builddir}" ]; then + if [ ! -d common ] || [ ! -r common/.prepared ]; then + cp -a "${srcdir}/common" "${builddir}" + fi + if [ ! -d "$systest" ] || [ ! -r "$systest/.prepared" ]; then + mkdir -p "${builddir}/$systest" + cp -a "${srcdir}/$systest" "${builddir}/" + touch "$systest/.prepared" + fi +fi + +if [ ! -d "${systest}" ]; then echofail "$0: $systest: no such test" >&2 exit 1 fi @@ -64,14 +91,13 @@ fi # command line is the lowest port number in a block of "numports" consecutive # ports and that the highest valid port number is 65,535. numport=100 -minvalid=`expr 1024 + 1` -maxvalid=`expr 65535 - $numport + 1` +minvalid=$((1024 + 1)) +maxvalid=$((65535 - numport + 1)) -test "$baseport" -eq "$baseport" > /dev/null 2>&1 -if [ $? -ne 0 ]; then +if ! [ "$baseport" -eq "$baseport" ] > /dev/null 2>&1; then echofail "$0: $systest: must specify a numeric value for the port" >&2 exit 1 -elif [ $baseport -lt $minvalid -o $baseport -gt $maxvalid ]; then +elif [ "$baseport" -lt "$minvalid" ] || [ "$baseport" -gt "$maxvalid" ]; then echofail "$0: $systest: the specified port must be in the range $minvalid to $maxvalid" >&2 exit 1 fi @@ -82,18 +108,18 @@ fi # will usually be a multiple of 10, the names are chosen so that if this is # true, the last digit of EXTRAPORTn is "n". PORT=$baseport -EXTRAPORT1=`expr $baseport + 1` -EXTRAPORT2=`expr $baseport + 2` -EXTRAPORT3=`expr $baseport + 3` -EXTRAPORT4=`expr $baseport + 4` -EXTRAPORT5=`expr $baseport + 5` -EXTRAPORT6=`expr $baseport + 6` -EXTRAPORT7=`expr $baseport + 7` -EXTRAPORT8=`expr $baseport + 8` -CONTROLPORT=`expr $baseport + 9` +EXTRAPORT1=$((baseport + 1)) +EXTRAPORT2=$((baseport + 2)) +EXTRAPORT3=$((baseport + 3)) +EXTRAPORT4=$((baseport + 4)) +EXTRAPORT5=$((baseport + 5)) +EXTRAPORT6=$((baseport + 6)) +EXTRAPORT7=$((baseport + 7)) +EXTRAPORT8=$((baseport + 8)) +CONTROLPORT=$((baseport + 9)) LOWPORT=$baseport -HIGHPORT=`expr $baseport + $numport - 1` +HIGHPORT=$((baseport + numport - 1)) export PORT export EXTRAPORT1 @@ -109,73 +135,68 @@ export CONTROLPORT export LOWPORT export HIGHPORT -echostart "S:$systest:`date`" +echostart "S:$systest:$(date_with_args)" echoinfo "T:$systest:1:A" echoinfo "A:$systest:System test $systest" echoinfo "I:$systest:PORTRANGE:${LOWPORT} - ${HIGHPORT}" -if [ x${PERL:+set} = x ] -then - echowarn "I:$systest:Perl not available. Skipping test." - echowarn "R:$systest:UNTESTED" - echoend "E:$systest:`date $dateargs`" - exit 0; -fi - -$PERL testsock.pl -p $PORT || { +$PERL ${srcdir}/testsock.pl -p "$PORT" || { echowarn "I:$systest:Network interface aliases not set up. Skipping test." - echowarn "R:$systest:UNTESTED" - echoend "E:$systest:`date $dateargs`" - exit 0; + echowarn "R:$systest:FAIL" + echoend "E:$systest:$(date_with_args)" + exit 1; } # Check for test-specific prerequisites. -test ! -f $systest/prereq.sh || ( cd $systest && $SHELL prereq.sh "$@" ) +test ! -f "$systest/prereq.sh" || ( cd "${systest}" && $SHELL prereq.sh "$@" ) result=$? if [ $result -eq 0 ]; then : prereqs ok else echowarn "I:$systest:Prerequisites missing, skipping test." - [ $result -eq 255 ] && echowarn "R:$systest:SKIPPED" || echowarn "R:$systest:UNTESTED" - echoend "E:$systest:`date $dateargs`" + if [ $result -eq 255 ]; then + echowarn "R:$systest:SKIPPED"; + else + echowarn "R:$systest:UNTESTED" + fi + echoend "E:$systest:$(date_with_args)" exit 0 fi # Check for PKCS#11 support if - test ! -f $systest/usepkcs11 || $SHELL cleanpkcs11.sh + test ! -f "$systest/usepkcs11" || $SHELL cleanpkcs11.sh then : pkcs11 ok else echowarn "I:$systest:Need PKCS#11, skipping test." echowarn "R:$systest:PKCS11ONLY" - echoend "E:$systest:`date $dateargs`" + echoend "E:$systest:$(date_with_args)" exit 0 fi # Clean up files left from any potential previous runs -if test -f $systest/clean.sh +if test -f "$systest/clean.sh" then - ( cd $systest && $SHELL clean.sh "$@" ) + ( cd "${systest}" && $SHELL clean.sh "$@" ) fi # Set up any dynamically generated test data -if test -f $systest/setup.sh +if test -f "$systest/setup.sh" then - ( cd $systest && $SHELL setup.sh "$@" ) + ( cd "${systest}" && $SHELL setup.sh "$@" ) fi # Start name servers running -$PERL start.pl --port $PORT $systest -if [ $? -ne 0 ]; then +if ! $PERL ${srcdir}/start.pl --port "$PORT" "$systest"; then echofail "R:$systest:FAIL" - echoend "E:$systest:`date $dateargs`" + echoend "E:$systest:$(date_with_args)" exit 1 fi # Run the tests -( cd $systest ; $SHELL tests.sh "$@" ) +( cd "${systest}" && $SHELL tests.sh "$@" ) status=$? if $stopservers @@ -186,17 +207,17 @@ else fi # Shutdown -$PERL stop.pl $systest +$PERL ${srcdir}/stop.pl "$systest" -status=`expr $status + $?` +status=$((status + $?)) if [ $status != 0 ]; then echofail "R:$systest:FAIL" # Do not clean up - we need the evidence. else - core_dumps="$(find $systest/ -name 'core*' -or -name '*.core' | sort | tr '\n' ' ')" - assertion_failures=$(find $systest/ -name named.run | xargs grep "assertion failure" | wc -l) - sanitizer_summaries=$(find $systest/ -name 'tsan.*' | wc -l) + core_dumps="$(find "$systest/" -name 'core*' -or -name '*.core' | sort | tr '\n' ' ')" + assertion_failures=$(find "$systest/" -name named.run -print0 | xargs -0 grep "assertion failure" | wc -l) + sanitizer_summaries=$(find "$systest/" -name 'tsan.*' | wc -l) if [ -n "$core_dumps" ]; then echoinfo "I:$systest:Test claims success despite crashes: $core_dumps" echofail "R:$systest:FAIL" @@ -205,31 +226,34 @@ else SYSTESTDIR="$systest" echoinfo "D:$systest:backtrace from $coredump start" binary=$(gdb --batch --core="$coredump" | sed -ne "s/Core was generated by \`//;s/ .*'.$//p;") - "$TOP/libtool" --mode=execute gdb \ - --batch \ - --command=run.gdb \ - --core="$coredump" \ - -- \ - "$binary" + "${top_builddir}/libtool" --mode=execute gdb \ + --batch \ + --command=run.gdb \ + --core="$coredump" \ + -- \ + "$binary" echoinfo "D:$systest:backtrace from $coredump end" done - elif [ $assertion_failures -ne 0 ]; then + elif [ "$assertion_failures" -ne 0 ]; then SYSTESTDIR="$systest" echoinfo "I:$systest:Test claims success despite $assertion_failures assertion failure(s)" - grep "SUMMARY: " $(find $systest/ -name 'tsan.*') | sort -u | cat_d + find "$systest/" -name 'tsan.*' -print0 | xargs -0 grep "SUMMARY: " | sort -u | cat_d echofail "R:$systest:FAIL" # Do not clean up - we need the evidence. - elif [ $sanitizer_summaries -ne 0 ]; then + elif [ "$sanitizer_summaries" -ne 0 ]; then echoinfo "I:$systest:Test claims success despite $sanitizer_summaries sanitizer reports(s)" echofail "R:$systest:FAIL" else echopass "R:$systest:PASS" if $clean then - ( cd $systest && $SHELL clean.sh "$@" ) - if test -d ../../../.git + ( cd "${systest}" && $SHELL clean.sh "$@" ) + if [ "${srcdir}" != "${builddir}" ]; then + rm -rf "./${systest}" ## FIXME (this also removes compiled binaries) + fi + if test -d ${srcdir}/../../../.git then - git status -su --ignored $systest 2>/dev/null | \ + git status -su --ignored "${systest}" 2>/dev/null | \ sed -n -e 's|^?? \(.*\)|I:file \1 not removed|p' \ -e 's|^!! \(.*/named.run\)$|I:file \1 not removed|p' \ -e 's|^!! \(.*/named.memstats\)$|I:file \1 not removed|p' @@ -238,6 +262,6 @@ else fi fi -echoend "E:$systest:`date $dateargs`" +echoend "E:$systest:$(date_with_args)" exit $status diff --git a/bin/tests/system/runtime/setup.sh b/bin/tests/system/runtime/setup.sh index 417ba70829..c759fc6c5a 100644 --- a/bin/tests/system/runtime/setup.sh +++ b/bin/tests/system/runtime/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/runtime/tests.sh b/bin/tests/system/runtime/tests.sh index e35cb70267..00162731d4 100644 --- a/bin/tests/system/runtime/tests.sh +++ b/bin/tests/system/runtime/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" set -e diff --git a/bin/tests/system/serve-stale/prereq.sh b/bin/tests/system/serve-stale/prereq.sh deleted file mode 100644 index 7aad052ec3..0000000000 --- a/bin/tests/system/serve-stale/prereq.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.74);' 2>/dev/null - then - : - else - echo "I:Net::DNS versions 0.69 to 0.74 have bugs that cause this test to fail: please update." >&2 - exit 1 - fi -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi -if $PERL -e 'use Net::DNS::Nameserver;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS::Nameserver library." >&2 - exit 1 -fi -if $PERL -e 'use Time::HiRes;' 2>/dev/null -then - : -else - echo "I:This test requires the Time::HiRes library." >&2 - exit 1 -fi diff --git a/bin/tests/system/serve-stale/setup.sh b/bin/tests/system/serve-stale/setup.sh index 79d7238cf9..f0ac9e60f7 100644 --- a/bin/tests/system/serve-stale/setup.sh +++ b/bin/tests/system/serve-stale/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/serve-stale/tests.sh b/bin/tests/system/serve-stale/tests.sh index 252eeab994..73e8cc8612 100755 --- a/bin/tests/system/serve-stale/tests.sh +++ b/bin/tests/system/serve-stale/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh RNDCCMD="$RNDC -c $SYSTEMTESTTOP/common/rndc.conf -p ${CONTROLPORT} -s" @@ -1056,7 +1055,7 @@ if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status+ret)) echo_i "start ns4" -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} serve-stale ns4 +start --noclean --restart --port ${PORT} serve-stale ns4 n=$((n+1)) echo_i "verify ancient cache statistics (serve-stale disabled) ($n)" diff --git a/bin/tests/system/sfcache/tests.sh b/bin/tests/system/sfcache/tests.sh index c512d6eea6..51e2da1430 100644 --- a/bin/tests/system/sfcache/tests.sh +++ b/bin/tests/system/sfcache/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" set -e diff --git a/bin/tests/system/smartsign/tests.sh b/bin/tests/system/smartsign/tests.sh index 7630112dbd..c08c1f1b74 100644 --- a/bin/tests/system/smartsign/tests.sh +++ b/bin/tests/system/smartsign/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/sortlist/setup.sh b/bin/tests/system/sortlist/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/sortlist/setup.sh +++ b/bin/tests/system/sortlist/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/sortlist/tests.sh b/bin/tests/system/sortlist/tests.sh index 2fc44b0f8f..a20dc3f66c 100644 --- a/bin/tests/system/sortlist/tests.sh +++ b/bin/tests/system/sortlist/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +noauth +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/spf/setup.sh b/bin/tests/system/spf/setup.sh index 985a4bcb69..0f5767dceb 100644 --- a/bin/tests/system/spf/setup.sh +++ b/bin/tests/system/spf/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/spf/tests.sh b/bin/tests/system/spf/tests.sh index dd54cf3766..27af97a356 100644 --- a/bin/tests/system/spf/tests.sh +++ b/bin/tests/system/spf/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh n=1 diff --git a/bin/tests/system/start.pl b/bin/tests/system/start.pl index 1ecbd70f22..e413e24942 100755 --- a/bin/tests/system/start.pl +++ b/bin/tests/system/start.pl @@ -75,8 +75,9 @@ if (!$test) { } # Global variables -my $topdir = abs_path($ENV{'SYSTEMTESTTOP'}); -my $testdir = abs_path($topdir . "/" . $test); +my $builddir = $ENV{'builddir'}; +my $srcdir = $ENV{'srcdir'}; +my $testdir = "$builddir/$test"; if (! -d $testdir) { die "No test directory: \"$testdir\"\n"; @@ -163,7 +164,7 @@ sub check_ns_port { my $tries = 0; while (1) { - my $return = system("$PERL $topdir/testsock.pl -p $port $options"); + my $return = system("$PERL $srcdir/testsock.pl -p $port $options"); if ($return == 0) { last; @@ -176,7 +177,7 @@ sub check_ns_port { print "I:$test:server sockets not available\n"; print "I:$test:failed\n"; - system("$PERL $topdir/stop.pl $test"); # Is this the correct behavior? + system("$PERL $srcdir/stop.pl $test"); # Is this the correct behavior? exit 1; } @@ -205,14 +206,14 @@ sub start_server { print "I:$test:failed\n"; system "kill -9 $child" if ("$child" ne ""); chdir "$testdir"; - system "$PERL $topdir/stop.pl $test"; + system "$PERL $srcdir/stop.pl $test"; exit 1; } sleep 0.1; } # go back to the top level directory - chdir $topdir; + chdir $builddir; } sub construct_ns_command { @@ -323,7 +324,7 @@ sub construct_ans_command { } elsif (-e "$testdir/$server/ans.pl") { $command = "$PERL ans.pl"; } else { - $command = "$PERL $topdir/ans.pl 10.53.0.$n"; + $command = "$PERL $srcdir/ans.pl 10.53.0.$n"; } if ($options) { @@ -384,7 +385,7 @@ sub verify_ns_server { print "I:$test:server $server seems to have not started\n"; print "I:$test:failed\n"; - system("$PERL $topdir/stop.pl $test"); + system("$PERL $srcdir/stop.pl $test"); exit 1; } @@ -419,7 +420,7 @@ sub verify_ns_server { print "I:$test:no response from $server\n"; print "I:$test:failed\n"; - system("$PERL $topdir/stop.pl $test"); + system("$PERL $srcdir/stop.pl $test"); exit 1; } diff --git a/bin/tests/system/start.sh b/bin/tests/system/start.sh deleted file mode 100755 index e71c7d6449..0000000000 --- a/bin/tests/system/start.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/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. - -SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -# shellcheck source=conf.sh -. "$SYSTEMTESTTOP/conf.sh" -export SYSTEMTESTTOP - -$PERL "$SYSTEMTESTTOP/start.pl" "$@" diff --git a/bin/tests/system/stop.sh b/bin/tests/system/start.sh.in old mode 100755 new mode 100644 similarity index 74% rename from bin/tests/system/stop.sh rename to bin/tests/system/start.sh.in index ba1256bc43..676dd94980 --- a/bin/tests/system/stop.sh +++ b/bin/tests/system/start.sh.in @@ -9,9 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP="$(cd -P -- "$(dirname -- "$0")" && pwd -P)" -# shellcheck source=conf.sh -. "$SYSTEMTESTTOP/conf.sh" -export SYSTEMTESTTOP +builddir=@builddir@ +srcdir=@srcdir@ -$PERL "$SYSTEMTESTTOP/stop.pl" "$@" +# shellcheck source=conf.sh +. "${builddir}/conf.sh" + +$PERL "${srcdir}/start.pl" "$@" diff --git a/bin/tests/system/staticstub/ns3/sign.sh b/bin/tests/system/staticstub/ns3/sign.sh index 0fe84ff66d..cd7e13f2f4 100755 --- a/bin/tests/system/staticstub/ns3/sign.sh +++ b/bin/tests/system/staticstub/ns3/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=example. diff --git a/bin/tests/system/staticstub/ns4/sign.sh b/bin/tests/system/staticstub/ns4/sign.sh index 757c8b4a98..2f5dbf05ab 100755 --- a/bin/tests/system/staticstub/ns4/sign.sh +++ b/bin/tests/system/staticstub/ns4/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=sub.example diff --git a/bin/tests/system/staticstub/setup.sh b/bin/tests/system/staticstub/setup.sh index 077690600e..b2af609891 100755 --- a/bin/tests/system/staticstub/setup.sh +++ b/bin/tests/system/staticstub/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/staticstub/tests.sh b/bin/tests/system/staticstub/tests.sh index 368d472f4c..e487ff298c 100755 --- a/bin/tests/system/staticstub/tests.sh +++ b/bin/tests/system/staticstub/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tests/system/statistics/prereq.sh b/bin/tests/system/statistics/prereq.sh deleted file mode 100644 index ec3fefe08a..0000000000 --- a/bin/tests/system/statistics/prereq.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.76 && $Net::DNS::VERSION <= 0.77);' 2>/dev/null - then - : - else - echo_i "Net::DNS version 0.76 and 0.77 have a bug that causes this test to fail: please update." >&2 - exit 1 - fi -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/statistics/setup.sh b/bin/tests/system/statistics/setup.sh index def2a615ac..e683db06d9 100644 --- a/bin/tests/system/statistics/setup.sh +++ b/bin/tests/system/statistics/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/statistics/tests.sh b/bin/tests/system/statistics/tests.sh index 1a4c5a5778..5347ade54e 100644 --- a/bin/tests/system/statistics/tests.sh +++ b/bin/tests/system/statistics/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd" diff --git a/bin/tests/system/statschannel/prereq.sh b/bin/tests/system/statschannel/prereq.sh deleted file mode 100644 index f3d4fd17a6..0000000000 --- a/bin/tests/system/statschannel/prereq.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -fail=0 - -if $PERL -e 'use File::Fetch;' 2>/dev/null -then - : -else - echo_i "This test requires the File::Fetch library." >&2 - fail=1 -fi - -exit $fail diff --git a/bin/tests/system/statschannel/tests.sh b/bin/tests/system/statschannel/tests.sh index 32a9da451c..aaa221b5d7 100644 --- a/bin/tests/system/statschannel/tests.sh +++ b/bin/tests/system/statschannel/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. # shellcheck source=conf.sh . "$SYSTEMTESTTOP/conf.sh" diff --git a/bin/tests/system/stop.pl b/bin/tests/system/stop.pl index a667d446fb..7940c23b46 100644 --- a/bin/tests/system/stop.pl +++ b/bin/tests/system/stop.pl @@ -54,8 +54,9 @@ if (!$test) { } # Global variables -my $topdir = abs_path($ENV{'SYSTEMTESTTOP'}); -my $testdir = abs_path($topdir . "/" . $test); +my $builddir = $ENV{'builddir'}; +my $srcdir = $ENV{'srcdir'}; +my $testdir = "$builddir/$test"; if (! -d $testdir) { die "No test directory: \"$testdir\"\n"; diff --git a/bin/tests/system/tcp/prereq.sh b/bin/tests/system/stop.sh.in similarity index 76% rename from bin/tests/system/tcp/prereq.sh rename to bin/tests/system/stop.sh.in index 375370b71f..1d5fb19846 100644 --- a/bin/tests/system/tcp/prereq.sh +++ b/bin/tests/system/stop.sh.in @@ -9,11 +9,10 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh +builddir=@builddir@ +srcdir=@srcdir@ -if ! test -n "$PYTHON"; then - echo_i "This test requires Python." - exit 1 -fi +# shellcheck source=conf.sh +. "${builddir}/conf.sh" +$PERL "${srcdir}/stop.pl" "$@" diff --git a/bin/tests/system/stress/prereq.sh b/bin/tests/system/stress/prereq.sh deleted file mode 100644 index de147a4c2a..0000000000 --- a/bin/tests/system/stress/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/stress/tests.sh b/bin/tests/system/stress/tests.sh index 53c3d20db6..08edd332aa 100644 --- a/bin/tests/system/stress/tests.sh +++ b/bin/tests/system/stress/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/stub/setup.sh b/bin/tests/system/stub/setup.sh index def2a615ac..e683db06d9 100644 --- a/bin/tests/system/stub/setup.sh +++ b/bin/tests/system/stub/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/stub/tests.sh b/bin/tests/system/stub/tests.sh index 730cd40603..ae81f126be 100644 --- a/bin/tests/system/stub/tests.sh +++ b/bin/tests/system/stub/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp -p ${PORT}" @@ -56,7 +55,7 @@ digcomp knowngood.dig.out.rec dig.out.ns3 || ret=1 $PERL $SYSTEMTESTTOP/stop.pl stub ns3 echo_i "re-starting stub server" - $PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} stub ns3 + start --noclean --restart --port ${PORT} stub ns3 } done diff --git a/bin/tests/system/synthfromdnssec/tests.sh b/bin/tests/system/synthfromdnssec/tests.sh index 1d18d612e7..d5ea27298a 100644 --- a/bin/tests/system/synthfromdnssec/tests.sh +++ b/bin/tests/system/synthfromdnssec/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. # shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" set -e diff --git a/bin/tests/system/system-test-driver.sh b/bin/tests/system/system-test-driver.sh.in old mode 100755 new mode 100644 similarity index 87% rename from bin/tests/system/system-test-driver.sh rename to bin/tests/system/system-test-driver.sh.in index 38710a3363..6ad8380643 --- a/bin/tests/system/system-test-driver.sh +++ b/bin/tests/system/system-test-driver.sh.in @@ -2,6 +2,9 @@ # shellcheck disable=SC2181 # shellcheck disable=SC2034 +builddir=@abs_builddir@ +srcdir=@abs_srcdir@ + usage() { echo "$0 --test-name=NAME --log-file=PATH.log --trs-file=PATH.trs --color-tests={yes|no} --expect-failure={yes|no} --enable-hard-errors={yes|no}" } @@ -17,7 +20,7 @@ fi OPTS=$(getopt --shell sh --name "$(basename "$0")" --options '' --longoptions test-name:,log-file:,trs-file:,color-tests:,expect-failure:,enable-hard-errors: -- "$@") -if [ "$?" != 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi +if [ "$?" -ne 0 ] ; then echo "Failed parsing options." >&2 ; exit 1 ; fi eval set -- "$OPTS" @@ -62,6 +65,6 @@ fi echo "Running $TEST_PROGRAM" -./run.sh -p "$(($RANDOM%32000+32000))" "$@" "$TEST_PROGRAM" +"${builddir}/run.sh" -p "$("${srcdir}/get_base_port.sh")" "$@" "$TEST_PROGRAM" exit $? diff --git a/bin/tests/system/tcp/setup.sh b/bin/tests/system/tcp/setup.sh index 7db0dec680..dc9bb97edb 100644 --- a/bin/tests/system/tcp/setup.sh +++ b/bin/tests/system/tcp/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/tcp/tests.sh b/bin/tests/system/tcp/tests.sh index 7e78d634af..a659019678 100644 --- a/bin/tests/system/tcp/tests.sh +++ b/bin/tests/system/tcp/tests.sh @@ -11,7 +11,6 @@ set -e -SYSTEMTESTTOP=.. # shellcheck source=../conf.sh . "$SYSTEMTESTTOP/conf.sh" @@ -81,7 +80,7 @@ refresh_tcp_stats() { # Send a command to the tool script listening on 10.53.0.6. send_command() { nextpart ans6/ans.run > /dev/null - echo "$*" | "${PERL}" "${SYSTEMTESTTOP}/send.pl" 10.53.0.6 "${CONTROLPORT}" + echo "$*" | send 10.53.0.6 "${CONTROLPORT}" wait_for_log_peek 10 "result=" ans6/ans.run || ret=1 if ! nextpartpeek ans6/ans.run | grep -qF "result=OK"; then return 1 diff --git a/bin/tests/system/tools/tests.sh b/bin/tests/system/tools/tests.sh index 9de91de891..f49f6eeda0 100644 --- a/bin/tests/system/tools/tests.sh +++ b/bin/tests/system/tools/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/tsig/setup.sh b/bin/tests/system/tsig/setup.sh index b3e0450b4a..1629d0cb71 100644 --- a/bin/tests/system/tsig/setup.sh +++ b/bin/tests/system/tsig/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/tsig/tests.sh b/bin/tests/system/tsig/tests.sh index 3a720decfc..6664ae0a88 100644 --- a/bin/tests/system/tsig/tests.sh +++ b/bin/tests/system/tsig/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/tsiggss/prereq.sh b/bin/tests/system/tsiggss/prereq.sh index ba0ac9b565..b552ebdc8b 100644 --- a/bin/tests/system/tsiggss/prereq.sh +++ b/bin/tests/system/tsiggss/prereq.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh # enable the tsiggss test only if gssapi was enabled diff --git a/bin/tests/system/tsiggss/setup.sh b/bin/tests/system/tsiggss/setup.sh index 74d16dd0ad..f6623ccbf1 100644 --- a/bin/tests/system/tsiggss/setup.sh +++ b/bin/tests/system/tsiggss/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh diff --git a/bin/tests/system/tsiggss/tests.sh b/bin/tests/system/tsiggss/tests.sh index 7c938ef78b..8a19050c40 100644 --- a/bin/tests/system/tsiggss/tests.sh +++ b/bin/tests/system/tsiggss/tests.sh @@ -11,7 +11,6 @@ # tests for TSIG-GSS updates -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/system/unknown/ns3/sign.sh b/bin/tests/system/unknown/ns3/sign.sh index 854047aadb..709e4aad14 100644 --- a/bin/tests/system/unknown/ns3/sign.sh +++ b/bin/tests/system/unknown/ns3/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh zone=example diff --git a/bin/tests/system/unknown/setup.sh b/bin/tests/system/unknown/setup.sh index 26805de9b8..492731f935 100644 --- a/bin/tests/system/unknown/setup.sh +++ b/bin/tests/system/unknown/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/unknown/tests.sh b/bin/tests/system/unknown/tests.sh index eeb8920ffa..119b8640b8 100644 --- a/bin/tests/system/unknown/tests.sh +++ b/bin/tests/system/unknown/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 @@ -145,7 +144,7 @@ status=`expr $status + $ret` echo_i "stop and restart slave" $PERL $SYSTEMTESTTOP/stop.pl unknown ns2 -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} unknown ns2 +start --noclean --restart --port ${PORT} unknown ns2 # server may be answering queries before zones are loaded, # so retry a few times if this query fails @@ -169,7 +168,7 @@ status=`expr $status + $ret` echo_i "stop and restart inline slave" $PERL $SYSTEMTESTTOP/stop.pl unknown ns3 -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} unknown ns3 +start --noclean --restart --port ${PORT} unknown ns3 # server may be answering queries before zones are loaded, # so retry a few times if this query fails diff --git a/bin/tests/system/upforwd/prereq.sh b/bin/tests/system/upforwd/prereq.sh deleted file mode 100644 index 0e299f4db8..0000000000 --- a/bin/tests/system/upforwd/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/upforwd/setup.sh b/bin/tests/system/upforwd/setup.sh index a59b54078a..64bb7feb70 100644 --- a/bin/tests/system/upforwd/setup.sh +++ b/bin/tests/system/upforwd/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp -f ns1/example1.db ns1/example.db diff --git a/bin/tests/system/upforwd/tests.sh b/bin/tests/system/upforwd/tests.sh index 3b0d7b3998..234fe53637 100644 --- a/bin/tests/system/upforwd/tests.sh +++ b/bin/tests/system/upforwd/tests.sh @@ -13,7 +13,6 @@ # ns2 = slave with update forwarding disabled; not currently used # ns3 = slave with update forwarding enabled -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/verify/setup.sh b/bin/tests/system/verify/setup.sh index dcd2eb8f78..8feca6f49d 100644 --- a/bin/tests/system/verify/setup.sh +++ b/bin/tests/system/verify/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh (cd zones && $SHELL genzones.sh) diff --git a/bin/tests/system/verify/tests.sh b/bin/tests/system/verify/tests.sh index e8b2210100..8c852d5714 100644 --- a/bin/tests/system/verify/tests.sh +++ b/bin/tests/system/verify/tests.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh failed () { cat verify.out.$n | sed 's/^/D:/'; diff --git a/bin/tests/system/verify/zones/genzones.sh b/bin/tests/system/verify/zones/genzones.sh index 1e5dcbb9b0..250fdd1870 100644 --- a/bin/tests/system/verify/zones/genzones.sh +++ b/bin/tests/system/verify/zones/genzones.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh SYSTESTDIR=verify diff --git a/bin/tests/system/views/setup.sh b/bin/tests/system/views/setup.sh index 05d6d65dba..a2f54fb5e2 100644 --- a/bin/tests/system/views/setup.sh +++ b/bin/tests/system/views/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh cp -f ns2/example1.db ns2/example.db diff --git a/bin/tests/system/views/tests.sh b/bin/tests/system/views/tests.sh index f3ce287962..b533da7722 100644 --- a/bin/tests/system/views/tests.sh +++ b/bin/tests/system/views/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd +noauth -p ${PORT}" diff --git a/bin/tests/system/wildcard/ns1/sign.sh b/bin/tests/system/wildcard/ns1/sign.sh index 497e2759a4..e28519ca1c 100755 --- a/bin/tests/system/wildcard/ns1/sign.sh +++ b/bin/tests/system/wildcard/ns1/sign.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=../.. . $SYSTEMTESTTOP/conf.sh SYSTESTDIR=wildcard diff --git a/bin/tests/system/wildcard/setup.sh b/bin/tests/system/wildcard/setup.sh index d99aef773a..9c2a601ef8 100644 --- a/bin/tests/system/wildcard/setup.sh +++ b/bin/tests/system/wildcard/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf diff --git a/bin/tests/system/wildcard/tests.sh b/bin/tests/system/wildcard/tests.sh index 92ae193f8a..1abdd3f742 100644 --- a/bin/tests/system/wildcard/tests.sh +++ b/bin/tests/system/wildcard/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh status=0 diff --git a/bin/tests/win32/makejournal.vcxproj.filters.in b/bin/tests/system/win32/makejournal.vcxproj.filters.in similarity index 100% rename from bin/tests/win32/makejournal.vcxproj.filters.in rename to bin/tests/system/win32/makejournal.vcxproj.filters.in diff --git a/bin/tests/win32/makejournal.vcxproj.in b/bin/tests/system/win32/makejournal.vcxproj.in similarity index 100% rename from bin/tests/win32/makejournal.vcxproj.in rename to bin/tests/system/win32/makejournal.vcxproj.in diff --git a/bin/tests/win32/makejournal.vcxproj.user b/bin/tests/system/win32/makejournal.vcxproj.user similarity index 100% rename from bin/tests/win32/makejournal.vcxproj.user rename to bin/tests/system/win32/makejournal.vcxproj.user diff --git a/bin/tests/system/xfer/prereq.sh b/bin/tests/system/xfer/prereq.sh deleted file mode 100644 index 75cd53ad49..0000000000 --- a/bin/tests/system/xfer/prereq.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - if $PERL -e 'use Net::DNS; die if ($Net::DNS::VERSION >= 0.69 && $Net::DNS::VERSION <= 0.74);' 2>/dev/null - then - : - else - echo_i "Net::DNS versions 0.69 to 0.74 have bugs that cause this test to fail: please update." >&2 - exit 1 - fi -else - echo_i "This test requires the Net::DNS library." >&2 - exit 1 -fi - -if ! $PERL -e 'use Digest::HMAC;' 2>/dev/null -then - echo_i "This test requires the Digest::HMAC Perl module." >&2 - exit 1 -fi diff --git a/bin/tests/system/xfer/setup.sh b/bin/tests/system/xfer/setup.sh index ca69037336..a2661f359b 100644 --- a/bin/tests/system/xfer/setup.sh +++ b/bin/tests/system/xfer/setup.sh @@ -9,15 +9,14 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh -$SHELL ../genzone.sh 1 6 7 >ns1/slave.db -$SHELL ../genzone.sh 1 6 7 >ns1/edns-expire.db -$SHELL ../genzone.sh 2 3 >ns2/example.db -$SHELL ../genzone.sh 2 3 >ns2/tsigzone.db -$SHELL ../genzone.sh 6 3 >ns6/master.db -$SHELL ../genzone.sh 7 >ns7/master2.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 1 6 7 >ns1/slave.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 1 6 7 >ns1/edns-expire.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/example.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 3 >ns2/tsigzone.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 6 3 >ns6/master.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 7 >ns7/master2.db cp -f ns4/root.db.in ns4/root.db $PERL -e 'for ($i=0;$i<10000;$i++){ printf("x%u 0 in a 10.53.0.1\n", $i);}' >> ns4/root.db diff --git a/bin/tests/system/xfer/tests.sh b/bin/tests/system/xfer/tests.sh index c88de9e679..731d067b27 100755 --- a/bin/tests/system/xfer/tests.sh +++ b/bin/tests/system/xfer/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" @@ -249,13 +248,16 @@ fi # now we test transfers with assorted TSIG glitches DIGCMD="$DIG $DIGOPTS @10.53.0.4" -SENDCMD="$PERL ../send.pl 10.53.0.5 $EXTRAPORT1" + +sendcmd() { + send 10.53.0.5 "$EXTRAPORT1" +} echo_i "testing that incorrectly signed transfers will fail..." n=$((n+1)) echo_i "initial correctly-signed transfer should succeed ($n)" -$SENDCMD < ans5/goodaxfr +sendcmd < ans5/goodaxfr # Initially, ns4 is not authoritative for anything. # Now that ans is up and running with the right data, we make ns4 @@ -292,7 +294,8 @@ $DIGCMD nil. TXT | grep 'initial AXFR' >/dev/null || { n=$((n+1)) echo_i "unsigned transfer ($n)" -$SENDCMD < ans5/unsigned +sendcmd < ans5/unsigned +sleep 1 $RNDCCMD 10.53.0.4 retransfer nil | sed 's/^/ns4 /' | cat_i @@ -311,7 +314,7 @@ $DIGCMD nil. TXT | grep 'unsigned AXFR' >/dev/null && { n=$((n+1)) echo_i "bad keydata ($n)" -$SENDCMD < ans5/badkeydata +sendcmd < ans5/badkeydata $RNDCCMD 10.53.0.4 retransfer nil | sed 's/^/ns4 /' | cat_i @@ -330,7 +333,7 @@ $DIGCMD nil. TXT | grep 'bad keydata AXFR' >/dev/null && { n=$((n+1)) echo_i "partially-signed transfer ($n)" -$SENDCMD < ans5/partial +sendcmd < ans5/partial $RNDCCMD 10.53.0.4 retransfer nil | sed 's/^/ns4 /' | cat_i @@ -349,7 +352,7 @@ $DIGCMD nil. TXT | grep 'partially signed AXFR' >/dev/null && { n=$((n+1)) echo_i "unknown key ($n)" -$SENDCMD < ans5/unknownkey +sendcmd < ans5/unknownkey $RNDCCMD 10.53.0.4 retransfer nil | sed 's/^/ns4 /' | cat_i @@ -368,7 +371,7 @@ $DIGCMD nil. TXT | grep 'unknown key AXFR' >/dev/null && { n=$((n+1)) echo_i "incorrect key ($n)" -$SENDCMD < ans5/wrongkey +sendcmd < ans5/wrongkey $RNDCCMD 10.53.0.4 retransfer nil | sed 's/^/ns4 /' | cat_i @@ -387,7 +390,7 @@ $DIGCMD nil. TXT | grep 'incorrect key AXFR' >/dev/null && { n=$((n+1)) echo_i "bad message id ($n)" -$SENDCMD < ans5/badmessageid +sendcmd < ans5/badmessageid # Uncomment to see AXFR stream with mismatching IDs. # $DIG $DIGOPTS @10.53.0.5 -y tsig_key:LSAnCU+Z nil. AXFR +all @@ -444,7 +447,7 @@ tmp=0 $DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.1.test$n grep "status: NOERROR," dig.out.1.test$n > /dev/null || tmp=1 $PERL $SYSTEMTESTTOP/stop.pl xfer ns3 -$PERL $SYSTEMTESTTOP/start.pl --noclean --restart --port ${PORT} xfer ns3 +start --noclean --restart --port ${PORT} xfer ns3 check_mapped () { $DIG -p ${PORT} txt mapped @10.53.0.3 > dig.out.2.test$n grep "status: NOERROR," dig.out.2.test$n > /dev/null || return 1 diff --git a/bin/tests/system/xferquota/setup.sh b/bin/tests/system/xferquota/setup.sh index 6b653493f1..2cabeb7bc1 100644 --- a/bin/tests/system/xferquota/setup.sh +++ b/bin/tests/system/xferquota/setup.sh @@ -13,7 +13,6 @@ # Set up test data for zone transfer quota tests. # -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $PERL setup.pl diff --git a/bin/tests/system/xferquota/tests.sh b/bin/tests/system/xferquota/tests.sh index 919d7e2530..b5a4535077 100755 --- a/bin/tests/system/xferquota/tests.sh +++ b/bin/tests/system/xferquota/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="+tcp +noadd +nosea +nostat +noquest +nocomm +nocmd -p ${PORT}" diff --git a/bin/tests/system/zero/prereq.sh b/bin/tests/system/zero/prereq.sh deleted file mode 100644 index de147a4c2a..0000000000 --- a/bin/tests/system/zero/prereq.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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. - -SYSTEMTESTTOP=.. -. $SYSTEMTESTTOP/conf.sh - -if $PERL -e 'use Net::DNS;' 2>/dev/null -then - : -else - echo "I:This test requires the Net::DNS library." >&2 - exit 1 -fi diff --git a/bin/tests/system/zero/setup.sh b/bin/tests/system/zero/setup.sh index 83c35ea60d..7ef0b8fb6b 100644 --- a/bin/tests/system/zero/setup.sh +++ b/bin/tests/system/zero/setup.sh @@ -7,7 +7,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh copy_setports ns1/named.conf.in ns1/named.conf @@ -15,4 +14,4 @@ copy_setports ns2/named.conf.in ns2/named.conf copy_setports ns3/named.conf.in ns3/named.conf copy_setports ns4/named.conf.in ns4/named.conf -$SHELL ../genzone.sh 2 4 | sed -e 's/^$TTL 3600$/$TTL 0 ; force TTL to zero/' -e 's/86400.IN SOA/0 SOA/' > ns2/example.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 2 4 | sed -e 's/^$TTL 3600$/$TTL 0 ; force TTL to zero/' -e 's/86400.IN SOA/0 SOA/' > ns2/example.db diff --git a/bin/tests/system/zero/tests.sh b/bin/tests/system/zero/tests.sh index 681ba118db..a5e4de9c4a 100644 --- a/bin/tests/system/zero/tests.sh +++ b/bin/tests/system/zero/tests.sh @@ -10,7 +10,6 @@ # information regarding copyright ownership. #shellcheck source=conf.sh -SYSTEMTESTTOP=.. . "$SYSTEMTESTTOP/conf.sh" dig_with_opts() { diff --git a/bin/tests/system/zonechecks/setup.sh b/bin/tests/system/zonechecks/setup.sh index dcd8e4c2c8..d704d7db75 100644 --- a/bin/tests/system/zonechecks/setup.sh +++ b/bin/tests/system/zonechecks/setup.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh $SHELL clean.sh @@ -17,8 +16,8 @@ $SHELL clean.sh copy_setports ns1/named.conf.in ns1/named.conf copy_setports ns2/named.conf.in ns2/named.conf -$SHELL ../genzone.sh 1 > ns1/master.db -$SHELL ../genzone.sh 1 > ns1/duplicate.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 1 > ns1/master.db +$SHELL ${TOP_SRCDIR}/bin/tests/system/genzone.sh 1 > ns1/duplicate.db cp bigserial.db ns1/ cd ns1 touch master.db.signed diff --git a/bin/tests/system/zonechecks/tests.sh b/bin/tests/system/zonechecks/tests.sh index 92da5b4824..b8fcb08ddd 100644 --- a/bin/tests/system/zonechecks/tests.sh +++ b/bin/tests/system/zonechecks/tests.sh @@ -9,7 +9,6 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -SYSTEMTESTTOP=.. . $SYSTEMTESTTOP/conf.sh DIGOPTS="-p ${PORT}" diff --git a/bin/tools/Makefile.am b/bin/tools/Makefile.am new file mode 100644 index 0000000000..4fb47c9624 --- /dev/null +++ b/bin/tools/Makefile.am @@ -0,0 +1,54 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) + +LDADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) + +bin_PROGRAMS = \ + arpaname \ + named-rrchecker \ + mdig + +sbin_PROGRAMS = \ + named-journalprint \ + nsec3hash + +mdig_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBBIND9_CFLAGS) + +mdig_LDADD = \ + $(LDADD) \ + $(LIBBIND9_LIBS) + +if HAVE_DNSTAP +bin_PROGRAMS += \ + dnstap-read + +dnstap_read_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(DNSTAP_CFLAGS) \ + -I$(top_builddir)/lib/dns + +dnstap_read_LDADD = \ + $(LDADD) \ + $(DNSTAP_LIBS) +endif + +if HAVE_LMDB +sbin_PROGRAMS += \ + named-nzd2nzf + +named_nzd2nzf_CFLAGS = \ + $(AM_CPPFLAGS) \ + $(LMDB_CFLAGS) + +named_nzd2nzf_LDADD = \ + $(LDADD) \ + $(LMDB_LIBS) + +endif diff --git a/bin/tools/dnstap-read.c b/bin/tools/dnstap-read.c index fd38fe21a0..c14424512e 100644 --- a/bin/tools/dnstap-read.c +++ b/bin/tools/dnstap-read.c @@ -33,6 +33,7 @@ #include +#include #include #include #include @@ -48,7 +49,7 @@ #include #include -#include "lib/dns/dnstap.pb-c.h" +#include "dnstap.pb-c.h" isc_mem_t *mctx = NULL; bool memrecord = false; @@ -68,8 +69,8 @@ const char *program = "dnstap-read"; } \ } while (0) -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...); static void fatal(const char *format, ...) { diff --git a/bin/tools/mdig.c b/bin/tools/mdig.c index 65264b817e..b19afba4da 100644 --- a/bin/tools/mdig.c +++ b/bin/tools/mdig.c @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -782,8 +783,8 @@ sendqueries(isc_task_t *task, isc_event_t *event) { return; } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -893,9 +894,8 @@ help(void) { stdout); } -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) - ISC_FORMAT_PRINTF(1, 2) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...) ISC_FORMAT_PRINTF(1, 2); static void fatal(const char *format, ...) { @@ -1715,7 +1715,7 @@ dash_option(const char *option, char *next, struct query *query, bool global, */ break; case 'v': - fputs("mDiG " VERSION "\n", stderr); + fprintf(stderr, "mDiG %s\n", PACKAGE_VERSION); exit(0); break; } @@ -1811,7 +1811,7 @@ dash_option(const char *option, char *next, struct query *query, bool global, } static struct query * -clone_default_query() { +clone_default_query(void) { struct query *query; query = isc_mem_allocate(mctx, sizeof(struct query)); diff --git a/bin/tools/named-rrchecker.c b/bin/tools/named-rrchecker.c index bc564d1250..50c6639608 100644 --- a/bin/tools/named-rrchecker.c +++ b/bin/tools/named-rrchecker.c @@ -12,6 +12,7 @@ #include #include +#include #include #include #include @@ -32,8 +33,8 @@ static isc_lex_t *lex; static isc_lexspecials_t specials; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { @@ -49,8 +50,8 @@ usage(void) { exit(0); } -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...); static void fatal(const char *format, ...) { diff --git a/bin/tools/nsec3hash.c b/bin/tools/nsec3hash.c index d72e64c42b..6ad6449119 100644 --- a/bin/tools/nsec3hash.c +++ b/bin/tools/nsec3hash.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -32,8 +33,8 @@ const char *program = "nsec3hash"; -ISC_PLATFORM_NORETURN_PRE static void -fatal(const char *format, ...) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +fatal(const char *format, ...); static void fatal(const char *format, ...) { @@ -55,7 +56,7 @@ check_result(isc_result_t result, const char *message) { } static void -usage() { +usage(void) { fprintf(stderr, "Usage: %s salt algorithm iterations domain\n", program); fprintf(stderr, " %s -r algorithm flags iterations salt domain\n", diff --git a/bin/win32/BINDInstall/BINDInstallDlg.cpp b/bin/win32/BINDInstall/BINDInstallDlg.cpp index 7172de39e9..83b9c4a2a4 100644 --- a/bin/win32/BINDInstall/BINDInstallDlg.cpp +++ b/bin/win32/BINDInstall/BINDInstallDlg.cpp @@ -151,9 +151,6 @@ const FileData installFiles[] = {"krb5_64.dll", FileData::BinDir, FileData::Critical, FALSE, TRUE}, #endif #endif -#ifdef HAVE_GEOIP - {"libgeoip.dll", FileData::BinDir, FileData::Critical, FALSE, TRUE}, -#endif #ifdef WITH_IDN {"idnkit.dll", FileData::BinDir, FileData::Critical, FALSE, TRUE}, {"iconv.dll", FileData::BinDir, FileData::Critical, FALSE, TRUE}, diff --git a/bind.keys.h b/bind.keys.h deleted file mode 100644 index 4d156dac4e..0000000000 --- a/bind.keys.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef BIND_KEYS_H -#define BIND_KEYS_H 1 -#define TRUST_ANCHORS \ - "\ -# The bind.keys file is used to override the built-in DNSSEC trust anchors\n\ -# which are included as part of BIND 9. The only trust anchors it contains\n\ -# are for the DNS root zone (\".\"). Trust anchors for any other zones MUST\n\ -# be configured elsewhere; if they are configured here, they will not be\n\ -# recognized or used by named.\n\ -#\n\ -# To use the built-in root key, set \"dnssec-validation auto;\" in the\n\ -# named.conf options, or else leave \"dnssec-validation\" unset. If\n\ -# \"dnssec-validation\" is set to \"yes\", then the keys in this file are\n\ -# ignored; keys will need to be explicitly configured in named.conf for\n\ -# validation to work. \"auto\" is the default setting, unless named is\n\ -# built with \"configure --disable-auto-validation\", in which case the\n\ -# default is \"yes\".\n\ -#\n\ -# This file is NOT expected to be user-configured.\n\ -#\n\ -# Servers being set up for the first time can use the contents of this file\n\ -# as initializing keys; thereafter, the keys in the managed key database\n\ -# will be trusted and maintained automatically.\n\ -#\n\ -# These keys are current as of Mar 2019. If any key fails to initialize\n\ -# correctly, it may have expired. In that event you should replace this\n\ -# file with a current version. The latest version of bind.keys can always\n\ -# be obtained from ISC at https://www.isc.org/bind-keys.\n\ -#\n\ -# See https://data.iana.org/root-anchors/root-anchors.xml for current trust\n\ -# anchor information for the root zone.\n\ -\n\ -trust-anchors {\n\ - # This key (20326) was published in the root zone in 2017.\n\ - . initial-key 257 3 8 \"AwEAAaz/tAm8yTn4Mfeh5eyI96WSVexTBAvkMgJzkKTOiW1vkIbzxeF3\n\ - +/4RgWOq7HrxRixHlFlExOLAJr5emLvN7SWXgnLh4+B5xQlNVz8Og8kv\n\ - ArMtNROxVQuCaSnIDdD5LKyWbRd2n9WGe2R8PzgCmr3EgVLrjyBxWezF\n\ - 0jLHwVN8efS3rCj/EWgvIWgb9tarpVUDK/b58Da+sqqls3eNbuv7pr+e\n\ - oZG+SrDK6nWeL3c6H5Apxz7LjVc1uTIdsIXxuOLYA4/ilBmSVIzuDWfd\n\ - RUfhHdY6+cn8HFRm+2hM8AnXGXws9555KrUB5qihylGa8subX2Nn6UwN\n\ - R1AkUTV74bU=\";\n\ -};\n\ -" -#endif /* BIND_KEYS_H */ diff --git a/config.h.win32 b/config.h.win32 index d3f3d210b8..4f3dc96d30 100644 --- a/config.h.win32 +++ b/config.h.win32 @@ -57,6 +57,9 @@ #if NTDDI_VERSION < 0x06020000 #error Minimum Target environment is Windows 8 and Windows Server 2012 #endif +#if _MSC_VER <= 1910 +#error Minimum Visual Studio version is 2017 or higher +#endif /* Define if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -113,13 +116,6 @@ char *getpassphrase(const char *); -/* - * Define to 1 if you want to use the DLZ "dlopen" driver - * (which has the same name on windows even though it uses - * LoadLibrary() instead of dlopen()). - */ -#define ISC_DLZ_DLOPEN 1 - #define S_IFMT _S_IFMT /* file type mask */ #define S_IFDIR _S_IFDIR /* directory */ #define S_IFCHR _S_IFCHR /* character special */ @@ -258,7 +254,7 @@ typedef __int64 off_t; /* * Configure sensible arguments */ -@CONFIGARGS@ +@PACKAGE_CONFIGARGS@ /* * Define if libxml2 is present diff --git a/configure.ac b/configure.ac index 2526738c98..592f40f169 100644 --- a/configure.ac +++ b/configure.ac @@ -7,23 +7,93 @@ # See the COPYRIGHT file distributed with this work for additional # information regarding copyright ownership. -AC_INIT(BIND, [9.17], [info@isc.org], [], [https://www.isc.org/downloads/]) -AC_PREREQ([2.60]) +# +# Defining the version in m4 requires a bit of dancing around, +# so the strings are properly concatenated, as you can't use +# a shell variable in AC_INIT() +# +m4_define([bind_VERSION_MAJOR], 9)dnl +m4_define([bind_VERSION_MINOR], 17)dnl +m4_define([bind_VERSION_PATCH], 1)dnl +m4_define([bind_VERSION_EXTRA], -dev)dnl +m4_define([bind_DESCRIPTION], [(Development Release)])dnl +m4_define([bind_SRCID], [m4_esyscmd_s([if test -f srcid; then cat srcid; else git rev-parse --short HEAD 2>/dev/null; fi])])dnl +m4_define([bind_PKG_VERSION], [[bind_VERSION_MAJOR.bind_VERSION_MINOR.bind_VERSION_PATCH]bind_VERSION_EXTRA])dnl + +# +# Autoconf initialization +# +AC_INIT([BIND], bind_PKG_VERSION, [info@isc.org], [], [https://www.isc.org/downloads/]) +AC_PREREQ(2.60) + +AC_DEFINE([PACKAGE_VERSION_MAJOR], ["][bind_VERSION_MAJOR]["], [BIND 9 Major part of the version]) +AC_DEFINE([PACKAGE_VERSION_MINOR], ["][bind_VERSION_MINOR]["], [BIND 9 Minor part of the version]) +AC_DEFINE([PACKAGE_VERSION_PATCH], ["][bind_VERSION_PATCH]["], [BIND 9 Patch part of the version]) +AC_DEFINE([PACKAGE_VERSION_EXTRA], ["][bind_VERSION_EXTRA]["], [BIND 9 Extra part of the version]) +AC_DEFINE([PACKAGE_DESCRIPTION], [m4_ifnblank(bind_DESCRIPTION, [" ]bind_DESCRIPTION["], [])], [An extra string to print after PACKAGE_STRING]) +AC_DEFINE([PACKAGE_SRCID], ["][bind_SRCID]["], [A short hash from git]) + +# This value should be increased whenever changing the structure of +# any object that will appear in a type 'map' master file (which +# contains a working memory image of an RBT database), as loading +# an incorrect memory image produces an inconsistent and probably +# nonfunctional database. These structures include but are not +# necessarily limited to dns_masterrawheader, rbtdb_file_header, +# rbt_file_header, dns_rbtdb, dns_rbt, dns_rbtnode, rdatasetheader. +# +# Err on the side of caution: if anything in the RBTDB is changed, +# bump the value. Making map files unreadable protects the system +# from instability; it's a feature not a bug. +# +# Whenever releasing a new major release of BIND9, set this value +# back to 1.0 when releasing the first alpha. Map files are *never* +# compatible across major releases. +AC_DEFINE([MAPAPI], ["2.0"], [BIND 9 MAPAPI Version]) + +bind_CONFIGARGS="${ac_configure_args:-default}" +AC_DEFINE_UNQUOTED([PACKAGE_CONFIGARGS], ["$bind_CONFIGARGS"], [Either 'defaults' or used ./configure options]) + +AC_DEFINE([PACKAGE_BUILDER], ["make"], [make or Visual Studio]) + +AC_CONFIG_SRCDIR([bin/named/main.c]) +AM_INIT_AUTOMAKE([foreign subdir-objects dist-xz -Wall -Werror]) +AM_SILENT_RULES([yes]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) # # Enable maintainer mode by default, but allow to disable it in the CI # AM_MAINTAINER_MODE([enable]) -AC_CONFIG_HEADER(config.h) -AC_CONFIG_MACRO_DIR([m4]) +# Set the library versions +# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html -AC_CANONICAL_HOST +AX_BIND9_LIB_VERSION([bind9]) +AX_BIND9_LIB_VERSION([dns]) +AX_BIND9_LIB_VERSION([irs]) +AX_BIND9_LIB_VERSION([isc]) +AX_BIND9_LIB_VERSION([isccc]) +AX_BIND9_LIB_VERSION([isccfg]) +AX_BIND9_LIB_VERSION([ns]) # # Enable system extensions to C and POSIX # AC_USE_SYSTEM_EXTENSIONS +AC_CANONICAL_HOST + +# +# Compiler compatibility flags +# +AC_PROG_CC_C99 +AC_PROG_CPP_WERROR + +# +# Find the machine's endian flavor. +# +AC_C_BIGENDIAN # # Enable large file support @@ -31,19 +101,14 @@ AC_USE_SYSTEM_EXTENSIONS AC_SYS_LARGEFILE AC_FUNC_FSEEKO -LFS_CFLAGS=`getconf LFS_CFLAGS 2>/dev/null` -LFS_LDFLAGS=`getconf LFS_LDFLAGS 2>/dev/null` -LFS_LIBS=`getconf LFS_LIBS 2>/dev/null` - -AC_SUBST([LFS_CFLAGS]) -AC_SUBST([LFS_LDFLAGS]) -AC_SUBST([LFS_LIBS]) - # Enable RFC 3542 APIs on macOS AC_DEFINE([__APPLE_USE_RFC_3542], [1], [Select RFC3542 IPv6 API on macOS]) AC_PROG_MAKE_SET +# Checks for programs. +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) # call AM_PROG_AR only if available + AC_PROG_LIBTOOL AS_IF([test -z "$LIBTOOL"], [AC_MSG_ERROR([The libtool script could not be found.])]) @@ -51,11 +116,57 @@ AC_PROG_INSTALL AC_PROG_LN_S AX_POSIX_SHELL -AC_SUBST(STD_CINCLUDES) -AC_SUBST(STD_CDEFINES) -AC_SUBST(STD_CWARNINGS) -AC_SUBST(CCOPT) -AC_SUBST(CCNOOPT) +# Initialize libtool +LT_INIT([dlopen]) + +LT_CONFIG_LTDL_DIR([libltdl]) +LTDL_INIT([recursive]) +AC_CONFIG_FILES([libltdl/Makefile]) + +# +# Set the default CFLAGS and CPPFLAGS +# +STD_CFLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wpointer-arith -Wno-missing-field-initializers -Wformat -Wshadow" + +# These should be always errors +STD_CFLAGS="$STD_CFLAGS -Werror=implicit-function-declaration -Werror=missing-prototypes -Werror=format-security -Werror=parentheses -Werror=implicit -Werror=strict-prototypes" + +# Fortify the sources by default +STD_CPPFLAGS="-D_FORTIFY_SOURCE=2" + +# +# Additional compiler settings. +# +AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], + [STD_CFLAGS="$STD_CFLAGS -fno-strict-aliasing"]) +AX_CHECK_COMPILE_FLAG([-fno-delete-null-pointer-checks], + [STD_CFLAGS="$STD_CFLAGS -fno-delete-null-pointer-checks"]) +AX_CHECK_COMPILE_FLAG([-fdiagnostics-show-option], + [STD_CFLAGS="$STD_CFLAGS -fdiagnostics-show-option"]) + +AC_ARG_ENABLE([warn_error], + [AS_HELP_STRING([--enable-warn-error], + [turn on -Werror when compiling])], + [],[enable_warn_error=no]) +AS_IF([test "$enable_warn_error" = "yes"], + [STD_CFLAGS="$STD_CFLAGS -Werror"]) + +AC_ARG_ENABLE([developer], + [AS_HELP_STRING([--enable-developer], + [enable developer build settings])]) + +AS_IF([test "$enable_developer" = "yes"], + [STD_CPPFLAGS="$STD_CPPFLAGS -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1" + test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes + test "${enable_querytrace+set}" = set || enable_querytrace=yes + test "${with_cmocka+set}" = set || with_cmocka=yes + test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes + test "${with_zlib+set}" = set || with_zlib=yes + test "${enable_warn_error+set}" = set || enable_warn_error=yes + ]) + +AC_SUBST([STD_CFLAGS]) +AC_SUBST([STD_CPPFLAGS]) # # Use pkg-config @@ -76,32 +187,6 @@ AC_ARG_ENABLE(buffer_useinline, fi, AC_DEFINE([ISC_BUFFER_USEINLINE], [1])) -AC_ARG_ENABLE([warn_shadow], - [AS_HELP_STRING([--enable-warn-shadow], - [turn on -Wshadow when compiling])]) - -AC_ARG_ENABLE([warn_error], - [AS_HELP_STRING([--enable-warn-error], - [turn on -Werror when compiling])]) - -AC_ARG_ENABLE([developer], - [AS_HELP_STRING([--enable-developer], - [enable developer build settings])]) - -XTARGETS= -AS_IF([test "$enable_developer" = "yes"], - [STD_CDEFINES="$STD_CDEFINES -DISC_MEM_DEFAULTFILL=1 -DISC_LIST_CHECKINIT=1" - test "${enable_fixed_rrset+set}" = set || enable_fixed_rrset=yes - test "${enable_querytrace+set}" = set || enable_querytrace=yes - test "${with_cmocka+set}" = set || with_cmocka=yes - test "${with_dlz_filesystem+set}" = set || with_dlz_filesystem=yes - test "${enable_warn_error+set}" = set || enable_warn_error=yes - test "${enable_warn_shadow+set}" = set || enable_warn_shadow=yes - test "${with_zlib+set}" = set || with_zlib=yes - XTARGETS='${XTARGETS}' - ]) -AC_SUBST([XTARGETS]) - AC_ARG_ENABLE([fuzzing], [AS_HELP_STRING([--enable-fuzzing=], [Enable fuzzing using American Fuzzy Lop or libFuzzer (default=no)])], @@ -155,119 +240,48 @@ no) ;; esac -# -# Make very sure that these are the first files processed by -# config.status, since we use the processed output as the input for -# AC_SUBST_FILE() substitutions in other files. -# -AC_CONFIG_FILES([make/rules make/includes]) - -AC_PATH_PROG(AR, ar) -ARFLAGS="cruv" -AC_SUBST(AR) -AC_SUBST(ARFLAGS) - -# The POSIX ln(1) program. Non-POSIX systems may substitute -# "copy" or something. -LN=ln -AC_SUBST(LN) - -case "$AR" in - "") - AC_MSG_ERROR([ -ar program not found. Please fix your PATH to include the directory in -which ar resides, or set AR in the environment with the full path to ar. -]) - - ;; -esac - # # Perl is optional; it is used only by some of the system test scripts. # Note: the backtrace feature (see below) uses perl to build the symbol table, # but it still compiles without perl, in which case an empty table will be used. # -AC_PATH_PROGS(PERL, perl5 perl) -AC_SUBST(PERL) +AC_PATH_PROGS([PERL], [perl5 perl]) +AC_SUBST([PERL]) +AM_CONDITIONAL([HAVE_PERL], [test -n "$PERL"]) + +AX_PERL_MODULE([Digest::HMAC]) +AM_CONDITIONAL([HAVE_PERLMOD_DIGEST_HMAC], + [test "$HAVE_PERLMOD_DIGEST__HMAC" = "yes"]) + +AX_PERL_MODULE([File::Fetch]) +AM_CONDITIONAL([HAVE_PERLMOD_FILE_FETCH], + [test "$HAVE_PERLMOD_FILE__FETCH" = "yes"]) + +AX_PERL_MODULE([Net::DNS]) +AM_CONDITIONAL([HAVE_PERLMOD_NET_DNS], + [test "$HAVE_PERLMOD_NET__DNS" = "yes"]) + +AX_PERL_MODULE([Net::DNS::Nameserver]) +AM_CONDITIONAL([HAVE_PERLMOD_NET_DNS_NAMESERVER], + [test "$HAVE_PERLMOD_NET__DNS__NAMESERVER" = "yes"]) + +AX_PERL_MODULE([Time::HiRes]) +AM_CONDITIONAL([HAVE_PERLMOD_TIME_HIRES], + [test "$HAVE_PERLMOD_TIME__HIRES" = "yes"]) # -# Python 3 is optional; it is used by the system test scripts. +# Python is optional, it is used only by some of the system test scripts. # -testminvers='import sys -if (sys.version_info < (3,5)): - exit(1)' +AM_PATH_PYTHON([3.4], [], [:]) +AM_CONDITIONAL([HAVE_PYTHON], [test "$PYTHON" != ":"]) -default_with_python="python python3 python3.8 python3.7 python3.6 python3.5" - -AC_ARG_VAR([PYTHON], [path to python executable]) - -AC_ARG_WITH([python], - AS_HELP_STRING([--with-python=PATH], - [specify path to Python 3 interpreter]), - [], [with_python=$default_with_python]) - -AS_IF([test "$with_python" = "yes"], - [with_python=$default_with_python]) - -AS_IF([test "$with_python" = "no"], - [AC_MSG_CHECKING([for Python support]) - unset PYTHON - AC_MSG_RESULT([disabled])], - [for p in $with_python - do - AS_CASE([$p], - [/*],[PYTHON="$p"]) - - AC_PATH_PROG([PYTHON], [$p]) - # Do not cache the result of the check from the previous line. If the - # first found Python interpreter has missing module dependencies and - # the result of the above check is cached, subsequent module checks - # will erroneously keep on using the cached path to the first found - # Python interpreter instead of different ones. - unset ac_cv_path_PYTHON - - AS_IF([test -z "$PYTHON"], [continue]) - - AC_MSG_CHECKING([if $PYTHON is Python version >= 3.5]) - AS_IF(["$PYTHON" -c "$testminvers" 2>/dev/null], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - unset PYTHON - continue]) - - # Stop looking any further once we find a Python 3 interpreter - # satisfying all requirements. - break - done]) +AX_PYTHON_MODULE([dns]) +AM_CONDITIONAL([HAVE_PYMOD_DNS], [test "$HAVE_PYMOD_DNS" = "yes"]) # -# Make sure INSTALL uses an absolute path, else it will be wrong in all -# Makefiles, since they use make/rules.in and INSTALL will be adjusted by -# configure based on the location of the file where it is substituted. -# Since in BIND9 INSTALL is only substituted into make/rules.in, an immediate -# subdirectory of install-sh, This relative path will be wrong for all -# directories more than one level down from install-sh. +# xsltproc is optional, it is used only by system test scripts. # -case "$INSTALL" in - /*) - ;; - *) - # - # Not all systems have dirname. - # - changequote({, }) - ac_dir="`echo $INSTALL | sed 's%/[^/]*$%%'`" - changequote([, ]) - - ac_prog="`echo $INSTALL | sed 's%.*/%%'`" - test "X$ac_dir" = "X$ac_prog" && ac_dir=. - test -d "$ac_dir" && ac_dir="`(cd \"$ac_dir\" && pwd)`" - INSTALL="$ac_dir/$ac_prog" - ;; -esac - -AC_PROG_CC -AC_PROG_CC_C99 +AC_PATH_PROG([XSLTPROC], [xsltproc]) # # Using Solaris linker with gcc on Solaris breaks Thread Local Storage @@ -280,63 +294,25 @@ AS_CASE([$host], ]) ]) -# -# CCNOOPT defaults to -O0 on gcc and disables optimization when is last -# -if test "X$CCNOOPT" = "X" -a "X$GCC" = "Xyes"; then - CCNOOPT="-O0" -fi - AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h sys/socket.h net/route.h linux/netlink.h linux/rtnetlink.h,,, -[$ac_includes_default -#ifdef HAVE_SYS_PARAM_H -# include -#endif -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -]) +AC_CHECK_HEADERS([fcntl.h regex.h sys/time.h unistd.h sys/mman.h sys/sockio.h sys/select.h sys/param.h sys/sysctl.h net/if6.h sys/socket.h net/route.h linux/netlink.h linux/rtnetlink.h], [], [], + [$ac_includes_default + #ifdef HAVE_SYS_PARAM_H + # include + #endif + #ifdef HAVE_SYS_SOCKET_H + # include + #endif + ]) # # Check for thread local storage # -AC_CHECK_HEADERS([threads.h], - [ - AC_MSG_CHECKING([for C11 Thread-Local Storage using thread_local]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [ - #include - ],[ - static thread_local int tls = 0; - return (tls); - ]) - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE_THREAD_LOCAL],[1],[Define if thread_local keyword is available]) - AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available]) - ],[ - AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9]) - ]) - ],[ - AC_MSG_CHECKING([for Thread-Local Storage using __thread]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [ - ],[ - static __thread int tls = 0; - return (tls); - ]) - ],[ - AC_MSG_RESULT([yes]) - AC_DEFINE([HAVE___THREAD],[1],[Define if __thread keyword is available]) - AC_DEFINE([HAVE_TLS],[1],[Define if Thread-Local Storage is available]) - ],[ - AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9]) - ]) - ]) +AC_CHECK_HEADERS([threads.h]) +AX_TLS([AS_IF([test "$ac_cv_tls" != "thread_local"], + [AC_DEFINE_UNQUOTED([thread_local], [$ac_cv_tls], [Define if the compiler uses a different keyword than thread_local for TLS variables])])], + [AC_MSG_ERROR([Thread Local Storage support required, update your toolchain to build BIND 9])]) AC_C_CONST AC_C_INLINE @@ -381,8 +357,8 @@ AC_CHECK_FUNCS(mmap) # # Older versions of HP/UX don't define seteuid() and setegid() # -AC_CHECK_FUNCS(seteuid setresuid) -AC_CHECK_FUNCS(setegid setresgid) +AC_CHECK_FUNCS([seteuid setresuid]) +AC_CHECK_FUNCS([setegid setresgid]) AC_TYPE_SIZE_T AC_TYPE_SSIZE_T @@ -415,16 +391,7 @@ AC_COMPILE_IFELSE( # # check for GCC noreturn attribute # -AC_MSG_CHECKING(for GCC noreturn attribute) -AC_TRY_COMPILE([],[void foo() __attribute__((noreturn));], - [AC_MSG_RESULT(yes) - ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE" - ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST __attribute__((noreturn))"], - [AC_MSG_RESULT(no) - ISC_PLATFORM_NORETURN_PRE="#define ISC_PLATFORM_NORETURN_PRE" - ISC_PLATFORM_NORETURN_POST="#define ISC_PLATFORM_NORETURN_POST"]) -AC_SUBST(ISC_PLATFORM_NORETURN_PRE) -AC_SUBST(ISC_PLATFORM_NORETURN_POST) +AX_GCC_FUNC_ATTRIBUTE([noreturn]) # # check if we have kqueue @@ -459,22 +426,11 @@ AC_ARG_ENABLE([devpoll], AS_IF([test "$enable_devpoll" = "yes"], [AC_CHECK_HEADERS([sys/devpoll.h devpoll.h])]) -# -# Find the machine's endian flavor. -# -AC_C_BIGENDIAN - # # GeoIP support? # # Should be on by default if libmaxminddb exists. # -AC_ARG_WITH([geoip2], - [AS_HELP_STRING([--with-geoip2], - [deprecated, use --with-maxminddb])], - [AC_MSG_WARN([--with-geoip2 is DEPRECATED and will be removed in a future release, use --with-maxminddb instead])], - [with_geoip2="auto"]) - AC_ARG_ENABLE([geoip], [AS_HELP_STRING([--disable-geoip], [support GeoIP2 geolocation ACLs if available [default=yes]])], @@ -483,35 +439,27 @@ AC_ARG_ENABLE([geoip], AC_ARG_WITH([maxminddb], [AS_HELP_STRING([--with-maxminddb=PATH], [Build with MaxMind GeoIP2 support (auto|yes|no|path) [default=auto]])], - [], [with_maxminddb="$with_geoip2"]) + [], [with_maxminddb="auto"]) -GEOIP2LINKSRCS= -GEOIP2LINKOBJS= AS_IF([test "$enable_geoip" = "yes"], [AS_CASE([$with_maxminddb], [no],[AC_MSG_ERROR([Use '--disable-geoip' to disable the GeoIP])], [auto],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb], [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])]) - GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' - GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' ],[:])], [yes],[PKG_CHECK_MODULES([MAXMINDDB], [libmaxminddb], [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) PKG_CHECK_VAR([MAXMINDDB_PREFIX], [libmaxminddb], [prefix], [], [AC_MSG_ERROR([libmaxminddb prefix not found in pkg-config; set MAXMINDDB_PREFIX in the environment])]) - GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' - GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' ])], [ # default AX_SAVE_FLAGS([maxminddb]) MAXMINDDB_CFLAGS="-I$with_maxminddb/include" MAXMINDDB_LIBS="-L$with_maxminddb/lib" CFLAGS="$CFLAGS $MAXMINDDB_CFLAGS" - LDFLAGS="$LDFLAGS $MAXMINDDB_LIBS" + LIBS="$LIBS $MAXMINDDB_LIBS" AC_SEARCH_LIBS([MMDB_open], [maxminddb], [AC_DEFINE([HAVE_GEOIP2], [1], [Build with GeoIP2 support]) - GEOIP2LINKSRCS='${GEOIP2LINKSRCS}' - GEOIP2LINKOBJS='${GEOIP2LINKOBJS}' MAXMINDDB_LIBS="$MAXMINDDB_LIBS $ac_cv_search_mmdb_open" AC_MSG_NOTICE([GeoIP2 default database path set to $with_maxminddb/share/GeoIP]) AS_VAR_COPY([MAXMINDDB_PREFIX], [$with_maxminddb]) @@ -522,15 +470,10 @@ AS_IF([test "$enable_geoip" = "yes"], AC_ARG_VAR([MAXMINDDB_PREFIX], [value of prefix for MAXMINDDB, overriding pkg-config]) ]) +AM_CONDITIONAL([HAVE_GEOIP2], [test -n "$MAXMINDDB_LIBS"]) + AC_SUBST([MAXMINDDB_CFLAGS]) AC_SUBST([MAXMINDDB_LIBS]) -AC_SUBST([GEOIP2LINKSRCS]) -AC_SUBST([GEOIP2LINKOBJS]) - -# -# Do we have arc4random(), etc ? -# -AC_CHECK_FUNCS(arc4random arc4random_buf arc4random_uniform getrandom) AX_PTHREAD @@ -584,7 +527,7 @@ AC_CHECK_FUNCS([pthread_setname_np pthread_set_name_np]) AC_CHECK_HEADERS([pthread_np.h], [], [], [#include ]) # libuv -AC_MSG_CHECKING(for libuv) +AC_MSG_CHECKING([for libuv]) PKG_CHECK_MODULES([LIBUV], [libuv >= 1.0.0], [], [AC_MSG_ERROR([libuv not found])]) AX_SAVE_FLAGS([libuv]) @@ -595,6 +538,7 @@ LIBS="$LIBS $LIBUV_LIBS" # Those functions are only provided in newer versions of libuv, we'll be emulating them # for now AC_CHECK_FUNCS([uv_handle_get_data uv_handle_set_data uv_import]) +AX_RESTORE_FLAGS([libuv]) # # flockfile is usually provided by pthreads @@ -606,8 +550,6 @@ AC_CHECK_FUNCS([flockfile getc_unlocked]) # AC_CHECK_FUNCS([sysconf]) -AC_SUBST(ALWAYS_DEFINES) - # # Do we want to use pthread rwlock? # @@ -751,12 +693,10 @@ AX_RESTORE_FLAGS([openssl]) AC_SUBST([OPENSSL_CFLAGS]) AC_SUBST([OPENSSL_LIBS]) -PKCS11_TOOLS= -PKCS11_TEST= # # was --enable-native-pkcs11 specified? # -AC_ARG_ENABLE(native-pkcs11, +AC_ARG_ENABLE([native-pkcs11], AS_HELP_STRING([--enable-native-pkcs11], [use native PKCS11 for public-key crypto [default=no]]), [:], [enable_native_pkcs11="no"]) @@ -764,26 +704,17 @@ AC_ARG_ENABLE(native-pkcs11, AC_MSG_CHECKING([for PKCS11 for Public-Key Cryptography]) AS_CASE([$enable_native_pkcs11], [no],[AC_MSG_RESULT([no])], - [yes],[PKCS11_TOOLS=pkcs11 - PKCS11_TEST=pkcs11 - CRYPTO=pkcs11 - AS_IF([$use_threads], - [:], - [AC_MSG_ERROR([PKCS11 requires threading support])]) + [yes],[CRYPTO=pkcs11 AC_MSG_RESULT([yes]) AC_CHECK_FUNCS([getpassphrase]) ]) -AC_SUBST([PKCS11_TEST]) -AC_SUBST([PKCS11_TOOLS]) +AM_CONDITIONAL([HAVE_PKCS11], [test "$CRYPTO" = "pkcs11"]) AC_SUBST([CRYPTO]) AS_CASE([$CRYPTO], [pkcs11],[AC_DEFINE([USE_PKCS11], [1], [define if PKCS11 is used for Public-Key Cryptography])], [AC_DEFINE([USE_OPENSSL], [1], [define if OpenSSL is used for Public-Key Cryptography])]) -# preparation for automake -# AM_CONDITIONAL([PKCS11_TOOLS], [test "$with_native_pkcs11" = "yes"]) - # # was --with-pkcs11 specified? # @@ -797,301 +728,69 @@ AS_CASE([$with_pkcs11], [no|undefined],[with_pkcs11="undefined"]) AC_DEFINE_UNQUOTED([PK11_LIB_LOCATION], ["$with_pkcs11"], [define the default PKCS11 library path]) -# for PKCS11 benchmarks +AC_CHECK_FUNCS([clock_gettime]) -have_clock_gt=no -AC_CHECK_FUNC(clock_gettime,have_clock_gt=yes,) -if test "no" = "$have_clock_gt"; then - AC_CHECK_LIB(rt,clock_gettime,have_clock_gt=rt,) -fi - -if test "no" != "$have_clock_gt"; then - AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Define if clock_gettime is available.]) -fi - -if test "rt" = "$have_clock_gt"; then - LIBS="-lrt $LIBS" -fi - -AC_MSG_CHECKING(for GSSAPI library) -AC_ARG_WITH(gssapi, - AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]], +AC_ARG_WITH([gssapi], + [AS_HELP_STRING([--with-gssapi=[PATH|[/path/]krb5-config]], [Specify path for system-supplied GSSAPI - [default=auto]]), - use_gssapi="$withval", use_gssapi="auto") + [default=auto]])], + [], [with_gssapi="auto"]) -# first try using krb5-config, if that does not work then fall back to "yes" method. +KRB5_CONFIG= +AS_CASE([$with_gssapi], + [no],[AC_MSG_CHECKING([for GSSAPI support]) + AC_MSG_RESULT([no])], + [yes],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config]) + AS_IF([test -z "$KRB5_CONFIG"], + [AC_MSG_ERROR([krb5-config required but not found])])], + [auto],[AC_PATH_PROG([KRB5_CONFIG], [krb5-config])], + [*krb5-config*],[KRB5_CONFIG="$with_gssapi"], + [AC_MSG_ERROR([--with-gssapi requires yes|no|auto|/path/to/krb5-config])]) -case "$use_gssapi" in -*/krb5-config|krb5-config) - AC_MSG_RESULT(trying $use_gssapi) - if test krb5-config = "$use_gssapi" - then - AC_PATH_PROG(KRB5_CONFIG, $use_gssapi) - else - KRB5_CONFIG="$use_gssapi" - fi - gssapi_cflags=`$KRB5_CONFIG --cflags gssapi` - gssapi_libs=`$KRB5_CONFIG --libs gssapi` - saved_cppflags="$CPPFLAGS" - CPPFLAGS="$gssapi_cflags $CPPFLAGS" - AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h, - [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>"]) - if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then - AC_MSG_RESULT([krb5-config: gssapi.h not found]) - CPPFLAGS="$saved_cppflags" - use_gssapi="yes" - else - AC_CHECK_HEADERS(krb5/krb5.h krb5.h, - [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>"]) - if test "" = "$ISC_PLATFORM_KRB5HEADER"; then - AC_MSG_RESULT([krb5-config: krb5.h not found]) - CPPFLAGS="$saved_cppflags" - use_gssapi="yes" - else - CPPFLAGS="$saved_cppflags" - saved_libs="$LIBS" - LIBS=$gssapi_libs - AC_MSG_CHECKING([krb5-config linking as $LIBS]) - AC_TRY_LINK( , [gss_acquire_cred();krb5_init_context()], - gssapi_linked=yes, gssapi_linked=no) - case $gssapi_linked in - yes) AC_MSG_RESULT([krb5-config: linked]);; - no) AC_MSG_RESULT([krb5-config: could not determine proper GSSAPI linkage]) - use_gssapi="yes" - ;; - esac - LIBS=$saved_libs - fi - fi - if test "yes" = "$use_gssapi"; then - AC_MSG_CHECKING([for GSSAPI library, non krb5-config method]) - fi - ;; -esac +GSSAPI_CFLAGS= +GSSAPI_LIBS= +KRB5_CFLAGS= +KRB5_LIBS= +AS_IF([test -n "$KRB5_CONFIG"], + [AC_MSG_CHECKING([for gssapi libraries]) + AX_SAVE_FLAGS([gssapi]) + GSSAPI_CFLAGS=`"$KRB5_CONFIG" --cflags gssapi` + GSSAPI_LIBS=`"$KRB5_CONFIG" --libs gssapi` + CFLAGS="$CFLAGS $GSSAPI_CFLAGS" + LIBS="$LIBS $GSSAPI_LIBS" + AC_MSG_RESULT([$GSSAPI_CFLAGS $GSSAPI_LIBS]) + AC_CHECK_HEADERS([gssapi/gssapi.h], [], + [AC_CHECK_HEADERS([gssapi.h], [], + [AC_MSG_ERROR([neither gssapi/gssapi.h nor gssapi.h found])])]) + AC_CHECK_HEADERS([gssapi/gssapi_krb5.h], + [AC_CHECK_HEADERS([gssapi_krb5.h], [] + [AC_MSG_ERROR([neither gssapi/gssapi_krb5.h nor gssapi_krb5.h found])])]) + AC_CHECK_FUNCS([gss_acquire_cred],[], + [AC_MSG_ERROR([linking with $GSSAPI_LIBS does not work])]) + AX_RESTORE_FLAGS([gssapi]) -case "$host" in -*darwin*) - if test "yes" = "$use_gssapi" -o "auto" = "$use_gssapi" - then - use_gssapi=framework - fi - ;; -esac + AC_MSG_CHECKING([for krb5 libraries]) + AX_SAVE_FLAGS([krb5]) + KRB5_CFLAGS=`"$KRB5_CONFIG" --cflags krb5` + KRB5_LIBS=`$KRB5_CONFIG --libs krb5` + CFLAGS="$CFLAGS $KRB5_CFLAGS" + LIBS="$CFLAGS $KRB5_LIBS" + AC_MSG_RESULT([$KRB5_CFLAGS $KRB5_LIBS]) + AC_CHECK_HEADERS([krb5/krb5.h], [], + [AC_CHECK_HEADERS([krb5.h], [], + [AC_MSG_ERROR([neither krb5/krb5.h nor krb5 found])])]) + AC_CHECK_FUNCS([krb5_init_context], [], + [AC_MSG_ERROR([linking with $KRB5_LIBS failed])]) + AX_RESTORE_FLAGS([krb5]) -# gssapi is just the framework, we really require kerberos v5, so -# look for those headers (the gssapi headers must be there, too) -# The problem with this implementation is that it doesn't allow -# for the specification of gssapi and krb5 headers in different locations, -# which probably ought to be fixed although fixing might raise the issue of -# trying to build with incompatible versions of gssapi and krb5. -if test "yes" = "$use_gssapi" -o "auto" = "$use_gssapi" -then - # first, deal with the obvious - if test \( -f /usr/include/kerberosv5/krb5.h -o \ - -f /usr/include/krb5/krb5.h -o \ - -f /usr/include/krb5.h \) -a \ - \( -f /usr/include/gssapi.h -o \ - -f /usr/include/gssapi/gssapi.h \) - then - use_gssapi=/usr - else - krb5dirs="/usr/local /usr/local/krb5 /usr/local/kerberosv5 /usr/local/kerberos /usr/pkg /usr/krb5 /usr/kerberosv5 /usr/kerberos /usr" - for d in $krb5dirs - do - if test -f $d/include/gssapi/gssapi_krb5.h -o \ - -f $d/include/krb5.h - then - if test -f $d/include/gssapi/gssapi.h -o \ - -f $d/include/gssapi.h - then - use_gssapi=$d - break - fi - fi - done - if test "auto" = "$use_gssapi" - then - use_gssapi="no" - fi - fi -fi - -case "$use_gssapi" in - no) - AC_MSG_RESULT(disabled) - USE_GSSAPI='' - ;; - yes) - AC_MSG_ERROR([--with-gssapi must specify a path]) - ;; - */krb5-config|krb5-config) - USE_GSSAPI='-DGSSAPI' - DST_GSSAPI_INC="$gssapi_cflags" - DNS_GSSAPI_LIBS="$gssapi_libs" - ;; - framework) - USE_GSSAPI='-DGSSAPI' - ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER " - ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER " - DNS_GSSAPI_LIBS="-framework Kerberos" - AC_MSG_RESULT(framework) - ;; - - *) - AC_MSG_RESULT(looking in $use_gssapi/lib) - USE_GSSAPI='-DGSSAPI' - saved_cppflags="$CPPFLAGS" - CPPFLAGS="-I$use_gssapi/include $CPPFLAGS" - AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h, - [ISC_PLATFORM_GSSAPIHEADER="#define ISC_PLATFORM_GSSAPIHEADER <$ac_header>" - gssapi_hack="#include <$ac_header>"]) - - if test "" = "$ISC_PLATFORM_GSSAPIHEADER"; then - AC_MSG_ERROR([gssapi.h not found]) - fi - - AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h, - [ISC_PLATFORM_GSSAPI_KRB5_HEADER="#define ISC_PLATFORM_GSSAPI_KRB5_HEADER <$ac_header>" - gssapi_krb5_hack="#include <$ac_header>"]) - - AC_CHECK_HEADERS(krb5.h krb5/krb5.h kerberosv5/krb5.h, - [ISC_PLATFORM_KRB5HEADER="#define ISC_PLATFORM_KRB5HEADER <$ac_header>" - krb5_hack="#include <$ac_header>"]) - - if test "" = "$ISC_PLATFORM_KRB5HEADER"; then - AC_MSG_ERROR([krb5.h not found]) - fi - - # - # XXXDCL This probably doesn't work right on all systems. - # It will need to be worked on as problems become evident. - # - # Essentially the problems here relate to two different - # areas. The first area is building with either KTH - # or MIT Kerberos, particularly when both are present on - # the machine. The other is static versus dynamic linking. - # - # On the KTH vs MIT issue, Both have libkrb5 that can mess - # up the works if one implementation ends up trying to - # use the other's krb. This is unfortunately a situation - # that very easily arises. - # - # Dynamic linking when the dependency information is built - # into MIT's libgssapi_krb5 or KTH's libgssapi magically makes - # all such problems go away, but when that setup is not - # present, because either the dynamic libraries lack - # dependencies or static linking is being done, then the - # problems start to show up. - saved_libs="$LIBS" - for TRY_LIBS in \ - "-lgssapi_krb5" \ - "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err" \ - "-lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv" \ - "-lgssapi" \ - "-lgssapi -lkrb5 -ldes -lcrypt -lasn1 -lroken -lcom_err" \ - "-lgssapi -lkrb5 -lcrypt -lasn1 -lroken -lcom_err" \ - "-lgssapi -lkrb5 -lgssapi_krb5 -lcrypt -lasn1 -lroken -lcom_err" \ - "-lgssapi -lkrb5 -lhx509 -lcrypt -lasn1 -lroken -lcom_err" \ - "-lgss -lkrb5" - do - # Note that this does not include $saved_libs, because - # on FreeBSD machines this configure script has added - # -L/usr/local/lib to LIBS, which can make the - # -lgssapi_krb5 test succeed with shared libraries even - # when you are trying to build with KTH in /usr/lib. - if test "/usr" = "$use_gssapi" - then - LIBS="$TRY_LIBS $ISC_OPENSSL_LIBS" - else - LIBS="-L$use_gssapi/lib $TRY_LIBS $ISC_OPENSSL_LIBS" - fi - AC_MSG_CHECKING(linking as $TRY_LIBS) - AC_TRY_LINK([ -#include -$gssapi_hack -$gssapi_krb5_hack -$krb5_hack - ] , [gss_acquire_cred(NULL, NULL, 0, NULL, 0, NULL, NULL, NULL);krb5_init_context(NULL); -#if defined(HAVE_GSSAPI_KRB5_H) || defined(HAVE_GSSAPI_GSSAPI_KRB5_H) -gsskrb5_register_acceptor_identity(NULL); -#endif], - gssapi_linked=yes, gssapi_linked=no) - case $gssapi_linked in - yes) AC_MSG_RESULT(yes); break ;; - no) AC_MSG_RESULT(no) ;; - esac - done - - CPPFLAGS="$saved_cppflags" - - case $gssapi_linked in - no) AC_MSG_ERROR(could not determine proper GSSAPI linkage) ;; - esac - - # - # XXXDCL Major kludge. Tries to cope with KTH in /usr/lib - # but MIT in /usr/local/lib and trying to build with KTH. - # /usr/local/lib can end up earlier on the link lines. - # Like most kludges, this one is not only inelegant it - # is also likely to be the wrong thing to do at least as - # many times as it is the right thing. Something better - # needs to be done. - # - if test "/usr" = "$use_gssapi" -a \ - -f /usr/local/lib/libkrb5.a; then - FIX_KTH_VS_MIT=yes - fi - - case "$FIX_KTH_VS_MIT" in - yes) - case "$enable_static_linking" in - yes) gssapi_lib_suffix=".a" ;; - *) gssapi_lib_suffix=".so" ;; - esac - - for lib in $LIBS; do - case $lib in - -L*) - ;; - -l*) - new_lib=`echo $lib | - sed -e s%^-l%$use_gssapi/lib/lib% \ - -e s%$%$gssapi_lib_suffix%` - NEW_LIBS="$NEW_LIBS $new_lib" - ;; - *) - AC_MSG_ERROR([KTH vs MIT Kerberos confusion!]) - ;; - esac - done - LIBS="$NEW_LIBS" - ;; - esac - - DST_GSSAPI_INC="-I$use_gssapi/include" - DNS_GSSAPI_LIBS="$LIBS" - - AC_MSG_RESULT(using GSSAPI from $use_gssapi/lib and $use_gssapi/include) - LIBS="$saved_libs" - ;; -esac - -AC_SUBST(ISC_PLATFORM_HAVEGSSAPI) -AC_SUBST(ISC_PLATFORM_GSSAPIHEADER) -AC_SUBST(ISC_PLATFORM_GSSAPI_KRB5_HEADER) -AC_SUBST(ISC_PLATFORM_KRB5HEADER) - -AC_SUBST(USE_GSSAPI) -AC_SUBST(DST_GSSAPI_INC) -AC_SUBST(DNS_GSSAPI_LIBS) -DNS_CRYPTO_LIBS="$DNS_GSSAPI_LIBS" - -# -# Applications linking with libdns also need to link with these libraries. -# - -AC_SUBST(DNS_CRYPTO_LIBS) + AC_DEFINE([HAVE_GSSAPI], [1], [Define to 1 if you have the Kerberos Framework available]) + # kludge to silence compiler warnings which recommend use of GSS.framework on macOS + AS_CASE([$host],[*-darwin*],[CFLAGS="$CFLAGS -Wno-deprecated-declarations"])]) +AM_CONDITIONAL([HAVE_GSSAPI], [test -n "$GSSAPI_LIBS"]) +AC_SUBST([GSSAPI_CFLAGS]) +AC_SUBST([GSSAPI_LIBS]) +AC_SUBST([KRB5_CFLAGS]) +AC_SUBST([KRB5_LIBS]) # # was --with-lmdb specified? @@ -1129,18 +828,7 @@ AS_IF([test "$ac_lib_lmdb_found" = "yes"], AC_SUBST([LMDB_CFLAGS]) AC_SUBST([LMDB_LIBS]) -#AM_CONDITIONAL([HAVE_LMDB], [test "$ac_lib_lmdb_found" = "yes"]) - -NZD_TOOLS= -NZDSRCS= -NZDTARGETS= -AS_IF([test -n "$LMDB_LIBS"], - [NZD_TOOLS="nzd" - NZDSRCS='${NZDSRCS}' - NZDTARGETS='${NZDTARGETS}']) -AC_SUBST([NZD_TOOLS]) -AC_SUBST([NZDSRCS]) -AC_SUBST([NZDTARGETS]) +AM_CONDITIONAL([HAVE_LMDB], [test -n "$LMDB_LIBS"]) # # was --with-libxml2 specified? @@ -1159,14 +847,7 @@ AS_CASE([$with_libxml2], [AC_DEFINE([HAVE_LIBXML2], [1], [Use libxml2 library])])], [AC_MSG_ERROR([Specifying libxml2 installation path is not supported, adjust PKG_CONFIG_PATH instead])]) -# -# DEPRECATED -# -AC_ARG_WITH([libjson], - [AS_HELP_STRING([--with-libjson], - [deprecated, use --with-json-c])], - [AC_MSG_WARN([--with-libjson is DEPRECATED and will be removed in a future release, use --with-json-c instead])], - [with_libjson="detect"]) +AM_CONDITIONAL([HAVE_LIBXML2], [test -n "$LIBXML2_LIBS"]) # # was --with-json-c specified? @@ -1174,7 +855,7 @@ AC_ARG_WITH([libjson], AC_ARG_WITH([json-c], [AS_HELP_STRING([--with-json-c], [build with json-c library [yes|no|detect] (default is detect)])], - [], [with_json_c="$with_libjson"]) + [], [with_json_c="detect"]) AS_CASE([$with_json_c], [no],[], @@ -1186,14 +867,19 @@ AS_CASE([$with_json_c], [AC_MSG_ERROR([Specifying json-c installation path is not supported, adjust PKG_CONFIG_PATH instead])] ) +AM_CONDITIONAL([HAVE_JSON_C], [test -n "$JSON_C_LIBS"]) + AC_SUBST([JSON_C_CFLAGS]) AC_SUBST([JSON_C_LIBS]) +# +# was --with-zlib specified? +# AC_ARG_WITH([zlib], - [AS_HELP_STRING([--with-zlib], - [build with zlib for HTTP compression - [default=yes]])], - [], with_zlib="auto") + [AS_HELP_STRING([--with-zlib], + [build with zlib for HTTP compression + [default=yes]])], + [], with_zlib="auto") AS_CASE([$with_zlib], [no],[], @@ -1206,111 +892,6 @@ AS_CASE([$with_zlib], AC_SUBST([ZLIB_CFLAGS]) AC_SUBST([ZLIB_LIBS]) -# -# In solaris 10, SMF can manage named service -# -AC_CHECK_LIB(scf, smf_enable_instance) - -# -# Additional compiler settings. -# -MKDEPCC="$CC" - -MKDEPCFLAGS="-M" -AS_CASE([$host], - [*-solaris*],[ - AS_IF([test "$GCC" != "yes"], - [MKDEPCFLAGS="-xM"])]) - -AS_IF([test "$GCC" = "yes"], - [STD_CWARNINGS="$STD_CWARNINGS -W -Wall -Wmissing-prototypes -Wcast-qual -Wwrite-strings -Wformat -Wpointer-arith -Wno-missing-field-initializers"] - ) - -AX_CHECK_COMPILE_FLAG([-fno-strict-aliasing], - [STD_CWARNINGS="$STD_CWARNINGS -fno-strict-aliasing"]) -AX_CHECK_COMPILE_FLAG([-fno-delete-null-pointer-checks], - [STC_CWARNINGS="$STD_CWARNINGS -fno-delete-null-pointer-checks"]) -AS_IF([test "$enable_warn_shadow" = "yes"], - [AX_CHECK_COMPILE_FLAG([-Wshadow], - [STD_CWARNINGS="$STD_CWARNINGS -Wshadow"])]) -AS_IF([test "$enable_warn_error" = "yes"], - [AX_CHECK_COMPILE_FLAG([-Werror], - [STD_CWARNINGS="$STD_CWARNINGS -Werror"])]) - -AC_SUBST([MKDEPCC]) -AC_SUBST([MKDEPCFLAGS]) -AC_SUBST([MKDEPPROG]) - -# -# -lxnet buys us one big porting headache... standards, gotta love 'em. -# -# AC_CHECK_LIB(xnet, socket, , -# AC_CHECK_LIB(socket, socket) -# ) -# -# Use this for now, instead: -# -case "$host" in - *-linux*) - ;; - *) - AC_CHECK_LIB(socket, socket) - AC_CHECK_LIB(nsl, inet_addr) - ;; -esac - -# -# Work around Solaris's select() limitations. -# -case "$host" in - *-solaris2.[[89]]|*-solaris2.1?) - AC_DEFINE(FD_SETSIZE, 65536, - [Solaris hack to get select_large_fdset.]) - ;; -esac - -# -# Purify support -# -AC_MSG_CHECKING(whether to use purify) -AC_ARG_WITH(purify, - AS_HELP_STRING([--with-purify[=PATH]],[use Rational purify]), - use_purify="$withval", use_purify="no") - -case "$use_purify" in - no) - ;; - yes) - AC_PATH_PROG(purify_path, purify, purify) - ;; - *) - purify_path="$use_purify" - ;; -esac - -case "$use_purify" in - no) - AC_MSG_RESULT(no) - PURIFY="" - ;; - *) - if test -f "$purify_path" || test purify = "$purify_path"; then - AC_MSG_RESULT($purify_path) - PURIFYFLAGS="`echo $PURIFYOPTIONS`" - PURIFY="$purify_path $PURIFYFLAGS" - else - AC_MSG_ERROR([$purify_path not found. - -Please choose the proper path with the following command: - - configure --with-purify=PATH -]) - fi - ;; -esac - -AC_SUBST(PURIFY) - # # Google/Great Performance Tools CPU Profiler # @@ -1339,39 +920,7 @@ AC_CHECK_HEADERS([execinfo.h], [AC_SEARCH_LIBS([backtrace], [execinfo], [AC_CHECK_FUNCS([backtrace backtrace_symbols])])]) -# AM_CONDITIONAL([HAVE_BACKTRACE], [test "$ac_cv_func_backtrace" = "yes"]) - -# -# File name extension for static archive files, for those few places -# where they are treated differently from dynamic ones. -# -O=lo -A=la -SA=a -LIBTOOL_MKDEP_SED='s;\.o;\.lo;' -LIBTOOL_MODE_COMPILE='--mode=compile' -LIBTOOL_MODE_INSTALL='--mode=install' -LIBTOOL_MODE_LINK='--mode=link' -LIBTOOL_MODE_UNINSTALL='--mode=uninstall' -INSTALL_LIBRARY='${INSTALL_PROGRAM}' - -AC_SUBST(O) -AC_SUBST(A) -AC_SUBST(SA) -AC_SUBST(LIBTOOL_MKDEP_SED) -AC_SUBST(LIBTOOL_MODE_COMPILE) -AC_SUBST(LIBTOOL_MODE_INSTALL) -AC_SUBST(LIBTOOL_MODE_LINK) -AC_SUBST(LIBTOOL_MODE_UNINSTALL) -AC_SUBST(INSTALL_LIBRARY) - -BIND9_CO_RULE=".c.$O:" -AC_SUBST(BIND9_CO_RULE) - -# -# Here begins a very long section to determine the system's networking -# capabilities. The order of the tests is significant. -# +AM_CONDITIONAL([HAVE_BACKTRACE], [test "$ac_cv_func_backtrace" = "yes"]) # # We do the IPv6 compilation checking after libtool so that we can put @@ -1407,7 +956,7 @@ AC_COMPILE_IFELSE( AC_ARG_ENABLE([tcp_fastopen], [AS_HELP_STRING([--disable-tcp-fastopen], [disable TCP Fast Open support [default=yes]])], - [], [enable_tcp_fastopen="yes"]) + [], [enable_tcp_fastopen="yes"]) AS_IF([test "$enable_tcp_fastopen" = "yes"], [AC_DEFINE([ENABLE_TCP_FASTOPEN], [1], [define if you want TCP_FASTOPEN enabled if available])]) @@ -1478,33 +1027,6 @@ then AC_CHECK_HEADERS(readline/history.h) fi -# -# Use our own SPNEGO implementation? -# -AC_ARG_ENABLE(isc-spnego, - AS_HELP_STRING([--disable-isc-spnego], - [use SPNEGO from GSSAPI library])) - -if test -n "$USE_GSSAPI" -then - case "$enable_isc_spnego" in - yes|'') - USE_ISC_SPNEGO='-DUSE_ISC_SPNEGO' - DST_EXTRA_OBJS="$DST_EXTRA_OBJS spnego.$O" - DST_EXTRA_SRCS="$DST_EXTRA_SRCS spnego.c" - AC_MSG_RESULT(using SPNEGO from lib/dns) - ;; - no) - AC_MSG_RESULT(using SPNEGO from GSSAPI library) - ;; - esac -fi - -AC_SUBST(USE_ISC_SPNEGO) - -AC_SUBST(DST_EXTRA_OBJS) -AC_SUBST(DST_EXTRA_SRCS) - # # Security Stuff # @@ -1544,13 +1066,6 @@ AS_IF([test "$enable_linux_caps" = "yes"], [AC_MSG_RESULT([no])]) AC_SUBST([LIBCAP_LIBS]) -AC_CHECK_HEADERS(sys/un.h, -ISC_PLATFORM_HAVESYSUNH="#define ISC_PLATFORM_HAVESYSUNH 1" -, -ISC_PLATFORM_HAVESYSUNH="#undef ISC_PLATFORM_HAVESYSUNH" -) -AC_SUBST(ISC_PLATFORM_HAVESYSUNH) - case "$host" in *-solaris*) AC_DEFINE(NEED_SECURE_DIRECTORY, 1, @@ -1713,170 +1228,35 @@ fi # # Activate "rrset-order fixed" or not? # -AC_ARG_ENABLE(fixed-rrset, - AS_HELP_STRING([--enable-fixed-rrset], - [enable fixed rrset ordering [default=no]]), - enable_fixed="$enableval", enable_fixed="no") -case "$enable_fixed" in - yes) - AC_DEFINE(DNS_RDATASET_FIXED, 1, - [Define to enable "rrset-order fixed" syntax.]) - ;; - no) - ;; - *) - ;; -esac +AC_ARG_ENABLE([fixed-rrset], + [AS_HELP_STRING([--enable-fixed-rrset], + [enable fixed rrset ordering [default=no]])], + [], [enable_fixed_rrset="no"]) +AS_IF([test "$enable_fixed_rrset" = "yes"], + [AC_DEFINE([DNS_RDATASET_FIXED], [1], + [Define to enable "rrset-order fixed" syntax.])]) # # Activate dnstap? # -AC_ARG_ENABLE(dnstap, - AS_HELP_STRING([--enable-dnstap], - [enable dnstap support - (requires fstrm, protobuf-c)]), - use_dnstap=$enableval, use_dnstap=no) +AC_ARG_ENABLE([dnstap], + [AS_HELP_STRING([--enable-dnstap], + [enable dnstap support + (requires fstrm, protobuf-c)])], + [], [enable_dnstap=no]) -DNSTAP= -DNSTAPSRCS= -DNSTAPOBJS= -DNSTAPTARGETS= -if test "x$use_dnstap" != "xno"; then - AC_ARG_WITH([protobuf-c], - AS_HELP_STRING([--with-protobuf-c=path], - [Path where protobuf-c is installed, for dnstap]), [ - # workaround for protobuf-c includes at old dir - # before protobuf-c-1.0.0 - if test -f $withval/include/google/protobuf-c/protobuf-c.h - then - CFLAGS="$CFLAGS -I$withval/include/google" - else - CFLAGS="$CFLAGS -I$withval/include" - fi - LDFLAGS="$LDFLAGS -L$withval/lib" - AC_PATH_PROG([PROTOC_C], [protoc-c], [], - [$PATH$PATH_SEPARATOR$withval/bin]) - ], [ - # workaround for protobuf-c includes at old dir - # before protobuf-c-1.0.0 - if test -f /usr/include/google/protobuf-c/protobuf-c.h - then - CFLAGS="$CFLAGS -I/usr/include/google" - else - if test -f /usr/local/include/google/protobuf-c/protobuf-c.h - then - CFLAGS="$CFLAGS -I/usr/local/include/google" - LDFLAGS="$LDFLAGS -L/usr/local/lib" - fi - fi - AC_PATH_PROG([PROTOC_C],[protoc-c]) - ]) - if test -z "$PROTOC_C"; then - AC_MSG_ERROR([The protoc-c program was not found.]) - fi - AC_ARG_WITH([libfstrm], AS_HELP_STRING([--with-libfstrm=path], - [Path where libfstrm is installed, for dnstap]), [ - CFLAGS="$CFLAGS -I$withval/include" - LDFLAGS="$LDFLAGS -L$withval/lib" - AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture], [], [$PATH$PATH_SEPARATOR$withval/bin]) - ],[ - AC_PATH_PROG([FSTRM_CAPTURE], [fstrm_capture]) - ]) +AS_IF([test "$enable_dnstap" != "no"], + [PKG_CHECK_MODULES([DNSTAP], [libfstrm libprotobuf-c], [], + [AC_MSG_FAILURE([Required libraries (fstrm, protobuf-c) were not found, please install them.])]) + AC_PATH_PROG([PROTOC_C], [protoc-c], []) + AS_IF([test -z "$PROTOC_C"], + [AC_MSG_ERROR([protoc-c compiler not found])]) + AC_DEFINE([HAVE_DNSTAP], 1, [Define to 1 to enable dnstap support]) + ]) - AC_SEARCH_LIBS([fstrm_iothr_init], [fstrm], [], - AC_MSG_ERROR([The fstrm library was not found. Please install fstrm!])) - AC_SEARCH_LIBS([protobuf_c_message_pack], [protobuf-c], [], - AC_MSG_ERROR([The protobuf-c library was not found. Please install protobuf-c!])) - - AC_DEFINE(HAVE_DNSTAP, 1, [Define to 1 to enable dnstap support]) - DNSTAP=dnstap - DNSTAPSRCS='${DNSTAPSRCS}' - DNSTAPOBJS='${DNSTAPOBJS}' - DNSTAPTARGETS='${DNSTAPTARGETS}' -fi -AC_SUBST(DNSTAP) -AC_SUBST(DNSTAPSRCS) -AC_SUBST(DNSTAPOBJS) -AC_SUBST(DNSTAPTARGETS) - -# -# The following sets up how non-blocking i/o is established. -# cygwin and solaris 2.x (x<5) require special handling. -# -case "$host" in -*-cygwin*) AC_DEFINE(PORT_NONBLOCK, O_NDELAY);; -*-solaris2.[[01234]]) - AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK) - AC_DEFINE(USE_FIONBIO_IOCTL, 1, - [Defined if you need to use ioctl(FIONBIO) instead a fcntl call to make non-blocking.]) - ;; -*) AC_DEFINE(PORT_NONBLOCK, O_NONBLOCK, - [Sets which flag to pass to open/fcntl to make non-blocking (O_NDELAY/O_NONBLOCK).]) - ;; -esac -# -# Solaris 2.5.1 and earlier cannot bind() then connect() a TCP socket. -# This prevents the source address being set. -# -case "$host" in -*-solaris2.[[012345]]|*-solaris2.5.1) - AC_DEFINE(BROKEN_TCP_BIND_BEFORE_CONNECT, 1, - [Define if you cannot bind() before connect() for TCP sockets.]) - ;; -esac -# -# The following sections deal with tools used for formatting -# the documentation. They are all optional, unless you are -# a developer editing the documentation source. -# - -# -# Look for TeX. -# - -AC_PATH_PROGS(LATEX, latex, latex) -AC_SUBST(LATEX) - -AC_PATH_PROGS(PDFLATEX, pdflatex, pdflatex) -AC_SUBST(PDFLATEX) - -AC_PATH_PROGS(DBLATEX, dblatex, dblatex) -AC_SUBST(DBLATEX) - -# -# Look for w3m -# - -AC_PATH_PROGS(W3M, w3m, w3m) -AC_SUBST(W3M) - -# -# Look for pandoc -# -AC_PATH_PROG(PANDOC, pandoc, pandoc) -AC_SUBST(PANDOC) - - -# -# Look for xsltproc (libxslt) -# - -AC_PATH_PROG(XSLTPROC, xsltproc, xsltproc) -AC_SUBST(XSLTPROC) - -# -# Look for xmllint (libxml2) -# - -AC_PATH_PROG(XMLLINT, xmllint, xmllint) -AC_SUBST(XMLLINT) - -# -# Look for Doxygen -# - -AC_PATH_PROG(DOXYGEN, doxygen, doxygen) -AC_SUBST(DOXYGEN) +AC_SUBST([DNSTAP_CFLAGS]) +AC_SUBST([DNSTAP_LIBS]) +AM_CONDITIONAL([HAVE_DNSTAP], [test "$enable_dnstap" != "no"]) # # Look for curl @@ -1885,76 +1265,6 @@ AC_SUBST(DOXYGEN) AC_PATH_PROG(CURL, curl, curl) AC_SUBST(CURL) -# -# Subroutine for searching for an ordinary file (e.g., a stylesheet) -# in a number of directories: -# -# NOM_PATH_FILE(VARIABLE, FILENAME, DIRECTORIES) -# -# If the file FILENAME is found in one of the DIRECTORIES, the shell -# variable VARIABLE is defined to its absolute pathname. Otherwise, -# it is set to FILENAME, with no directory prefix (that's not terribly -# useful, but looks less confusing in substitutions than leaving it -# empty). The variable VARIABLE will be substituted into output files. -# - -AC_DEFUN([NOM_PATH_FILE], [ -$1="" -AC_MSG_CHECKING(for $2) -for d in $3 -do - f=$d/$2 - if test -f $f - then - $1=$f - AC_MSG_RESULT($f) - break - fi -done -if test "X[$]$1" = "X" -then - AC_MSG_RESULT("not found"); - $1=$2 -fi -AC_SUBST($1) -]) - -# -# Look for Docbook-XSL stylesheets. Location probably varies by system. -# If it's not explicitly specified, guess where it might be found, based on -# where SGML stuff lives on some systems (FreeBSD is the only one we're sure -# of at the moment). -# -AC_MSG_CHECKING(for Docbook-XSL path) -AC_ARG_WITH(docbook-xsl, - AS_HELP_STRING([--with-docbook-xsl[=PATH]], - [specify path for Docbook-XSL stylesheets]), - docbook_path="$withval", docbook_path="auto") -case "$docbook_path" in -auto) - AC_MSG_RESULT(auto) - docbook_xsl_trees="/usr/pkg/share/xsl/docbook /usr/local/share/xsl/docbook-ns /usr/local/share/xsl/docbook /usr/share/xsl/docbook /usr/share/sgml/docbook/xsl-stylesheets /opt/local/share/xsl/docbook-xsl /opt/local/share/xsl/docbook-xsl-nons /usr/share/xml/docbook/stylesheet/docbook-xsl" - ;; -*) - docbook_xsl_trees="$withval" - AC_MSG_RESULT($docbook_xsl_trees) - ;; -esac - -# -# Look for stylesheets we need. -# - -NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_HTML, html/docbook.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_XHTML, xhtml/docbook.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_STYLE_MAN, manpages/docbook.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_HTML, html/chunk.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_CHUNK_XHTML, xhtml/chunk.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_HTML, html/chunktoc.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_CHUNKTOC_XHTML, xhtml/chunktoc.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_HTML, html/maketoc.xsl, $docbook_xsl_trees) -NOM_PATH_FILE(XSLT_DOCBOOK_MAKETOC_XHTML, xhtml/maketoc.xsl, $docbook_xsl_trees) - # # IDN support using libidn2 # @@ -1999,27 +1309,15 @@ AS_CASE([$with_cmocka], [no],[], [detect],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0], [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka]) - UNITTESTS=tests],[with_cmocka=no])], + with_cmocka=yes],[with_cmocka=no])], [yes],[PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.0.0], - [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])]) - UNITTESTS=tests], + [AC_DEFINE([HAVE_CMOCKA], [1], [Use CMocka])])], [AC_MSG_ERROR([Use PKG_CONFIG_PATH to specify path to CMocka library])] ) AC_SUBST([CMOCKA_CFLAGS]) AC_SUBST([CMOCKA_LIBS]) -AC_SUBST(UNITTESTS) -# -# Check for kyua execution engine if CMocka was requested -# and bail out if execution engine was not found -# -AC_ARG_VAR([KYUA], [path to kyua execution engine]) -AS_IF([test "$with_cmocka" != "no"], - [AC_PATH_PROGS([KYUA], [kyua], []) - AS_IF([test -z "$KYUA"], - [AC_MSG_WARN([kyua test execution engine not found])])]) - -AC_SUBST([KYUA]) +AM_CONDITIONAL([HAVE_CMOCKA], [test "$with_cmocka" = "yes"]) # # Check for -Wl,--wrap= support @@ -2029,19 +1327,18 @@ LD_WRAP_TESTS=false AC_MSG_CHECKING([for linker support for --wrap option]) AX_SAVE_FLAGS([wrap]) LDFLAGS="-Wl,-wrap,exit" -AC_LINK_IFELSE( +AC_RUN_IFELSE( [AC_LANG_PROGRAM([[#include void __real_exit (int status); void __wrap_exit (int status) { __real_exit (status); } ]], [[exit (1);]])], [LD_WRAP_TESTS=true - AC_DEFINE([LD_WRAP], [1], [define if the linker supports --wrap option]) AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])]) AX_RESTORE_FLAGS([wrap]) -AC_SUBST([LD_WRAP_TESTS]) +AM_CONDITIONAL([HAVE_LD_WRAP], [test "$LD_WRAP_TESTS" = "true"]) WRAP_INTERPOSE= AC_MSG_CHECKING([for linker support for '-z interpose' option]) @@ -2113,103 +1410,6 @@ AC_ARG_ENABLE(auto-validation, AS_IF([test "$enable_auto_validation" = "no"],[validation_default=yes]) AC_DEFINE_UNQUOTED([VALIDATION_DEFAULT], ["$validation_default"], [the default value of dnssec-validation option]) -# -# Substitutions -# -AC_SUBST(BIND9_TOP_BUILDDIR) -BIND9_TOP_BUILDDIR=`pwd` - -AC_SUBST(BIND9_ISC_BUILDINCLUDE) -AC_SUBST(BIND9_ISCCC_BUILDINCLUDE) -AC_SUBST(BIND9_ISCCFG_BUILDINCLUDE) -AC_SUBST(BIND9_DNS_BUILDINCLUDE) -AC_SUBST(BIND9_NS_BUILDINCLUDE) -AC_SUBST(BIND9_BIND9_BUILDINCLUDE) -AC_SUBST(BIND9_IRS_BUILDINCLUDE) -if test "X$srcdir" != "X"; then - BIND9_ISC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isc/include" - BIND9_ISCCC_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccc/include" - BIND9_ISCCFG_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/isccfg/include" - BIND9_DNS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/dns/include" - BIND9_NS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/ns/include" - BIND9_BIND9_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/bind9/include" - BIND9_IRS_BUILDINCLUDE="-I${BIND9_TOP_BUILDDIR}/lib/irs/include" -else - BIND9_ISC_BUILDINCLUDE="" - BIND9_ISCCC_BUILDINCLUDE="" - BIND9_ISCCFG_BUILDINCLUDE="" - BIND9_DNS_BUILDINCLUDE="" - BIND9_NS_BUILDINCLUDE="" - BIND9_BIND9_BUILDINCLUDE="" - BIND9_IRS_BUILDINCLUDE="" -fi - -AC_SUBST_FILE(BIND9_MAKE_INCLUDES) -BIND9_MAKE_INCLUDES=$BIND9_TOP_BUILDDIR/make/includes - -AC_SUBST_FILE(BIND9_MAKE_RULES) -BIND9_MAKE_RULES=$BIND9_TOP_BUILDDIR/make/rules - -. "$srcdir/version" -BIND9_PRODUCT="PRODUCT=\"${PRODUCT}\"" -AC_SUBST(BIND9_PRODUCT) -BIND9_DESCRIPTION="DESCRIPTION=\"${DESCRIPTION}\"" -AC_SUBST(BIND9_DESCRIPTION) -BIND9_VERSION="${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}" -AC_SUBST(BIND9_VERSION) -BIND9_MAJOR="MAJOR=${MAJORVER}.${MINORVER}" -AC_SUBST(BIND9_MAJOR) -BIND9_VERSIONSTRING="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}${DESCRIPTION:+ }${DESCRIPTION}" -AC_SUBST(BIND9_VERSIONSTRING) -BIND9_VERSIONSHORT="${PRODUCT} ${MAJORVER}.${MINORVER}${PATCHVER:+.}${PATCHVER}${RELEASETYPE}${RELEASEVER}${EXTENSIONS}" -AC_SUBST(BIND9_VERSIONSHORT) - -BIND9_SRCID="SRCID=unset_id" -if test -f "${srcdir}/srcid"; then - . "${srcdir}/srcid" - BIND9_SRCID="SRCID=$SRCID" -elif test -d "${srcdir}/.git"; then - BIND9_SRCID="SRCID="`(cd "${srcdir}";git rev-parse --short HEAD)` -fi - -AC_SUBST(BIND9_SRCID) - -if test -z "$ac_configure_args"; then - BIND9_CONFIGARGS="defaults" -else - for a in $ac_configure_args - do - BIND9_CONFIGARGS="$BIND9_CONFIGARGS $a" - done -fi -BIND9_CONFIGARGS="`echo $BIND9_CONFIGARGS | sed 's/^ //'`" -BIND9_CONFIGARGS="CONFIGARGS=${BIND9_CONFIGARGS}" -AC_SUBST(BIND9_CONFIGARGS) - -AC_SUBST_FILE(LIBISC_API) -LIBISC_API="$srcdir/lib/isc/api" - -AC_SUBST_FILE(LIBISCCC_API) -LIBISCCC_API="$srcdir/lib/isccc/api" - -AC_SUBST_FILE(LIBISCCFG_API) -LIBISCCFG_API="$srcdir/lib/isccfg/api" - -AC_SUBST_FILE(LIBDNS_API) -LIBDNS_API="$srcdir/lib/dns/api" - -AC_SUBST_FILE(LIBDNS_MAPAPI) -LIBDNS_MAPAPI="$srcdir/lib/dns/mapapi" - -AC_SUBST_FILE(LIBBIND9_API) -LIBBIND9_API="$srcdir/lib/bind9/api" - -AC_SUBST_FILE(LIBIRS_API) -LIBIRS_API="$srcdir/lib/irs/api" - -AC_SUBST_FILE(LIBNS_API) -LIBNS_API="$srcdir/lib/ns/api" - # # Configure any DLZ drivers. # @@ -2231,99 +1431,6 @@ DLZ_DRIVER_MYSQL_INCLUDES="" DLZ_DRIVER_MYSQL_LIBS="" # -# Configure support for building a shared library object -# -# Even when libtool is available it can't always be relied upon -# to build an object that can be dlopen()'ed, but this is necessary -# for building the dlzexternal system test, so we'll try it the -# old-fashioned way. -# -SO="so" -SO_CFLAGS="" -SO_LDFLAGS="" -SO_LD="" -SO_TARGETS="" -SO_STRIP="cat" - -AC_ARG_WITH([dlopen], - AS_HELP_STRING([--with-dlopen=ARG], - [support dynamically loadable DLZ and DYNDB drivers]), - [], [with_dlopen="auto"]) - - -# -# If PIC is disabled, dlopen must also be -# -AS_IF([test "$pic_mode" = "no"], - [AS_CASE([$with_dlopen], - [auto],[with_dlopen="no"], - [yes],[AC_MSG_ERROR([--with-dlopen requires PIC])])]) - -AS_CASE([$with_dlopen], - [auto|yes],[ - AC_SEARCH_LIBS([dlopen],[dl]) - AC_CHECK_FUNCS([dlopen dlclose dlsym], - [with_dlopen="yes"], - [with_dlopen="no"]) - ]) - -AS_IF([test "$with_dlopen" = "yes"], - [AS_CASE([$host], - [*-linux*|*-gnu*],[ - LDFLAGS="${LDFLAGS} -Wl,--export-dynamic" - SO_CFLAGS="-fPIC" - SO_LDFLAGS="" - SO_LDFLAGS="-Xcompiler -shared" - SO_LD="${CC}" - ], - [*-freebsd*|*-openbsd*|*-netbsd*],[ - LDFLAGS="${LDFLAGS} -Wl,-E" - SO_CFLAGS="-fpic" - SO_LDFLAGS="-Xcompiler -shared" - SO_LD="${CC}" - ], - [*-darwin*],[ - SO_CFLAGS="-fPIC" - SO_LD="${CC}" - SO_LDFLAGS="-Xcompiler -dynamiclib -undefined dynamic_lookup" - ], - [*-solaris*],[ - SO_CFLAGS="-KPIC" - SO_LDFLAGS="-G -z text" - SO_LD="ld" - ], - [ia64-hp-hpux*],[ - SO_CFLAGS="+z" - SO_LDFLAGS="-b" - SO_LD="${CC}" - ], - [ - SO_CFLAGS="-fPIC" - ]) - AS_IF([test "$GCC" = "yes"], - [SO_CFLAGS="-fPIC" - AS_IF([test -z "$SO_LD"], - [SO_LDFLAGS="-Xcompiler -shared" - SO_LD="${CC}" - ]) - ]) - # If we still don't know how to make shared objects, don't make any. - AS_IF([test -n "$SO_LD"], - [SO_TARGETS="\${SO_TARGETS}" - AC_DEFINE([ISC_DLZ_DLOPEN], [1], - [Define to allow building of objects for dlopen().]) - ]) - ]) - -CFLAGS="$CFLAGS $SO_CFLAGS" - -AC_SUBST(SO) -AC_SUBST(SO_CFLAGS) -AC_SUBST(SO_LDFLAGS) -AC_SUBST(SO_LD) -AC_SUBST(SO_STRIP) -AC_SUBST(SO_TARGETS) - # # Response policy rewriting using DNS Response Policy Service (DNSRPS) # interface. @@ -2394,286 +1501,105 @@ AS_IF([test "$enable_dnsrps" != "no"],[ AC_DEFINE([USE_DNSRPS], [1], [Enable DNS Response Policy Service API]) ]) -sinclude(contrib/dlz/config.dlz.in) -AC_MSG_CHECKING(contributed DLZ drivers) - -if test -n "$CONTRIB_DLZ" -then - AC_MSG_RESULT(yes) - DLZ_DRIVER_RULES=contrib/dlz/drivers/rules - AC_CONFIG_FILES([$DLZ_DRIVER_RULES - contrib/dlz/modules/mysql/Makefile - contrib/dlz/modules/mysqldyn/Makefile]) -else - AC_MSG_RESULT(no) - DLZ_DRIVER_RULES=/dev/null -fi - -AC_SUBST(CONTRIB_DLZ) -AC_SUBST(DLZ_DRIVER_INCLUDES) -AC_SUBST(DLZ_DRIVER_LIBS) -AC_SUBST(DLZ_DRIVER_SRCS) -AC_SUBST(DLZ_DRIVER_OBJS) -AC_SUBST(DLZ_SYSTEM_TEST) -AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES) -AC_SUBST(DLZ_DRIVER_MYSQL_LIBS) -AC_SUBST_FILE(DLZ_DRIVER_RULES) +# FIXME +#sinclude(contrib/dlz/config.dlz.in) +# AC_MSG_CHECKING(contributed DLZ drivers) +# +# if test -n "$CONTRIB_DLZ" +# then +# AC_MSG_RESULT(yes) +# DLZ_DRIVER_RULES=contrib/dlz/drivers/rules +# AC_CONFIG_FILES([$DLZ_DRIVER_RULES +# contrib/dlz/modules/mysql/Makefile +# contrib/dlz/modules/mysqldyn/Makefile]) +# else +# AC_MSG_RESULT(no) +# DLZ_DRIVER_RULES=/dev/null +# fi +# +# AC_SUBST(CONTRIB_DLZ) +# AC_SUBST(DLZ_DRIVER_INCLUDES) +# AC_SUBST(DLZ_DRIVER_LIBS) +# AC_SUBST(DLZ_DRIVER_SRCS) +# AC_SUBST(DLZ_DRIVER_OBJS) +# AC_SUBST(DLZ_SYSTEM_TEST) +# AC_SUBST(DLZ_DRIVER_MYSQL_INCLUDES) +# AC_SUBST(DLZ_DRIVER_MYSQL_LIBS) +# AC_SUBST_FILE(DLZ_DRIVER_RULES) AC_CHECK_HEADERS([glob.h]) -if test "yes" = "$cross_compiling"; then - if test -z "$BUILD_CC"; then - AC_MSG_ERROR([BUILD_CC not set]) - fi - BUILD_CFLAGS="$BUILD_CFLAGS" - BUILD_CPPFLAGS="$BUILD_CPPFLAGS" - BUILD_LDFLAGS="$BUILD_LDFLAGS" - BUILD_LIBS="$BUILD_LIBS" -else - BUILD_CC="$CC" - BUILD_CFLAGS="$CFLAGS" - BUILD_CPPFLAGS="$CPPFLAGS $GEN_NEED_OPTARG" - BUILD_LDFLAGS="$LDFLAGS" - BUILD_LIBS="$LIBS" -fi - -NEWFLAGS="" -for e in $BUILD_LDFLAGS ; do - case $e in - -L*) - case $host_os in - netbsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - freebsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - solaris*) - ee=`echo $e | sed -e 's%^-L%-R%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac -done -BUILD_LDFLAGS="$NEWFLAGS" - -NEWFLAGS="" -for e in $DNS_GSSAPI_LIBS ; do - case $e in - -L*) - case $host_os in - netbsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - freebsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - solaris*) - ee=`echo $e | sed -e 's%^-L%-R%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac -done -DNS_GSSAPI_LIBS="$NEWFLAGS" - -NEWFLAGS="" -for e in $ISC_OPENSSL_LIBS ; do - case $e in - -L*) - case $host_os in - netbsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - freebsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - solaris*) - ee=`echo $e | sed -e 's%^-L%-R%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac -done -ISC_OPENSSL_LIBS="$NEWFLAGS" - -NEWFLAGS="" -for e in $DNS_CRYPTO_LIBS ; do - case $e in - -L*) - case $host_os in - netbsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - freebsd*) - ee=`echo $e | sed -e 's%^-L%-Wl,-rpath,%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - solaris*) - ee=`echo $e | sed -e 's%^-L%-R%'` - NEWFLAGS="$NEWFLAGS $e $ee" - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac - ;; - *) - NEWFLAGS="$NEWFLAGS $e" - ;; - esac -done -DNS_CRYPTO_LIBS="$NEWFLAGS" - -AC_SUBST(BUILD_CC) -AC_SUBST(BUILD_CFLAGS) -AC_SUBST(BUILD_CPPFLAGS) -AC_SUBST(BUILD_LDFLAGS) -AC_SUBST(BUILD_LIBS) - -# -# Commands to run at the end of config.status. -# Don't just put these into configure, it won't work right if somebody -# runs config.status directly (which autoconf allows). -# - -AC_CONFIG_COMMANDS( - [chmod], - [chmod a+x doc/doxygen/doxygen-input-filter]) - # # Files to configure. These are listed here because we used to -# specify them as arguments to AC_OUTPUT. It's (now) ok to move these -# elsewhere if there's a good reason for doing so. +# specify them as arguments to AC_OUTPUT. # -AC_CONFIG_FILES([ - Makefile - bin/Makefile - bin/check/Makefile - bin/confgen/Makefile - bin/confgen/unix/Makefile - bin/delv/Makefile - bin/dig/Makefile - bin/dnssec/Makefile - bin/named/Makefile - bin/named/unix/Makefile - bin/nsupdate/Makefile - bin/pkcs11/Makefile - bin/plugins/Makefile - bin/rndc/Makefile - bin/tests/Makefile - bin/tests/headerdep_test.sh - bin/tests/optional/Makefile - bin/tests/pkcs11/Makefile - bin/tests/pkcs11/benchmarks/Makefile - bin/tests/system/Makefile - bin/tests/system/conf.sh - bin/tests/system/dlzexternal/Makefile - bin/tests/system/dlzexternal/ns1/dlzs.conf - bin/tests/system/dyndb/Makefile - bin/tests/system/dyndb/driver/Makefile - bin/tests/system/pipelined/Makefile - bin/tests/system/rndc/Makefile - bin/tests/system/rpz/Makefile - bin/tests/system/rsabigexponent/Makefile - bin/tests/system/tkey/Makefile - bin/tools/Makefile - contrib/scripts/check-secure-delegation.pl - contrib/scripts/zone-edit.sh - doc/Makefile - doc/arm/Makefile - doc/arm/noteversion.xml - doc/arm/pkgversion.xml - doc/arm/releaseinfo.xml - doc/doxygen/Doxyfile - doc/doxygen/Makefile - doc/doxygen/doxygen-input-filter - doc/misc/Makefile - doc/tex/Makefile - doc/tex/armstyle.sty - doc/xsl/Makefile - doc/xsl/isc-docbook-chunk.xsl - doc/xsl/isc-docbook-html.xsl - doc/xsl/isc-manpage.xsl - doc/xsl/isc-notes-html.xsl - fuzz/Makefile - lib/Makefile - lib/bind9/Makefile - lib/bind9/include/Makefile - lib/bind9/include/bind9/Makefile - lib/dns/Makefile - lib/dns/include/Makefile - lib/dns/include/dns/Makefile - lib/dns/include/dst/Makefile - lib/dns/tests/Makefile - lib/irs/Makefile - lib/irs/include/Makefile - lib/irs/include/irs/Makefile - lib/irs/include/irs/netdb.h - lib/irs/include/irs/platform.h - lib/irs/tests/Makefile - lib/isc/Makefile - lib/isc/include/Makefile - lib/isc/include/isc/Makefile - lib/isc/include/isc/platform.h - lib/isc/include/pk11/Makefile - lib/isc/include/pkcs11/Makefile - lib/isc/netmgr/Makefile - lib/isc/pthreads/Makefile - lib/isc/pthreads/include/Makefile - lib/isc/pthreads/include/isc/Makefile - lib/isc/tests/Makefile - lib/isc/unix/Makefile - lib/isc/unix/include/Makefile - lib/isc/unix/include/isc/Makefile - lib/isccc/Makefile - lib/isccc/include/Makefile - lib/isccc/include/isccc/Makefile - lib/isccc/tests/Makefile - lib/isccfg/Makefile - lib/isccfg/include/Makefile - lib/isccfg/include/isccfg/Makefile - lib/isccfg/tests/Makefile - lib/ns/Makefile - lib/ns/include/Makefile - lib/ns/include/ns/Makefile - lib/ns/tests/Makefile - lib/samples/Makefile - lib/samples/Makefile-postinstall - make/Makefile - make/mkdep - unit/unittest.sh - util/check-make-install -]) +# Top + +AC_CONFIG_FILES([Makefile]) + +# Binaries + +AC_CONFIG_FILES([bin/Makefile + bin/named/Makefile + bin/rndc/Makefile + bin/dig/Makefile + bin/delv/Makefile + bin/dnssec/Makefile + bin/tools/Makefile + bin/nsupdate/Makefile + bin/check/Makefile + bin/confgen/Makefile + bin/pkcs11/Makefile + bin/plugins/Makefile]) + +# Libraries + +AC_CONFIG_FILES([lib/Makefile + lib/isc/Makefile + lib/dns/Makefile + lib/ns/Makefile + lib/irs/Makefile + lib/isccfg/Makefile + lib/isccc/Makefile + lib/bind9/Makefile + lib/samples/Makefile]) + +# Generated headers + +AC_CONFIG_FILES([lib/isc/include/isc/platform.h]) + +# Unit Tests + +AC_CONFIG_FILES([lib/isc/tests/Makefile + lib/dns/tests/Makefile + lib/ns/tests/Makefile + lib/irs/tests/Makefile + lib/isccc/tests/Makefile + lib/isccfg/tests/Makefile]) + +# System Tests + +AC_CONFIG_FILES([bin/tests/Makefile + bin/tests/system/Makefile + bin/tests/system/conf.sh + bin/tests/system/dyndb/driver/Makefile + bin/tests/system/dlzexternal/driver/Makefile]) + +AC_CONFIG_FILES([bin/tests/system/ifconfig.sh], + [chmod +x bin/tests/system/ifconfig.sh]) +AC_CONFIG_FILES([bin/tests/system/run.sh], + [chmod +x bin/tests/system/run.sh]) +AC_CONFIG_FILES([bin/tests/system/start.sh], + [chmod +x bin/tests/system/start.sh]) +AC_CONFIG_FILES([bin/tests/system/stop.sh], + [chmod +x bin/tests/system/stop.sh]) +AC_CONFIG_FILES([bin/tests/system/system-test-driver.sh], + [chmod +x bin/tests/system/system-test-driver.sh]) + +# Misc + +AC_CONFIG_FILES([util/check-make-install]) # # Do it @@ -2681,27 +1607,6 @@ AC_CONFIG_FILES([ AC_OUTPUT -# -# Now that the Makefiles exist we can ensure that everything is rebuilt. -# -AC_ARG_WITH(make-clean, - AS_HELP_STRING([--with-make-clean], - [run "make clean" at end of configure [yes|no]]), - make_clean="$withval", make_clean="yes") -case "$make_clean" in -yes) - if test "yes" != "$no_create" - then - if test "yes" = "$silent" - then - make clean > /dev/null - else - make clean - fi - fi - ;; -esac - AC_ARG_ENABLE(full-report, AS_HELP_STRING([--enable-full-report], [report values of all configure options])) @@ -2810,6 +1715,9 @@ report() { echo "-------------------------------------------------------------------------------" echo "Compiler: $CC" $CC --version 2>&1 | sed 's/^/ /' + echo "CFLAGS: $STD_CFLAGS $CFLAGS" + echo "CPPFLAGS: $STD_CPPFLAGS $CPPFLAGS" + echo "LDFLAGS: $LDFLAGS" if test "X$ac_unrecognized_opts" != "X"; then echo "Unrecognized options:" diff --git a/contrib/README b/contrib/README index 15db70fe0a..466e11d1c7 100644 --- a/contrib/README +++ b/contrib/README @@ -18,6 +18,11 @@ be fixed as time permits. Sample configuration for setting up a DNS-over-TLS server using BIND with Nginx as a TLS proxy. + - kasp/ + + Scripts for converting key and signature policies from OpenDNSSEC + KASP format to the policy.conf format used by dnssec-keymgr. + - dlz/modules Dynamically linkable DLZ modules that can be configured into diff --git a/contrib/dlz/modules/include/dlz_minimal.h b/contrib/dlz/modules/include/dlz_minimal.h index bac8ab12d1..ff87532a84 100644 --- a/contrib/dlz/modules/include/dlz_minimal.h +++ b/contrib/dlz/modules/include/dlz_minimal.h @@ -31,9 +31,9 @@ #include #include -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 #include -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ #include #include #include @@ -104,9 +104,9 @@ typedef struct isc_sockaddr { struct sockaddr sa; struct sockaddr_in sin; struct sockaddr_in6 sin6; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 struct sockaddr_un sunix; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } type; unsigned int length; void * link; diff --git a/contrib/kasp/README b/contrib/kasp/README new file mode 100644 index 0000000000..fb897f1073 --- /dev/null +++ b/contrib/kasp/README @@ -0,0 +1,11 @@ +This directory is for tools and scripts related to the OpenDNSSEC KASP +("key and signature policy") format. Currently it only contains +"kasp2policy.py", a python script for converting KASP key policy +to the "dnssec.policy" format that is used by dnssec-keymgr. + +This depends on PLY (python lex/yacc) and on the "isc.dnskey" module in +bin/python/isc. + +Basic test: +$ python kasp2policy.py kasp.xml > policy.out +$ diff policy.out policy.good diff --git a/contrib/kasp/kasp.xml b/contrib/kasp/kasp.xml new file mode 100644 index 0000000000..d94b0843ec --- /dev/null +++ b/contrib/kasp/kasp.xml @@ -0,0 +1,134 @@ + + + + + + A default policy that will + amaze you and your friends + + PT5M + PT5M + + PT15M + PT15M + + PT2M + PT1M + + + + + + + + + + PT1M + PT0S + PT0S + + + + 5 + PT40M + softHSM + 1 + + + + + 5 + PT25M + softHSM + 1 + + + + + PT0S + + PT0S + PT0S + unixtime + + + + + PT8M + + PT0S + + + PT0S + PT0S + + + + + A default policy that will amaze you and your friends + + PT7M + PT7M + + PT15M + PT16M + + PT2M + PT1M + + + + + P120D + + 1 + 5 + + + + + + + + PT15M + PT0S + PT0S + + + + 7 + PT45M + softHSM + 1 + + + + + 7 + PT25M + softHSM + 1 + + + + + PT0S + + PT0S + PT0S + unixtime + + + + + PT12M + + PT0S + + + PT0S + PT0S + + + + diff --git a/contrib/kasp/policy.good b/contrib/kasp/policy.good new file mode 100644 index 0000000000..18c636083c --- /dev/null +++ b/contrib/kasp/policy.good @@ -0,0 +1,24 @@ +# A default policy that will +# amaze you and your friends +policy Policy1 { + algorithm RSASHA1; + keyttl 60; + key-size ksk 2048; + key-size zsk 2048; + roll-period ksk 2400; + roll-period zsk 1500; + standby ksk 1; + standby zsk 1; +}; + +# A default policy that will amaze you and your friends +policy Policy2 { + algorithm NSEC3RSASHA1; + keyttl 900; + key-size ksk 2048; + key-size zsk 2048; + roll-period ksk 2700; + roll-period zsk 1500; + standby ksk 1; + standby zsk 1; +}; diff --git a/doc/arm/libdns.xml b/doc/arm/libdns.xml index f4758429db..21e4f69257 100644 --- a/doc/arm/libdns.xml +++ b/doc/arm/libdns.xml @@ -77,10 +77,6 @@ $ make install Normal installation of BIND will also install library object and header files. Root privilege is normally required. - - To see how to build your own application after the installation, see - lib/samples/Makefile-postinstall.in. -
diff --git a/lib/.gitignore b/lib/.gitignore index f4b58582ca..8445734faf 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -1,2 +1,3 @@ platform.h netdb.h +gen diff --git a/lib/Kyuafile b/lib/Kyuafile deleted file mode 100644 index 39ce98697b..0000000000 --- a/lib/Kyuafile +++ /dev/null @@ -1,9 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('dns/Kyuafile') -include('irs/Kyuafile') -include('isc/Kyuafile') -include('isccc/Kyuafile') -include('isccfg/Kyuafile') -include('ns/Kyuafile') diff --git a/lib/Makefile.am b/lib/Makefile.am new file mode 100644 index 0000000000..5cbaf3c895 --- /dev/null +++ b/lib/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/Makefile.top + +SUBDIRS = isc dns isccc ns isccfg bind9 irs samples diff --git a/lib/bind9/Makefile.am b/lib/bind9/Makefile.am new file mode 100644 index 0000000000..ffba4ace11 --- /dev/null +++ b/lib/bind9/Makefile.am @@ -0,0 +1,30 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libbind9.la + +libbind9_ladir = $(includedir)/bind9 +libbind9_la_HEADERS = \ + include/bind9/check.h \ + include/bind9/getaddresses.h + +libbind9_la_SOURCES = \ + $(libbind9_la_HEADERS) \ + check.c \ + getaddresses.c + +libbind9_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBBIND9_CFLAGS) + +libbind9_la_LIBADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) \ + $(LIBISCCFG_LIBS) + +libbind9_la_LDFLAGS = \ + $(libbind9_VERSION_INFO) diff --git a/lib/bind9/check.c b/lib/bind9/check.c index c1f8503b00..fdb0f42378 100644 --- a/lib/bind9/check.c +++ b/lib/bind9/check.c @@ -3899,7 +3899,6 @@ check_rpz_catz(const char *rpz_catz, const cfg_obj_t *rpz_obj, return (result); } -#ifdef HAVE_DLOPEN /*% * Data structure used for the 'callback_data' argument to check_one_plugin(). */ @@ -3947,7 +3946,6 @@ check_one_plugin(const cfg_obj_t *config, const cfg_obj_t *obj, return (ISC_R_SUCCESS); } -#endif /* ifdef HAVE_DLOPEN */ static isc_result_t check_dnstap(const cfg_obj_t *voptions, const cfg_obj_t *config, @@ -3997,9 +3995,6 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, const cfg_obj_t *view_ta = NULL, *global_ta = NULL; const cfg_obj_t *check_keys[2] = { NULL, NULL }; const cfg_obj_t *keys = NULL; -#ifndef HAVE_DLOPEN - const cfg_obj_t *dyndb = NULL; -#endif /* ifndef HAVE_DLOPEN */ const cfg_listelt_t *element, *element2; isc_symtab_t *symtab = NULL; isc_result_t result = ISC_R_SUCCESS; @@ -4057,22 +4052,6 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, } } -#ifndef HAVE_DLOPEN - if (voptions != NULL) { - (void)cfg_map_get(voptions, "dyndb", &dyndb); - } else { - (void)cfg_map_get(config, "dyndb", &dyndb); - } - - if (dyndb != NULL) { - cfg_obj_log(dyndb, logctx, ISC_LOG_ERROR, - "dynamic loading of databases is not supported"); - if (tresult != ISC_R_SUCCESS) { - result = ISC_R_NOTIMPLEMENTED; - } - } -#endif /* ifndef HAVE_DLOPEN */ - /* * Check that the response-policy and catalog-zones options * refer to zones that exist. @@ -4373,7 +4352,6 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, } } -#ifdef HAVE_DLOPEN { struct check_one_plugin_data check_one_plugin_data = { .mctx = mctx, @@ -4389,7 +4367,6 @@ check_viewconf(const cfg_obj_t *config, const cfg_obj_t *voptions, result = tresult; } } -#endif /* HAVE_DLOPEN */ cleanup: if (symtab != NULL) { diff --git a/lib/bind9/include/bind9/version.h b/lib/bind9/include/bind9/version.h deleted file mode 100644 index aa48b897f9..0000000000 --- a/lib/bind9/include/bind9/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 bind9/version.h */ - -#include - -LIBBIND9_EXTERNAL_DATA extern const char bind9_version[]; - -LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_libinterface; -LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_librevision; -LIBBIND9_EXTERNAL_DATA extern const unsigned int bind9_libage; diff --git a/lib/bind9/version.c b/lib/bind9/version.c deleted file mode 100644 index 6b25b6afbb..0000000000 --- a/lib/bind9/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -const char bind9_version[] = VERSION; - -const unsigned int bind9_libinterface = LIBINTERFACE; -const unsigned int bind9_librevision = LIBREVISION; -const unsigned int bind9_libage = LIBAGE; diff --git a/lib/bind9/win32/libbind9.vcxproj.filters.in b/lib/bind9/win32/libbind9.vcxproj.filters.in index 4e283308b7..3ea1f2067d 100644 --- a/lib/bind9/win32/libbind9.vcxproj.filters.in +++ b/lib/bind9/win32/libbind9.vcxproj.filters.in @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -38,8 +35,5 @@ Header Files - - Header Files - - \ No newline at end of file + diff --git a/lib/bind9/win32/libbind9.vcxproj.in b/lib/bind9/win32/libbind9.vcxproj.in index 4fd23e197d..817c378e56 100644 --- a/lib/bind9/win32/libbind9.vcxproj.in +++ b/lib/bind9/win32/libbind9.vcxproj.in @@ -121,12 +121,10 @@ - - diff --git a/lib/bind9/win32/version.c b/lib/bind9/win32/version.c deleted file mode 100644 index 11e99d1d25..0000000000 --- a/lib/bind9/win32/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBBIND9_EXTERNAL_DATA const char bind9_version[] = VERSION; - -LIBBIND9_EXTERNAL_DATA const unsigned int bind9_libinterface = LIBINTERFACE; -LIBBIND9_EXTERNAL_DATA const unsigned int bind9_librevision = LIBREVISION; -LIBBIND9_EXTERNAL_DATA const unsigned int bind9_libage = LIBAGE; diff --git a/lib/dns/Kyuafile b/lib/dns/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/dns/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am new file mode 100644 index 0000000000..62de041110 --- /dev/null +++ b/lib/dns/Makefile.am @@ -0,0 +1,352 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libdns.la + +nodist_libdns_ladir = $(includedir)/dns +nodist_libdns_la_HEADERS = \ + include/dns/enumclass.h \ + include/dns/enumtype.h \ + include/dns/rdatastruct.h + +nodist_libdns_la_SOURCES = \ + $(nodist_libdns_la_HEADERS) \ + code.h + +BUILT_SOURCES = \ + $(nodist_libdns_la_SOURCES) + +CLEANFILES = \ + $(nodist_libdns_la_SOURCES) + +noinst_PROGRAMS = gen + +gen_SOURCES = gen.c gen-unix.h + +gen_CPPFLAGS = \ + $(AM_CPPFLAGS) + +EXTRA_DIST = gen-win32.h + +include/dns/enumtype.h: gen Makefile + mkdir -p include/dns + $(builddir)/gen -s $(srcdir) -t > $@ + +include/dns/enumclass.h: gen Makefile + mkdir -p include/dns + $(builddir)/gen -s $(srcdir) -c > $@ + +include/dns/rdatastruct.h: gen rdata/rdatastructpre.h rdata/rdatastructsuf.h Makefile + mkdir -p include/dns + $(builddir)/gen -s $(srcdir) -i \ + -P $(srcdir)/rdata/rdatastructpre.h \ + -S $(srcdir)/rdata/rdatastructsuf.h > $@ + +code.h: gen Makefile + $(builddir)/gen -s $(srcdir) > $@ + +libdns_ladir = $(includedir)/dns +libdns_la_HEADERS = \ + include/dns/acl.h \ + include/dns/adb.h \ + include/dns/badcache.h \ + include/dns/bit.h \ + include/dns/byaddr.h \ + include/dns/cache.h \ + include/dns/callbacks.h \ + include/dns/catz.h \ + include/dns/cert.h \ + include/dns/client.h \ + include/dns/clientinfo.h \ + include/dns/compress.h \ + include/dns/db.h \ + include/dns/dbiterator.h \ + include/dns/dbtable.h \ + include/dns/diff.h \ + include/dns/dispatch.h \ + include/dns/dlz.h \ + include/dns/dlz_dlopen.h \ + include/dns/dns64.h \ + include/dns/dnsrps.h \ + include/dns/dnssec.h \ + include/dns/ds.h \ + include/dns/dsdigest.h \ + include/dns/dnstap.h \ + include/dns/dyndb.h \ + include/dns/ecs.h \ + include/dns/edns.h \ + include/dns/ecdb.h \ + include/dns/events.h \ + include/dns/fixedname.h \ + include/dns/forward.h \ + include/dns/geoip.h \ + include/dns/ipkeylist.h \ + include/dns/iptable.h \ + include/dns/journal.h \ + include/dns/kasp.h \ + include/dns/keydata.h \ + include/dns/keyflags.h \ + include/dns/keymgr.h \ + include/dns/keytable.h \ + include/dns/keyvalues.h \ + include/dns/lib.h \ + include/dns/librpz.h \ + include/dns/lookup.h \ + include/dns/log.h \ + include/dns/master.h \ + include/dns/masterdump.h \ + include/dns/message.h \ + include/dns/name.h \ + include/dns/ncache.h \ + include/dns/nsec.h \ + include/dns/nsec3.h \ + include/dns/nta.h \ + include/dns/opcode.h \ + include/dns/order.h \ + include/dns/peer.h \ + include/dns/portlist.h \ + include/dns/private.h \ + include/dns/rbt.h \ + include/dns/rcode.h \ + include/dns/rdata.h \ + include/dns/rdataclass.h \ + include/dns/rdatalist.h \ + include/dns/rdataset.h \ + include/dns/rdatasetiter.h \ + include/dns/rdataslab.h \ + include/dns/rdatatype.h \ + include/dns/request.h \ + include/dns/resolver.h \ + include/dns/result.h \ + include/dns/rootns.h \ + include/dns/rpz.h \ + include/dns/rriterator.h \ + include/dns/rrl.h \ + include/dns/sdb.h \ + include/dns/sdlz.h \ + include/dns/secalg.h \ + include/dns/secproto.h \ + include/dns/soa.h \ + include/dns/ssu.h \ + include/dns/stats.h \ + include/dns/tcpmsg.h \ + include/dns/time.h \ + include/dns/timer.h \ + include/dns/tkey.h \ + include/dns/tsec.h \ + include/dns/tsig.h \ + include/dns/ttl.h \ + include/dns/types.h \ + include/dns/update.h \ + include/dns/validator.h \ + include/dns/view.h \ + include/dns/xfrin.h \ + include/dns/zone.h \ + include/dns/zonekey.h \ + include/dns/zoneverify.h \ + include/dns/zt.h + +dstdir = $(includedir)/dst +dst_HEADERS = \ + include/dst/dst.h \ + include/dst/gssapi.h \ + include/dst/result.h + +libdns_la_SOURCES = \ + $(libdns_la_HEADERS) \ + $(dst_HEADERS) \ + acl.c \ + adb.c \ + badcache.c \ + byaddr.c \ + cache.c \ + callbacks.c \ + catz.c \ + clientinfo.c \ + compress.c \ + db.c \ + dbiterator.c \ + dbtable.c \ + diff.c \ + dispatch.c \ + dlz.c \ + dns64.c \ + dnsrps.c \ + dnssec.c \ + ds.c \ + dst_api.c \ + dst_internal.h \ + dst_openssl.h \ + dst_parse.c \ + dst_parse.h \ + dst_pkcs11.h \ + dst_result.c \ + dyndb.c \ + ecs.c \ + fixedname.c \ + forward.c \ + hmac_link.c \ + ipkeylist.c \ + iptable.c \ + journal.c \ + kasp.c \ + key.c \ + keydata.c \ + keymgr.c \ + keytable.c \ + lib.c \ + log.c \ + lookup.c \ + master.c \ + masterdump.c \ + message.c \ + name.c \ + ncache.c \ + nsec.c \ + nsec3.c \ + nta.c \ + openssl_link.c \ + openssldh_link.c \ + order.c \ + peer.c \ + private.c \ + portlist.c \ + rbt.c \ + rbtdb.h \ + rbtdb.c \ + rcode.c \ + rdata.c \ + rdatalist.c \ + rdataset.c \ + rdatasetiter.c \ + rdataslab.c \ + request.c \ + resolver.c \ + result.c \ + rootns.c \ + rpz.c \ + rrl.c \ + rriterator.c \ + sdb.c \ + sdlz.c \ + soa.c \ + ssu.c \ + ssu_external.c \ + stats.c \ + tcpmsg.c \ + time.c \ + timer.c \ + tkey.c \ + tsec.c \ + tsig.c \ + ttl.c \ + update.c \ + validator.c \ + view.c \ + xfrin.c \ + zone.c \ + zoneverify.c \ + zonekey.c \ + zt.c \ + client.c \ + ecdb.c \ + rdatalist_p.h \ + tsig_p.h \ + zone_p.h + +if HAVE_GSSAPI +libdns_la_SOURCES += \ + gssapi_link.c \ + gssapictx.c +else !HAVE_GSSAPI +libdns_la_SOURCES += \ + gssapictx-dummy.c +endif + +if HAVE_PKCS11 +libdns_la_SOURCES += \ + pkcs11.c \ + pkcs11ecdsa_link.c \ + pkcs11eddsa_link.c \ + pkcs11rsa_link.c +else !HAVE_PKCS11 +libdns_la_SOURCES += \ + opensslecdsa_link.c \ + openssleddsa_link.c \ + opensslrsa_link.c +endif + +if HAVE_GEOIP2 +libdns_la_SOURCES += \ + geoip2.c +endif + +libdns_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(OPENSSL_CFLAGS) \ + $(LIBLTDL_CFLAGS) + +libdns_la_LDFLAGS = \ + $(libdns_VERSION_INFO) + +libdns_la_LIBADD = \ + $(LIBISC_LIBS) \ + $(OPENSSL_LIBS) \ + $(LIBLTDL_LIBS) + +if HAVE_JSON_C +libdns_la_CPPFLAGS += \ + $(JSON_C_CFLAGS) + +libdns_la_LIBADD += \ + $(JSON_C_LIBS) +endif HAVE_JSON_C + +if HAVE_LIBXML2 +libdns_la_CPPFLAGS += \ + $(LIBXML2_CFLAGS) + +libdns_la_LIBADD += \ + $(LIBXML2_LIBS) +endif HAVE_LIBXML2 + +if HAVE_GSSAPI +libdns_la_CPPFLAGS += \ + $(GSSAPI_CFLAGS) \ + $(KRB5_CFLAGS) +libdns_la_LIBADD += \ + $(GSSAPI_LIBS) \ + $(KRB5_LIBS) +endif + +if HAVE_GEOIP2 +libdns_la_CPPFLAGS += \ + $(MAXMINDDB_CFLAGS) +libdns_la_LDFLAGS += \ + $(MAXMINDDB_LIBS) +endif + +if HAVE_DNSTAP +nodist_libdns_la_SOURCES += \ + dnstap.pb-c.h \ + dnstap.pb-c.c + +libdns_la_SOURCES += \ + dnstap.c + +dnstap.pb-c.h dnstap.pb-c.c: dnstap.proto + $(PROTOC_C) --proto_path=$(srcdir) --c_out=. dnstap.proto + +libdns_la_CPPFLAGS += $(DNSTAP_CFLAGS) +libdns_la_LIBADD += $(DNSTAP_LIBS) +endif + +if HAVE_LMDB +libdns_la_CPPFLAGS += $(LMDB_CFLAGS) +libdns_la_LIBADD += $(LMDB_LIBS) +endif + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/dns/dnstap.c b/lib/dns/dnstap.c index 55efea3f50..42de18f9e4 100644 --- a/lib/dns/dnstap.c +++ b/lib/dns/dnstap.c @@ -135,7 +135,7 @@ typedef struct ioq { struct fstrm_iothr_queue *ioq; } dt__ioq_t; -ISC_THREAD_LOCAL dt__ioq_t dt_ioq = { 0 }; +static thread_local dt__ioq_t dt_ioq = { 0 }; static atomic_uint_fast32_t global_generation; diff --git a/lib/dns/dst_api.c b/lib/dns/dst_api.c index 94106a3fc1..2466bb734f 100644 --- a/lib/dns/dst_api.c +++ b/lib/dns/dst_api.c @@ -231,9 +231,9 @@ dst_lib_init(isc_mem_t *mctx, const char *engine) { RETERR(dst__pkcs11eddsa_init(&dst_t_func[DST_ALG_ED25519])); RETERR(dst__pkcs11eddsa_init(&dst_t_func[DST_ALG_ED448])); #endif /* USE_PKCS11 */ -#ifdef GSSAPI +#if HAVE_GSSAPI RETERR(dst__gssapi_init(&dst_t_func[DST_ALG_GSSAPI])); -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ dst_initialized = true; return (ISC_R_SUCCESS); diff --git a/lib/dns/dst_internal.h b/lib/dns/dst_internal.h index 116e2d28fa..48595db66b 100644 --- a/lib/dns/dst_internal.h +++ b/lib/dns/dst_internal.h @@ -237,10 +237,10 @@ dst__pkcs11ecdsa_init(struct dst_func **funcp); isc_result_t dst__pkcs11eddsa_init(struct dst_func **funcp); #endif /* USE_PKCS11 */ -#ifdef GSSAPI +#if HAVE_GSSAPI isc_result_t dst__gssapi_init(struct dst_func **funcp); -#endif /* GSSAPI */ +#endif /* HAVE_GSSAPI*/ /*% * Destructors diff --git a/lib/dns/dyndb.c b/lib/dns/dyndb.c index fdc8ea59f8..93bc9c712b 100644 --- a/lib/dns/dyndb.c +++ b/lib/dns/dyndb.c @@ -9,12 +9,7 @@ * information regarding copyright ownership. */ -#if HAVE_DLFCN_H -#include -#elif _WIN32 -#include -#endif /* if HAVE_DLFCN_H */ - +#include #include #include @@ -83,19 +78,17 @@ impfind(const char *name) { return (NULL); } -#if HAVE_DLFCN_H && HAVE_DLOPEN static isc_result_t -load_symbol(void *handle, const char *filename, const char *symbol_name, +load_symbol(lt_dlhandle handle, const char *filename, const char *symbol_name, void **symbolp) { - const char *errmsg; void *symbol; REQUIRE(handle != NULL); REQUIRE(symbolp != NULL && *symbolp == NULL); - symbol = dlsym(handle, symbol_name); + symbol = lt_dlsym(handle, symbol_name); if (symbol == NULL) { - errmsg = dlerror(); + const char *errmsg = lt_dlerror(); if (errmsg == NULL) { errmsg = "returned function pointer is NULL"; } @@ -106,7 +99,7 @@ load_symbol(void *handle, const char *filename, const char *symbol_name, symbol_name, filename, errmsg); return (ISC_R_FAILURE); } - dlerror(); + (void)lt_dlerror(); *symbolp = symbol; @@ -117,12 +110,12 @@ static isc_result_t load_library(isc_mem_t *mctx, const char *filename, const char *instname, dyndb_implementation_t **impp) { isc_result_t result; - void *handle = NULL; + lt_dlhandle handle = NULL; dyndb_implementation_t *imp = NULL; dns_dyndb_register_t *register_func = NULL; dns_dyndb_destroy_t *destroy_func = NULL; dns_dyndb_version_t *version_func = NULL; - int version, flags; + int version; REQUIRE(impp != NULL && *impp == NULL); @@ -130,18 +123,17 @@ load_library(isc_mem_t *mctx, const char *filename, const char *instname, ISC_LOG_INFO, "loading DynDB instance '%s' driver '%s'", instname, filename); - flags = RTLD_NOW | RTLD_LOCAL; -#if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ - flags |= RTLD_DEEPBIND; -#endif /* if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ */ + if (lt_dlinit() != 0) { + CHECK(ISC_R_FAILURE); + } - handle = dlopen(filename, flags); + handle = lt_dlopen(filename); if (handle == NULL) { CHECK(ISC_R_FAILURE); } /* Clear dlerror */ - dlerror(); + (void)lt_dlerror(); CHECK(load_symbol(handle, filename, "dyndb_version", (void **)&version_func)); @@ -183,7 +175,7 @@ cleanup: DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR, "failed to dynamically load instance '%s' " "driver '%s': %s (%s)", - instname, filename, dlerror(), + instname, filename, lt_dlerror(), isc_result_totext(result)); } if (imp != NULL) { @@ -191,7 +183,7 @@ cleanup: sizeof(dyndb_implementation_t)); } if (result != ISC_R_SUCCESS && handle != NULL) { - dlclose(handle); + (void)lt_dlclose(handle); } return (result); @@ -209,140 +201,6 @@ unload_library(dyndb_implementation_t **impp) { isc_mem_free(imp->mctx, imp->name); isc_mem_putanddetach(&imp->mctx, imp, sizeof(dyndb_implementation_t)); } -#elif _WIN32 -static isc_result_t -load_symbol(HMODULE handle, const char *filename, const char *symbol_name, - void **symbolp) { - void *symbol; - - REQUIRE(handle != NULL); - REQUIRE(symbolp != NULL && *symbolp == NULL); - - symbol = GetProcAddress(handle, symbol_name); - if (symbol == NULL) { - int errstatus = GetLastError(); - isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, - DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR, - "failed to lookup symbol %s in " - "dyndb module '%s': %d", - symbol_name, filename, errstatus); - return (ISC_R_FAILURE); - } - - *symbolp = symbol; - - return (ISC_R_SUCCESS); -} - -static isc_result_t -load_library(isc_mem_t *mctx, const char *filename, const char *instname, - dyndb_implementation_t **impp) { - isc_result_t result; - HMODULE handle; - dyndb_implementation_t *imp = NULL; - dns_dyndb_register_t *register_func = NULL; - dns_dyndb_destroy_t *destroy_func = NULL; - dns_dyndb_version_t *version_func = NULL; - int version; - - REQUIRE(impp != NULL && *impp == NULL); - - isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DYNDB, - ISC_LOG_INFO, "loading DynDB instance '%s' driver '%s'", - instname, filename); - - handle = LoadLibraryA(filename); - if (handle == NULL) { - CHECK(ISC_R_FAILURE); - } - - CHECK(load_symbol(handle, filename, "dyndb_version", - (void **)&version_func)); - - version = version_func(NULL); - if (version < (DNS_DYNDB_VERSION - DNS_DYNDB_AGE) || - version > DNS_DYNDB_VERSION) - { - isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, - DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR, - "driver API version mismatch: %d/%d", version, - DNS_DYNDB_VERSION); - CHECK(ISC_R_FAILURE); - } - - CHECK(load_symbol(handle, filename, "dyndb_init", - (void **)®ister_func)); - CHECK(load_symbol(handle, filename, "dyndb_destroy", - (void **)&destroy_func)); - - imp = isc_mem_get(mctx, sizeof(dyndb_implementation_t)); - - imp->mctx = NULL; - isc_mem_attach(mctx, &imp->mctx); - imp->handle = handle; - imp->register_func = register_func; - imp->destroy_func = destroy_func; - imp->name = isc_mem_strdup(mctx, instname); - - imp->inst = NULL; - INIT_LINK(imp, link); - - *impp = imp; - imp = NULL; - -cleanup: - if (result != ISC_R_SUCCESS) { - isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, - DNS_LOGMODULE_DYNDB, ISC_LOG_ERROR, - "failed to dynamically load instance '%s' " - "driver '%s': %d (%s)", - instname, filename, GetLastError(), - isc_result_totext(result)); - } - if (imp != NULL) { - isc_mem_putanddetach(&imp->mctx, imp, - sizeof(dyndb_implementation_t)); - } - if (result != ISC_R_SUCCESS && handle != NULL) { - FreeLibrary(handle); - } - - return (result); -} - -static void -unload_library(dyndb_implementation_t **impp) { - dyndb_implementation_t *imp; - - REQUIRE(impp != NULL && *impp != NULL); - - imp = *impp; - *impp = NULL; - - isc_mem_free(imp->mctx, imp->name); - isc_mem_putanddetach(&imp->mctx, imp, sizeof(dyndb_implementation_t)); -} -#else /* HAVE_DLFCN_H || _WIN32 */ -static isc_result_t -load_library(isc_mem_t *mctx, const char *filename, const char *instname, - dyndb_implementation_t **impp) { - UNUSED(mctx); - UNUSED(filename); - UNUSED(instname); - UNUSED(impp); - - isc_log_write(dns_lctx, DNS_LOGCATEGORY_DATABASE, DNS_LOGMODULE_DYNDB, - ISC_LOG_ERROR, - "dynamic database support is not implemented"); - - return (ISC_R_NOTIMPLEMENTED); -} - -static void -unload_library(dyndb_implementation_t **impp) { - UNUSED(impp); -} -#endif /* HAVE_DLFCN_H */ isc_result_t dns_dyndb_load(const char *libname, const char *name, const char *parameters, diff --git a/lib/dns/gen-unix.h b/lib/dns/gen-unix.h index 36f5b4729e..86f1124c48 100644 --- a/lib/dns/gen-unix.h +++ b/lib/dns/gen-unix.h @@ -32,7 +32,13 @@ #include /* Required on some systems for dirent.h. */ #include /* XXXDCL Required for ?. */ -#include +#ifdef __cplusplus +#define ISC_LANG_BEGINDECLS extern "C" { +#define ISC_LANG_ENDDECLS } +#else /* ifdef __cplusplus */ +#define ISC_LANG_BEGINDECLS +#define ISC_LANG_ENDDECLS +#endif /* ifdef __cplusplus */ #ifdef NEED_OPTARG extern char *optarg; diff --git a/lib/dns/gen-win32.h b/lib/dns/gen-win32.h index 31188558a8..ad16243615 100644 --- a/lib/dns/gen-win32.h +++ b/lib/dns/gen-win32.h @@ -65,7 +65,13 @@ #include #include -#include +#ifdef __cplusplus +#define ISC_LANG_BEGINDECLS extern "C" { +#define ISC_LANG_ENDDECLS } +#else /* ifdef __cplusplus */ +#define ISC_LANG_BEGINDECLS +#define ISC_LANG_ENDDECLS +#endif /* ifdef __cplusplus */ int isc_commandline_index = 1; /* Index into parent argv vector. */ int isc_commandline_option; /* Character checked for validity. */ diff --git a/lib/dns/geoip2.c b/lib/dns/geoip2.c index 9e7e6d49f0..91cc5ce94d 100644 --- a/lib/dns/geoip2.c +++ b/lib/dns/geoip2.c @@ -70,7 +70,7 @@ typedef struct geoip_state { MMDB_entry_s entry; } geoip_state_t; -ISC_THREAD_LOCAL geoip_state_t geoip_state = { 0 }; +static thread_local geoip_state_t geoip_state = { 0 }; static void set_state(const MMDB_s *db, const isc_netaddr_t *addr, diff --git a/lib/dns/gssapi_link.c b/lib/dns/gssapi_link.c index 3a939709d4..fe3bc7562f 100644 --- a/lib/dns/gssapi_link.c +++ b/lib/dns/gssapi_link.c @@ -9,9 +9,21 @@ * information regarding copyright ownership. */ -#ifdef GSSAPI - +#include /* IWYU pragma: keep */ #include +#include /* IWYU pragma: keep */ + +#if HAVE_GSSAPI_GSSAPI_H +#include +#elif HAVE_GSSAPI_H +#include +#endif + +#if HAVE_GSSAPI_GSSAPI_KRB5_H +#include +#elif HAVE_GSSAPI_KRB5_H +#include +#endif #include #include @@ -354,8 +366,4 @@ dst__gssapi_init(dst_func_t **funcp) { return (ISC_R_SUCCESS); } -#else /* ifdef GSSAPI */ -int gssapi_link_unneeded = 1; -#endif /* ifdef GSSAPI */ - /*! \file */ diff --git a/lib/dns/gssapictx-dummy.c b/lib/dns/gssapictx-dummy.c new file mode 100644 index 0000000000..b155ef710b --- /dev/null +++ b/lib/dns/gssapictx-dummy.c @@ -0,0 +1,103 @@ +/* + * 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 + +isc_result_t +dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, + gss_cred_id_t *cred) { + REQUIRE(cred != NULL && *cred == NULL); + + UNUSED(name); + UNUSED(initiate); + UNUSED(cred); + + return (ISC_R_NOTIMPLEMENTED); +} + +bool +dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, + const dns_name_t *name, + const dns_name_t *realm, bool subdomain) { + UNUSED(signer); + UNUSED(name); + UNUSED(realm); + UNUSED(subdomain); + + return (false); +} + +bool +dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, + const dns_name_t *name, + const dns_name_t *realm, bool subdomain) { + UNUSED(signer); + UNUSED(name); + UNUSED(realm); + UNUSED(subdomain); + + return (false); +} + +isc_result_t +dst_gssapi_releasecred(gss_cred_id_t *cred) { + UNUSED(cred); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +dst_gssapi_initctx(const dns_name_t *name, isc_buffer_t *intoken, + isc_buffer_t *outtoken, gss_ctx_id_t *gssctx, + isc_mem_t *mctx, char **err_message) { + UNUSED(name); + UNUSED(intoken); + UNUSED(outtoken); + UNUSED(gssctx); + UNUSED(mctx); + UNUSED(err_message); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +dst_gssapi_acceptctx(gss_cred_id_t cred, const char *gssapi_keytab, + isc_region_t *intoken, isc_buffer_t **outtoken, + gss_ctx_id_t *ctxout, dns_name_t *principal, + isc_mem_t *mctx) { + UNUSED(cred); + UNUSED(gssapi_keytab); + UNUSED(intoken); + UNUSED(outtoken); + UNUSED(ctxout); + UNUSED(principal); + UNUSED(mctx); + + return (ISC_R_NOTIMPLEMENTED); +} + +isc_result_t +dst_gssapi_deletectx(isc_mem_t *mctx, gss_ctx_id_t *gssctx) { + UNUSED(mctx); + UNUSED(gssctx); + return (ISC_R_NOTIMPLEMENTED); +} + +/*! \file */ diff --git a/lib/dns/gssapictx.c b/lib/dns/gssapictx.c index 18f1280a28..bf75147ef3 100644 --- a/lib/dns/gssapictx.c +++ b/lib/dns/gssapictx.c @@ -14,6 +14,25 @@ #include #include #include +#include + +#if HAVE_GSSAPI_GSSAPI_H +#include +#elif HAVE_GSSAPI_H +#include +#endif + +#if HAVE_GSSAPI_GSSAPI_KRB5_H +#include +#elif HAVE_GSSAPI_KRB5_H +#include +#endif + +#if HAVE_KRB5_KRB5_H +#include +#elif HAVE_KRB5_H +#include +#endif #include #include @@ -42,50 +61,23 @@ #include "dst_internal.h" -/* - * If we're using our own SPNEGO implementation (see configure.in), - * pull it in now. Otherwise, we just use whatever GSSAPI supplies. - */ -#if defined(GSSAPI) && defined(USE_ISC_SPNEGO) -#include "spnego.h" -#define gss_accept_sec_context gss_accept_sec_context_spnego -#define gss_init_sec_context gss_init_sec_context_spnego -#endif /* if defined(GSSAPI) && defined(USE_ISC_SPNEGO) */ - -/* - * Solaris8 apparently needs an explicit OID set, and Solaris10 needs - * one for anything but Kerberos. Supplying an explicit OID set - * doesn't appear to hurt anything in other implementations, so we - * always use one. If we're not using our own SPNEGO implementation, - * we include SPNEGO's OID. - */ -#ifdef GSSAPI -#ifdef WIN32 -#include -#else /* ifdef WIN32 */ -#include ISC_PLATFORM_KRB5HEADER -#endif /* ifdef WIN32 */ - +#ifndef GSS_KRB5_MECHANISM static unsigned char krb5_mech_oid_bytes[] = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x12, 0x01, 0x02, 0x02 }; +static gss_OID_desc __gss_krb5_mechanism_oid_desc = { + sizeof(krb5_mech_oid_bytes), krb5_mech_oid_bytes +}; +#define GSS_KRB5_MECHANISM (&__gss_krb5_mechanism_oid_desc) +#endif /* ifndef GSS_KRB5_MECHANISM */ -#ifndef USE_ISC_SPNEGO +#ifndef GSS_SPNEGO_MECHANISM static unsigned char spnego_mech_oid_bytes[] = { 0x2b, 0x06, 0x01, 0x05, 0x05, 0x02 }; -#endif /* ifndef USE_ISC_SPNEGO */ - -static gss_OID_desc mech_oid_set_array[] = { - { sizeof(krb5_mech_oid_bytes), krb5_mech_oid_bytes }, -#ifndef USE_ISC_SPNEGO - { sizeof(spnego_mech_oid_bytes), spnego_mech_oid_bytes }, -#endif /* ifndef USE_ISC_SPNEGO */ +static gss_OID_desc __gss_spnego_mechanism_oid_desc = { + sizeof(spnego_mech_oid_bytes), spnego_mech_oid_bytes }; - -static gss_OID_set_desc mech_oid_set = { sizeof(mech_oid_set_array) / - sizeof(*mech_oid_set_array), - mech_oid_set_array }; - -#endif /* ifdef GSSAPI */ +#define GSS_SPNEGO_MECHANISM (&__gss_spnego_mechanism_oid_desc) +#endif /* ifndef GSS_SPNEGO_MECHANISM */ #define REGION_TO_GBUFFER(r, gb) \ do { \ @@ -106,7 +98,6 @@ static gss_OID_set_desc mech_oid_set = { sizeof(mech_oid_set_array) / goto out; \ } while (0) -#ifdef GSSAPI static inline void name_to_gbuffer(const dns_name_t *name, isc_buffer_t *buffer, gss_buffer_desc *gbuffer) { @@ -187,9 +178,7 @@ log_cred(const gss_cred_id_t cred) { gss_error_tostring(gret, minor, buf, sizeof(buf))); } } -#endif /* ifdef GSSAPI */ -#ifdef GSSAPI /* * check for the most common configuration errors. * @@ -243,12 +232,43 @@ check_config(const char *gss_name) { } krb5_free_context(krb5_ctx); } -#endif /* ifdef GSSAPI */ + +static OM_uint32 +mech_oid_set_create(OM_uint32 *minor, gss_OID_set *mech_oid_set) { + OM_uint32 gret; + + gret = gss_create_empty_oid_set(minor, mech_oid_set); + if (gret != GSS_S_COMPLETE) { + return (gret); + } + + gret = gss_add_oid_set_member(minor, GSS_KRB5_MECHANISM, mech_oid_set); + if (gret != GSS_S_COMPLETE) { + goto release; + } + + gret = gss_add_oid_set_member(minor, GSS_SPNEGO_MECHANISM, + mech_oid_set); + if (gret != GSS_S_COMPLETE) { + goto release; + } + +release: + REQUIRE(gss_release_oid_set(minor, mech_oid_set) == GSS_S_COMPLETE); + + return (gret); +} + +static void +mech_oid_set_release(gss_OID_set *mech_oid_set) { + OM_uint32 minor; + + REQUIRE(gss_release_oid_set(&minor, mech_oid_set) == GSS_S_COMPLETE); +} isc_result_t dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, gss_cred_id_t *cred) { -#ifdef GSSAPI isc_result_t result; isc_buffer_t namebuf; gss_name_t gname; @@ -258,6 +278,7 @@ dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, OM_uint32 lifetime; gss_cred_usage_t usage; char buf[1024]; + gss_OID_set mech_oid_set; REQUIRE(cred != NULL && *cred == NULL); @@ -301,7 +322,14 @@ dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, usage = GSS_C_ACCEPT; } - gret = gss_acquire_cred(&minor, gname, GSS_C_INDEFINITE, &mech_oid_set, + gret = mech_oid_set_create(&minor, &mech_oid_set); + if (gret != GSS_S_COMPLETE) { + gss_log(3, "failed to create OID_set: %s", + gss_error_tostring(gret, minor, buf, sizeof(buf))); + return (ISC_R_FAILURE); + } + + gret = gss_acquire_cred(&minor, gname, GSS_C_INDEFINITE, mech_oid_set, usage, cred, NULL, &lifetime); if (gret != GSS_S_COMPLETE) { @@ -324,6 +352,8 @@ dst_gssapi_acquirecred(const dns_name_t *name, bool initiate, result = ISC_R_SUCCESS; cleanup: + mech_oid_set_release(&mech_oid_set); + if (gname != NULL) { gret = gss_release_name(&minor, &gname); if (gret != GSS_S_COMPLETE) { @@ -334,22 +364,12 @@ cleanup: } return (result); -#else /* ifdef GSSAPI */ - REQUIRE(cred != NULL && *cred == NULL); - - UNUSED(name); - UNUSED(initiate); - UNUSED(cred); - - return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef GSSAPI */ } bool dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm, bool subdomain) { -#ifdef GSSAPI char sbuf[DNS_NAME_FORMATSIZE]; char rbuf[DNS_NAME_FORMATSIZE]; char *sname; @@ -421,20 +441,12 @@ dst_gssapi_identitymatchesrealmkrb5(const dns_name_t *signer, } return (true); -#else /* ifdef GSSAPI */ - UNUSED(signer); - UNUSED(name); - UNUSED(realm); - UNUSED(subdomain); - return (false); -#endif /* ifdef GSSAPI */ } bool dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, const dns_name_t *name, const dns_name_t *realm, bool subdomain) { -#ifdef GSSAPI char sbuf[DNS_NAME_FORMATSIZE]; char rbuf[DNS_NAME_FORMATSIZE]; char *sname; @@ -509,18 +521,10 @@ dst_gssapi_identitymatchesrealmms(const dns_name_t *signer, } return (true); -#else /* ifdef GSSAPI */ - UNUSED(signer); - UNUSED(name); - UNUSED(realm); - UNUSED(subdomain); - return (false); -#endif /* ifdef GSSAPI */ } isc_result_t dst_gssapi_releasecred(gss_cred_id_t *cred) { -#ifdef GSSAPI OM_uint32 gret, minor; char buf[1024]; @@ -535,14 +539,8 @@ dst_gssapi_releasecred(gss_cred_id_t *cred) { *cred = NULL; return (ISC_R_SUCCESS); -#else /* ifdef GSSAPI */ - UNUSED(cred); - - return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef GSSAPI */ } -#ifdef GSSAPI /* * Format a gssapi error message info into a char ** on the given memory * context. This is used to return gssapi error messages back up the @@ -564,13 +562,11 @@ gss_err_message(isc_mem_t *mctx, uint32_t major, uint32_t minor, (*err_message) = isc_mem_strdup(mctx, estr); } } -#endif /* ifdef GSSAPI */ isc_result_t dst_gssapi_initctx(const dns_name_t *name, isc_buffer_t *intoken, isc_buffer_t *outtoken, gss_ctx_id_t *gssctx, isc_mem_t *mctx, char **err_message) { -#ifdef GSSAPI isc_region_t r; isc_buffer_t namebuf; gss_name_t gname; @@ -652,16 +648,6 @@ out: } (void)gss_release_name(&minor, &gname); return (result); -#else /* ifdef GSSAPI */ - UNUSED(name); - UNUSED(intoken); - UNUSED(outtoken); - UNUSED(gssctx); - UNUSED(mctx); - UNUSED(err_message); - - return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef GSSAPI */ } isc_result_t @@ -669,7 +655,6 @@ dst_gssapi_acceptctx(gss_cred_id_t cred, const char *gssapi_keytab, isc_region_t *intoken, isc_buffer_t **outtoken, gss_ctx_id_t *ctxout, dns_name_t *principal, isc_mem_t *mctx) { -#ifdef GSSAPI isc_region_t r; isc_buffer_t namebuf; gss_buffer_desc gnamebuf = GSS_C_EMPTY_BUFFER, gintoken, @@ -691,7 +676,6 @@ dst_gssapi_acceptctx(gss_cred_id_t cred, const char *gssapi_keytab, } if (gssapi_keytab != NULL) { -#if defined(ISC_PLATFORM_GSSAPI_KRB5_HEADER) || defined(WIN32) gret = gsskrb5_register_acceptor_identity(gssapi_keytab); if (gret != GSS_S_COMPLETE) { gss_log(3, @@ -701,27 +685,6 @@ dst_gssapi_acceptctx(gss_cred_id_t cred, const char *gssapi_keytab, gss_error_tostring(gret, 0, buf, sizeof(buf))); return (DNS_R_INVALIDTKEY); } -#else /* if defined(ISC_PLATFORM_GSSAPI_KRB5_HEADER) || defined(WIN32) */ - /* - * Minimize memory leakage by only setting KRB5_KTNAME - * if it needs to change. - */ - const char *old = getenv("KRB5_KTNAME"); - if (old == NULL || strcmp(old, gssapi_keytab) != 0) { - size_t size; - char *kt; - - size = strlen(gssapi_keytab) + 13; - kt = malloc(size); - if (kt == NULL) { - return (ISC_R_NOMEMORY); - } - snprintf(kt, size, "KRB5_KTNAME=%s", gssapi_keytab); - if (putenv(kt) != 0) { - return (ISC_R_NOMEMORY); - } - } -#endif /* if defined(ISC_PLATFORM_GSSAPI_KRB5_HEADER) || defined(WIN32) */ } log_cred(cred); @@ -819,22 +782,10 @@ out: } return (result); -#else /* ifdef GSSAPI */ - UNUSED(cred); - UNUSED(gssapi_keytab); - UNUSED(intoken); - UNUSED(outtoken); - UNUSED(ctxout); - UNUSED(principal); - UNUSED(mctx); - - return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef GSSAPI */ } isc_result_t dst_gssapi_deletectx(isc_mem_t *mctx, gss_ctx_id_t *gssctx) { -#ifdef GSSAPI OM_uint32 gret, minor; char buf[1024]; @@ -850,16 +801,10 @@ dst_gssapi_deletectx(isc_mem_t *mctx, gss_ctx_id_t *gssctx) { gss_error_tostring(gret, minor, buf, sizeof(buf))); } return (ISC_R_SUCCESS); -#else /* ifdef GSSAPI */ - UNUSED(mctx); - UNUSED(gssctx); - return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef GSSAPI */ } char * gss_error_tostring(uint32_t major, uint32_t minor, char *buf, size_t buflen) { -#ifdef GSSAPI gss_buffer_desc msg_minor = GSS_C_EMPTY_BUFFER, msg_major = GSS_C_EMPTY_BUFFER; OM_uint32 msg_ctx, minor_stat; @@ -884,12 +829,6 @@ gss_error_tostring(uint32_t major, uint32_t minor, char *buf, size_t buflen) { (void)gss_release_buffer(&minor_stat, &msg_minor); } return (buf); -#else /* ifdef GSSAPI */ - snprintf(buf, buflen, "GSSAPI error: Major = %u, Minor = %u.", major, - minor); - - return (buf); -#endif /* ifdef GSSAPI */ } void diff --git a/lib/dns/include/dns/types.h b/lib/dns/include/dns/types.h index e20e1e505c..fb90ed610d 100644 --- a/lib/dns/include/dns/types.h +++ b/lib/dns/include/dns/types.h @@ -156,13 +156,6 @@ typedef struct dns_zonemgr dns_zonemgr_t; typedef struct dns_zt dns_zt_t; typedef struct dns_ipkeylist dns_ipkeylist_t; -/* - * If we are not using GSSAPI, define the types we use as opaque types here. - */ -#ifndef GSSAPI -typedef struct not_defined_gss_cred_id *gss_cred_id_t; -typedef struct not_defined_gss_ctx * gss_ctx_id_t; -#endif /* ifndef GSSAPI */ typedef struct dst_gssapi_signverifyctx dst_gssapi_signverifyctx_t; typedef enum { dns_hash_sha1 = 1 } dns_hash_t; diff --git a/lib/dns/include/dns/version.h b/lib/dns/include/dns/version.h deleted file mode 100644 index 0552e81e40..0000000000 --- a/lib/dns/include/dns/version.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 dns/version.h */ - -#ifndef DNS_VERSION_H -#define DNS_VERSION_H 1 - -#include - -LIBDNS_EXTERNAL_DATA extern const char dns_version[]; -LIBDNS_EXTERNAL_DATA extern const char dns_major[]; -LIBDNS_EXTERNAL_DATA extern const char dns_mapapi[]; - -LIBDNS_EXTERNAL_DATA extern const unsigned int dns_libinterface; -LIBDNS_EXTERNAL_DATA extern const unsigned int dns_librevision; -LIBDNS_EXTERNAL_DATA extern const unsigned int dns_libage; - -#endif /* DNS_VERSION_H */ diff --git a/lib/dns/include/dst/gssapi.h b/lib/dns/include/dst/gssapi.h index 4248b39ace..7767577f69 100644 --- a/lib/dns/include/dst/gssapi.h +++ b/lib/dns/include/dst/gssapi.h @@ -17,6 +17,12 @@ #include #include +#if HAVE_GSSAPI_GSSAPI_H +#include +#elif HAVE_GSSAPI_H +#include +#endif + #include #include #include @@ -24,23 +30,16 @@ #include -#ifdef GSSAPI -#ifdef WIN32 /* - * MSVC does not like macros in #include lines. + * Define dummy opaque typedefs if we are not using GSSAPI + * + * FIXME: Make the gssapi types completely opaque and include only + * internally. */ -#include -#include -#else /* ifdef WIN32 */ -#include ISC_PLATFORM_GSSAPIHEADER -#ifdef ISC_PLATFORM_GSSAPI_KRB5_HEADER -#include ISC_PLATFORM_GSSAPI_KRB5_HEADER -#endif /* ifdef ISC_PLATFORM_GSSAPI_KRB5_HEADER */ -#endif /* ifdef WIN32 */ -#ifndef GSS_SPNEGO_MECHANISM -#define GSS_SPNEGO_MECHANISM ((void *)0) -#endif /* ifndef GSS_SPNEGO_MECHANISM */ -#endif /* ifdef GSSAPI */ +#if !HAVE_GSSAPI +typedef void *gss_cred_id_t; +typedef void *gss_ctx_id_t; +#endif ISC_LANG_BEGINDECLS diff --git a/lib/dns/mapapi b/lib/dns/mapapi deleted file mode 100644 index d7a692f964..0000000000 --- a/lib/dns/mapapi +++ /dev/null @@ -1,16 +0,0 @@ -# This value should be increased whenever changing the structure of -# any object that will appear in a type 'map' master file (which -# contains a working memory image of an RBT database), as loading -# an incorrect memory image produces an inconsistent and probably -# nonfunctional database. These structures include but are not -# necessarily limited to dns_masterrawheader, rbtdb_file_header, -# rbt_file_header, dns_rbtdb, dns_rbt, dns_rbtnode, rdatasetheader. -# -# Err on the side of caution: if anything in the RBTDB is changed, -# bump the value. Making map files unreadable protects the system -# from instability; it's a feature not a bug. -# -# Whenever releasing a new major release of BIND9, set this value -# back to 1.0 when releasing the first alpha. Map files are *never* -# compatible across major releases. -MAPAPI=2.0 diff --git a/lib/dns/name.c b/lib/dns/name.c index 831b534fb1..7f581847e4 100644 --- a/lib/dns/name.c +++ b/lib/dns/name.c @@ -148,7 +148,7 @@ LIBDNS_EXTERNAL_DATA const dns_name_t *dns_wildcardname = &wild; /* * dns_name_t to text post-conversion procedure. */ -ISC_THREAD_LOCAL dns_name_totextfilter_t *totext_filter_proc = NULL; +static thread_local dns_name_totextfilter_t *totext_filter_proc = NULL; static void set_offsets(const dns_name_t *name, unsigned char *offsets, diff --git a/lib/dns/opensslecdsa_link.c b/lib/dns/opensslecdsa_link.c index ba9b4dd1fd..72f4608d99 100644 --- a/lib/dns/opensslecdsa_link.c +++ b/lib/dns/opensslecdsa_link.c @@ -11,8 +11,6 @@ /*! \file */ -#if !USE_PKCS11 - #include #include @@ -684,5 +682,3 @@ dst__opensslecdsa_init(dst_func_t **funcp) { } return (ISC_R_SUCCESS); } - -#endif /* !USE_PKCS11 */ diff --git a/lib/dns/openssleddsa_link.c b/lib/dns/openssleddsa_link.c index 524d6473bf..9ccde3a1e8 100644 --- a/lib/dns/openssleddsa_link.c +++ b/lib/dns/openssleddsa_link.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if !USE_PKCS11 +/*! \file */ #if HAVE_OPENSSL_ED25519 || HAVE_OPENSSL_ED448 @@ -33,7 +33,6 @@ #include "dst_internal.h" #include "dst_openssl.h" #include "dst_parse.h" -#include "openssl_shim.h" #define DST_RET(a) \ { \ @@ -777,7 +776,3 @@ dst__openssleddsa_init(dst_func_t **funcp) { } #endif /* HAVE_OPENSSL_ED25519 || HAVE_OPENSSL_ED448 */ - -#endif /* !USE_PKCS11 */ - -/*! \file */ diff --git a/lib/dns/opensslrsa_link.c b/lib/dns/opensslrsa_link.c index bc975be91a..54542f8721 100644 --- a/lib/dns/opensslrsa_link.c +++ b/lib/dns/opensslrsa_link.c @@ -9,7 +9,7 @@ * information regarding copyright ownership. */ -#if !USE_PKCS11 +/*! \file */ #include #include @@ -1193,7 +1193,3 @@ dst__opensslrsa_init(dst_func_t **funcp, unsigned char algorithm) { } return (ISC_R_SUCCESS); } - -#endif /* !USE_PKCS11 */ - -/*! \file */ diff --git a/lib/dns/pkcs11.c b/lib/dns/pkcs11.c index bbe847d377..285b7de049 100644 --- a/lib/dns/pkcs11.c +++ b/lib/dns/pkcs11.c @@ -9,8 +9,6 @@ * information regarding copyright ownership. */ -#if USE_PKCS11 - #include #include @@ -33,6 +31,3 @@ dst__pkcs11_toresult(const char *funcname, const char *file, int line, } return (fallback); } - -#endif /* USE_PKCS11 */ -/*! \file */ diff --git a/lib/dns/pkcs11ecdsa_link.c b/lib/dns/pkcs11ecdsa_link.c index dbbdc48b65..7ad46db951 100644 --- a/lib/dns/pkcs11ecdsa_link.c +++ b/lib/dns/pkcs11ecdsa_link.c @@ -11,8 +11,6 @@ /*! \file */ -#if USE_PKCS11 - #include #include @@ -1149,5 +1147,3 @@ dst__pkcs11ecdsa_init(dst_func_t **funcp) { } return (ISC_R_SUCCESS); } - -#endif /* USE_PKCS11 */ diff --git a/lib/dns/pkcs11eddsa_link.c b/lib/dns/pkcs11eddsa_link.c index 1794128732..9b1061b491 100644 --- a/lib/dns/pkcs11eddsa_link.c +++ b/lib/dns/pkcs11eddsa_link.c @@ -11,8 +11,6 @@ /*! \file */ -#if USE_PKCS11 - #include #include @@ -1111,5 +1109,3 @@ dst__pkcs11eddsa_init(dst_func_t **funcp) { } return (ISC_R_SUCCESS); } - -#endif /* USE_PKCS11 */ diff --git a/lib/dns/pkcs11rsa_link.c b/lib/dns/pkcs11rsa_link.c index 5487f29869..fc5efe3bb8 100644 --- a/lib/dns/pkcs11rsa_link.c +++ b/lib/dns/pkcs11rsa_link.c @@ -11,8 +11,6 @@ /*! \file */ -#if USE_PKCS11 - #include #include @@ -2061,5 +2059,3 @@ dst__pkcs11rsa_init(dst_func_t **funcp) { } return (ISC_R_SUCCESS); } - -#endif /* USE_PKCS11 */ diff --git a/lib/dns/rbt.c b/lib/dns/rbt.c index da38f76155..7ac9b0c15c 100644 --- a/lib/dns/rbt.c +++ b/lib/dns/rbt.c @@ -40,7 +40,6 @@ #include #include #include -#include #define CHECK(x) \ do { \ @@ -447,7 +446,7 @@ init_file_version(void) { memset(FILE_VERSION, 0, sizeof(FILE_VERSION)); n = snprintf(FILE_VERSION, sizeof(FILE_VERSION), "RBT Image %s %s", - dns_major, dns_mapapi); + PACKAGE_VERSION_MAJOR, MAPAPI); INSIST(n > 0 && (unsigned int)n < sizeof(FILE_VERSION)); } diff --git a/lib/dns/rbtdb.c b/lib/dns/rbtdb.c index a4522c1dd8..2e268c7f76 100644 --- a/lib/dns/rbtdb.c +++ b/lib/dns/rbtdb.c @@ -58,7 +58,6 @@ #include #include #include -#include #include #include #include @@ -7711,7 +7710,7 @@ init_file_version(void) { memset(FILE_VERSION, 0, sizeof(FILE_VERSION)); n = snprintf(FILE_VERSION, sizeof(FILE_VERSION), "RBTDB Image %s %s", - dns_major, dns_mapapi); + PACKAGE_VERSION_MAJOR, MAPAPI); INSIST(n > 0 && (unsigned int)n < sizeof(FILE_VERSION)); } diff --git a/lib/dns/resolver.c b/lib/dns/resolver.c index 645a3e12cb..80203d95e1 100644 --- a/lib/dns/resolver.c +++ b/lib/dns/resolver.c @@ -583,7 +583,7 @@ struct dns_resolver { #ifdef ENABLE_AFL bool dns_fuzzing_resolver = false; void -dns_resolver_setfuzzing() { +dns_resolver_setfuzzing(void) { dns_fuzzing_resolver = true; } #endif /* ifdef ENABLE_AFL */ diff --git a/lib/dns/spnego.asn1 b/lib/dns/spnego.asn1 deleted file mode 100644 index abf9b76bba..0000000000 --- a/lib/dns/spnego.asn1 +++ /dev/null @@ -1,50 +0,0 @@ --- Copyright (C) The Internet Society 2005. This version of --- this module is part of RFC 4178; see the RFC itself for --- full legal notices. - --- (The above copyright notice is per RFC 3978 5.6 (a), q.v.) - --- This is the SPNEGO ASN.1 module from RFC 4178, tweaked --- to get the Heimdal ASN.1 compiler to accept it. - -SPNEGOASNOneSpec DEFINITIONS ::= BEGIN - -MechType ::= OBJECT IDENTIFIER - -MechTypeList ::= SEQUENCE OF MechType - -ContextFlags ::= BIT STRING { - delegFlag (0), - mutualFlag (1), - replayFlag (2), - sequenceFlag (3), - anonFlag (4), - confFlag (5), - integFlag (6) -} - -NegTokenInit ::= SEQUENCE { - mechTypes [0] MechTypeList, - reqFlags [1] ContextFlags OPTIONAL, - mechToken [2] OCTET STRING OPTIONAL, - mechListMIC [3] OCTET STRING OPTIONAL -} - -NegTokenResp ::= SEQUENCE { - negState [0] ENUMERATED { - accept-completed (0), - accept-incomplete (1), - reject (2), - request-mic (3) - } OPTIONAL, - supportedMech [1] MechType OPTIONAL, - responseToken [2] OCTET STRING OPTIONAL, - mechListMIC [3] OCTET STRING OPTIONAL -} - -NegotiationToken ::= CHOICE { - negTokenInit [0] NegTokenInit, - negTokenResp [1] NegTokenResp -} - -END diff --git a/lib/dns/spnego.c b/lib/dns/spnego.c deleted file mode 100644 index c8efafe474..0000000000 --- a/lib/dns/spnego.c +++ /dev/null @@ -1,1753 +0,0 @@ -/* - * 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 - * \brief - * Portable SPNEGO implementation. - * - * This is part of a portable implementation of the SPNEGO protocol - * (RFCs 2478 and 4178). This implementation uses the RFC 4178 ASN.1 - * module but is not a full implementation of the RFC 4178 protocol; - * at the moment, we only support GSS-TSIG with Kerberos - * authentication, so we only need enough of the SPNEGO protocol to - * support that. - * - * The files that make up this portable SPNEGO implementation are: - * \li spnego.c (this file) - * \li spnego.h (API SPNEGO exports to the rest of lib/dns) - * \li spnego.asn1 (SPNEGO ASN.1 module) - * \li spnego_asn1.c (routines generated from spngo.asn1) - * \li spnego_asn1.pl (perl script to generate spnego_asn1.c) - * - * Everything but the functions exported in spnego.h is static, to - * avoid possible conflicts with other libraries (particularly Heimdal, - * since much of this code comes from Heimdal by way of mod_auth_kerb). - * - * spnego_asn1.c is shipped as part of lib/dns because generating it - * requires both Perl and the Heimdal ASN.1 compiler. See - * spnego_asn1.pl for further details. We've tried to eliminate all - * compiler warnings from the generated code, but you may see a few - * when using a compiler version we haven't tested yet. - */ - -/* - * Portions of this code were derived from mod_auth_kerb and Heimdal. - * These packages are available from: - * - * http://modauthkerb.sourceforge.net/ - * http://www.pdc.kth.se/heimdal/ - * - * and were released under the following licenses: - * - * ---------------------------------------------------------------- - * - * Copyright (c) 2004 Masarykova universita - * (Masaryk University, Brno, Czech Republic) - * 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. - * - * 3. Neither the name of the University nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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. - * - * ---------------------------------------------------------------- - * - * Copyright (c) 1997 - 2003 Kungliga Tekniska Hgskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * 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. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``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 INSTITUTE OR CONTRIBUTORS 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. - */ - -/* - * XXXSRA We should omit this file entirely in Makefile.in via autoconf, - * but this will keep it from generating errors until that's written. - */ - -#ifdef GSSAPI - -/* - * XXXSRA Some of the following files are almost certainly unnecessary, - * but using this list (borrowed from gssapictx.c) gets rid of some - * whacky compilation errors when building with MSVC and should be - * harmless in any case. - */ - -#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 "dst_internal.h" - -/* - * The API we export - */ -#include "spnego.h" - -/* asn1_err.h */ -/* Generated from ../../../lib/asn1/asn1_err.et */ - -#ifndef ERROR_TABLE_BASE_asn1 -/* these may be brought in already via gssapi_krb5.h */ -typedef enum asn1_error_number { - ASN1_BAD_TIMEFORMAT = 1859794432, - ASN1_MISSING_FIELD = 1859794433, - ASN1_MISPLACED_FIELD = 1859794434, - ASN1_TYPE_MISMATCH = 1859794435, - ASN1_OVERFLOW = 1859794436, - ASN1_OVERRUN = 1859794437, - ASN1_BAD_ID = 1859794438, - ASN1_BAD_LENGTH = 1859794439, - ASN1_BAD_FORMAT = 1859794440, - ASN1_PARSE_ERROR = 1859794441 -} asn1_error_number; - -#define ERROR_TABLE_BASE_asn1 1859794432 -#endif /* ifndef ERROR_TABLE_BASE_asn1 */ - -#define __asn1_common_definitions__ - -typedef struct octet_string { - size_t length; - void *data; -} octet_string; - -typedef char *general_string; - -typedef char *utf8_string; - -typedef struct oid { - size_t length; - unsigned *components; -} oid; - -/* der.h */ - -typedef enum { - ASN1_C_UNIV = 0, - ASN1_C_APPL = 1, - ASN1_C_CONTEXT = 2, - ASN1_C_PRIVATE = 3 -} Der_class; - -typedef enum { PRIM = 0, CONS = 1 } Der_type; - -/* Universal tags */ - -enum { UT_Boolean = 1, - UT_Integer = 2, - UT_BitString = 3, - UT_OctetString = 4, - UT_Null = 5, - UT_OID = 6, - UT_Enumerated = 10, - UT_Sequence = 16, - UT_Set = 17, - UT_PrintableString = 19, - UT_IA5String = 22, - UT_UTCTime = 23, - UT_GeneralizedTime = 24, - UT_VisibleString = 26, - UT_GeneralString = 27 }; - -#define ASN1_INDEFINITE 0xdce0deed - -static int -der_get_length(const unsigned char *p, size_t len, size_t *val, size_t *size); - -static int -der_get_octet_string(const unsigned char *p, size_t len, octet_string *data, - size_t *size); -static int -der_get_oid(const unsigned char *p, size_t len, oid *data, size_t *size); -static int -der_get_tag(const unsigned char *p, size_t len, Der_class *xclass, - Der_type *type, int *tag, size_t *size); - -static int -der_match_tag(const unsigned char *p, size_t len, Der_class xclass, - Der_type type, int tag, size_t *size); -static int -der_match_tag_and_length(const unsigned char *p, size_t len, Der_class xclass, - Der_type type, int tag, size_t *length_ret, - size_t *size); - -static int -decode_oid(const unsigned char *p, size_t len, oid *k, size_t *size); - -static int -decode_enumerated(const unsigned char *p, size_t len, void *num, size_t *size); - -static int -decode_octet_string(const unsigned char *, size_t, octet_string *, size_t *); - -static int -der_put_int(unsigned char *p, size_t len, int val, size_t *); - -static int -der_put_length(unsigned char *p, size_t len, size_t val, size_t *); - -static int -der_put_octet_string(unsigned char *p, size_t len, const octet_string *data, - size_t *); -static int -der_put_oid(unsigned char *p, size_t len, const oid *data, size_t *size); -static int -der_put_tag(unsigned char *p, size_t len, Der_class xclass, Der_type type, - int tag, size_t *); -static int -der_put_length_and_tag(unsigned char *, size_t, size_t, Der_class, Der_type, - int, size_t *); - -static int -encode_enumerated(unsigned char *p, size_t len, const void *data, size_t *); - -static int -encode_octet_string(unsigned char *p, size_t len, const octet_string *k, - size_t *); -static int -encode_oid(unsigned char *p, size_t len, const oid *k, size_t *); - -static void -free_octet_string(octet_string *k); - -static void -free_oid(oid *k); - -static size_t -length_len(size_t len); - -static int -fix_dce(size_t reallen, size_t *len); - -/* - * Include stuff generated by the ASN.1 compiler. - */ - -#include "spnego_asn1.c" - -/* - * Force the oid arrays to be uint64_t aligned to silence warnings - * about the arrays not being properly aligned for (void *). - */ -typedef union { - unsigned char b[8]; - uint64_t _align; -} aligned8; -typedef union { - unsigned char b[16]; - uint64_t _align[2]; -} aligned16; - -static aligned16 gss_krb5_mech_oid_bytes = { { 0x2a, 0x86, 0x48, 0x86, 0xf7, - 0x12, 0x01, 0x02, 0x02 } }; - -static gss_OID_desc gss_krb5_mech_oid_desc = { 9, gss_krb5_mech_oid_bytes.b }; - -static gss_OID GSS_KRB5_MECH = &gss_krb5_mech_oid_desc; - -static aligned16 gss_mskrb5_mech_oid_bytes = { { 0x2a, 0x86, 0x48, 0x82, 0xf7, - 0x12, 0x01, 0x02, 0x02 } }; - -static gss_OID_desc gss_mskrb5_mech_oid_desc = { 9, - gss_mskrb5_mech_oid_bytes.b }; - -static gss_OID GSS_MSKRB5_MECH = &gss_mskrb5_mech_oid_desc; - -static aligned8 gss_spnego_mech_oid_bytes = { { 0x2b, 0x06, 0x01, 0x05, 0x05, - 0x02 } }; - -static gss_OID_desc gss_spnego_mech_oid_desc = { 6, - gss_spnego_mech_oid_bytes.b }; - -static gss_OID GSS_SPNEGO_MECH = &gss_spnego_mech_oid_desc; - -/* spnegokrb5_locl.h */ - -static OM_uint32 -gssapi_spnego_encapsulate(OM_uint32 *, unsigned char *, size_t, gss_buffer_t, - const gss_OID); - -static OM_uint32 -gssapi_spnego_decapsulate(OM_uint32 *, gss_buffer_t, unsigned char **, size_t *, - const gss_OID); - -/* mod_auth_kerb.c */ - -static bool -cmp_gss_type(gss_buffer_t token, gss_OID gssoid) { - unsigned char *p; - size_t len; - - if (token->length == 0U) { - return (GSS_S_DEFECTIVE_TOKEN); - } - - p = token->value; - if (*p++ != 0x60) { - return (GSS_S_DEFECTIVE_TOKEN); - } - len = *p++; - if (len & 0x80) { - if ((len & 0x7f) > 4U) { - return (GSS_S_DEFECTIVE_TOKEN); - } - p += len & 0x7f; - } - if (*p++ != 0x06) { - return (GSS_S_DEFECTIVE_TOKEN); - } - - if (((OM_uint32)*p++) != gssoid->length) { - return (GSS_S_DEFECTIVE_TOKEN); - } - - return (!isc_safe_memequal(p, gssoid->elements, gssoid->length)); -} - -/* accept_sec_context.c */ -/* - * SPNEGO wrapper for Kerberos5 GSS-API kouril@ics.muni.cz, 2003 (mostly - * based on Heimdal code) - */ - -static OM_uint32 -code_NegTokenArg(OM_uint32 *minor_status, const NegTokenResp *resp, - unsigned char **outbuf, size_t *outbuf_size) { - OM_uint32 ret; - u_char *buf; - size_t buf_size, buf_len = 0; - - buf_size = 1024; - buf = malloc(buf_size); - if (buf == NULL) { - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - do { - ret = encode_NegTokenResp(buf + buf_size - 1, buf_size, resp, - &buf_len); - if (ret == 0) { - size_t tmp; - - ret = der_put_length_and_tag( - buf + buf_size - buf_len - 1, - buf_size - buf_len, buf_len, ASN1_C_CONTEXT, - CONS, 1, &tmp); - if (ret == 0) { - buf_len += tmp; - } - } - if (ret) { - if (ret == ASN1_OVERFLOW) { - u_char *tmp; - - buf_size *= 2; - tmp = realloc(buf, buf_size); - if (tmp == NULL) { - *minor_status = ENOMEM; - free(buf); - return (GSS_S_FAILURE); - } - buf = tmp; - } else { - *minor_status = ret; - free(buf); - return (GSS_S_FAILURE); - } - } - } while (ret == ASN1_OVERFLOW); - - *outbuf = malloc(buf_len); - if (*outbuf == NULL) { - *minor_status = ENOMEM; - free(buf); - return (GSS_S_FAILURE); - } - memmove(*outbuf, buf + buf_size - buf_len, buf_len); - *outbuf_size = buf_len; - - free(buf); - - return (GSS_S_COMPLETE); -} - -static OM_uint32 -send_reject(OM_uint32 *minor_status, gss_buffer_t output_token) { - NegTokenResp resp; - OM_uint32 ret; - - resp.negState = malloc(sizeof(*resp.negState)); - if (resp.negState == NULL) { - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - *(resp.negState) = reject; - - resp.supportedMech = NULL; - resp.responseToken = NULL; - resp.mechListMIC = NULL; - - ret = code_NegTokenArg(minor_status, &resp, - (unsigned char **)&output_token->value, - &output_token->length); - free_NegTokenResp(&resp); - if (ret) { - return (ret); - } - - return (GSS_S_BAD_MECH); -} - -static OM_uint32 -send_accept(OM_uint32 *minor_status, gss_buffer_t output_token, - gss_buffer_t mech_token, const gss_OID pref) { - NegTokenResp resp; - OM_uint32 ret; - - memset(&resp, 0, sizeof(resp)); - resp.negState = malloc(sizeof(*resp.negState)); - if (resp.negState == NULL) { - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - *(resp.negState) = accept_completed; - - resp.supportedMech = malloc(sizeof(*resp.supportedMech)); - if (resp.supportedMech == NULL) { - free_NegTokenResp(&resp); - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - ret = der_get_oid(pref->elements, pref->length, resp.supportedMech, - NULL); - if (ret) { - free_NegTokenResp(&resp); - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - if (mech_token != NULL && mech_token->length != 0U) { - resp.responseToken = malloc(sizeof(*resp.responseToken)); - if (resp.responseToken == NULL) { - free_NegTokenResp(&resp); - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - resp.responseToken->length = mech_token->length; - resp.responseToken->data = mech_token->value; - } - - ret = code_NegTokenArg(minor_status, &resp, - (unsigned char **)&output_token->value, - &output_token->length); - if (resp.responseToken != NULL) { - free(resp.responseToken); - resp.responseToken = NULL; - } - free_NegTokenResp(&resp); - if (ret) { - return (ret); - } - - return (GSS_S_COMPLETE); -} - -OM_uint32 -gss_accept_sec_context_spnego(OM_uint32 *minor_status, - gss_ctx_id_t *context_handle, - const gss_cred_id_t acceptor_cred_handle, - const gss_buffer_t input_token_buffer, - const gss_channel_bindings_t input_chan_bindings, - gss_name_t *src_name, gss_OID *mech_type, - gss_buffer_t output_token, OM_uint32 *ret_flags, - OM_uint32 *time_rec, - gss_cred_id_t *delegated_cred_handle) { - NegTokenInit init_token; - OM_uint32 major_status = GSS_S_COMPLETE; - OM_uint32 minor_status2; - gss_buffer_desc ibuf, obuf; - gss_buffer_t ot = NULL; - gss_OID pref = GSS_KRB5_MECH; - unsigned char *buf; - size_t buf_size; - size_t len, taglen, ni_len; - int found = 0; - int ret; - unsigned i; - - /* - * Before doing anything else, see whether this is a SPNEGO - * PDU. If not, dispatch to the GSSAPI library and get out. - */ - - if (cmp_gss_type(input_token_buffer, GSS_SPNEGO_MECH)) { - return (gss_accept_sec_context( - minor_status, context_handle, acceptor_cred_handle, - input_token_buffer, input_chan_bindings, src_name, - mech_type, output_token, ret_flags, time_rec, - delegated_cred_handle)); - } - - /* - * If we get here, it's SPNEGO. - */ - - memset(&init_token, 0, sizeof(init_token)); - - ret = gssapi_spnego_decapsulate(minor_status, input_token_buffer, &buf, - &buf_size, GSS_SPNEGO_MECH); - if (ret) { - return (ret); - } - - ret = der_match_tag_and_length(buf, buf_size, ASN1_C_CONTEXT, CONS, 0, - &len, &taglen); - if (ret) { - return (ret); - } - - ret = decode_NegTokenInit(buf + taglen, len, &init_token, &ni_len); - if (ret) { - *minor_status = EINVAL; /* XXX */ - return (GSS_S_DEFECTIVE_TOKEN); - } - - for (i = 0; !found && i < init_token.mechTypes.len; ++i) { - unsigned char mechbuf[17]; - size_t mech_len; - - ret = der_put_oid(mechbuf + sizeof(mechbuf) - 1, - sizeof(mechbuf), &init_token.mechTypes.val[i], - &mech_len); - if (ret) { - free_NegTokenInit(&init_token); - return (GSS_S_DEFECTIVE_TOKEN); - } - if (mech_len == GSS_KRB5_MECH->length && - isc_safe_memequal(GSS_KRB5_MECH->elements, - mechbuf + sizeof(mechbuf) - mech_len, - mech_len)) - { - found = 1; - break; - } - if (mech_len == GSS_MSKRB5_MECH->length && - isc_safe_memequal(GSS_MSKRB5_MECH->elements, - mechbuf + sizeof(mechbuf) - mech_len, - mech_len)) - { - found = 1; - if (i == 0) { - pref = GSS_MSKRB5_MECH; - } - break; - } - } - - if (!found) { - free_NegTokenInit(&init_token); - return (send_reject(minor_status, output_token)); - } - - if (i == 0 && init_token.mechToken != NULL) { - ibuf.length = init_token.mechToken->length; - ibuf.value = init_token.mechToken->data; - - major_status = gss_accept_sec_context( - minor_status, context_handle, acceptor_cred_handle, - &ibuf, input_chan_bindings, src_name, mech_type, &obuf, - ret_flags, time_rec, delegated_cred_handle); - if (GSS_ERROR(major_status)) { - free_NegTokenInit(&init_token); - send_reject(&minor_status2, output_token); - return (major_status); - } - ot = &obuf; - } - ret = send_accept(&minor_status2, output_token, ot, pref); - free_NegTokenInit(&init_token); - if (ot != NULL && ot->length != 0U) { - gss_release_buffer(&minor_status2, ot); - } - - return (ret != GSS_S_COMPLETE ? (OM_uint32)ret : major_status); -} - -/* decapsulate.c */ - -static OM_uint32 -gssapi_verify_mech_header(u_char **str, size_t total_len, const gss_OID mech) { - size_t len, len_len, mech_len, foo; - int e; - u_char *p = *str; - - if (total_len < 1U) { - return (GSS_S_DEFECTIVE_TOKEN); - } - if (*p++ != 0x60) { - return (GSS_S_DEFECTIVE_TOKEN); - } - e = der_get_length(p, total_len - 1, &len, &len_len); - if (e || 1 + len_len + len != total_len) { - return (GSS_S_DEFECTIVE_TOKEN); - } - p += len_len; - if (*p++ != 0x06) { - return (GSS_S_DEFECTIVE_TOKEN); - } - e = der_get_length(p, total_len - 1 - len_len - 1, &mech_len, &foo); - if (e) { - return (GSS_S_DEFECTIVE_TOKEN); - } - p += foo; - if (mech_len != mech->length) { - return (GSS_S_BAD_MECH); - } - if (!isc_safe_memequal(p, mech->elements, mech->length)) { - return (GSS_S_BAD_MECH); - } - p += mech_len; - *str = p; - return (GSS_S_COMPLETE); -} - -/* - * Remove the GSS-API wrapping from `in_token' giving `buf and buf_size' Does - * not copy data, so just free `in_token'. - */ - -static OM_uint32 -gssapi_spnego_decapsulate(OM_uint32 *minor_status, - gss_buffer_t input_token_buffer, unsigned char **buf, - size_t *buf_len, const gss_OID mech) { - u_char *p; - OM_uint32 ret; - - p = input_token_buffer->value; - ret = gssapi_verify_mech_header(&p, input_token_buffer->length, mech); - if (ret) { - *minor_status = ret; - return (GSS_S_FAILURE); - } - *buf_len = input_token_buffer->length - - (p - (u_char *)input_token_buffer->value); - *buf = p; - return (GSS_S_COMPLETE); -} - -/* der_free.c */ - -static void -free_octet_string(octet_string *k) { - free(k->data); - k->data = NULL; -} - -static void -free_oid(oid *k) { - free(k->components); - k->components = NULL; -} - -/* der_get.c */ - -/* - * All decoding functions take a pointer `p' to first position in which to - * read, from the left, `len' which means the maximum number of characters we - * are able to read, `ret' were the value will be returned and `size' where - * the number of used bytes is stored. Either 0 or an error code is returned. - */ - -static int -der_get_unsigned(const unsigned char *p, size_t len, unsigned *ret, - size_t *size) { - unsigned val = 0; - size_t oldlen = len; - - while (len--) { - val = val * 256 + *p++; - } - *ret = val; - if (size) { - *size = oldlen; - } - return (0); -} - -static int -der_get_int(const unsigned char *p, size_t len, int *ret, size_t *size) { - int val = 0; - size_t oldlen = len; - - if (len > 0U) { - val = (signed char)*p++; - while (--len) { - val = val * 256 + *p++; - } - } - *ret = val; - if (size) { - *size = oldlen; - } - return (0); -} - -static int -der_get_length(const unsigned char *p, size_t len, size_t *val, size_t *size) { - size_t v; - - if (len <= 0U) { - return (ASN1_OVERRUN); - } - --len; - v = *p++; - if (v < 128U) { - *val = v; - if (size) { - *size = 1; - } - } else { - int e; - size_t l; - unsigned tmp; - - if (v == 0x80U) { - *val = ASN1_INDEFINITE; - if (size) { - *size = 1; - } - return (0); - } - v &= 0x7F; - if (len < v) { - return (ASN1_OVERRUN); - } - e = der_get_unsigned(p, v, &tmp, &l); - if (e) { - return (e); - } - *val = tmp; - if (size) { - *size = l + 1; - } - } - return (0); -} - -static int -der_get_octet_string(const unsigned char *p, size_t len, octet_string *data, - size_t *size) { - data->length = len; - if (len != 0U) { - data->data = malloc(len); - if (data->data == NULL) { - return (ENOMEM); - } - memmove(data->data, p, len); - } else { - data->data = NULL; - } - if (size) { - *size = len; - } - return (0); -} - -static int -der_get_oid(const unsigned char *p, size_t len, oid *data, size_t *size) { - int n; - size_t oldlen = len; - - data->components = NULL; - data->length = 0; - if (len < 1U) { - return (ASN1_OVERRUN); - } - - data->components = malloc(len * sizeof(*data->components)); - if (data->components == NULL) { - return (ENOMEM); - } - data->components[0] = (*p) / 40; - data->components[1] = (*p) % 40; - --len; - ++p; - for (n = 2; len > 0U; ++n) { - unsigned u = 0; - - do { - --len; - u = u * 128 + (*p++ % 128); - } while (len > 0U && p[-1] & 0x80); - data->components[n] = u; - } - if (p[-1] & 0x80) { - free_oid(data); - return (ASN1_OVERRUN); - } - data->length = n; - if (size) { - *size = oldlen; - } - return (0); -} - -static int -der_get_tag(const unsigned char *p, size_t len, Der_class *xclass, - Der_type *type, int *tag, size_t *size) { - if (len < 1U) { - return (ASN1_OVERRUN); - } - *xclass = (Der_class)(((*p) >> 6) & 0x03); - *type = (Der_type)(((*p) >> 5) & 0x01); - *tag = (*p) & 0x1F; - if (size) { - *size = 1; - } - return (0); -} - -static int -der_match_tag(const unsigned char *p, size_t len, Der_class xclass, - Der_type type, int tag, size_t *size) { - size_t l; - Der_class thisclass; - Der_type thistype; - int thistag; - int e; - - e = der_get_tag(p, len, &thisclass, &thistype, &thistag, &l); - if (e) { - return (e); - } - if (xclass != thisclass || type != thistype) { - return (ASN1_BAD_ID); - } - if (tag > thistag) { - return (ASN1_MISPLACED_FIELD); - } - if (tag < thistag) { - return (ASN1_MISSING_FIELD); - } - if (size) { - *size = l; - } - return (0); -} - -static int -der_match_tag_and_length(const unsigned char *p, size_t len, Der_class xclass, - Der_type type, int tag, size_t *length_ret, - size_t *size) { - size_t l, ret = 0; - int e; - - e = der_match_tag(p, len, xclass, type, tag, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, length_ret, &l); - if (e) { - return (e); - } - /* p += l; */ - len -= l; - POST(len); - ret += l; - if (size) { - *size = ret; - } - return (0); -} - -static int -decode_enumerated(const unsigned char *p, size_t len, void *num, size_t *size) { - size_t ret = 0; - size_t l, reallen; - int e; - - e = der_match_tag(p, len, ASN1_C_UNIV, PRIM, UT_Enumerated, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &reallen, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - e = der_get_int(p, reallen, num, &l); - if (e) { - return (e); - } - p += l; - len -= l; - POST(p); - POST(len); - ret += l; - if (size) { - *size = ret; - } - return (0); -} - -static int -decode_octet_string(const unsigned char *p, size_t len, octet_string *k, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - size_t slen; - - k->data = NULL; - k->length = 0; - - e = der_match_tag(p, len, ASN1_C_UNIV, PRIM, UT_OctetString, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - - e = der_get_length(p, len, &slen, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - if (len < slen) { - return (ASN1_OVERRUN); - } - - e = der_get_octet_string(p, slen, k, &l); - if (e) { - return (e); - } - p += l; - len -= l; - POST(p); - POST(len); - ret += l; - if (size) { - *size = ret; - } - return (0); -} - -static int -decode_oid(const unsigned char *p, size_t len, oid *k, size_t *size) { - size_t ret = 0; - size_t l; - int e; - size_t slen; - - e = der_match_tag(p, len, ASN1_C_UNIV, PRIM, UT_OID, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - - e = der_get_length(p, len, &slen, &l); - if (e) { - return (e); - } - p += l; - len -= l; - ret += l; - if (len < slen) { - return (ASN1_OVERRUN); - } - - e = der_get_oid(p, slen, k, &l); - if (e) { - return (e); - } - p += l; - len -= l; - POST(p); - POST(len); - ret += l; - if (size) { - *size = ret; - } - return (0); -} - -static int -fix_dce(size_t reallen, size_t *len) { - if (reallen == ASN1_INDEFINITE) { - return (1); - } - if (*len < reallen) { - return (-1); - } - *len = reallen; - return (0); -} - -/* der_length.c */ - -static size_t -len_unsigned(unsigned val) { - size_t ret = 0; - - do { - ++ret; - val /= 256; - } while (val); - return (ret); -} - -static size_t -length_len(size_t len) { - if (len < 128U) { - return (1); - } else { - return (len_unsigned((unsigned int)len) + 1); - } -} - -/* der_put.c */ - -/* - * All encoding functions take a pointer `p' to first position in which to - * write, from the right, `len' which means the maximum number of characters - * we are able to write. The function returns the number of characters - * written in `size' (if non-NULL). The return value is 0 or an error. - */ - -static int -der_put_unsigned(unsigned char *p, size_t len, unsigned val, size_t *size) { - unsigned char *base = p; - - if (val) { - while (len > 0U && val) { - *p-- = val % 256; - val /= 256; - --len; - } - if (val != 0) { - return (ASN1_OVERFLOW); - } else { - *size = base - p; - return (0); - } - } else if (len < 1U) { - return (ASN1_OVERFLOW); - } else { - *p = 0; - *size = 1; - return (0); - } -} - -static int -der_put_int(unsigned char *p, size_t len, int val, size_t *size) { - unsigned char *base = p; - - if (val >= 0) { - do { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = val % 256; - len--; - val /= 256; - } while (val); - if (p[1] >= 128) { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = 0; - len--; - POST(len); - } - } else { - val = ~val; - do { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = ~(val % 256); - len--; - val /= 256; - } while (val); - if (p[1] < 128) { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = 0xff; - len--; - POST(len); - } - } - *size = base - p; - return (0); -} - -static int -der_put_length(unsigned char *p, size_t len, size_t val, size_t *size) { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - if (val < 128U) { - *p = (unsigned char)val; - *size = 1; - return (0); - } else { - size_t l; - int e; - - e = der_put_unsigned(p, len - 1, (unsigned int)val, &l); - if (e) { - return (e); - } - p -= l; - *p = 0x80 | (unsigned char)l; - *size = l + 1; - return (0); - } -} - -static int -der_put_octet_string(unsigned char *p, size_t len, const octet_string *data, - size_t *size) { - if (len < data->length) { - return (ASN1_OVERFLOW); - } - p -= data->length; - len -= data->length; - POST(len); - memmove(p + 1, data->data, data->length); - *size = data->length; - return (0); -} - -static int -der_put_oid(unsigned char *p, size_t len, const oid *data, size_t *size) { - unsigned char *base = p; - size_t n; - - for (n = data->length; n >= 3u; --n) { - unsigned u = data->components[n - 1]; - - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = u % 128; - u /= 128; - --len; - while (u > 0) { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = 128 + u % 128; - u /= 128; - --len; - } - } - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p-- = 40 * data->components[0] + data->components[1]; - *size = base - p; - return (0); -} - -static int -der_put_tag(unsigned char *p, size_t len, Der_class xclass, Der_type type, - int tag, size_t *size) { - if (len < 1U) { - return (ASN1_OVERFLOW); - } - *p = (xclass << 6) | (type << 5) | tag; /* XXX */ - *size = 1; - return (0); -} - -static int -der_put_length_and_tag(unsigned char *p, size_t len, size_t len_val, - Der_class xclass, Der_type type, int tag, size_t *size) { - size_t ret = 0; - size_t l; - int e; - - e = der_put_length(p, len, len_val, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - ret += l; - e = der_put_tag(p, len, xclass, type, tag, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - POST(p); - POST(len); - ret += l; - *size = ret; - return (0); -} - -static int -encode_enumerated(unsigned char *p, size_t len, const void *data, - size_t *size) { - unsigned num = *(const unsigned *)data; - size_t ret = 0; - size_t l; - int e; - - e = der_put_int(p, len, num, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - ret += l; - e = der_put_length_and_tag(p, len, l, ASN1_C_UNIV, PRIM, UT_Enumerated, - &l); - if (e) { - return (e); - } - p -= l; - len -= l; - POST(p); - POST(len); - ret += l; - *size = ret; - return (0); -} - -static int -encode_octet_string(unsigned char *p, size_t len, const octet_string *k, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - e = der_put_octet_string(p, len, k, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - ret += l; - e = der_put_length_and_tag(p, len, l, ASN1_C_UNIV, PRIM, UT_OctetString, - &l); - if (e) { - return (e); - } - p -= l; - len -= l; - POST(p); - POST(len); - ret += l; - *size = ret; - return (0); -} - -static int -encode_oid(unsigned char *p, size_t len, const oid *k, size_t *size) { - size_t ret = 0; - size_t l; - int e; - - e = der_put_oid(p, len, k, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - ret += l; - e = der_put_length_and_tag(p, len, l, ASN1_C_UNIV, PRIM, UT_OID, &l); - if (e) { - return (e); - } - p -= l; - len -= l; - POST(p); - POST(len); - ret += l; - *size = ret; - return (0); -} - -/* encapsulate.c */ - -static void -gssapi_encap_length(size_t data_len, size_t *len, size_t *total_len, - const gss_OID mech) { - size_t len_len; - - *len = 1 + 1 + mech->length + data_len; - - len_len = length_len(*len); - - *total_len = 1 + len_len + *len; -} - -static u_char * -gssapi_mech_make_header(u_char *p, size_t len, const gss_OID mech) { - int e; - size_t len_len, foo; - - *p++ = 0x60; - len_len = length_len(len); - e = der_put_length(p + len_len - 1, len_len, len, &foo); - if (e || foo != len_len) { - return (NULL); - } - p += len_len; - *p++ = 0x06; - *p++ = mech->length; - memmove(p, mech->elements, mech->length); - p += mech->length; - return (p); -} - -/* - * Give it a krb5_data and it will encapsulate with extra GSS-API wrappings. - */ - -static OM_uint32 -gssapi_spnego_encapsulate(OM_uint32 *minor_status, unsigned char *buf, - size_t buf_size, gss_buffer_t output_token, - const gss_OID mech) { - size_t len, outer_len; - u_char *p; - - gssapi_encap_length(buf_size, &len, &outer_len, mech); - - output_token->length = outer_len; - output_token->value = malloc(outer_len); - if (output_token->value == NULL) { - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - p = gssapi_mech_make_header(output_token->value, len, mech); - if (p == NULL) { - if (output_token->length != 0U) { - gss_release_buffer(minor_status, output_token); - } - return (GSS_S_FAILURE); - } - memmove(p, buf, buf_size); - return (GSS_S_COMPLETE); -} - -/* init_sec_context.c */ -/* - * SPNEGO wrapper for Kerberos5 GSS-API kouril@ics.muni.cz, 2003 (mostly - * based on Heimdal code) - */ - -static int -add_mech(MechTypeList *mech_list, gss_OID mech) { - MechType *tmp; - int ret; - - tmp = realloc(mech_list->val, (mech_list->len + 1) * sizeof(*tmp)); - if (tmp == NULL) { - return (ENOMEM); - } - mech_list->val = tmp; - - ret = der_get_oid(mech->elements, mech->length, - &mech_list->val[mech_list->len], NULL); - if (ret) { - return (ret); - } - - mech_list->len++; - return (0); -} - -/* - * return the length of the mechanism in token or -1 - * (which implies that the token was bad - GSS_S_DEFECTIVE_TOKEN - */ - -static ssize_t -gssapi_krb5_get_mech(const u_char *ptr, size_t total_len, - const u_char **mech_ret) { - size_t len, len_len, mech_len, foo; - const u_char *p = ptr; - int e; - - if (total_len < 1U) { - return (-1); - } - if (*p++ != 0x60) { - return (-1); - } - e = der_get_length(p, total_len - 1, &len, &len_len); - if (e || 1 + len_len + len != total_len) { - return (-1); - } - p += len_len; - if (*p++ != 0x06) { - return (-1); - } - e = der_get_length(p, total_len - 1 - len_len - 1, &mech_len, &foo); - if (e) { - return (-1); - } - p += foo; - *mech_ret = p; - return (mech_len); -} - -static OM_uint32 -spnego_initial(OM_uint32 *minor_status, - const gss_cred_id_t initiator_cred_handle, - gss_ctx_id_t *context_handle, const gss_name_t target_name, - const gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, - const gss_channel_bindings_t input_chan_bindings, - const gss_buffer_t input_token, gss_OID *actual_mech_type, - gss_buffer_t output_token, OM_uint32 *ret_flags, - OM_uint32 *time_rec) { - NegTokenInit token_init; - OM_uint32 major_status, minor_status2; - gss_buffer_desc krb5_output_token = GSS_C_EMPTY_BUFFER; - unsigned char *buf = NULL; - size_t buf_size; - size_t len; - int ret; - - (void)mech_type; - - memset(&token_init, 0, sizeof(token_init)); - - ret = add_mech(&token_init.mechTypes, GSS_KRB5_MECH); - if (ret) { - *minor_status = ret; - ret = GSS_S_FAILURE; - goto end; - } - - major_status = gss_init_sec_context( - minor_status, initiator_cred_handle, context_handle, - target_name, GSS_KRB5_MECH, req_flags, time_req, - input_chan_bindings, input_token, actual_mech_type, - &krb5_output_token, ret_flags, time_rec); - if (GSS_ERROR(major_status)) { - ret = major_status; - goto end; - } - if (krb5_output_token.length > 0U) { - token_init.mechToken = malloc(sizeof(*token_init.mechToken)); - if (token_init.mechToken == NULL) { - *minor_status = ENOMEM; - ret = GSS_S_FAILURE; - goto end; - } - token_init.mechToken->data = krb5_output_token.value; - token_init.mechToken->length = krb5_output_token.length; - } - /* - * The MS implementation of SPNEGO seems to not like the mechListMIC - * field, so we omit it (it's optional anyway) - */ - - buf_size = 1024; - buf = malloc(buf_size); - if (buf == NULL) { - *minor_status = ENOMEM; - ret = GSS_S_FAILURE; - goto end; - } - - do { - ret = encode_NegTokenInit(buf + buf_size - 1, buf_size, - &token_init, &len); - if (ret == 0) { - size_t tmp; - - ret = der_put_length_and_tag( - buf + buf_size - len - 1, buf_size - len, len, - ASN1_C_CONTEXT, CONS, 0, &tmp); - if (ret == 0) { - len += tmp; - } - } - if (ret) { - if (ret == ASN1_OVERFLOW) { - u_char *tmp; - - buf_size *= 2; - tmp = realloc(buf, buf_size); - if (tmp == NULL) { - *minor_status = ENOMEM; - ret = GSS_S_FAILURE; - goto end; - } - buf = tmp; - } else { - *minor_status = ret; - ret = GSS_S_FAILURE; - goto end; - } - } - } while (ret == ASN1_OVERFLOW); - - ret = gssapi_spnego_encapsulate(minor_status, buf + buf_size - len, len, - output_token, GSS_SPNEGO_MECH); - if (ret == GSS_S_COMPLETE) { - ret = major_status; - } - -end: - if (token_init.mechToken != NULL) { - free(token_init.mechToken); - token_init.mechToken = NULL; - } - free_NegTokenInit(&token_init); - if (krb5_output_token.length != 0U) { - gss_release_buffer(&minor_status2, &krb5_output_token); - } - if (buf) { - free(buf); - } - - return (ret); -} - -static OM_uint32 -spnego_reply(OM_uint32 *minor_status, const gss_cred_id_t initiator_cred_handle, - gss_ctx_id_t *context_handle, const gss_name_t target_name, - const gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, - const gss_channel_bindings_t input_chan_bindings, - const gss_buffer_t input_token, gss_OID *actual_mech_type, - gss_buffer_t output_token, OM_uint32 *ret_flags, - OM_uint32 *time_rec) { - OM_uint32 ret; - NegTokenResp resp; - unsigned char *buf; - size_t buf_size; - u_char oidbuf[17]; - size_t oidlen; - gss_buffer_desc sub_token; - ssize_t mech_len; - const u_char *p; - size_t len, taglen; - - (void)mech_type; - - output_token->length = 0; - output_token->value = NULL; - - /* - * SPNEGO doesn't include gss wrapping on SubsequentContextToken - * like the Kerberos 5 mech does. But lets check for it anyway. - */ - - mech_len = gssapi_krb5_get_mech(input_token->value, input_token->length, - &p); - - if (mech_len < 0) { - buf = input_token->value; - buf_size = input_token->length; - } else if ((size_t)mech_len == GSS_KRB5_MECH->length && - isc_safe_memequal(GSS_KRB5_MECH->elements, p, mech_len)) - { - return (gss_init_sec_context( - minor_status, initiator_cred_handle, context_handle, - target_name, GSS_KRB5_MECH, req_flags, time_req, - input_chan_bindings, input_token, actual_mech_type, - output_token, ret_flags, time_rec)); - } else if ((size_t)mech_len == GSS_SPNEGO_MECH->length && - isc_safe_memequal(GSS_SPNEGO_MECH->elements, p, mech_len)) - { - ret = gssapi_spnego_decapsulate(minor_status, input_token, &buf, - &buf_size, GSS_SPNEGO_MECH); - if (ret) { - return (ret); - } - } else { - return (GSS_S_BAD_MECH); - } - - ret = der_match_tag_and_length(buf, buf_size, ASN1_C_CONTEXT, CONS, 1, - &len, &taglen); - if (ret) { - return (ret); - } - - if (len > buf_size - taglen) { - return (ASN1_OVERRUN); - } - - ret = decode_NegTokenResp(buf + taglen, len, &resp, NULL); - if (ret) { - free_NegTokenResp(&resp); - *minor_status = ENOMEM; - return (GSS_S_FAILURE); - } - - if (resp.negState == NULL || *(resp.negState) == reject || - resp.supportedMech == NULL) - { - free_NegTokenResp(&resp); - return (GSS_S_BAD_MECH); - } - - ret = der_put_oid(oidbuf + sizeof(oidbuf) - 1, sizeof(oidbuf), - resp.supportedMech, &oidlen); - if (ret || oidlen != GSS_KRB5_MECH->length || - !isc_safe_memequal(oidbuf + sizeof(oidbuf) - oidlen, - GSS_KRB5_MECH->elements, oidlen)) - { - free_NegTokenResp(&resp); - return (GSS_S_BAD_MECH); - } - - if (resp.responseToken != NULL) { - sub_token.length = resp.responseToken->length; - sub_token.value = resp.responseToken->data; - } else { - sub_token.length = 0; - sub_token.value = NULL; - } - - ret = gss_init_sec_context(minor_status, initiator_cred_handle, - context_handle, target_name, GSS_KRB5_MECH, - req_flags, time_req, input_chan_bindings, - &sub_token, actual_mech_type, output_token, - ret_flags, time_rec); - if (ret) { - free_NegTokenResp(&resp); - return (ret); - } - - /* - * XXXSRA I don't think this limited implementation ever needs - * to check the MIC -- our preferred mechanism (Kerberos) - * authenticates its own messages and is the only mechanism - * we'll accept, so if the mechanism negotiation completes - * successfully, we don't need the MIC. See RFC 4178. - */ - - free_NegTokenResp(&resp); - return (ret); -} - -OM_uint32 -gss_init_sec_context_spnego( - OM_uint32 *minor_status, const gss_cred_id_t initiator_cred_handle, - gss_ctx_id_t *context_handle, const gss_name_t target_name, - const gss_OID mech_type, OM_uint32 req_flags, OM_uint32 time_req, - const gss_channel_bindings_t input_chan_bindings, - const gss_buffer_t input_token, gss_OID *actual_mech_type, - gss_buffer_t output_token, OM_uint32 *ret_flags, OM_uint32 *time_rec) { - /* Dirty trick to suppress compiler warnings */ - - /* Figure out whether we're starting over or processing a reply */ - - if (input_token == GSS_C_NO_BUFFER || input_token->length == 0U) { - return (spnego_initial(minor_status, initiator_cred_handle, - context_handle, target_name, mech_type, - req_flags, time_req, input_chan_bindings, - input_token, actual_mech_type, - output_token, ret_flags, time_rec)); - } else { - return (spnego_reply(minor_status, initiator_cred_handle, - context_handle, target_name, mech_type, - req_flags, time_req, input_chan_bindings, - input_token, actual_mech_type, - output_token, ret_flags, time_rec)); - } -} - -#endif /* GSSAPI */ diff --git a/lib/dns/spnego.h b/lib/dns/spnego.h deleted file mode 100644 index 2753dfc8c6..0000000000 --- a/lib/dns/spnego.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 - * \brief - * Entry points into portable SPNEGO implementation. - * See spnego.c for information on the SPNEGO implementation itself. - */ - -#ifndef _SPNEGO_H_ -#define _SPNEGO_H_ - -/*% - * Wrapper for GSSAPI gss_init_sec_context(), using portable SPNEGO - * implementation instead of the one that's part of the GSSAPI - * library. Takes arguments identical to the standard GSSAPI - * function, uses standard gss_init_sec_context() to handle - * everything inside the SPNEGO wrapper. - */ -OM_uint32 -gss_init_sec_context_spnego(OM_uint32 *, const gss_cred_id_t, gss_ctx_id_t *, - const gss_name_t, const gss_OID, OM_uint32, - OM_uint32, const gss_channel_bindings_t, - const gss_buffer_t, gss_OID *, gss_buffer_t, - OM_uint32 *, OM_uint32 *); - -/*% - * Wrapper for GSSAPI gss_accept_sec_context(), using portable SPNEGO - * implementation instead of the one that's part of the GSSAPI - * library. Takes arguments identical to the standard GSSAPI - * function. Checks the OID of the input token to see if it's SPNEGO; - * if so, processes it, otherwise hands the call off to the standard - * gss_accept_sec_context() function. - */ -OM_uint32 -gss_accept_sec_context_spnego(OM_uint32 *, gss_ctx_id_t *, const gss_cred_id_t, - const gss_buffer_t, const gss_channel_bindings_t, - gss_name_t *, gss_OID *, gss_buffer_t, - OM_uint32 *, OM_uint32 *, gss_cred_id_t *); - -#endif /* ifndef _SPNEGO_H_ */ diff --git a/lib/dns/spnego_asn1.c b/lib/dns/spnego_asn1.c deleted file mode 100644 index 142cf3e5af..0000000000 --- a/lib/dns/spnego_asn1.c +++ /dev/null @@ -1,983 +0,0 @@ -/* - * 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 - * \brief Method routines generated from SPNEGO ASN.1 module. - * See spnego_asn1.pl for details. Do not edit. - */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -#ifndef __asn1_h__ -#define __asn1_h__ - -#ifndef __asn1_common_definitions__ -#define __asn1_common_definitions__ - -typedef struct octet_string { - size_t length; - void *data; -} octet_string; - -typedef char *general_string; - -typedef char *utf8_string; - -typedef struct oid { - size_t length; - unsigned *components; -} oid; - -#define ASN1_MALLOC_ENCODE(T, B, BL, S, L, R) \ - do { \ - (BL) = length_##T((S)); \ - (B) = malloc((BL)); \ - if ((B) == NULL) { \ - (R) = ENOMEM; \ - } else { \ - (R) = encode_##T(((unsigned char *)(B)) + (BL)-1, \ - (BL), (S), (L)); \ - if ((R) != 0) { \ - free((B)); \ - (B) = NULL; \ - } \ - } \ - } while (0) - -#endif /* ifndef __asn1_common_definitions__ */ - -/* - * MechType ::= OBJECT IDENTIFIER - */ - -typedef oid MechType; - -static int -encode_MechType(unsigned char *, size_t, const MechType *, size_t *); -static int -decode_MechType(const unsigned char *, size_t, MechType *, size_t *); -static void -free_MechType(MechType *); -/* unused declaration: length_MechType */ -/* unused declaration: copy_MechType */ - -/* - * MechTypeList ::= SEQUENCE OF MechType - */ - -typedef struct MechTypeList { - unsigned int len; - MechType *val; -} MechTypeList; - -static int -encode_MechTypeList(unsigned char *, size_t, const MechTypeList *, size_t *); -static int -decode_MechTypeList(const unsigned char *, size_t, MechTypeList *, size_t *); -static void -free_MechTypeList(MechTypeList *); -/* unused declaration: length_MechTypeList */ -/* unused declaration: copy_MechTypeList */ - -/* - * ContextFlags ::= BIT STRING { delegFlag(0), mutualFlag(1), replayFlag(2), - * sequenceFlag(3), anonFlag(4), confFlag(5), integFlag(6) } - */ - -typedef struct ContextFlags { - unsigned int delegFlag : 1; - unsigned int mutualFlag : 1; - unsigned int replayFlag : 1; - unsigned int sequenceFlag : 1; - unsigned int anonFlag : 1; - unsigned int confFlag : 1; - unsigned int integFlag : 1; -} ContextFlags; - -static int -encode_ContextFlags(unsigned char *, size_t, const ContextFlags *, size_t *); -static int -decode_ContextFlags(const unsigned char *, size_t, ContextFlags *, size_t *); -static void -free_ContextFlags(ContextFlags *); -/* unused declaration: length_ContextFlags */ -/* unused declaration: copy_ContextFlags */ -/* unused declaration: ContextFlags2int */ -/* unused declaration: int2ContextFlags */ -/* unused declaration: asn1_ContextFlags_units */ - -/* - * NegTokenInit ::= SEQUENCE { mechTypes[0] MechTypeList, reqFlags[1] - * ContextFlags OPTIONAL, mechToken[2] OCTET STRING OPTIONAL, - * mechListMIC[3] OCTET STRING OPTIONAL } - */ - -typedef struct NegTokenInit { - MechTypeList mechTypes; - ContextFlags *reqFlags; - octet_string *mechToken; - octet_string *mechListMIC; -} NegTokenInit; - -static int -encode_NegTokenInit(unsigned char *, size_t, const NegTokenInit *, size_t *); -static int -decode_NegTokenInit(const unsigned char *, size_t, NegTokenInit *, size_t *); -static void -free_NegTokenInit(NegTokenInit *); -/* unused declaration: length_NegTokenInit */ -/* unused declaration: copy_NegTokenInit */ - -/* - * NegTokenResp ::= SEQUENCE { negState[0] ENUMERATED { - * accept-completed(0), accept-incomplete(1), reject(2), request-mic(3) } - * OPTIONAL, supportedMech[1] MechType OPTIONAL, responseToken[2] OCTET - * STRING OPTIONAL, mechListMIC[3] OCTET STRING OPTIONAL } - */ - -typedef struct NegTokenResp { - enum { accept_completed = 0, - accept_incomplete = 1, - reject = 2, - request_mic = 3 } * - negState; - - MechType *supportedMech; - octet_string *responseToken; - octet_string *mechListMIC; -} NegTokenResp; - -static int -encode_NegTokenResp(unsigned char *, size_t, const NegTokenResp *, size_t *); -static int -decode_NegTokenResp(const unsigned char *, size_t, NegTokenResp *, size_t *); -static void -free_NegTokenResp(NegTokenResp *); -/* unused declaration: length_NegTokenResp */ -/* unused declaration: copy_NegTokenResp */ - -#endif /* __asn1_h__ */ -/* Generated from spnego.asn1 */ -/* Do not edit */ - -#define BACK \ - if (e) \ - return (e); \ - p -= l; \ - len -= l; \ - ret += l; \ - POST(p); \ - POST(len); \ - POST(ret) - -static int -encode_MechType(unsigned char *p, size_t len, const MechType *data, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - e = encode_oid(p, len, data, &l); - BACK; - *size = ret; - return (0); -} - -#define FORW \ - if (e) \ - goto fail; \ - p += l; \ - len -= l; \ - ret += l; \ - POST(p); \ - POST(len); \ - POST(ret) - -static int -decode_MechType(const unsigned char *p, size_t len, MechType *data, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - memset(data, 0, sizeof(*data)); - e = decode_oid(p, len, data, &l); - FORW; - if (size) { - *size = ret; - } - return (0); -fail: - free_MechType(data); - return (e); -} - -static void -free_MechType(MechType *data) { - free_oid(data); -} - -/* unused function: length_MechType */ - -/* unused function: copy_MechType */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -static int -encode_MechTypeList(unsigned char *p, size_t len, const MechTypeList *data, - size_t *size) { - size_t ret = 0; - size_t l; - int i, e; - - for (i = (data)->len - 1; i >= 0; --i) { - size_t oldret = ret; - ret = 0; - e = encode_MechType(p, len, &(data)->val[i], &l); - BACK; - ret += oldret; - } - e = der_put_length_and_tag(p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, - &l); - BACK; - *size = ret; - return (0); -} - -static int -decode_MechTypeList(const unsigned char *p, size_t len, MechTypeList *data, - size_t *size) { - size_t ret = 0, reallen; - size_t l; - int e; - - memset(data, 0, sizeof(*data)); - reallen = 0; - e = der_match_tag_and_length(p, len, ASN1_C_UNIV, CONS, UT_Sequence, - &reallen, &l); - FORW; - if (len < reallen) { - return (ASN1_OVERRUN); - } - len = reallen; - { - size_t origlen = len; - size_t oldret = ret; - ret = 0; - (data)->len = 0; - (data)->val = NULL; - while (ret < origlen) { - void *old = (data)->val; - (data)->len++; - (data)->val = - realloc((data)->val, - sizeof(*((data)->val)) * (data)->len); - if ((data)->val == NULL) { - (data)->val = old; - (data)->len--; - return (ENOMEM); - } - e = decode_MechType(p, len, - &(data)->val[(data)->len - 1], &l); - FORW; - len = origlen - ret; - } - ret += oldret; - } - if (size) { - *size = ret; - } - return (0); -fail: - free_MechTypeList(data); - return (e); -} - -static void -free_MechTypeList(MechTypeList *data) { - while ((data)->len) { - free_MechType(&(data)->val[(data)->len - 1]); - (data)->len--; - } - free((data)->val); - (data)->val = NULL; -} - -/* unused function: length_MechTypeList */ - -/* unused function: copy_MechTypeList */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -static int -encode_ContextFlags(unsigned char *p, size_t len, const ContextFlags *data, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - { - unsigned char c = 0; - *p-- = c; - len--; - ret++; - c = 0; - *p-- = c; - len--; - ret++; - c = 0; - *p-- = c; - len--; - ret++; - c = 0; - if (data->integFlag) { - c |= 1 << 1; - } - if (data->confFlag) { - c |= 1 << 2; - } - if (data->anonFlag) { - c |= 1 << 3; - } - if (data->sequenceFlag) { - c |= 1 << 4; - } - if (data->replayFlag) { - c |= 1 << 5; - } - if (data->mutualFlag) { - c |= 1 << 6; - } - if (data->delegFlag) { - c |= 1 << 7; - } - *p-- = c; - *p-- = 0; - len -= 2; - ret += 2; - } - - e = der_put_length_and_tag(p, len, ret, ASN1_C_UNIV, PRIM, UT_BitString, - &l); - BACK; - *size = ret; - return (0); -} - -static int -decode_ContextFlags(const unsigned char *p, size_t len, ContextFlags *data, - size_t *size) { - size_t ret = 0, reallen; - size_t l; - int e; - - memset(data, 0, sizeof(*data)); - reallen = 0; - e = der_match_tag_and_length(p, len, ASN1_C_UNIV, PRIM, UT_BitString, - &reallen, &l); - FORW; - if (len < reallen) { - return (ASN1_OVERRUN); - } - p++; - len--; - POST(len); - reallen--; - ret++; - data->delegFlag = (*p >> 7) & 1; - data->mutualFlag = (*p >> 6) & 1; - data->replayFlag = (*p >> 5) & 1; - data->sequenceFlag = (*p >> 4) & 1; - data->anonFlag = (*p >> 3) & 1; - data->confFlag = (*p >> 2) & 1; - data->integFlag = (*p >> 1) & 1; - ret += reallen; - if (size) { - *size = ret; - } - return (0); -fail: - free_ContextFlags(data); - return (e); -} - -static void -free_ContextFlags(ContextFlags *data) { - (void)data; -} - -/* unused function: length_ContextFlags */ - -/* unused function: copy_ContextFlags */ - -/* unused function: ContextFlags2int */ - -/* unused function: int2ContextFlags */ - -/* unused variable: ContextFlags_units */ - -/* unused function: asn1_ContextFlags_units */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -static int -encode_NegTokenInit(unsigned char *p, size_t len, const NegTokenInit *data, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - if ((data)->mechListMIC) { - size_t oldret = ret; - ret = 0; - e = encode_octet_string(p, len, (data)->mechListMIC, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 3, - &l); - BACK; - ret += oldret; - } - if ((data)->mechToken) { - size_t oldret = ret; - ret = 0; - e = encode_octet_string(p, len, (data)->mechToken, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 2, - &l); - BACK; - ret += oldret; - } - if ((data)->reqFlags) { - size_t oldret = ret; - ret = 0; - e = encode_ContextFlags(p, len, (data)->reqFlags, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 1, - &l); - BACK; - ret += oldret; - } - { - size_t oldret = ret; - ret = 0; - e = encode_MechTypeList(p, len, &(data)->mechTypes, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 0, - &l); - BACK; - ret += oldret; - } - e = der_put_length_and_tag(p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, - &l); - BACK; - *size = ret; - return (0); -} - -static int -decode_NegTokenInit(const unsigned char *p, size_t len, NegTokenInit *data, - size_t *size) { - size_t ret = 0, reallen; - size_t l; - int e; - - memset(data, 0, sizeof(*data)); - reallen = 0; - e = der_match_tag_and_length(p, len, ASN1_C_UNIV, CONS, UT_Sequence, - &reallen, &l); - FORW; - { - int dce_fix; - if ((dce_fix = fix_dce(reallen, &len)) < 0) { - e = ASN1_BAD_FORMAT; - goto fail; - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 0, &l); - FORW; - { - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - e = ASN1_BAD_FORMAT; - goto fail; - } - e = decode_MechTypeList( - p, len, &(data)->mechTypes, &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 1, &l); - if (e) { - (data)->reqFlags = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - e = ASN1_BAD_FORMAT; - goto fail; - } - (data)->reqFlags = malloc( - sizeof(*(data)->reqFlags)); - if ((data)->reqFlags == NULL) { - e = ENOMEM; - goto fail; - } - e = decode_ContextFlags( - p, len, (data)->reqFlags, &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 2, &l); - if (e) { - (data)->mechToken = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - e = ASN1_BAD_FORMAT; - goto fail; - } - (data)->mechToken = malloc( - sizeof(*(data)->mechToken)); - if ((data)->mechToken == NULL) { - e = ENOMEM; - goto fail; - } - e = decode_octet_string( - p, len, (data)->mechToken, &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 3, &l); - if (e) { - (data)->mechListMIC = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - e = ASN1_BAD_FORMAT; - goto fail; - } - (data)->mechListMIC = malloc( - sizeof(*(data)->mechListMIC)); - if ((data)->mechListMIC == NULL) { - e = ENOMEM; - goto fail; - } - e = decode_octet_string( - p, len, (data)->mechListMIC, - &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - if (dce_fix) { - e = der_match_tag_and_length(p, len, (Der_class)0, - (Der_type)0, 0, &reallen, - &l); - FORW; - } - } - if (size) { - *size = ret; - } - return (0); -fail: - free_NegTokenInit(data); - return (e); -} - -static void -free_NegTokenInit(NegTokenInit *data) { - free_MechTypeList(&(data)->mechTypes); - if ((data)->reqFlags) { - free_ContextFlags((data)->reqFlags); - free((data)->reqFlags); - (data)->reqFlags = NULL; - } - if ((data)->mechToken) { - free_octet_string((data)->mechToken); - free((data)->mechToken); - (data)->mechToken = NULL; - } - if ((data)->mechListMIC) { - free_octet_string((data)->mechListMIC); - free((data)->mechListMIC); - (data)->mechListMIC = NULL; - } -} - -/* unused function: length_NegTokenInit */ - -/* unused function: copy_NegTokenInit */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -static int -encode_NegTokenResp(unsigned char *p, size_t len, const NegTokenResp *data, - size_t *size) { - size_t ret = 0; - size_t l; - int e; - - if ((data)->mechListMIC) { - size_t oldret = ret; - ret = 0; - e = encode_octet_string(p, len, (data)->mechListMIC, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 3, - &l); - BACK; - ret += oldret; - } - if ((data)->responseToken) { - size_t oldret = ret; - ret = 0; - e = encode_octet_string(p, len, (data)->responseToken, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 2, - &l); - BACK; - ret += oldret; - } - if ((data)->supportedMech) { - size_t oldret = ret; - ret = 0; - e = encode_MechType(p, len, (data)->supportedMech, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 1, - &l); - BACK; - ret += oldret; - } - if ((data)->negState) { - size_t oldret = ret; - ret = 0; - e = encode_enumerated(p, len, (data)->negState, &l); - BACK; - e = der_put_length_and_tag(p, len, ret, ASN1_C_CONTEXT, CONS, 0, - &l); - BACK; - ret += oldret; - } - e = der_put_length_and_tag(p, len, ret, ASN1_C_UNIV, CONS, UT_Sequence, - &l); - BACK; - *size = ret; - return (0); -} - -static int -decode_NegTokenResp(const unsigned char *p, size_t len, NegTokenResp *data, - size_t *size) { - size_t ret = 0, reallen; - size_t l; - int e; - - /* cppcheck-suppress uninitvar */ - memset(data, 0, sizeof(*data)); - reallen = 0; - e = der_match_tag_and_length(p, len, ASN1_C_UNIV, CONS, UT_Sequence, - &reallen, &l); - FORW; - { - int dce_fix; - if ((dce_fix = fix_dce(reallen, &len)) < 0) { - return (ASN1_BAD_FORMAT); - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 0, &l); - if (e) { - (data)->negState = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - return (ASN1_BAD_FORMAT); - } - (data)->negState = malloc( - sizeof(*(data)->negState)); - if ((data)->negState == NULL) { - return (ENOMEM); - } - e = decode_enumerated( - p, len, (data)->negState, &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 1, &l); - if (e) { - (data)->supportedMech = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - return (ASN1_BAD_FORMAT); - } - (data)->supportedMech = malloc( - sizeof(*(data)->supportedMech)); - if ((data)->supportedMech == NULL) { - return (ENOMEM); - } - e = decode_MechType( - p, len, (data)->supportedMech, - &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 2, &l); - if (e) { - (data)->responseToken = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - return (ASN1_BAD_FORMAT); - } - (data)->responseToken = malloc( - sizeof(*(data)->responseToken)); - if ((data)->responseToken == NULL) { - return (ENOMEM); - } - e = decode_octet_string( - p, len, (data)->responseToken, - &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - { - size_t newlen, oldlen; - - e = der_match_tag(p, len, ASN1_C_CONTEXT, CONS, 3, &l); - if (e) { - (data)->mechListMIC = NULL; - } else { - p += l; - len -= l; - ret += l; - e = der_get_length(p, len, &newlen, &l); - FORW; - { - int mydce_fix; - oldlen = len; - if ((mydce_fix = fix_dce(newlen, - &len)) < 0) { - return (ASN1_BAD_FORMAT); - } - (data)->mechListMIC = malloc( - sizeof(*(data)->mechListMIC)); - if ((data)->mechListMIC == NULL) { - return (ENOMEM); - } - e = decode_octet_string( - p, len, (data)->mechListMIC, - &l); - FORW; - if (mydce_fix) { - e = der_match_tag_and_length( - p, len, (Der_class)0, - (Der_type)0, 0, - &reallen, &l); - FORW; - } else { - len = oldlen - newlen; - } - } - } - } - if (dce_fix) { - e = der_match_tag_and_length(p, len, (Der_class)0, - (Der_type)0, 0, &reallen, - &l); - FORW; - } - } - if (size) { - *size = ret; - } - return (0); -fail: - free_NegTokenResp(data); - return (e); -} - -static void -free_NegTokenResp(NegTokenResp *data) { - if ((data)->negState) { - free((data)->negState); - (data)->negState = NULL; - } - if ((data)->supportedMech) { - free_MechType((data)->supportedMech); - free((data)->supportedMech); - (data)->supportedMech = NULL; - } - if ((data)->responseToken) { - free_octet_string((data)->responseToken); - free((data)->responseToken); - (data)->responseToken = NULL; - } - if ((data)->mechListMIC) { - free_octet_string((data)->mechListMIC); - free((data)->mechListMIC); - (data)->mechListMIC = NULL; - } -} - -/* unused function: length_NegTokenResp */ - -/* unused function: copy_NegTokenResp */ - -/* Generated from spnego.asn1 */ -/* Do not edit */ - -/* CHOICE */ -/* unused variable: asn1_NegotiationToken_dummy_holder */ diff --git a/lib/dns/spnego_asn1.pl b/lib/dns/spnego_asn1.pl deleted file mode 100644 index 66f7b731b8..0000000000 --- a/lib/dns/spnego_asn1.pl +++ /dev/null @@ -1,193 +0,0 @@ -#!/bin/bin/perl -w -# -# 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. - -# Our SPNEGO implementation uses some functions generated by the -# Heimdal ASN.1 compiler, which this script then whacks a bit to make -# them work properly in this stripped down implementation. We don't -# want to require our users to have a copy of the compiler, so we ship -# the output of this script, but we need to keep the script around in -# any case to cope with future changes to the SPNEGO ASN.1 code, so we -# might as well supply the script for users who want it. - -# Overall plan: run the ASN.1 compiler, run each of its output files -# through indent, fix up symbols and whack everything to be static. -# We use indent for two reasons: (1) to whack the Heimdal compiler's -# output into something closer to ISC's coding standard, and (2) to -# make it easier for this script to parse the result. - -# Output from this script is C code which we expect to be #included -# into another C file, which is why everything generated by this -# script is marked "static". The intent is to minimize the number of -# extern symbols exported by the SPNEGO implementation, to avoid -# potential conflicts with the GSSAPI libraries. - -### - -# Filename of the ASN.1 specification. Hardcoded for the moment -# since this script is intended for compiling exactly one module. - -my $asn1_source = $ENV{ASN1_SOURCE} || "spnego.asn1"; - -# Heimdal ASN.1 compiler. This script was written using the version -# from Heimdal 0.7.1. To build this, download a copy of -# heimdal-0.7.1.tar.gz, configure and build with the default options, -# then look for the compiler in heimdal-0.7.1/lib/asn1/asn1_compile. - -my $asn1_compile = $ENV{ASN1_COMPILE} || "asn1_compile"; - -# BSD indent program. This script was written using the version of -# indent that comes with FreeBSD 4.11-STABLE. The GNU project, as -# usual, couldn't resist the temptation to monkey with indent's -# command line syntax, so this probably won't work with GNU indent. - -my $indent = $ENV{INDENT} || "indent"; - -### - -# Step 1: run the compiler. Input is the ASN.1 file. Outputs are a -# header file (name specified on command line without the .h suffix), -# a file called "asn1_files" listing the names of the other output -# files, and a set of files containing C code generated by the -# compiler for each data type that the compiler found. - -if (! -r $asn1_source || system($asn1_compile, $asn1_source, "asn1")) { - die("Couldn't compile ASN.1 source file $asn1_source\n"); -} - -my @files = ("asn1.h"); - -open(F, "asn1_files") - or die("Couldn't open asn1_files: $!\n"); -push(@files, split) - while (); -close(F); - -unlink("asn1_files"); - -### - -# Step 2: generate header block. - -print(q~/* - * Copyright (C) 2006 Internet Systems Consortium, Inc. ("ISC") - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, - * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM - * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/* $Id: spnego_asn1.pl,v 1.4 2007/06/19 23:47:16 tbox Exp $ */ - -/*! \file - * \brief Method routines generated from SPNEGO ASN.1 module. - * See spnego_asn1.pl for details. Do not edit. - */ - -~); - -### - -# Step 3: read and process each generated file, then delete it. - -my $output; - -for my $file (@files) { - - my $is_static = 0; - - system($indent, "-di1", "-ldi1", $file) == 0 - or die("Couldn't indent $file"); - - unlink("$file.BAK"); - - open(F, $file) - or die("Couldn't open $file: $!"); - - while () { - - # Symbol name fixups - - s/heim_general_string/general_string/g; - s/heim_octet_string/octet_string/g; - s/heim_oid/oid/g; - s/heim_utf8_string/utf8_string/g; - - # Convert all externs to statics - - if (/^static/) { - $is_static = 1; - } - - if (!/^typedef/ && - !$is_static && - /^[A-Za-z_][0-9A-Za-z_]*[ \t]*($|[^:0-9A-Za-z_])/) { - $_ = "static " . $_; - $is_static = 1; - } - - if (/[{};]/) { - $is_static = 0; - } - - # Suppress file inclusion, pass anything else through - - if (!/#include/) { - $output .= $_; - } - } - - close(F); - unlink($file); -} - -# Step 4: Delete unused stuff to avoid code bloat and compiler warnings. - -my @unused_functions = qw(ContextFlags2int - int2ContextFlags - asn1_ContextFlags_units - length_NegTokenInit - copy_NegTokenInit - length_NegTokenResp - copy_NegTokenResp - length_MechTypeList - length_MechType - copy_MechTypeList - length_ContextFlags - copy_ContextFlags - copy_MechType); - -$output =~ s<^static [^\n]+\n$_\(.+?^}>ms - foreach (@unused_functions); - -$output =~ s<^static .+$_\(.*\);$>m - foreach (@unused_functions); - -$output =~ s<^static struct units ContextFlags_units\[\].+?^};> - ms; - -$output =~ s<^static int asn1_NegotiationToken_dummy_holder = 1;> - ms; - -$output =~ s<^static void\nfree_ContextFlags\(ContextFlags \* data\)\n{\n> - <$&\t(void)data;\n>ms; - -# Step 5: Write the result. - -print($output); - diff --git a/lib/dns/ssu_external.c b/lib/dns/ssu_external.c index f690beea31..a1f0a3736a 100644 --- a/lib/dns/ssu_external.c +++ b/lib/dns/ssu_external.c @@ -20,10 +20,10 @@ #include #include -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 #include #include -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ #include #include @@ -58,7 +58,7 @@ ssu_e_log(int level, const char *fmt, ...) { static int ux_socket_connect(const char *path) { int fd = -1; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 struct sockaddr_un addr; REQUIRE(path != NULL); @@ -94,7 +94,7 @@ ux_socket_connect(const char *path) { close(fd); return (-1); } -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ return (fd); } diff --git a/lib/dns/tests/Kyuafile b/lib/dns/tests/Kyuafile deleted file mode 100644 index a3066a6175..0000000000 --- a/lib/dns/tests/Kyuafile +++ /dev/null @@ -1,33 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='acl_test'} -tap_test_program{name='db_test'} -tap_test_program{name='dbdiff_test'} -tap_test_program{name='dbiterator_test'} -tap_test_program{name='dbversion_test'} -tap_test_program{name='dh_test'} -tap_test_program{name='dispatch_test'} -tap_test_program{name='dnstap_test'} -tap_test_program{name='dst_test'} -tap_test_program{name='geoip_test'} -tap_test_program{name='keytable_test'} -tap_test_program{name='master_test'} -tap_test_program{name='name_test'} -tap_test_program{name='nsec3_test'} -tap_test_program{name='peer_test'} -tap_test_program{name='private_test'} -tap_test_program{name='rbt_serialize_test', is_exclusive=true} -tap_test_program{name='rbt_test'} -tap_test_program{name='rdata_test'} -tap_test_program{name='rdataset_test'} -tap_test_program{name='rdatasetstats_test'} -tap_test_program{name='resolver_test'} -tap_test_program{name='result_test'} -tap_test_program{name='rsa_test'} -tap_test_program{name='sigs_test'} -tap_test_program{name='time_test'} -tap_test_program{name='tsig_test'} -tap_test_program{name='update_test'} -tap_test_program{name='zonemgr_test'} -tap_test_program{name='zt_test'} diff --git a/lib/dns/tests/Makefile.am b/lib/dns/tests/Makefile.am new file mode 100644 index 0000000000..8a890bfb47 --- /dev/null +++ b/lib/dns/tests/Makefile.am @@ -0,0 +1,96 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(KRB5_CFLAGS) \ + -DSRCDIR=\"$(abs_srcdir)\" \ + -DBUILDDIR=\"$(abs_builddir)\" + +LDADD += \ + libdnstest.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) + +noinst_LTLIBRARIES = libdnstest.la +libdnstest_la_SOURCES = dnstest.c dnstest.h + +check_PROGRAMS = \ + acl_test \ + db_test \ + dbdiff_test \ + dbiterator_test \ + dbversion_test \ + dh_test \ + dispatch_test \ + dst_test \ + geoip_test \ + keytable_test \ + name_test \ + nsec3_test \ + peer_test \ + private_test \ + rbt_serialize_test \ + rbt_test \ + rdata_test \ + rdataset_test \ + rdatasetstats_test \ + resolver_test \ + result_test \ + rsa_test \ + sigs_test \ + time_test \ + tsig_test \ + update_test \ + zonemgr_test \ + zt_test + +TESTS = $(check_PROGRAMS) + +if HAVE_PERL + +check_PROGRAMS += \ + master_test + +EXTRA_master_test_DEPENDENCIES = testdata/master/master12.data testdata/master/master13.data testdata/master/master14.data +CLEANFILES = $(EXTRA_master_test_DEPENDENCIES) + +testdata/master/master12.data: testdata/master/master12.data.in + mkdir -p testdata/master + $(PERL) -w $(srcdir)/mkraw.pl < testdata/master/master12.data.in > $@ + +testdata/master/master13.data: testdata/master/master13.data.in + mkdir -p testdata/master + $(PERL) -w $(srcdir)/mkraw.pl < testdata/master/master13.data.in > $@ + +testdata/master/master14.data: testdata/master/master14.data.in + mkdir -p testdata/master + $(PERL) -w $(srcdir)/mkraw.pl < testdata/master/master14.data.in > $@ + +endif + +if HAVE_GEOIP2 +check_PROGRAMS += \ + geoip_test + +geoip_test_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(MAXMINDDB_CFLAGS) + +geoip_test_LDADD = \ + $(LDADD) \ + $(MAXMINDDB_LIBS) +endif + +if HAVE_DNSTAP +check_PROGRAMS += \ + dnstap_test + +dnstap_test_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(DNSTAP_CFLAGS) +dnstap_test_LDADD = \ + $(LDADD) \ + $(DNSTAP_LIBS) +endif diff --git a/lib/dns/tests/dnstap_test.c b/lib/dns/tests/dnstap_test.c index 165c8f7aa8..39c46b9ddc 100644 --- a/lib/dns/tests/dnstap_test.c +++ b/lib/dns/tests/dnstap_test.c @@ -67,7 +67,7 @@ _teardown(void **state) { } static void -cleanup() { +cleanup(void) { (void)isc_file_remove(TAPFILE); (void)isc_file_remove(TAPSOCK); } diff --git a/lib/dns/tests/geoip_test.c b/lib/dns/tests/geoip_test.c index eca6f9b824..d9d32f4304 100644 --- a/lib/dns/tests/geoip_test.c +++ b/lib/dns/tests/geoip_test.c @@ -22,6 +22,7 @@ #define UNIT_TESTING #include +#include #include #include @@ -30,12 +31,8 @@ #include -#include "dnstest.h" - -#if defined(HAVE_GEOIP2) -#include - #include "../geoip2.c" +#include "dnstest.h" /* Use GeoIP2 databases from the 'geoip2' system test */ #define TEST_GEOIP_DATA "../../../bin/tests/system/geoip2/data" @@ -396,11 +393,9 @@ domain(void **state) { match = do_lookup_string("10.53.0.5", dns_geoip_domain_name, "five.es"); assert_true(match); } -#endif /* HAVE_GEOIP2 */ int main(void) { -#if defined(HAVE_GEOIP2) const struct CMUnitTest tests[] = { cmocka_unit_test(baseline), cmocka_unit_test(country), cmocka_unit_test(country_v6), cmocka_unit_test(city), @@ -410,9 +405,6 @@ main(void) { }; return (cmocka_run_group_tests(tests, _setup, _teardown)); -#else /* if defined(HAVE_GEOIP2) */ - print_message("1..0 # Skip GeoIP not enabled\n"); -#endif /* if defined(HAVE_GEOIP2) */ } #else /* HAVE_CMOCKA */ diff --git a/lib/dns/tests/keytable_test.c b/lib/dns/tests/keytable_test.c index 40fd712cc4..881553660d 100644 --- a/lib/dns/tests/keytable_test.c +++ b/lib/dns/tests/keytable_test.c @@ -172,7 +172,7 @@ create_dsstruct(dns_name_t *name, uint16_t flags, uint8_t proto, uint8_t alg, /* Common setup: create a keytable and ntatable to test with a few keys */ static void -create_tables() { +create_tables(void) { isc_result_t result; unsigned char digest[ISC_MAX_MD_SIZE]; dns_rdata_ds_t ds; @@ -215,7 +215,7 @@ create_tables() { } static void -destroy_tables() { +destroy_tables(void) { if (ntatable != NULL) { dns_ntatable_detach(&ntatable); } diff --git a/lib/dns/tests/master_test.c b/lib/dns/tests/master_test.c index 74709a85ea..9b8913057e 100644 --- a/lib/dns/tests/master_test.c +++ b/lib/dns/tests/master_test.c @@ -23,6 +23,7 @@ #define UNIT_TESTING #include +#include #include #include #include @@ -140,7 +141,8 @@ setup_master(void (*warn)(struct dns_rdatacallbacks *, const char *, ...), } static isc_result_t -test_master(const char *testfile, dns_masterformat_t format, +test_master(const char *workdir, const char *testfile, + dns_masterformat_t format, void (*warn)(struct dns_rdatacallbacks *, const char *, ...), void (*error)(struct dns_rdatacallbacks *, const char *, ...)) { isc_result_t result; @@ -161,9 +163,17 @@ test_master(const char *testfile, dns_masterformat_t format, callbacks.error = error; } + if (workdir != NULL) { + result = isc_dir_chdir(workdir); + if (result != ISC_R_SUCCESS) { + return (result); + } + } + result = dns_master_loadfile(testfile, &dns_origin, &dns_origin, dns_rdataclass_in, true, 0, &callbacks, NULL, NULL, dt_mctx, format, 0); + return (result); } @@ -183,7 +193,7 @@ load_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master1.data", + result = test_master(SRCDIR, "testdata/master/master1.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -198,7 +208,7 @@ unexpected_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master2.data", + result = test_master(SRCDIR, "testdata/master/master2.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_UNEXPECTEDEND); } @@ -214,7 +224,7 @@ noowner_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master3.data", + result = test_master(SRCDIR, "testdata/master/master3.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, DNS_R_NOOWNER); } @@ -230,7 +240,7 @@ nottl_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master4.data", + result = test_master(SRCDIR, "testdata/master/master4.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -246,7 +256,7 @@ badclass_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master5.data", + result = test_master(SRCDIR, "testdata/master/master5.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, DNS_R_BADCLASS); } @@ -261,7 +271,7 @@ toobig_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master15.data", + result = test_master(SRCDIR, "testdata/master/master15.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_NOSPACE); } @@ -276,7 +286,7 @@ maxrdata_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master16.data", + result = test_master(SRCDIR, "testdata/master/master16.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -291,7 +301,7 @@ dnskey_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master6.data", + result = test_master(SRCDIR, "testdata/master/master6.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -309,7 +319,7 @@ dnsnokey_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master7.data", + result = test_master(SRCDIR, "testdata/master/master7.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_UNEXPECTEDEND); } @@ -324,7 +334,7 @@ include_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master8.data", + result = test_master(SRCDIR, "testdata/master/master8.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, DNS_R_SEENINCLUDE); } @@ -343,6 +353,9 @@ master_includelist_test(void **state) { result = setup_master(nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); + result = isc_dir_chdir(SRCDIR); + assert_int_equal(result, ISC_R_SUCCESS); + result = dns_master_loadfile( "testdata/master/master8.data", &dns_origin, &dns_origin, dns_rdataclass_in, 0, true, &callbacks, include_callback, @@ -365,7 +378,7 @@ includefail_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master9.data", + result = test_master(SRCDIR, "testdata/master/master9.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, DNS_R_BADCLASS); } @@ -380,7 +393,7 @@ blanklines_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master10.data", + result = test_master(SRCDIR, "testdata/master/master10.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -396,7 +409,7 @@ leadingzero_test(void **state) { UNUSED(state); - result = test_master("testdata/master/master11.data", + result = test_master(SRCDIR, "testdata/master/master11.data", dns_masterformat_text, nullmsg, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); } @@ -447,21 +460,21 @@ loadraw_test(void **state) { UNUSED(state); /* Raw format version 0 */ - result = test_master("testdata/master/master12.data", + result = test_master(BUILDDIR, "testdata/master/master12.data", dns_masterformat_raw, nullmsg, nullmsg); assert_string_equal(isc_result_totext(result), "success"); assert_true(headerset); assert_int_equal(header.flags, 0); /* Raw format version 1, no source serial */ - result = test_master("testdata/master/master13.data", + result = test_master(BUILDDIR, "testdata/master/master13.data", dns_masterformat_raw, nullmsg, nullmsg); assert_string_equal(isc_result_totext(result), "success"); assert_true(headerset); assert_int_equal(header.flags, 0); /* Raw format version 1, source serial == 2011120101 */ - result = test_master("testdata/master/master14.data", + result = test_master(BUILDDIR, "testdata/master/master14.data", dns_masterformat_raw, nullmsg, nullmsg); assert_string_equal(isc_result_totext(result), "success"); assert_true(headerset); @@ -501,10 +514,16 @@ dumpraw_test(void **state) { dns_rdataclass_in, 0, NULL, &db); assert_int_equal(result, ISC_R_SUCCESS); + result = isc_dir_chdir(SRCDIR); + assert_int_equal(result, ISC_R_SUCCESS); + result = dns_db_load(db, "testdata/master/master1.data", dns_masterformat_text, 0); assert_int_equal(result, ISC_R_SUCCESS); + result = isc_dir_chdir(BUILDDIR); + assert_int_equal(result, ISC_R_SUCCESS); + dns_db_currentversion(db, &version); result = dns_master_dump(dt_mctx, db, version, @@ -512,7 +531,7 @@ dumpraw_test(void **state) { dns_masterformat_raw, NULL); assert_int_equal(result, ISC_R_SUCCESS); - result = test_master("test.dump", dns_masterformat_raw, nullmsg, + result = test_master(NULL, "test.dump", dns_masterformat_raw, nullmsg, nullmsg); assert_string_equal(isc_result_totext(result), "success"); assert_true(headerset); @@ -528,7 +547,7 @@ dumpraw_test(void **state) { dns_masterformat_raw, &header); assert_int_equal(result, ISC_R_SUCCESS); - result = test_master("test.dump", dns_masterformat_raw, nullmsg, + result = test_master(NULL, "test.dump", dns_masterformat_raw, nullmsg, nullmsg); assert_string_equal(isc_result_totext(result), "success"); assert_true(headerset); @@ -573,7 +592,7 @@ neworigin_test(void **state) { UNUSED(state); warn_expect_value = "record with inherited owner"; - result = test_master("testdata/master/master17.data", + result = test_master(SRCDIR, "testdata/master/master17.data", dns_masterformat_text, warn_expect, nullmsg); assert_int_equal(result, ISC_R_SUCCESS); assert_true(warn_expect_result); diff --git a/lib/dns/tkey.c b/lib/dns/tkey.c index 1e6fa5ae4c..97209ff7b1 100644 --- a/lib/dns/tkey.c +++ b/lib/dns/tkey.c @@ -14,6 +14,14 @@ #include #include +#if HAVE_GSSAPI +#if HAVE_GSSAPI_GSSAPI_H +#include +#elif HAVE_GSSAPI_H +#include +#endif +#endif /* HAVE_GSSAPI */ + #include #include #include @@ -574,9 +582,9 @@ process_gsstkey(dns_message_t *msg, dns_name_t *name, dns_rdata_tkey_t *tkeyin, dns_tsigkey_detach(&tsigkey); } } else if (tsigkey == NULL) { -#ifdef GSSAPI +#if HAVE_GSSAPI OM_uint32 gret, minor, lifetime; -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ uint32_t expire; RETERR(dst_key_fromgssapi(name, gss_ctx, ring->mctx, &dstkey, @@ -586,12 +594,12 @@ process_gsstkey(dns_message_t *msg, dns_name_t *name, dns_rdata_tkey_t *tkeyin, * is smaller. */ expire = now + 3600; -#ifdef GSSAPI +#if HAVE_GSSAPI gret = gss_context_time(&minor, gss_ctx, &lifetime); if (gret == GSS_S_COMPLETE && now + lifetime < expire) { expire = now + lifetime; } -#endif /* ifdef GSSAPI */ +#endif /* HAVE_GSSAPI */ RETERR(dns_tsigkey_createfromkey( name, &tkeyin->algorithm, dstkey, true, principal, now, expire, ring->mctx, ring, &tsigkey)); diff --git a/lib/dns/win32/libdns.vcxproj.filters.in b/lib/dns/win32/libdns.vcxproj.filters.in index 89811c148d..33f16d4e84 100644 --- a/lib/dns/win32/libdns.vcxproj.filters.in +++ b/lib/dns/win32/libdns.vcxproj.filters.in @@ -27,9 +27,6 @@ Library Source Files - - Library Source Files - Library Source Files @@ -623,9 +620,6 @@ Library Header Files - - Library Header Files - Library Header Files diff --git a/lib/dns/win32/libdns.vcxproj.in b/lib/dns/win32/libdns.vcxproj.in index 3a5cd719c0..b8e8438d2a 100644 --- a/lib/dns/win32/libdns.vcxproj.in +++ b/lib/dns/win32/libdns.vcxproj.in @@ -223,7 +223,6 @@ - diff --git a/lib/dns/win32/version.c b/lib/dns/win32/version.c deleted file mode 100644 index 19fc7dbd50..0000000000 --- a/lib/dns/win32/version.c +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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 - -LIBDNS_EXTERNAL_DATA const char dns_version[] = VERSION; -LIBDNS_EXTERNAL_DATA const char dns_major[] = MAJOR; -LIBDNS_EXTERNAL_DATA const char dns_mapapi[] = MAPAPI; - -LIBDNS_EXTERNAL_DATA const unsigned int dns_libinterface = LIBINTERFACE; -LIBDNS_EXTERNAL_DATA const unsigned int dns_librevision = LIBREVISION; -LIBDNS_EXTERNAL_DATA const unsigned int dns_libage = LIBAGE; diff --git a/lib/irs/Kyuafile b/lib/irs/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/irs/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/irs/Makefile.am b/lib/irs/Makefile.am new file mode 100644 index 0000000000..cb7024381c --- /dev/null +++ b/lib/irs/Makefile.am @@ -0,0 +1,40 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libirs.la + +libirs_ladir = $(includedir)/irs +libirs_la_HEADERS = \ + include/irs/context.h \ + include/irs/dnsconf.h \ + include/irs/netdb.h \ + include/irs/resconf.h \ + include/irs/types.h + +libirs_la_SOURCES = \ + $(libirs_la_HEADERS) \ + context.c \ + dnsconf.c \ + gai_strerror.c \ + getaddrinfo.c \ + getnameinfo.c \ + resconf.c + +libirs_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBIRS_CFLAGS) + +libirs_la_LIBADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCFG_LIBS) + +libirs_la_LDFLAGS = \ + $(libirs_VERSION_INFO) + + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/irs/context.c b/lib/irs/context.c index 267383baab..7ac891e635 100644 --- a/lib/irs/context.c +++ b/lib/irs/context.c @@ -42,7 +42,7 @@ #define DNS_CONF "/etc/dns.conf" #endif /* ifndef DNS_CONF */ -ISC_THREAD_LOCAL irs_context_t *irs_context = NULL; +static thread_local irs_context_t *irs_context = NULL; struct irs_context { /* diff --git a/lib/irs/include/irs/netdb.h b/lib/irs/include/irs/netdb.h new file mode 100644 index 0000000000..bf89777473 --- /dev/null +++ b/lib/irs/include/irs/netdb.h @@ -0,0 +1,190 @@ +/* + * 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 */ + +#ifndef IRS_NETDB_H +#define IRS_NETDB_H 1 + +#include /* Contractual provision. */ +#include /* Required on FreeBSD (and others?) for size_t. */ + +/* + * Undefine all #defines we are interested in as may or may not have + * defined them. + */ + +/* + * Error return codes from gethostbyname() and gethostbyaddr() + * (left in extern int h_errno). + */ + +#undef NETDB_INTERNAL +#undef NETDB_SUCCESS +#undef HOST_NOT_FOUND +#undef TRY_AGAIN +#undef NO_RECOVERY +#undef NO_DATA +#undef NO_ADDRESS + +#define NETDB_INTERNAL -1 /* see errno */ +#define NETDB_SUCCESS 0 /* no problem */ +#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ +#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ +#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ +#define NO_DATA 4 /* Valid name, no data record of requested type */ +#define NO_ADDRESS NO_DATA /* no address, look for MX record */ + +/* + * Error return codes from getaddrinfo(). EAI_INSECUREDATA is our own extension + * and it's very unlikely to be already defined, but undef it just in case; it + * at least doesn't do any harm. + */ + +#undef EAI_ADDRFAMILY +#undef EAI_AGAIN +#undef EAI_BADFLAGS +#undef EAI_FAIL +#undef EAI_FAMILY +#undef EAI_MEMORY +#undef EAI_NODATA +#undef EAI_NONAME +#undef EAI_SERVICE +#undef EAI_SOCKTYPE +#undef EAI_SYSTEM +#undef EAI_BADHINTS +#undef EAI_PROTOCOL +#undef EAI_OVERFLOW +#undef EAI_INSECUREDATA +#undef EAI_MAX + +#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ +#define EAI_AGAIN 2 /* temporary failure in name resolution */ +#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ +#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ +#define EAI_FAMILY 5 /* ai_family not supported */ +#define EAI_MEMORY 6 /* memory allocation failure */ +#define EAI_NODATA 7 /* no address associated with hostname */ +#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ +#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ +#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ +#define EAI_SYSTEM 11 /* system error returned in errno */ +#define EAI_BADHINTS 12 +#define EAI_PROTOCOL 13 +#define EAI_OVERFLOW 14 +#define EAI_INSECUREDATA 15 +#define EAI_MAX 16 + +/* + * Flag values for getaddrinfo() + */ +#undef AI_PASSIVE +#undef AI_CANONNAME +#undef AI_NUMERICHOST + +#define AI_PASSIVE 0x00000001 +#define AI_CANONNAME 0x00000002 +#define AI_NUMERICHOST 0x00000004 + +/* + * Flag values for getipnodebyname() + */ +#undef AI_V4MAPPED +#undef AI_ALL +#undef AI_ADDRCONFIG +#undef AI_DEFAULT + +#define AI_V4MAPPED 0x00000008 +#define AI_ALL 0x00000010 +#define AI_ADDRCONFIG 0x00000020 +#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG) + +/* + * Constants for getnameinfo() + */ +#undef NI_MAXHOST +#undef NI_MAXSERV + +#define NI_MAXHOST 1025 +#define NI_MAXSERV 32 + +/* + * Flag values for getnameinfo() + */ +#undef NI_NOFQDN +#undef NI_NUMERICHOST +#undef NI_NAMEREQD +#undef NI_NUMERICSERV +#undef NI_DGRAM +#undef NI_NUMERICSCOPE + +#define NI_NOFQDN 0x00000001 +#define NI_NUMERICHOST 0x00000002 +#define NI_NAMEREQD 0x00000004 +#define NI_NUMERICSERV 0x00000008 +#define NI_DGRAM 0x00000010 + +/* + * Define to map into irs_ namespace. + */ + +#define IRS_NAMESPACE + +#ifdef IRS_NAMESPACE + +/* + * Use our versions not the ones from the C library. + */ + +#ifdef getnameinfo +#undef getnameinfo +#endif +#define getnameinfo irs_getnameinfo + +#ifdef getaddrinfo +#undef getaddrinfo +#endif +#define getaddrinfo irs_getaddrinfo + +#ifdef freeaddrinfo +#undef freeaddrinfo +#endif +#define freeaddrinfo irs_freeaddrinfo + +#ifdef gai_strerror +#undef gai_strerror +#endif +#define gai_strerror irs_gai_strerror + +int +getaddrinfo(const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **res); + +int +getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, + socklen_t hostlen, char *serv, socklen_t servlen, int flags); + +void +freeaddrinfo(struct addrinfo *ai); + +const char * +gai_strerror(int ecode); + +#endif /* IRS_NAMESPACE */ + +/* + * Tell Emacs to use C mode on this file. + * Local variables: + * mode: c + * End: + */ + +#endif /* IRS_NETDB_H */ diff --git a/lib/irs/include/irs/netdb.h.in b/lib/irs/include/irs/netdb.h.in deleted file mode 100644 index 4089f9e916..0000000000 --- a/lib/irs/include/irs/netdb.h.in +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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 */ - -#ifndef IRS_NETDB_H -#define IRS_NETDB_H 1 - -#include /* Required on FreeBSD (and others?) for size_t. */ -#include /* Contractual provision. */ - -/* - * Undefine all #defines we are interested in as may or may not have - * defined them. - */ - -/* - * Error return codes from gethostbyname() and gethostbyaddr() - * (left in extern int h_errno). - */ - -#undef NETDB_INTERNAL -#undef NETDB_SUCCESS -#undef HOST_NOT_FOUND -#undef TRY_AGAIN -#undef NO_RECOVERY -#undef NO_DATA -#undef NO_ADDRESS - -#define NETDB_INTERNAL -1 /* see errno */ -#define NETDB_SUCCESS 0 /* no problem */ -#define HOST_NOT_FOUND 1 /* Authoritative Answer Host not found */ -#define TRY_AGAIN 2 /* Non-Authoritive Host not found, or SERVERFAIL */ -#define NO_RECOVERY 3 /* Non recoverable errors, FORMERR, REFUSED, NOTIMP */ -#define NO_DATA 4 /* Valid name, no data record of requested type */ -#define NO_ADDRESS NO_DATA /* no address, look for MX record */ - -/* - * Error return codes from getaddrinfo(). EAI_INSECUREDATA is our own extension - * and it's very unlikely to be already defined, but undef it just in case; it - * at least doesn't do any harm. - */ - -#undef EAI_ADDRFAMILY -#undef EAI_AGAIN -#undef EAI_BADFLAGS -#undef EAI_FAIL -#undef EAI_FAMILY -#undef EAI_MEMORY -#undef EAI_NODATA -#undef EAI_NONAME -#undef EAI_SERVICE -#undef EAI_SOCKTYPE -#undef EAI_SYSTEM -#undef EAI_BADHINTS -#undef EAI_PROTOCOL -#undef EAI_OVERFLOW -#undef EAI_INSECUREDATA -#undef EAI_MAX - -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_OVERFLOW 14 -#define EAI_INSECUREDATA 15 -#define EAI_MAX 16 - -/* - * Flag values for getaddrinfo() - */ -#undef AI_PASSIVE -#undef AI_CANONNAME -#undef AI_NUMERICHOST - -#define AI_PASSIVE 0x00000001 -#define AI_CANONNAME 0x00000002 -#define AI_NUMERICHOST 0x00000004 - -/* - * Flag values for getipnodebyname() - */ -#undef AI_V4MAPPED -#undef AI_ALL -#undef AI_ADDRCONFIG -#undef AI_DEFAULT - -#define AI_V4MAPPED 0x00000008 -#define AI_ALL 0x00000010 -#define AI_ADDRCONFIG 0x00000020 -#define AI_DEFAULT (AI_V4MAPPED|AI_ADDRCONFIG) - -/* - * Constants for getnameinfo() - */ -#undef NI_MAXHOST -#undef NI_MAXSERV - -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 - -/* - * Flag values for getnameinfo() - */ -#undef NI_NOFQDN -#undef NI_NUMERICHOST -#undef NI_NAMEREQD -#undef NI_NUMERICSERV -#undef NI_DGRAM -#undef NI_NUMERICSCOPE - -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 - -/* - * Define to map into irs_ namespace. - */ - -#define IRS_NAMESPACE - -#ifdef IRS_NAMESPACE - -/* - * Use our versions not the ones from the C library. - */ - -#ifdef getnameinfo -#undef getnameinfo -#endif -#define getnameinfo irs_getnameinfo - -#ifdef getaddrinfo -#undef getaddrinfo -#endif -#define getaddrinfo irs_getaddrinfo - -#ifdef freeaddrinfo -#undef freeaddrinfo -#endif -#define freeaddrinfo irs_freeaddrinfo - -#ifdef gai_strerror -#undef gai_strerror -#endif -#define gai_strerror irs_gai_strerror - -int -getaddrinfo(const char *hostname, const char *servname, - const struct addrinfo *hints, struct addrinfo **res); - -int -getnameinfo(const struct sockaddr *sa, socklen_t salen, - char *host, socklen_t hostlen, - char *serv, socklen_t servlen, - int flags); - -void freeaddrinfo (struct addrinfo *ai); - -const char * -gai_strerror(int ecode); - -#endif /* IRS_NAMESPACE */ - -/* - * Tell Emacs to use C mode on this file. - * Local variables: - * mode: c - * End: - */ - -#endif /* IRS_NETDB_H */ diff --git a/lib/irs/include/irs/platform.h.in b/lib/irs/include/irs/platform.h.in deleted file mode 100644 index 5599374078..0000000000 --- a/lib/irs/include/irs/platform.h.in +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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 */ - -#ifndef IRS_PLATFORM_H -#define IRS_PLATFORM_H 1 - -/***** - ***** Platform-dependent defines. - *****/ - -#define LIBIRS_EXTERNAL_DATA - -/* - * Tell Emacs to use C mode on this file. - * Local Variables: - * mode: c - * End: - */ - -#endif /* IRS_PLATFORM_H */ diff --git a/lib/irs/include/irs/version.h b/lib/irs/include/irs/version.h deleted file mode 100644 index b980b4b6d5..0000000000 --- a/lib/irs/include/irs/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBIRS_EXTERNAL_DATA extern const char irs_version[]; - -LIBIRS_EXTERNAL_DATA extern const unsigned int irs_libinterface; -LIBIRS_EXTERNAL_DATA extern const unsigned int irs_librevision; -LIBIRS_EXTERNAL_DATA extern const unsigned int irs_libage; diff --git a/lib/irs/tests/Kyuafile b/lib/irs/tests/Kyuafile deleted file mode 100644 index 466f1bff62..0000000000 --- a/lib/irs/tests/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='resconf_test'} diff --git a/lib/irs/tests/Makefile.am b/lib/irs/tests/Makefile.am new file mode 100644 index 0000000000..5dc892cf39 --- /dev/null +++ b/lib/irs/tests/Makefile.am @@ -0,0 +1,15 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBIRS_CFLAGS) + +LDADD += \ + $(LIBISC_LIBS) \ + $(LIBIRS_LIBS) + +check_PROGRAMS = \ + resconf_test + +TESTS = $(check_PROGRAMS) diff --git a/lib/irs/tests/resconf_test.c b/lib/irs/tests/resconf_test.c index 7304a4ba6c..2cb81f6c09 100644 --- a/lib/irs/tests/resconf_test.c +++ b/lib/irs/tests/resconf_test.c @@ -32,7 +32,7 @@ static isc_mem_t *mctx = NULL; static void -setup_test() { +setup_test(void) { isc_mem_create(&mctx); /* diff --git a/lib/irs/version.c b/lib/irs/version.c deleted file mode 100644 index 694d964a35..0000000000 --- a/lib/irs/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -const char irs_version[] = VERSION; - -const unsigned int irs_libinterface = LIBINTERFACE; -const unsigned int irs_librevision = LIBREVISION; -const unsigned int irs_libage = LIBAGE; diff --git a/lib/irs/win32/include/irs/.gitignore b/lib/irs/win32/include/irs/.gitignore index a705f39f34..734ffcd9b4 100644 --- a/lib/irs/win32/include/irs/.gitignore +++ b/lib/irs/win32/include/irs/.gitignore @@ -1,2 +1 @@ !netdb.h -!platform.h diff --git a/lib/irs/win32/include/irs/platform.h b/lib/irs/win32/include/irs/platform.h deleted file mode 100644 index 1520601c7d..0000000000 --- a/lib/irs/win32/include/irs/platform.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 */ - -#ifndef IRS_PLATFORM_H -#define IRS_PLATFORM_H 1 - -/***** -***** Platform-dependent defines. -*****/ - -#ifdef LIBIRS_EXPORTS -#define LIBIRS_EXTERNAL_DATA __declspec(dllexport) -#else /* ifdef LIBIRS_EXPORTS */ -#define LIBIRS_EXTERNAL_DATA __declspec(dllimport) -#endif /* ifdef LIBIRS_EXPORTS */ - -/* - * Tell Emacs to use C mode on this file. - * Local Variables: - * mode: c - * End: - */ - -#endif /* IRS_PLATFORM_H */ diff --git a/lib/irs/win32/libirs.vcxproj.filters.in b/lib/irs/win32/libirs.vcxproj.filters.in index 0ffbc07357..670a65c18f 100644 --- a/lib/irs/win32/libirs.vcxproj.filters.in +++ b/lib/irs/win32/libirs.vcxproj.filters.in @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -53,17 +50,11 @@ Header Files - - Header Files - Header Files Header Files - - Header Files - diff --git a/lib/irs/win32/libirs.vcxproj.in b/lib/irs/win32/libirs.vcxproj.in index 7ca472a6c7..0f24284d8e 100644 --- a/lib/irs/win32/libirs.vcxproj.in +++ b/lib/irs/win32/libirs.vcxproj.in @@ -125,16 +125,13 @@ - - - diff --git a/lib/irs/win32/version.c b/lib/irs/win32/version.c deleted file mode 100644 index 76179c1087..0000000000 --- a/lib/irs/win32/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBIRS_EXTERNAL_DATA const char irs_version[] = VERSION; - -LIBIRS_EXTERNAL_DATA const unsigned int irs_libinterface = LIBINTERFACE; -LIBIRS_EXTERNAL_DATA const unsigned int irs_librevision = LIBREVISION; -LIBIRS_EXTERNAL_DATA const unsigned int irs_libage = LIBAGE; diff --git a/lib/isc/Kyuafile b/lib/isc/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/isc/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/isc/Makefile.am b/lib/isc/Makefile.am new file mode 100644 index 0000000000..cb6d6b7d77 --- /dev/null +++ b/lib/isc/Makefile.am @@ -0,0 +1,251 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libisc.la + +libisc_ladir = $(includedir)/isc +libisc_la_HEADERS = \ + include/isc/aes.h \ + include/isc/app.h \ + include/isc/assertions.h \ + include/isc/astack.h \ + include/isc/atomic.h \ + include/isc/attributes.h \ + include/isc/backtrace.h \ + include/isc/base32.h \ + include/isc/base64.h \ + include/isc/bind9.h \ + include/isc/buffer.h \ + include/isc/bufferlist.h \ + include/isc/commandline.h \ + include/isc/counter.h \ + include/isc/crc64.h \ + include/isc/deprecated.h \ + include/isc/endian.h \ + include/isc/errno.h \ + include/isc/error.h \ + include/isc/event.h \ + include/isc/eventclass.h \ + include/isc/file.h \ + include/isc/formatcheck.h \ + include/isc/fsaccess.h \ + include/isc/fuzz.h \ + include/isc/glob.h \ + include/isc/hash.h \ + include/isc/heap.h \ + include/isc/hex.h \ + include/isc/hmac.h \ + include/isc/hp.h \ + include/isc/ht.h \ + include/isc/httpd.h \ + include/isc/interfaceiter.h \ + include/isc/iterated_hash.h \ + include/isc/lang.h \ + include/isc/lex.h \ + include/isc/lfsr.h \ + include/isc/lib.h \ + include/isc/likely.h \ + include/isc/list.h \ + include/isc/log.h \ + include/isc/magic.h \ + include/isc/md.h \ + include/isc/mem.h \ + include/isc/meminfo.h \ + include/isc/mutexatomic.h \ + include/isc/mutexblock.h \ + include/isc/netaddr.h \ + include/isc/netmgr.h \ + include/isc/netscope.h \ + include/isc/nonce.h \ + include/isc/os.h \ + include/isc/parseint.h \ + include/isc/pool.h \ + include/isc/portset.h \ + include/isc/platform.h \ + include/isc/print.h \ + include/isc/queue.h \ + include/isc/quota.h \ + include/isc/radix.h \ + include/isc/random.h \ + include/isc/ratelimiter.h \ + include/isc/refcount.h \ + include/isc/regex.h \ + include/isc/region.h \ + include/isc/resource.h \ + include/isc/result.h \ + include/isc/resultclass.h \ + include/isc/rwlock.h \ + include/isc/safe.h \ + include/isc/serial.h \ + include/isc/siphash.h \ + include/isc/sockaddr.h \ + include/isc/socket.h \ + include/isc/stats.h \ + include/isc/stdio.h \ + include/isc/strerr.h \ + include/isc/string.h \ + include/isc/symtab.h \ + include/isc/task.h \ + include/isc/taskpool.h \ + include/isc/timer.h \ + include/isc/tm.h \ + include/isc/types.h \ + include/isc/util.h \ + pthreads/include/isc/condition.h\ + pthreads/include/isc/mutex.h \ + pthreads/include/isc/once.h \ + pthreads/include/isc/thread.h \ + unix/include/isc/align.h \ + unix/include/isc/dir.h \ + unix/include/isc/netdb.h \ + unix/include/isc/net.h \ + unix/include/isc/offset.h \ + unix/include/isc/stat.h \ + unix/include/isc/stdatomic.h \ + unix/include/isc/stdtime.h \ + unix/include/isc/syslog.h \ + unix/include/isc/time.h + +pk11dir = $(includedir)/pk11 +pk11_HEADERS = \ + include/pk11/constants.h \ + include/pk11/internal.h \ + include/pk11/pk11.h \ + include/pk11/result.h \ + include/pk11/site.h + +pkcs11dir = $(includedir)/pkcs11 +pkcs11_HEADERS = \ + include/pkcs11/pkcs11.h + +libisc_la_SOURCES = \ + $(libisc_la_HEADERS) \ + $(pk11_HEADERS) \ + $(pkcs11_HEADERS) \ + netmgr/netmgr-int.h \ + netmgr/netmgr.c \ + netmgr/tcp.c \ + netmgr/tcpdns.c \ + netmgr/udp.c \ + netmgr/uv-compat.c \ + netmgr/uv-compat.h \ + netmgr/uverr2result.c \ + unix/pk11_api.c \ + unix/dir.c \ + unix/errno.c \ + unix/errno2result.c \ + unix/file.c \ + unix/fsaccess.c \ + unix/interfaceiter.c \ + unix/meminfo.c \ + unix/net.c \ + unix/os.c \ + unix/resource.c \ + unix/socket.c \ + unix/stdio.c \ + unix/stdtime.c \ + unix/syslog.c \ + unix/time.c \ + pk11.c \ + pk11_result.c \ + aes.c \ + app.c \ + assertions.c \ + astack.c \ + backtrace.c \ + base32.c \ + base64.c \ + bind9.c \ + buffer.c \ + bufferlist.c \ + commandline.c \ + counter.c \ + crc64.c \ + entropy.c \ + error.c \ + event.c \ + glob.c \ + hash.c \ + hp.c \ + ht.c \ + heap.c \ + hex.c \ + hmac.c \ + httpd.c \ + iterated_hash.c \ + lex.c \ + lfsr.c \ + lib.c \ + log.c \ + md.c \ + mem.c \ + mutexblock.c \ + netaddr.c \ + netscope.c \ + nonce.c \ + openssl_shim.c \ + queue.c \ + openssl_shim.h \ + pool.c \ + parseint.c \ + portset.c \ + quota.c \ + radix.c \ + random.c \ + ratelimiter.c \ + region.c \ + regex.c \ + result.c \ + rwlock.c \ + safe.c \ + serial.c \ + siphash.c \ + sockaddr.c \ + stats.c \ + string.c \ + symtab.c \ + task.c \ + taskpool.c \ + timer.c \ + tm.c \ + pthreads/condition.c \ + pthreads/mutex.c \ + pthreads/thread.c \ + entropy_private.h \ + mem_p.h \ + task_p.h \ + timer_p.h + +libisc_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBUV_CFLAGS) \ + $(OPENSSL_CFLAGS) \ + $(ZLIB_CFLAGS) + +libisc_la_LDFLAGS = \ + $(libisc_VERSION_INFO) + +libisc_la_LIBADD = \ + $(LIBUV_LIBS) \ + $(OPENSSL_LIBS) \ + $(ZLIB_LIBS) + +if HAVE_JSON_C +libisc_la_CPPFLAGS += \ + $(JSON_C_CFLAGS) + +libisc_la_LIBADD += \ + $(JSON_C_LIBS) +endif HAVE_JSON_C + +if HAVE_LIBXML2 +libisc_la_CPPFLAGS += \ + $(LIBXML2_CFLAGS) + +libisc_la_LIBADD += \ + $(LIBXML2_LIBS) +endif HAVE_LIBXML2 + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/isc/app.c b/lib/isc/app.c index 28f46568c7..3211d7785f 100644 --- a/lib/isc/app.c +++ b/lib/isc/app.c @@ -369,7 +369,7 @@ isc_app_run(void) { } bool -isc_app_isrunning() { +isc_app_isrunning(void) { return (atomic_load_acquire(&is_running)); } diff --git a/lib/isc/assertions.c b/lib/isc/assertions.c index c2ca5f46a1..0215fd3a67 100644 --- a/lib/isc/assertions.c +++ b/lib/isc/assertions.c @@ -96,16 +96,17 @@ default_callback(const char *file, int line, isc_assertiontype_t type, const char *cond) { void *tracebuf[BACKTRACE_MAXFRAME]; int nframes; - const char *logsuffix = "."; + bool have_backtrace = false; isc_result_t result; result = isc_backtrace_gettrace(tracebuf, BACKTRACE_MAXFRAME, &nframes); if (result == ISC_R_SUCCESS && nframes > 0) { - logsuffix = ", back trace"; + have_backtrace = true; } fprintf(stderr, "%s:%d: %s(%s) failed%s\n", file, line, - isc_assertion_typetotext(type), cond, logsuffix); + isc_assertion_typetotext(type), cond, + (have_backtrace) ? ", back trace" : "."); if (result == ISC_R_SUCCESS) { #if HAVE_BACKTRACE_SYMBOLS diff --git a/lib/isc/hp.c b/lib/isc/hp.c index 2eb7827d59..b19366da96 100644 --- a/lib/isc/hp.c +++ b/lib/isc/hp.c @@ -66,7 +66,7 @@ static int isc__hp_max_retired = HP_MAX_THREADS * HP_MAX_HPS; static atomic_int_fast32_t tid_v_base = ATOMIC_VAR_INIT(0); -ISC_THREAD_LOCAL int tid_v = TID_UNKNOWN; +static thread_local int tid_v = TID_UNKNOWN; typedef struct retirelist { int size; @@ -82,7 +82,7 @@ struct isc_hp { }; static inline int -tid() { +tid(void) { if (tid_v == TID_UNKNOWN) { tid_v = atomic_fetch_add(&tid_v_base, 1); REQUIRE(tid_v < isc__hp_max_threads); diff --git a/lib/isc/include/isc/assertions.h b/lib/isc/include/isc/assertions.h index 2c409eb7ff..a688b62b8d 100644 --- a/lib/isc/include/isc/assertions.h +++ b/lib/isc/include/isc/assertions.h @@ -12,9 +12,9 @@ /*! \file isc/assertions.h */ -#ifndef ISC_ASSERTIONS_H -#define ISC_ASSERTIONS_H 1 +#pragma once +#include #include #include #include @@ -33,10 +33,9 @@ typedef void (*isc_assertioncallback_t)(const char *, int, isc_assertiontype_t, const char *); /* coverity[+kill] */ -ISC_PLATFORM_NORETURN_PRE +ISC_NORETURN void -isc_assertion_failed(const char *, int, isc_assertiontype_t, - const char *) ISC_PLATFORM_NORETURN_POST; +isc_assertion_failed(const char *, int, isc_assertiontype_t, const char *); void isc_assertion_setcallback(isc_assertioncallback_t); @@ -68,5 +67,3 @@ isc_assertion_typetotext(isc_assertiontype_t type); 0))) ISC_LANG_ENDDECLS - -#endif /* ISC_ASSERTIONS_H */ diff --git a/lib/dns/version.c b/lib/isc/include/isc/attributes.h similarity index 56% rename from lib/dns/version.c rename to lib/isc/include/isc/attributes.h index 629a5847ae..8f291f4969 100644 --- a/lib/dns/version.c +++ b/lib/isc/include/isc/attributes.h @@ -9,14 +9,18 @@ * information regarding copyright ownership. */ -/*! \file */ +#pragma once -#include +#ifdef _WIN32 +#define __attribute__(attribute) /* do nothing */ +#else +#define __declspec(modifier) /* do nothing */ +#endif -const char dns_version[] = VERSION; -const char dns_major[] = MAJOR; -const char dns_mapapi[] = MAPAPI; - -const unsigned int dns_libinterface = LIBINTERFACE; -const unsigned int dns_librevision = LIBREVISION; -const unsigned int dns_libage = LIBAGE; +#if HAVE_FUNC_ATTRIBUTE_NORETURN +#define ISC_NORETURN __attribute__((noreturn)) +#elif _WIN32 +#define ISC_NORETURN __declspec(noreturn) +#else +#define ISC_NORETURN +#endif diff --git a/lib/isc/include/isc/error.h b/lib/isc/include/isc/error.h index 316fea41fb..be1449e199 100644 --- a/lib/isc/include/isc/error.h +++ b/lib/isc/include/isc/error.h @@ -16,6 +16,7 @@ #include +#include #include #include #include @@ -37,14 +38,12 @@ isc_error_unexpected(const char *, int, const char *, ...) ISC_FORMAT_PRINTF(3, 4); /*% fatal error */ -ISC_PLATFORM_NORETURN_PRE void -isc_error_fatal(const char *, int, const char *, ...) - ISC_FORMAT_PRINTF(3, 4) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +isc_error_fatal(const char *, int, const char *, ...) ISC_FORMAT_PRINTF(3, 4); /*% runtimecheck error */ -ISC_PLATFORM_NORETURN_PRE void -isc_error_runtimecheck(const char *, int, - const char *) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +isc_error_runtimecheck(const char *, int, const char *); #define ISC_ERROR_RUNTIMECHECK(cond) \ ((void)(ISC_LIKELY(cond) || \ diff --git a/lib/isc/include/isc/netaddr.h b/lib/isc/include/isc/netaddr.h index aa6efe06a0..a84979224c 100644 --- a/lib/isc/include/isc/netaddr.h +++ b/lib/isc/include/isc/netaddr.h @@ -21,10 +21,10 @@ #include #include -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 #include #include -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ ISC_LANG_BEGINDECLS @@ -33,9 +33,9 @@ struct isc_netaddr { union { struct in_addr in; struct in6_addr in6; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 char un[sizeof(((struct sockaddr_un *)0)->sun_path)]; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } type; uint32_t zone; }; diff --git a/lib/isc/include/isc/platform.h.in b/lib/isc/include/isc/platform.h.in index 68c0103834..dcda32d251 100644 --- a/lib/isc/include/isc/platform.h.in +++ b/lib/isc/include/isc/platform.h.in @@ -46,35 +46,6 @@ *** Miscellaneous. ***/ -/* - * Defined to or for how to include - * the GSSAPI header. - */ -@ISC_PLATFORM_GSSAPIHEADER@ - -/* - * Defined to or for how to - * include the GSSAPI KRB5 header. - */ -@ISC_PLATFORM_GSSAPI_KRB5_HEADER@ - -/* - * Defined to or for how to include - * the KRB5 header. - */ -@ISC_PLATFORM_KRB5HEADER@ - -/* - * Define if the platform has . - */ -@ISC_PLATFORM_HAVESYSUNH@ - -/* - * Defines for the noreturn attribute. - */ -@ISC_PLATFORM_NORETURN_PRE@ -@ISC_PLATFORM_NORETURN_POST@ - /*** *** Windows dll support. ***/ diff --git a/lib/isc/include/isc/sockaddr.h b/lib/isc/include/isc/sockaddr.h index 846c86cb26..f677fee633 100644 --- a/lib/isc/include/isc/sockaddr.h +++ b/lib/isc/include/isc/sockaddr.h @@ -19,9 +19,9 @@ #include #include #include -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 #include -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ struct isc_sockaddr { union { @@ -29,9 +29,9 @@ struct isc_sockaddr { struct sockaddr_in sin; struct sockaddr_in6 sin6; struct sockaddr_storage ss; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 struct sockaddr_un sunix; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } type; unsigned int length; /* XXXRTH beginning? */ ISC_LINK(struct isc_sockaddr) link; diff --git a/lib/isc/include/isc/version.h b/lib/isc/include/isc/version.h deleted file mode 100644 index 77bf076bac..0000000000 --- a/lib/isc/include/isc/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 isc/version.h */ - -#include - -LIBISC_EXTERNAL_DATA extern const char isc_version[]; - -LIBISC_EXTERNAL_DATA extern const unsigned int isc_libinterface; -LIBISC_EXTERNAL_DATA extern const unsigned int isc_librevision; -LIBISC_EXTERNAL_DATA extern const unsigned int isc_libage; diff --git a/lib/isc/include/pk11/pk11.h b/lib/isc/include/pk11/pk11.h index d1c7761c20..20ec2b280c 100644 --- a/lib/isc/include/pk11/pk11.h +++ b/lib/isc/include/pk11/pk11.h @@ -9,14 +9,14 @@ * information regarding copyright ownership. */ -#ifndef PK11_PK11_H -#define PK11_PK11_H 1 +#pragma once /*! \file pk11/pk11.h */ #include #include +#include #include #include #include @@ -134,9 +134,9 @@ isc_result_t pk11_parse_uri(pk11_object_t *obj, const char *label, isc_mem_t *mctx, pk11_optype_t optype); -ISC_PLATFORM_NORETURN_PRE void +ISC_NORETURN void pk11_error_fatalcheck(const char *file, int line, const char *funcname, - CK_RV rv) ISC_PLATFORM_NORETURN_POST; + CK_RV rv); void pk11_dump_tokens(void); @@ -284,5 +284,3 @@ pkcs_C_GenerateRandom(CK_SESSION_HANDLE hSession, CK_BYTE_PTR RandomData, CK_ULONG ulRandomLen); ISC_LANG_ENDDECLS - -#endif /* PK11_PK11_H */ diff --git a/lib/isc/netaddr.c b/lib/isc/netaddr.c index ed3fd13bb2..8d3ee2e4f1 100644 --- a/lib/isc/netaddr.c +++ b/lib/isc/netaddr.c @@ -49,13 +49,13 @@ isc_netaddr_equal(const isc_netaddr_t *a, const isc_netaddr_t *b) { return (false); } break; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 case AF_UNIX: if (strcmp(a->type.un, b->type.un) != 0) { return (false); } break; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ default: return (false); } @@ -142,7 +142,7 @@ isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) { case AF_INET6: type = &netaddr->type.in6; break; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 case AF_UNIX: alen = strlen(netaddr->type.un); if (alen > isc_buffer_availablelength(target)) { @@ -152,7 +152,7 @@ isc_netaddr_totext(const isc_netaddr_t *netaddr, isc_buffer_t *target) { (const unsigned char *)(netaddr->type.un), alen); return (ISC_R_SUCCESS); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ default: return (ISC_R_FAILURE); } @@ -312,7 +312,7 @@ isc_netaddr_fromin6(isc_netaddr_t *netaddr, const struct in6_addr *ina6) { isc_result_t isc_netaddr_frompath(isc_netaddr_t *netaddr, const char *path) { -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 if (strlen(path) > sizeof(netaddr->type.un) - 1) { return (ISC_R_NOSPACE); } @@ -322,11 +322,11 @@ isc_netaddr_frompath(isc_netaddr_t *netaddr, const char *path) { strlcpy(netaddr->type.un, path, sizeof(netaddr->type.un)); netaddr->zone = 0; return (ISC_R_SUCCESS); -#else /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#else /* ifndef _WIN32 */ UNUSED(netaddr); UNUSED(path); return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } void @@ -355,12 +355,12 @@ isc_netaddr_fromsockaddr(isc_netaddr_t *t, const isc_sockaddr_t *s) { memmove(&t->type.in6, &s->type.sin6.sin6_addr, 16); t->zone = s->type.sin6.sin6_scope_id; break; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 case AF_UNIX: memmove(t->type.un, s->type.sunix.sun_path, sizeof(t->type.un)); t->zone = 0; break; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ default: INSIST(0); ISC_UNREACHABLE(); diff --git a/lib/isc/netmgr/netmgr.c b/lib/isc/netmgr/netmgr.c index 53882c5d0b..180d3336f9 100644 --- a/lib/isc/netmgr/netmgr.c +++ b/lib/isc/netmgr/netmgr.c @@ -116,7 +116,7 @@ static const isc_statscounter_t unixstatsindex[] = { * request using async_cb. */ -ISC_THREAD_LOCAL int isc__nm_tid_v = ISC_NETMGR_TID_UNKNOWN; +static thread_local int isc__nm_tid_v = ISC_NETMGR_TID_UNKNOWN; static void nmsocket_maybe_destroy(isc_nmsocket_t *sock); @@ -130,12 +130,12 @@ static void process_queue(isc__networker_t *worker, isc_queue_t *queue); int -isc_nm_tid() { +isc_nm_tid(void) { return (isc__nm_tid_v); } bool -isc__nm_in_netthread() { +isc__nm_in_netthread(void) { return (isc__nm_tid_v >= 0); } diff --git a/lib/isc/netmgr/tcp.c b/lib/isc/netmgr/tcp.c index ed951c5d71..4f73620d8e 100644 --- a/lib/isc/netmgr/tcp.c +++ b/lib/isc/netmgr/tcp.c @@ -36,7 +36,7 @@ static atomic_uint_fast32_t last_tcpquota_log = ATOMIC_VAR_INIT(0); static bool -can_log_tcp_quota() { +can_log_tcp_quota(void) { isc_stdtime_t now, last; isc_stdtime_get(&now); diff --git a/lib/isc/pthreads/include/isc/thread.h b/lib/isc/pthreads/include/isc/thread.h index 79f3e96ce2..9dd30d58c2 100644 --- a/lib/isc/pthreads/include/isc/thread.h +++ b/lib/isc/pthreads/include/isc/thread.h @@ -9,12 +9,14 @@ * information regarding copyright ownership. */ -#ifndef ISC_THREAD_H -#define ISC_THREAD_H 1 +#pragma once /*! \file */ #include +#if HAVE_THREADS_H +#include +#endif #if defined(HAVE_PTHREAD_NP_H) #include @@ -50,23 +52,4 @@ isc_thread_setaffinity(int cpu); #define isc_thread_self (unsigned long)pthread_self -/*** - *** Thread-Local Storage - ***/ - -#if defined(HAVE_TLS) -#if defined(HAVE_THREAD_LOCAL) -#include -#define ISC_THREAD_LOCAL static thread_local -#elif defined(HAVE___THREAD) -#define ISC_THREAD_LOCAL static __thread -#else /* if defined(HAVE_THREAD_LOCAL) */ -#error "Unknown method for defining a TLS variable!" -#endif /* if defined(HAVE_THREAD_LOCAL) */ -#else /* if defined(HAVE_TLS) */ -#error "Thread-local storage support is required!" -#endif /* if defined(HAVE_TLS) */ - ISC_LANG_ENDDECLS - -#endif /* ISC_THREAD_H */ diff --git a/lib/isc/random.c b/lib/isc/random.c index 02b92260db..aec88370ad 100644 --- a/lib/isc/random.c +++ b/lib/isc/random.c @@ -60,7 +60,7 @@ */ #include "xoshiro128starstar.c" -ISC_THREAD_LOCAL isc_once_t isc_random_once = ISC_ONCE_INIT; +static thread_local isc_once_t isc_random_once = ISC_ONCE_INIT; static void isc_random_initialize(void) { diff --git a/lib/isc/sockaddr.c b/lib/isc/sockaddr.c index 6fb4c69cf7..8472739281 100644 --- a/lib/isc/sockaddr.c +++ b/lib/isc/sockaddr.c @@ -137,7 +137,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) { snprintf(pbuf, sizeof(pbuf), "%u", ntohs(sockaddr->type.sin6.sin6_port)); break; -#ifdef ISC_PLAFORM_HAVESYSUNH +#ifndef _WIN32 case AF_UNIX: plen = strlen(sockaddr->type.sunix.sun_path); if (plen >= isc_buffer_availablelength(target)) { @@ -154,7 +154,7 @@ isc_sockaddr_totext(const isc_sockaddr_t *sockaddr, isc_buffer_t *target) { avail.base[0] = '\0'; return (ISC_R_SUCCESS); -#endif /* ifdef ISC_PLAFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ default: return (ISC_R_FAILURE); } @@ -465,7 +465,7 @@ isc_sockaddr_isnetzero(const isc_sockaddr_t *sockaddr) { isc_result_t isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path) { -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 if (strlen(path) >= sizeof(sockaddr->type.sunix.sun_path)) { return (ISC_R_NOSPACE); } @@ -475,11 +475,11 @@ isc_sockaddr_frompath(isc_sockaddr_t *sockaddr, const char *path) { strlcpy(sockaddr->type.sunix.sun_path, path, sizeof(sockaddr->type.sunix.sun_path)); return (ISC_R_SUCCESS); -#else /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#else /* ifndef _WIN32 */ UNUSED(sockaddr); UNUSED(path); return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } isc_result_t @@ -493,11 +493,11 @@ isc_sockaddr_fromsockaddr(isc_sockaddr_t *isa, const struct sockaddr *sa) { case AF_INET6: length = sizeof(isa->type.sin6); break; -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 case AF_UNIX: length = sizeof(isa->type.sunix); break; -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ default: return (ISC_R_NOTIMPLEMENTED); } diff --git a/lib/isc/tests/Kyuafile b/lib/isc/tests/Kyuafile deleted file mode 100644 index d07b11f543..0000000000 --- a/lib/isc/tests/Kyuafile +++ /dev/null @@ -1,31 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='aes_test'} -tap_test_program{name='buffer_test'} -tap_test_program{name='counter_test'} -tap_test_program{name='errno_test'} -tap_test_program{name='file_test'} -tap_test_program{name='hash_test'} -tap_test_program{name='heap_test'} -tap_test_program{name='hmac_test'} -tap_test_program{name='ht_test'} -tap_test_program{name='lex_test'} -tap_test_program{name='md_test'} -tap_test_program{name='mem_test'} -tap_test_program{name='netaddr_test'} -tap_test_program{name='parse_test'} -tap_test_program{name='pool_test'} -tap_test_program{name='radix_test'} -tap_test_program{name='quota_test'} -tap_test_program{name='regex_test'} -tap_test_program{name='result_test'} -tap_test_program{name='safe_test'} -tap_test_program{name='siphash_test'} -tap_test_program{name='sockaddr_test'} -tap_test_program{name='socket_test'} -tap_test_program{name='symtab_test'} -tap_test_program{name='task_test'} -tap_test_program{name='taskpool_test'} -tap_test_program{name='time_test'} -tap_test_program{name='timer_test'} diff --git a/lib/isc/tests/Makefile.am b/lib/isc/tests/Makefile.am new file mode 100644 index 0000000000..9a0dc87e29 --- /dev/null +++ b/lib/isc/tests/Makefile.am @@ -0,0 +1,65 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) + +LDADD += \ + libisctest.la \ + $(LIBISC_LIBS) + +noinst_LTLIBRARIES = libisctest.la +libisctest_la_SOURCES = isctest.c isctest.h + +check_PROGRAMS = \ + aes_test \ + buffer_test \ + counter_test \ + crc64_test \ + errno_test \ + file_test \ + hash_test \ + heap_test \ + hmac_test \ + ht_test \ + lex_test \ + md_test \ + mem_test \ + netaddr_test \ + parse_test \ + pool_test \ + quota_test \ + radix_test \ + random_test \ + regex_test \ + result_test \ + safe_test \ + sockaddr_test \ + socket_test \ + symtab_test \ + task_test \ + taskpool_test \ + time_test \ + timer_test + +TESTS = $(check_PROGRAMS) + +hmac_test_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(OPENSSL_CFLAGS) + +hmac_test_LDADD = \ + $(LDADD) \ + $(OPENSSL_LIBS) + +md_test_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(OPENSSL_CFLAGS) + +md_test_LDADD = \ + $(LDADD) \ + $(OPENSSL_LIBS) + +random_test_LDADD = \ + $(LDADD) \ + -lm diff --git a/lib/isc/tests/ht_test.c b/lib/isc/tests/ht_test.c index 4c07c02730..212735b66d 100644 --- a/lib/isc/tests/ht_test.c +++ b/lib/isc/tests/ht_test.c @@ -195,7 +195,7 @@ test_ht_full(int bits, uintptr_t count) { } static void -test_ht_iterator() { +test_ht_iterator(void) { isc_ht_t *ht = NULL; isc_result_t result; isc_ht_iter_t *iter = NULL; diff --git a/lib/isc/unix/net.c b/lib/isc/unix/net.c index bf11cccaf5..8dcbec049d 100644 --- a/lib/isc/unix/net.c +++ b/lib/isc/unix/net.c @@ -191,9 +191,9 @@ static void initialize_action(void) { ipv4_result = try_proto(PF_INET); ipv6_result = try_proto(PF_INET6); -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 unix_result = try_proto(PF_UNIX); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } static void @@ -418,7 +418,7 @@ make_nonblock(int fd) { ret = ioctl(fd, FIONBIO, (char *)&on); #else /* ifdef USE_FIONBIO_IOCTL */ flags = fcntl(fd, F_GETFL, 0); - flags |= PORT_NONBLOCK; + flags |= O_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); #endif /* ifdef USE_FIONBIO_IOCTL */ diff --git a/lib/isc/unix/socket.c b/lib/isc/unix/socket.c index da2b7d0153..2a749e4c99 100644 --- a/lib/isc/unix/socket.c +++ b/lib/isc/unix/socket.c @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -58,9 +59,6 @@ #include #include -#ifdef ISC_PLATFORM_HAVESYSUNH -#include -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ #ifdef HAVE_KQUEUE #include #endif /* ifdef HAVE_KQUEUE */ @@ -1002,7 +1000,7 @@ make_nonblock(int fd) { ret = ioctl(fd, FIONBIO, (char *)&on); #else /* ifdef USE_FIONBIO_IOCTL */ flags = fcntl(fd, F_GETFL, 0); - flags |= PORT_NONBLOCK; + flags |= O_NONBLOCK; ret = fcntl(fd, F_SETFL, flags); #endif /* ifdef USE_FIONBIO_IOCTL */ @@ -4199,7 +4197,7 @@ isc_socket_sendto2(isc_socket_t *sock0, isc_region_t *region, isc_task_t *task, void isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 int s; struct stat sb; char strbuf[ISC_STRERRORSIZE]; @@ -4324,16 +4322,16 @@ isc_socket_cleanunix(const isc_sockaddr_t *sockaddr, bool active) { } cleanup: close(s); -#else /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#else /* ifndef _WIN32 */ UNUSED(sockaddr); UNUSED(active); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } isc_result_t isc_socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, uint32_t owner, uint32_t group) { -#ifdef ISC_PLATFORM_HAVESYSUNH +#ifndef _WIN32 isc_result_t result = ISC_R_SUCCESS; char strbuf[ISC_STRERRORSIZE]; char path[sizeof(sockaddr->type.sunix.sun_path)]; @@ -4375,13 +4373,13 @@ isc_socket_permunix(const isc_sockaddr_t *sockaddr, uint32_t perm, result = ISC_R_FAILURE; } return (result); -#else /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#else /* ifndef _WIN32 */ UNUSED(sockaddr); UNUSED(perm); UNUSED(owner); UNUSED(group); return (ISC_R_NOTIMPLEMENTED); -#endif /* ifdef ISC_PLATFORM_HAVESYSUNH */ +#endif /* ifndef _WIN32 */ } isc_result_t @@ -5280,7 +5278,7 @@ static isc_once_t hasreuseport_once = ISC_ONCE_INIT; static bool hasreuseport = false; static void -init_hasreuseport() { +init_hasreuseport(void) { /* * SO_REUSEPORT works very differently on *BSD and on Linux (because why not). * We only want to use it on Linux, if it's available. On BSD we want to dup() @@ -5318,7 +5316,7 @@ init_hasreuseport() { } bool -isc_socket_hasreuseport() { +isc_socket_hasreuseport(void) { RUNTIME_CHECK(isc_once_do(&hasreuseport_once, init_hasreuseport) == ISC_R_SUCCESS); return (hasreuseport); diff --git a/lib/isc/version.c b/lib/isc/version.c deleted file mode 100644 index 025bb5f7e1..0000000000 --- a/lib/isc/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -const char isc_version[] = VERSION; - -const unsigned int isc_libinterface = LIBINTERFACE; -const unsigned int isc_librevision = LIBREVISION; -const unsigned int isc_libage = LIBAGE; diff --git a/lib/isc/win32/include/isc/platform.h.in b/lib/isc/win32/include/isc/platform.h.in index cce2bb513e..41eecd94aa 100644 --- a/lib/isc/win32/include/isc/platform.h.in +++ b/lib/isc/win32/include/isc/platform.h.in @@ -16,18 +16,12 @@ ***** Platform-dependent defines. *****/ -#if _MSC_VER > 1400 -#define HAVE_TLS 1 -#define HAVE___DECLSPEC_THREAD 1 -#endif - /* * Some compatibility cludges */ -#if defined(_WIN32) || defined(_WIN64) /* We are on Windows */ -# define strtok_r strtok_s +#define strtok_r strtok_s #define ISC_STRERRORSIZE 128 @@ -40,14 +34,6 @@ typedef uint32_t socklen_t; #endif -#endif - -/* - * Remove __attribute__ ((foo)) on Windows - */ - -#define __attribute__(attribute) /* do nothing */ - /* * Limits */ @@ -66,17 +52,6 @@ typedef uint32_t socklen_t; #undef MSG_TRUNC -/* - * Define if the platform has . - */ -#undef ISC_PLATFORM_HAVESYSUNH - -/* - * Defines for the noreturn attribute. - */ -#define ISC_PLATFORM_NORETURN_PRE __declspec(noreturn) -#define ISC_PLATFORM_NORETURN_POST - /* * Set up a macro for importing and exporting from the DLL */ diff --git a/lib/isc/win32/include/isc/stdatomic.h b/lib/isc/win32/include/isc/stdatomic.h index eb22a80665..aa028ceae2 100644 --- a/lib/isc/win32/include/isc/stdatomic.h +++ b/lib/isc/win32/include/isc/stdatomic.h @@ -105,7 +105,7 @@ typedef uintptr_t volatile atomic_uintptr_t; #endif /* ifdef _WIN64 */ static inline void -atomic_store_abort() { +atomic_store_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -159,7 +159,7 @@ atomic_store_abort() { #endif /* ifdef _WIN64 */ static inline int8_t -atomic_load_abort() { +atomic_load_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -220,7 +220,7 @@ atomic_load_abort() { #endif /* ifdef _WIN64 */ static inline int8_t -atomic_add_abort() { +atomic_add_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -281,7 +281,7 @@ atomic_add_abort() { #endif /* ifdef _WIN64 */ static inline int8_t -atomic_and_abort() { +atomic_and_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -336,7 +336,7 @@ atomic_and_abort() { #endif /* ifdef _WIN64 */ static inline int8_t -atomic_or_abort() { +atomic_or_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -451,7 +451,7 @@ atomic_compare_exchange_strong_explicit64(atomic_int_fast64_t *obj, } static inline bool -atomic_compare_exchange_abort() { +atomic_compare_exchange_abort(void) { INSIST(0); ISC_UNREACHABLE(); } @@ -486,7 +486,7 @@ atomic_compare_exchange_abort() { memory_order_seq_cst) static inline bool -atomic_exchange_abort() { +atomic_exchange_abort(void) { INSIST(0); ISC_UNREACHABLE(); } diff --git a/lib/isc/win32/include/isc/thread.h b/lib/isc/win32/include/isc/thread.h index 9ce612217a..304d149a53 100644 --- a/lib/isc/win32/include/isc/thread.h +++ b/lib/isc/win32/include/isc/thread.h @@ -87,11 +87,7 @@ isc_thread_setaffinity(int cpu); #define isc_thread_yield() Sleep(0) -#if HAVE___DECLSPEC_THREAD -#define ISC_THREAD_LOCAL static __declspec(thread) -#else /* if HAVE___DECLSPEC_THREAD */ -#error "Thread-local storage support is required!" -#endif /* if HAVE___DECLSPEC_THREAD */ +#define thread_local __declspec(thread) ISC_LANG_ENDDECLS diff --git a/lib/isc/win32/libisc.vcxproj.filters.in b/lib/isc/win32/libisc.vcxproj.filters.in index 5e8d0b40bd..249e5271e3 100644 --- a/lib/isc/win32/libisc.vcxproj.filters.in +++ b/lib/isc/win32/libisc.vcxproj.filters.in @@ -266,9 +266,6 @@ Library Header Files - - Library Header Files - @IF PKCS11 Library Header Files @@ -435,9 +432,6 @@ Win32 Source Files - - Win32 Source Files - Win32 Source Files diff --git a/lib/isc/win32/libisc.vcxproj.in b/lib/isc/win32/libisc.vcxproj.in index b9c09da842..aafc24a276 100644 --- a/lib/isc/win32/libisc.vcxproj.in +++ b/lib/isc/win32/libisc.vcxproj.in @@ -372,7 +372,6 @@ copy InstallFiles ..\Build\Release\ - @IF PKCS11 @@ -499,7 +498,6 @@ copy InstallFiles ..\Build\Release\ - @IF PKCS11 diff --git a/lib/isc/win32/socket.c b/lib/isc/win32/socket.c index c93a635654..487515e003 100644 --- a/lib/isc/win32/socket.c +++ b/lib/isc/win32/socket.c @@ -3672,7 +3672,7 @@ isc_socket_socketevent(isc_mem_t *mctx, void *sender, isc_eventtype_t eventtype, } bool -isc_socket_hasreuseport() { +isc_socket_hasreuseport(void) { return (false); } diff --git a/lib/isc/win32/unistd.h b/lib/isc/win32/unistd.h index aa68088ecf..0df49d3b1e 100644 --- a/lib/isc/win32/unistd.h +++ b/lib/isc/win32/unistd.h @@ -10,8 +10,7 @@ */ /* None of these are defined in NT, so define them for our use */ -#define O_NONBLOCK 1 -#define PORT_NONBLOCK O_NONBLOCK +#define O_NONBLOCK 1 /* * fcntl() commands diff --git a/lib/isc/win32/version.c b/lib/isc/win32/version.c deleted file mode 100644 index 6a2a5afbf9..0000000000 --- a/lib/isc/win32/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBISC_EXTERNAL_DATA const char isc_version[] = VERSION; - -LIBISC_EXTERNAL_DATA const unsigned int isc_libinterface = LIBINTERFACE; -LIBISC_EXTERNAL_DATA const unsigned int isc_librevision = LIBREVISION; -LIBISC_EXTERNAL_DATA const unsigned int isc_libage = LIBAGE; diff --git a/lib/isc/xoshiro128starstar.c b/lib/isc/xoshiro128starstar.c index 88f9a9c7d1..ba14e48dad 100644 --- a/lib/isc/xoshiro128starstar.c +++ b/lib/isc/xoshiro128starstar.c @@ -34,7 +34,7 @@ * * The state must be seeded so that it is not everywhere zero. */ -ISC_THREAD_LOCAL uint32_t seed[4] = { 0 }; +static thread_local uint32_t seed[4] = { 0 }; static inline uint32_t rotl(const uint32_t x, int k) { diff --git a/lib/isccc/Kyuafile b/lib/isccc/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/isccc/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/isccc/Makefile.am b/lib/isccc/Makefile.am new file mode 100644 index 0000000000..017f822a32 --- /dev/null +++ b/lib/isccc/Makefile.am @@ -0,0 +1,42 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libisccc.la + +libisccc_ladir = $(includedir)/isccc +libisccc_la_HEADERS = \ + include/isccc/alist.h \ + include/isccc/base64.h \ + include/isccc/cc.h \ + include/isccc/ccmsg.h \ + include/isccc/events.h \ + include/isccc/result.h \ + include/isccc/sexpr.h \ + include/isccc/symtab.h \ + include/isccc/symtype.h \ + include/isccc/types.h \ + include/isccc/util.h + +libisccc_la_SOURCES = \ + $(libisccc_la_HEADERS) \ + alist.c \ + base64.c \ + cc.c \ + ccmsg.c \ + result.c \ + sexpr.c \ + symtab.c + +libisccc_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBISCCC_CFLAGS) + +libisccc_la_LIBADD = \ + $(LIBISC_LIBS) + +libisccc_la_LDFLAGS = \ + $(libisccc_VERSION_INFO) + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/isccc/include/isccc/version.h b/lib/isccc/include/isccc/version.h deleted file mode 100644 index 4a1036cf87..0000000000 --- a/lib/isccc/include/isccc/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 isccc/version.h */ - -#include - -LIBISCCC_EXTERNAL_DATA extern const char isccc_version[]; - -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libinterface; -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_librevision; -LIBISCCC_EXTERNAL_DATA extern const unsigned int isccc_libage; diff --git a/lib/isccc/tests/Kyuafile b/lib/isccc/tests/Kyuafile deleted file mode 100644 index ce23ab8fc3..0000000000 --- a/lib/isccc/tests/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='result_test'} diff --git a/lib/isccc/tests/Makefile.am b/lib/isccc/tests/Makefile.am new file mode 100644 index 0000000000..000e5c8d42 --- /dev/null +++ b/lib/isccc/tests/Makefile.am @@ -0,0 +1,15 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBISCCC_CFLAGS) + +LDADD += \ + $(LIBISC_LIBS) \ + $(LIBISCCC_LIBS) + +check_PROGRAMS = \ + result_test + +TESTS = $(check_PROGRAMS) diff --git a/lib/isccc/version.c b/lib/isccc/version.c deleted file mode 100644 index 25e26a838b..0000000000 --- a/lib/isccc/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -const char isccc_version[] = VERSION; - -const unsigned int isccc_libinterface = LIBINTERFACE; -const unsigned int isccc_librevision = LIBREVISION; -const unsigned int isccc_libage = LIBAGE; diff --git a/lib/isccc/win32/libisccc.vcxproj.filters.in b/lib/isccc/win32/libisccc.vcxproj.filters.in index 1d1ff10372..dda104217a 100644 --- a/lib/isccc/win32/libisccc.vcxproj.filters.in +++ b/lib/isccc/win32/libisccc.vcxproj.filters.in @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -80,8 +77,5 @@ Header Files - - Header Files - diff --git a/lib/isccc/win32/libisccc.vcxproj.in b/lib/isccc/win32/libisccc.vcxproj.in index 98f1305afa..2ad7474781 100644 --- a/lib/isccc/win32/libisccc.vcxproj.in +++ b/lib/isccc/win32/libisccc.vcxproj.in @@ -126,7 +126,6 @@ - @@ -140,7 +139,6 @@ - diff --git a/lib/isccc/win32/version.c b/lib/isccc/win32/version.c deleted file mode 100644 index acbbcd07a7..0000000000 --- a/lib/isccc/win32/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBISCCC_EXTERNAL_DATA const char isccc_version[] = VERSION; - -LIBISCCC_EXTERNAL_DATA const unsigned int isccc_libinterface = LIBINTERFACE; -LIBISCCC_EXTERNAL_DATA const unsigned int isccc_librevision = LIBREVISION; -LIBISCCC_EXTERNAL_DATA const unsigned int isccc_libage = LIBAGE; diff --git a/lib/isccfg/Kyuafile b/lib/isccfg/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/isccfg/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/isccfg/Makefile.am b/lib/isccfg/Makefile.am new file mode 100644 index 0000000000..bd337f67ae --- /dev/null +++ b/lib/isccfg/Makefile.am @@ -0,0 +1,39 @@ +include $(top_srcdir)/Makefile.top + +lib_LTLIBRARIES = libisccfg.la + +libisccfg_ladir = $(includedir)/isccfg +libisccfg_la_HEADERS = \ + include/isccfg/aclconf.h \ + include/isccfg/cfg.h \ + include/isccfg/dnsconf.h \ + include/isccfg/grammar.h \ + include/isccfg/kaspconf.h \ + include/isccfg/log.h \ + include/isccfg/namedconf.h + +libisccfg_la_SOURCES = \ + $(libisccfg_la_HEADERS) \ + aclconf.c \ + dnsconf.c \ + kaspconf.c \ + log.c \ + namedconf.c \ + parser.c + +libisccfg_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISCCFG_CFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) + +libisccfg_la_LIBADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) + +libisccfg_la_LDFLAGS = \ + $(libisccfg_VERSION_INFO) + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/isccfg/include/isccfg/version.h b/lib/isccfg/include/isccfg/version.h deleted file mode 100644 index 30ca02d953..0000000000 --- a/lib/isccfg/include/isccfg/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 isccfg/version.h */ - -#include - -LIBISCCFG_EXTERNAL_DATA extern const char cfg_version[]; - -LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_libinterface; -LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_librevision; -LIBISCCFG_EXTERNAL_DATA extern const unsigned int cfg_libage; diff --git a/lib/isccfg/tests/Kyuafile b/lib/isccfg/tests/Kyuafile deleted file mode 100644 index 89d50352f2..0000000000 --- a/lib/isccfg/tests/Kyuafile +++ /dev/null @@ -1,5 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='duration_test'} -tap_test_program{name='parser_test'} diff --git a/lib/isccfg/tests/Makefile.am b/lib/isccfg/tests/Makefile.am new file mode 100644 index 0000000000..9f31441bb2 --- /dev/null +++ b/lib/isccfg/tests/Makefile.am @@ -0,0 +1,17 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBISCCFG_CFLAGS) + +LDADD += \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBISCCFG_LIBS) + +check_PROGRAMS = \ + parser_test + +TESTS = $(check_PROGRAMS) diff --git a/lib/isccfg/tests/duration_test.c b/lib/isccfg/tests/duration_test.c index 44234152a5..6c7e20898f 100644 --- a/lib/isccfg/tests/duration_test.c +++ b/lib/isccfg/tests/duration_test.c @@ -54,7 +54,7 @@ static isc_logcategory_t categories[] = { { "", 0 }, { NULL, 0 } }; static void -cleanup() { +cleanup(void) { if (lctx != NULL) { isc_log_destroy(&lctx); } @@ -64,7 +64,7 @@ cleanup() { } static isc_result_t -setup() { +setup(void) { isc_result_t result; isc_mem_debugging |= ISC_MEM_DEBUGRECORD; diff --git a/lib/isccfg/tests/parser_test.c b/lib/isccfg/tests/parser_test.c index f5ac432462..e218927704 100644 --- a/lib/isccfg/tests/parser_test.c +++ b/lib/isccfg/tests/parser_test.c @@ -54,7 +54,7 @@ static isc_logcategory_t categories[] = { { "", 0 }, { NULL, 0 } }; static void -cleanup() { +cleanup(void) { if (lctx != NULL) { isc_log_destroy(&lctx); } @@ -64,7 +64,7 @@ cleanup() { } static isc_result_t -setup() { +setup(void) { isc_result_t result; isc_mem_debugging |= ISC_MEM_DEBUGRECORD; diff --git a/lib/isccfg/version.c b/lib/isccfg/version.c deleted file mode 100644 index 21b65bd9c6..0000000000 --- a/lib/isccfg/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -const char cfg_version[] = VERSION; - -const unsigned int cfg_libinterface = LIBINTERFACE; -const unsigned int cfg_librevision = LIBREVISION; -const unsigned int cfg_libage = LIBAGE; diff --git a/lib/isccfg/win32/libisccfg.vcxproj.filters.in b/lib/isccfg/win32/libisccfg.vcxproj.filters.in index 91d4202d7e..70aebf1879 100644 --- a/lib/isccfg/win32/libisccfg.vcxproj.filters.in +++ b/lib/isccfg/win32/libisccfg.vcxproj.filters.in @@ -21,9 +21,6 @@ Source Files - - Source Files - Source Files @@ -65,8 +62,5 @@ Header Files - - Header Files - diff --git a/lib/isccfg/win32/libisccfg.vcxproj.in b/lib/isccfg/win32/libisccfg.vcxproj.in index 8f2b38c973..07571f91ca 100644 --- a/lib/isccfg/win32/libisccfg.vcxproj.in +++ b/lib/isccfg/win32/libisccfg.vcxproj.in @@ -125,7 +125,6 @@ - @@ -135,7 +134,6 @@ - diff --git a/lib/isccfg/win32/version.c b/lib/isccfg/win32/version.c deleted file mode 100644 index a65667667b..0000000000 --- a/lib/isccfg/win32/version.c +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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 - -LIBISCCFG_EXTERNAL_DATA const char cfg_version[] = VERSION; - -LIBISCCFG_EXTERNAL_DATA const unsigned int cfg_libinterface = LIBINTERFACE; -LIBISCCFG_EXTERNAL_DATA const unsigned int cfg_librevision = LIBREVISION; -LIBISCCFG_EXTERNAL_DATA const unsigned int cfg_libage = LIBAGE; diff --git a/lib/ns/Kyuafile b/lib/ns/Kyuafile deleted file mode 100644 index 0739e3a60c..0000000000 --- a/lib/ns/Kyuafile +++ /dev/null @@ -1,4 +0,0 @@ -syntax(2) -test_suite('bind9') - -include('tests/Kyuafile') diff --git a/lib/ns/Makefile.am b/lib/ns/Makefile.am new file mode 100644 index 0000000000..adafb78204 --- /dev/null +++ b/lib/ns/Makefile.am @@ -0,0 +1,59 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + -DNAMED_PLUGINDIR=\"$(libdir)/named\" + +lib_LTLIBRARIES = libns.la + +libns_ladir = $(includedir)/ns + +libns_la_HEADERS = \ + include/ns/client.h \ + include/ns/hooks.h \ + include/ns/interfacemgr.h \ + include/ns/lib.h \ + include/ns/listenlist.h \ + include/ns/log.h \ + include/ns/notify.h \ + include/ns/query.h \ + include/ns/server.h \ + include/ns/sortlist.h \ + include/ns/stats.h \ + include/ns/types.h \ + include/ns/update.h \ + include/ns/xfrout.h + +libns_la_SOURCES = \ + $(libns_la_HEADERS) \ + client.c \ + hooks.c \ + interfacemgr.c \ + lib.c \ + listenlist.c \ + log.c \ + notify.c \ + query.c \ + server.c \ + sortlist.c \ + stats.c \ + update.c \ + xfrout.c + +libns_la_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) \ + $(LIBLTDL_CFLAGS) + +libns_la_LIBADD = \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBLTDL_LIBS) + +libns_la_LDFLAGS = \ + $(libns_VERSION_INFO) + +if HAVE_CMOCKA +SUBDIRS = tests +endif diff --git a/lib/ns/hooks.c b/lib/ns/hooks.c index 8719acefac..a95f54b7a8 100644 --- a/lib/ns/hooks.c +++ b/lib/ns/hooks.c @@ -12,15 +12,10 @@ /*! \file */ #include +#include #include #include -#if HAVE_DLFCN_H -#include -#elif _WIN32 -#include -#endif /* if HAVE_DLFCN_H */ - #include #include #include @@ -95,7 +90,6 @@ ns_plugin_expandpath(const char *src, char *dst, size_t dstsize) { } } -#if HAVE_DLFCN_H && HAVE_DLOPEN static isc_result_t load_symbol(void *handle, const char *modpath, const char *symbol_name, void **symbolp) { @@ -111,10 +105,10 @@ load_symbol(void *handle, const char *modpath, const char *symbol_name, * this ensures that we'll report the correct error condition * if there is one.) */ - dlerror(); - symbol = dlsym(handle, symbol_name); + lt_dlerror(); + symbol = lt_dlsym(handle, symbol_name); if (symbol == NULL) { - const char *errmsg = dlerror(); + const char *errmsg = lt_dlerror(); if (errmsg == NULL) { errmsg = "returned function pointer is NULL"; } @@ -134,24 +128,23 @@ load_symbol(void *handle, const char *modpath, const char *symbol_name, static isc_result_t load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) { isc_result_t result; - void *handle = NULL; + lt_dlhandle handle = NULL; ns_plugin_t *plugin = NULL; ns_plugin_check_t *check_func = NULL; ns_plugin_register_t *register_func = NULL; ns_plugin_destroy_t *destroy_func = NULL; ns_plugin_version_t *version_func = NULL; - int version, flags; + int version; REQUIRE(pluginp != NULL && *pluginp == NULL); - flags = RTLD_LAZY | RTLD_LOCAL; -#if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ - flags |= RTLD_DEEPBIND; -#endif /* if defined(RTLD_DEEPBIND) && !__SANITIZE_ADDRESS__ */ + if (lt_dlinit() != 0) { + return (ISC_R_FAILURE); + } - handle = dlopen(modpath, flags); + handle = lt_dlopen(modpath); if (handle == NULL) { - const char *errmsg = dlerror(); + const char *errmsg = lt_dlerror(); if (errmsg == NULL) { errmsg = "unknown error"; } @@ -210,127 +203,8 @@ cleanup: sizeof(*plugin)); } - (void)dlclose(handle); - } - - return (result); -} - -static void -unload_plugin(ns_plugin_t **pluginp) { - ns_plugin_t *plugin = NULL; - - REQUIRE(pluginp != NULL && *pluginp != NULL); - - plugin = *pluginp; - *pluginp = NULL; - - isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_HOOKS, - ISC_LOG_DEBUG(1), "unloading plugin '%s'", - plugin->modpath); - - if (plugin->inst != NULL) { - plugin->destroy_func(&plugin->inst); - } - if (plugin->handle != NULL) { - (void)dlclose(plugin->handle); - } - if (plugin->modpath != NULL) { - isc_mem_free(plugin->mctx, plugin->modpath); - } - - isc_mem_putanddetach(&plugin->mctx, plugin, sizeof(*plugin)); -} -#elif _WIN32 -static isc_result_t -load_symbol(HMODULE handle, const char *modpath, const char *symbol_name, - void **symbolp) { - void *symbol = NULL; - - REQUIRE(handle != NULL); - REQUIRE(symbolp != NULL && *symbolp == NULL); - - symbol = GetProcAddress(handle, symbol_name); - if (symbol == NULL) { - int errstatus = GetLastError(); - isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_HOOKS, ISC_LOG_ERROR, - "failed to look up symbol %s in " - "plugin '%s': %d", - symbol_name, modpath, errstatus); - return (ISC_R_FAILURE); - } - - *symbolp = symbol; - - return (ISC_R_SUCCESS); -} - -static isc_result_t -load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) { - isc_result_t result; - HMODULE handle; - ns_plugin_t *plugin = NULL; - ns_plugin_register_t *register_func = NULL; - ns_plugin_destroy_t *destroy_func = NULL; - ns_plugin_version_t *version_func = NULL; - int version; - - REQUIRE(pluginp != NULL && *pluginp == NULL); - - handle = LoadLibraryA(modpath); - if (handle == NULL) { - CHECK(ISC_R_FAILURE); - } - - CHECK(load_symbol(handle, modpath, "plugin_version", - (void **)&version_func)); - - version = version_func(); - if (version < (NS_PLUGIN_VERSION - NS_PLUGIN_AGE) || - version > NS_PLUGIN_VERSION) - { - isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_HOOKS, ISC_LOG_ERROR, - "plugin API version mismatch: %d/%d", version, - NS_PLUGIN_VERSION); - CHECK(ISC_R_FAILURE); - } - - CHECK(load_symbol(handle, modpath, "plugin_register", - (void **)®ister_func)); - CHECK(load_symbol(handle, modpath, "plugin_destroy", - (void **)&destroy_func)); - - plugin = isc_mem_get(mctx, sizeof(*plugin)); - memset(plugin, 0, sizeof(*plugin)); - isc_mem_attach(mctx, &plugin->mctx); - plugin->handle = handle; - plugin->modpath = isc_mem_strdup(plugin->mctx, modpath); - plugin->register_func = register_func; - plugin->destroy_func = destroy_func; - - ISC_LINK_INIT(plugin, link); - - *pluginp = plugin; - plugin = NULL; - -cleanup: - if (result != ISC_R_SUCCESS) { - isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, - NS_LOGMODULE_HOOKS, ISC_LOG_ERROR, - "failed to dynamically load " - "plugin '%s': %d (%s)", - modpath, GetLastError(), - isc_result_totext(result)); - - if (plugin != NULL) { - isc_mem_putanddetach(&plugin->mctx, plugin, - sizeof(*plugin)); - } - if (handle != NULL) { - FreeLibrary(handle); + (void)lt_dlclose(handle); } } @@ -354,33 +228,14 @@ unload_plugin(ns_plugin_t **pluginp) { plugin->destroy_func(&plugin->inst); } if (plugin->handle != NULL) { - FreeLibrary(plugin->handle); + (void)lt_dlclose(plugin->handle); } - if (plugin->modpath != NULL) { isc_mem_free(plugin->mctx, plugin->modpath); } isc_mem_putanddetach(&plugin->mctx, plugin, sizeof(*plugin)); } -#else /* HAVE_DLFCN_H || _WIN32 */ -static isc_result_t -load_plugin(isc_mem_t *mctx, const char *modpath, ns_plugin_t **pluginp) { - UNUSED(mctx); - UNUSED(modpath); - UNUSED(pluginp); - - isc_log_write(ns_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_HOOKS, - ISC_LOG_ERROR, "plugin support is not implemented"); - - return (ISC_R_NOTIMPLEMENTED); -} - -static void -unload_plugin(ns_plugin_t **pluginp) { - UNUSED(pluginp); -} -#endif /* HAVE_DLFCN_H */ isc_result_t ns_plugin_register(const char *modpath, const char *parameters, const void *cfg, diff --git a/lib/ns/include/ns/version.h b/lib/ns/include/ns/version.h deleted file mode 100644 index bcb93319e2..0000000000 --- a/lib/ns/include/ns/version.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * 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/ns/version.h */ - -#include - -LIBNS_EXTERNAL_DATA extern const char ns_version[]; - -LIBNS_EXTERNAL_DATA extern const unsigned int ns_libinterface; -LIBNS_EXTERNAL_DATA extern const unsigned int ns_librevision; -LIBNS_EXTERNAL_DATA extern const unsigned int ns_libage; diff --git a/lib/ns/query.c b/lib/ns/query.c index 46f1b59c89..8f1a8b1162 100644 --- a/lib/ns/query.c +++ b/lib/ns/query.c @@ -5782,7 +5782,7 @@ static atomic_uint_fast32_t last_soft, last_hard; #ifdef ISC_MUTEX_ATOMICS static isc_once_t last_once = ISC_ONCE_INIT; static void -last_init() { +last_init(void) { atomic_init(&last_soft, 0); atomic_init(&last_hard, 0); } diff --git a/lib/ns/tests/Kyuafile b/lib/ns/tests/Kyuafile deleted file mode 100644 index adf0b88ca7..0000000000 --- a/lib/ns/tests/Kyuafile +++ /dev/null @@ -1,7 +0,0 @@ -syntax(2) -test_suite('bind9') - -tap_test_program{name='listenlist_test'} -tap_test_program{name='notify_test'} -tap_test_program{name='plugin_test'} -tap_test_program{name='query_test'} diff --git a/lib/ns/tests/Makefile.am b/lib/ns/tests/Makefile.am new file mode 100644 index 0000000000..76145db571 --- /dev/null +++ b/lib/ns/tests/Makefile.am @@ -0,0 +1,45 @@ +include $(top_srcdir)/Makefile.top +include $(top_srcdir)/Makefile.tests + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBNS_CFLAGS) + +LDADD += \ + libnstest.la \ + $(LIBISC_LIBS) \ + $(LIBDNS_LIBS) \ + $(LIBNS_LIBS) + +check_LTLIBRARIES = libnstest.la +libnstest_la_SOURCES = nstest.c nstest.h +check_PROGRAMS = \ + listenlist_test \ + plugin_test + +TESTS = $(check_PROGRAMS) + +if HAVE_LD_WRAP + +check_PROGRAMS += \ + notify_test \ + query_test + +notify_test_SOURCES = \ + notify_test.c \ + wrap.c + +notify_test_LDFLAGS = \ + $(LDFLAGS) \ + -Wl,--wrap=isc_nmhandle_unref + +query_test_SOURCES = \ + query_test.c \ + wrap.c + +query_test_LDFLAGS = \ + $(LDFLAGS) \ + -Wl,--wrap=isc_nmhandle_unref + +endif diff --git a/lib/ns/tests/plugin_test.c b/lib/ns/tests/plugin_test.c index 2e6c6240e2..02f39508c3 100644 --- a/lib/ns/tests/plugin_test.c +++ b/lib/ns/tests/plugin_test.c @@ -23,14 +23,15 @@ #define UNIT_TESTING #include +#include #include #include #include #include #include -ISC_PLATFORM_NORETURN_PRE void -_fail(const char *const file, const int line) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN void +_fail(const char *const file, const int line); #include diff --git a/lib/ns/win32/libns.vcxproj.filters b/lib/ns/win32/libns.vcxproj.filters index 2931412cbf..ac8950d637 100644 --- a/lib/ns/win32/libns.vcxproj.filters +++ b/lib/ns/win32/libns.vcxproj.filters @@ -60,9 +60,6 @@ Source Files - - Source Files - @@ -104,11 +101,8 @@ Header Files - - Header Files - Header Files - \ No newline at end of file + diff --git a/lib/ns/win32/libns.vcxproj.in b/lib/ns/win32/libns.vcxproj.in index c7728e7a3d..125699e16e 100644 --- a/lib/ns/win32/libns.vcxproj.in +++ b/lib/ns/win32/libns.vcxproj.in @@ -131,7 +131,6 @@ - @@ -147,7 +146,6 @@ - diff --git a/lib/ns/win32/version.c b/lib/ns/win32/version.c deleted file mode 100644 index f506fa1ddb..0000000000 --- a/lib/ns/win32/version.c +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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 - -LIBNS_EXTERNAL_DATA const char ns_version[] = VERSION; -LIBNS_EXTERNAL_DATA const char ns_major[] = MAJOR; -LIBNS_EXTERNAL_DATA const char ns_mapapi[] = MAPAPI; - -LIBNS_EXTERNAL_DATA const unsigned int ns_libinterface = LIBINTERFACE; -LIBNS_EXTERNAL_DATA const unsigned int ns_librevision = LIBREVISION; -LIBNS_EXTERNAL_DATA const unsigned int ns_libage = LIBAGE; diff --git a/lib/samples/.gitignore b/lib/samples/.gitignore index b132e89060..3d14fb9600 100644 --- a/lib/samples/.gitignore +++ b/lib/samples/.gitignore @@ -1,4 +1,3 @@ -Makefile-postinstall nsprobe process resolve diff --git a/lib/samples/Makefile-postinstall.in b/lib/samples/Makefile-postinstall.in deleted file mode 100644 index f87f4c93d9..0000000000 --- a/lib/samples/Makefile-postinstall.in +++ /dev/null @@ -1,66 +0,0 @@ -# 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@ -#prefix = @prefix@ -#exec_prefix = @exec_prefix@ - -CDEFINES = -CWARNINGS = - -DNSLIBS = -ldns @DNS_CRYPTO_LIBS@ -ISCLIBS = -lisc @OPENSSL_LIBS@ @LIBXML2_LIBS@ -ISCCFGLIBS = -lisccfg -IRSLIBS = -lirs - -LIBS = ${DNSLIBS} ${ISCCFGLIBS} ${ISCLIBS} @LIBS@ - -SUBDIRS = - -TARGETS = sample@EXEEXT@ sample-async@EXEEXT@ sample-gai@EXEEXT@ \ - sample-update@EXEEXT@ sample-request@EXEEXT@ nsprobe@EXEEXT@ - -OBJS = sample.@O@ sample-async.@O@ sample-gai.@O@ sample-update.@O@ \ - sample-request.@O@ nsprobe.@O@ - -SRCS = sample.c sample-async.c sample-gai.c sample-update.c \ - sample-request.c nsprobe.c - -@BIND9_MAKE_RULES@ - -# The following two may depend on BIND9_MAKE_RULES -CINCLUDES = -I@export_includedir@ -LDFLAGS = -L@export_libdir@ - -sample@EXEEXT@: sample.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample.@O@ ${LIBS} - -sample-async@EXEEXT@: sample-async.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample-async.@O@ ${LIBS} - -sample-gai@EXEEXT@: sample-gai.@O@ ${IRSDEPLIBS} ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample-gai.@O@ ${IRSLIBS} ${LIBS} - -sample-update@EXEEXT@: sample-update.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample-update.@O@ ${LIBS} - -sample-request@EXEEXT@: sample-request.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - sample-request.@O@ ${LIBS} - -nsprobe@EXEEXT@: nsprobe.@O@ ${DEPLIBS} - ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ \ - nsprobe.@O@ ${LIBS} - -clean distclean maintainer-clean:: - rm -f ${TARGETS} diff --git a/lib/samples/Makefile.am b/lib/samples/Makefile.am new file mode 100644 index 0000000000..6f18fcd536 --- /dev/null +++ b/lib/samples/Makefile.am @@ -0,0 +1,32 @@ +include $(top_srcdir)/Makefile.top + +AM_CPPFLAGS += \ + $(LIBISC_CFLAGS) \ + $(LIBDNS_CFLAGS) \ + $(LIBIRS_CFLAGS) + +noinst_PROGRAMS = \ + resolve \ + sample-async \ + sample-gai \ + sample-update \ + sample-request \ + nsprobe + +resolve_SOURCES = resolve.c +resolve_LDADD = $(LIBISC_LIBS) $(LIBIRS_LIBS) $(LIBDNS_LIBS) + +sample_async_SOURCES = sample-async.c +sample_async_LDADD = $(LIBISC_LIBS) $(LIBDNS_LIBS) + +sample_gai_SOURCES = sample-gai.c +sample_gai_LDADD = $(LIBIRS_LIBS) + +sample_update_SOURCES = sample-update.c +sample_update_LDADD = $(LIBISC_LIBS) $(LIBDNS_LIBS) + +sample_request_SOURCES = sample-request.c +sample_request_LDADD = $(LIBISC_LIBS) $(LIBDNS_LIBS) + +nsprobe_SOURCES = nsprobe.c +nsprobe_LDADD = $(LIBISC_LIBS) $(LIBDNS_LIBS) diff --git a/lib/samples/nsprobe.c b/lib/samples/nsprobe.c index 5ac09c8b67..debf75165a 100644 --- a/lib/samples/nsprobe.c +++ b/lib/samples/nsprobe.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -1038,8 +1039,8 @@ cleanup: return (result); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/lib/samples/resolve.c b/lib/samples/resolve.c index 1466635083..cdfe07f104 100644 --- a/lib/samples/resolve.c +++ b/lib/samples/resolve.c @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -79,8 +80,8 @@ printdata(dns_rdataset_t *rdataset, dns_name_t *owner) { return (ISC_R_SUCCESS); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/lib/samples/sample-async.c b/lib/samples/sample-async.c index 302d31212d..769a5382e7 100644 --- a/lib/samples/sample-async.c +++ b/lib/samples/sample-async.c @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -252,8 +253,8 @@ cleanup: return (result); } -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/lib/samples/sample-request.c b/lib/samples/sample-request.c index d3290c4b55..8c15c8d5c3 100644 --- a/lib/samples/sample-request.c +++ b/lib/samples/sample-request.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -50,8 +51,8 @@ static isc_mem_t *mctx; static dns_fixedname_t fixedqname; -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/lib/samples/sample-update.c b/lib/samples/sample-update.c index 1ed3d7bd45..4d46590b82 100644 --- a/lib/samples/sample-update.c +++ b/lib/samples/sample-update.c @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -68,8 +69,8 @@ update_addordelete(isc_mem_t *mctx, char *cmdline, bool isdelete, static void evaluate_prereq(isc_mem_t *mctx, char *cmdline, dns_name_t *name); -ISC_PLATFORM_NORETURN_PRE static void -usage(void) ISC_PLATFORM_NORETURN_POST; +ISC_NORETURN static void +usage(void); static void usage(void) { diff --git a/m4/ax_bind9_lib_version.m4 b/m4/ax_bind9_lib_version.m4 new file mode 100644 index 0000000000..dd08f6b7d7 --- /dev/null +++ b/m4/ax_bind9_lib_version.m4 @@ -0,0 +1,10 @@ +AC_DEFUN([AX_BIND9_LIB_VERSION], + [AS_IF([test -z "$SED"], + [AC_PROG_SED]) + AS_IF([test -z "$SED"], + [AC_MSG_ERROR([sed not found, but required, set \$SED to sed])]) + ax_bind9_lib$1_current=`$SED -n "s,^LIBINTERFACE = \(.*\),\1,p" "$srcdir/lib/$1/api"` + ax_bind9_lib$1_revision=`$SED -n "s,^LIBREVISION = \(.*\),\1,p" "$srcdir/lib/$1/api"` + ax_bind9_lib$1_age=`$SED -n "s,^LIBAGE = \(.*\),\1,p" "$srcdir/lib/$1/api"` + AC_SUBST([lib$1_VERSION_INFO],["-version-info $ax_bind9_lib$1_current:$ax_bind9_lib$1_revision:$ax_bind9_lib$1_age]") + ]) diff --git a/m4/ax_gcc_func_attribute.m4 b/m4/ax_gcc_func_attribute.m4 new file mode 100644 index 0000000000..c926439721 --- /dev/null +++ b/m4/ax_gcc_func_attribute.m4 @@ -0,0 +1,242 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_gcc_func_attribute.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_FUNC_ATTRIBUTE(ATTRIBUTE) +# +# DESCRIPTION +# +# This macro checks if the compiler supports one of GCC's function +# attributes; many other compilers also provide function attributes with +# the same syntax. Compiler warnings are used to detect supported +# attributes as unsupported ones are ignored by default so quieting +# warnings when using this macro will yield false positives. +# +# The ATTRIBUTE parameter holds the name of the attribute to be checked. +# +# If ATTRIBUTE is supported define HAVE_FUNC_ATTRIBUTE_. +# +# The macro caches its result in the ax_cv_have_func_attribute_ +# variable. +# +# The macro currently supports the following function attributes: +# +# alias +# aligned +# alloc_size +# always_inline +# artificial +# cold +# const +# constructor +# constructor_priority for constructor attribute with priority +# deprecated +# destructor +# dllexport +# dllimport +# error +# externally_visible +# fallthrough +# flatten +# format +# format_arg +# gnu_format +# gnu_inline +# hot +# ifunc +# leaf +# malloc +# noclone +# noinline +# nonnull +# noreturn +# nothrow +# optimize +# pure +# sentinel +# sentinel_position +# unused +# used +# visibility +# warning +# warn_unused_result +# weak +# weakref +# +# Unsupported function attributes will be tested with a prototype +# returning an int and not accepting any arguments and the result of the +# check might be wrong or meaningless so use with care. +# +# LICENSE +# +# Copyright (c) 2013 Gabriele Svelto +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 10 + +AC_DEFUN([AX_GCC_FUNC_ATTRIBUTE], [ + AS_VAR_PUSHDEF([ac_var], [ax_cv_have_func_attribute_$1]) + + AC_CACHE_CHECK([for __attribute__(($1))], [ac_var], [ + AC_LINK_IFELSE([AC_LANG_PROGRAM([ + m4_case([$1], + [alias], [ + int foo( void ) { return 0; } + int bar( void ) __attribute__(($1("foo"))); + ], + [aligned], [ + int foo( void ) __attribute__(($1(32))); + ], + [alloc_size], [ + void *foo(int a) __attribute__(($1(1))); + ], + [always_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [artificial], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [cold], [ + int foo( void ) __attribute__(($1)); + ], + [const], [ + int foo( void ) __attribute__(($1)); + ], + [constructor_priority], [ + int foo( void ) __attribute__((__constructor__(65535/2))); + ], + [constructor], [ + int foo( void ) __attribute__(($1)); + ], + [deprecated], [ + int foo( void ) __attribute__(($1(""))); + ], + [destructor], [ + int foo( void ) __attribute__(($1)); + ], + [dllexport], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [dllimport], [ + int foo( void ) __attribute__(($1)); + ], + [error], [ + int foo( void ) __attribute__(($1(""))); + ], + [externally_visible], [ + int foo( void ) __attribute__(($1)); + ], + [fallthrough], [ + int foo( void ) {switch (0) { case 1: __attribute__(($1)); case 2: break ; }}; + ], + [flatten], [ + int foo( void ) __attribute__(($1)); + ], + [format], [ + int foo(const char *p, ...) __attribute__(($1(printf, 1, 2))); + ], + [gnu_format], [ + int foo(const char *p, ...) __attribute__((format(gnu_printf, 1, 2))); + ], + [format_arg], [ + char *foo(const char *p) __attribute__(($1(1))); + ], + [gnu_inline], [ + inline __attribute__(($1)) int foo( void ) { return 0; } + ], + [hot], [ + int foo( void ) __attribute__(($1)); + ], + [ifunc], [ + int my_foo( void ) { return 0; } + static int (*resolve_foo(void))(void) { return my_foo; } + int foo( void ) __attribute__(($1("resolve_foo"))); + ], + [leaf], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [malloc], [ + void *foo( void ) __attribute__(($1)); + ], + [noclone], [ + int foo( void ) __attribute__(($1)); + ], + [noinline], [ + __attribute__(($1)) int foo( void ) { return 0; } + ], + [nonnull], [ + int foo(char *p) __attribute__(($1(1))); + ], + [noreturn], [ + void foo( void ) __attribute__(($1)); + ], + [nothrow], [ + int foo( void ) __attribute__(($1)); + ], + [optimize], [ + __attribute__(($1(3))) int foo( void ) { return 0; } + ], + [pure], [ + int foo( void ) __attribute__(($1)); + ], + [sentinel], [ + int foo(void *p, ...) __attribute__(($1)); + ], + [sentinel_position], [ + int foo(void *p, ...) __attribute__(($1(1))); + ], + [returns_nonnull], [ + void *foo( void ) __attribute__(($1)); + ], + [unused], [ + int foo( void ) __attribute__(($1)); + ], + [used], [ + int foo( void ) __attribute__(($1)); + ], + [visibility], [ + int foo_def( void ) __attribute__(($1("default"))); + int foo_hid( void ) __attribute__(($1("hidden"))); + int foo_int( void ) __attribute__(($1("internal"))); + int foo_pro( void ) __attribute__(($1("protected"))); + ], + [warning], [ + int foo( void ) __attribute__(($1(""))); + ], + [warn_unused_result], [ + int foo( void ) __attribute__(($1)); + ], + [weak], [ + int foo( void ) __attribute__(($1)); + ], + [weakref], [ + static int foo( void ) { return 0; } + static int bar( void ) __attribute__(($1("foo"))); + ], + [ + m4_warn([syntax], [Unsupported attribute $1, the test may fail]) + int foo( void ) __attribute__(($1)); + ] + )], []) + ], + dnl GCC doesn't exit with an error if an unknown attribute is + dnl provided but only outputs a warning, so accept the attribute + dnl only if no warning were issued. + [AS_IF([test -s conftest.err], + [AS_VAR_SET([ac_var], [no])], + [AS_VAR_SET([ac_var], [yes])])], + [AS_VAR_SET([ac_var], [no])]) + ]) + + AS_IF([test yes = AS_VAR_GET([ac_var])], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_FUNC_ATTRIBUTE_$1), 1, + [Define to 1 if the system has the `$1' function attribute])], []) + + AS_VAR_POPDEF([ac_var]) +]) diff --git a/m4/ax_perl_module.m4 b/m4/ax_perl_module.m4 new file mode 100644 index 0000000000..9b636e6cf5 --- /dev/null +++ b/m4/ax_perl_module.m4 @@ -0,0 +1,31 @@ +# +# SYNOPSIS +# +# AX_PERL_MODULE(MODULE[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# Checks for Perl module. +# +# LICENSE +# +# Copyright (c) 2020 Internet Systems Consortium +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +AC_DEFUN([AX_PERL_MODULE],[ + AC_MSG_CHECKING([for perl module: $1]) + $PERL "-M$1" -e exit >/dev/null 2>&1 + AS_IF([test $? -eq 0], + [AC_MSG_RESULT([yes]) + eval AS_TR_CPP(HAVE_PERLMOD_$1)=yes + $2 + ], + [AC_MSG_RESULT([no]) + eval AS_TR_CPP(HAVE_PERLMOD_$1)=no + $3 + ]) + ]) diff --git a/m4/ax_python_module.m4 b/m4/ax_python_module.m4 new file mode 100644 index 0000000000..db1db90a6a --- /dev/null +++ b/m4/ax_python_module.m4 @@ -0,0 +1,32 @@ +# +# SYNOPSIS +# +# AX_PYTHON_MODULE(MODULE[, ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]]) +# +# DESCRIPTION +# +# Checks for Python module. +# +# LICENSE +# +# Copyright (c) 2008 Andrew Collier +# (c) 2020 Internet Systems Consortium +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +AC_DEFUN([AX_PYTHON_MODULE],[ + AC_MSG_CHECKING([for python module: $1]) + $PYTHON -c "import $1" >/dev/null 2>&1 + AS_IF([test $? -eq 0], + [AC_MSG_RESULT([yes]) + eval AS_TR_CPP(HAVE_PYMOD_$1)=yes + $2 + ], + [AC_MSG_RESULT([no]) + eval AS_TR_CPP(HAVE_PYMOD_$1)=no + $3 + ]) + ]) diff --git a/m4/ax_tls.m4 b/m4/ax_tls.m4 new file mode 100644 index 0000000000..fb184fe201 --- /dev/null +++ b/m4/ax_tls.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_tls.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_TLS([action-if-found], [action-if-not-found]) +# +# DESCRIPTION +# +# Provides a test for the compiler support of thread local storage (TLS) +# extensions. Defines TLS if it is found. Currently knows about C++11, +# GCC/ICC, and MSVC. I think SunPro uses the same as GCC, and Borland +# apparently supports either. +# +# LICENSE +# +# Copyright (c) 2008 Alan Woodland +# Copyright (c) 2010 Diego Elio Petteno` +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 15 + +AC_DEFUN([AX_TLS], [ + AC_MSG_CHECKING([for thread local storage (TLS) class]) + AC_CACHE_VAL([ac_cv_tls], + [for ax_tls_keyword in thread_local _Thread_local __thread '__declspec(thread)' none; do + AS_CASE([$ax_tls_keyword], + [none], [ac_cv_tls=none ; break], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [#include ], + [static $ax_tls_keyword int bar;] + )], + [ac_cv_tls=$ax_tls_keyword ; break], + [ac_cv_tls=none] + )] + ) + done ] + ) + AC_MSG_RESULT([$ac_cv_tls]) + + AS_IF([test "$ac_cv_tls" != "none"], + [AC_DEFINE_UNQUOTED([TLS],[$ac_cv_tls],[If the compiler supports a TLS storage class, define it to that here]) + m4_ifnblank([$1],[$1],[[:]])], + [m4_ifnblank([$2],[$2],[[:]])]) +]) diff --git a/make/.gitignore b/make/.gitignore deleted file mode 100644 index d46289bf38..0000000000 --- a/make/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -includes -rules -mkdep diff --git a/make/includes.in b/make/includes.in deleted file mode 100644 index 48cdaf7cc3..0000000000 --- a/make/includes.in +++ /dev/null @@ -1,41 +0,0 @@ -# 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. - -# Search for machine-generated header files in the build tree, -# and for normal headers in the source tree (${top_srcdir}). -# We only need to look in OS-specific subdirectories for the -# latter case, because there are no machine-generated OS-specific -# headers. - -ISC_INCLUDES = @BIND9_ISC_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/isc \ - -I${top_srcdir}/lib/isc/include \ - -I${top_srcdir}/lib/isc/unix/include \ - -I${top_srcdir}/lib/isc/pthreads/include - -ISCCC_INCLUDES = @BIND9_ISCCC_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/isccc/include - -ISCCFG_INCLUDES = @BIND9_ISCCFG_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/isccfg/include - -DNS_INCLUDES = @BIND9_DNS_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/dns/include - -NS_INCLUDES = @BIND9_NS_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/ns/include - -IRS_INCLUDES = @BIND9_IRS_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/irs/include - -BIND9_INCLUDES = @BIND9_BIND9_BUILDINCLUDE@ \ - -I${top_srcdir}/lib/bind9/include - -TEST_INCLUDES = \ - -I${top_srcdir}/lib/tests/include diff --git a/make/mkdep.in b/make/mkdep.in deleted file mode 100644 index 2ba9495e82..0000000000 --- a/make/mkdep.in +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/sh - - -## -## Modified to handle -vpath option by Michael Graff, ISC. -## The purpose of this is to allow this script to run outside of the -## source directory, for instance when running configure with -## ../bind9-mainline/configure -## and still have "make depend" work. -## - -## ++Copyright++ 1987 -## - -## Copyright (c) 1987 Regents of the University of California. -## 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. -## 3. Neither the name of the University nor the names of its contributors -## may be used to endorse or promote products derived from this software -## without specific prior written permission. -## THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. -## - -## Portions Copyright (c) 1993 by Digital Equipment Corporation. -## -## Permission to use, copy, modify, and distribute this software for any -## purpose with or without fee is hereby granted, provided that the above -## copyright notice and this permission notice appear in all copies, and that -## the name of Digital Equipment Corporation not be used in advertising or -## publicity pertaining to distribution of the document or software without -## specific, written prior permission. -## -## THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL -## WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES -## OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT -## CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL -## DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR -## PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -## ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -## SOFTWARE. -## - -## --Copyright-- - -# -# @(#)mkdep.sh 5.12 (Berkeley) 6/30/88 -# - -MAKE=Makefile # default makefile name is "Makefile" - -while : - do case "$1" in - # -vpath allows one to select a virtual path for .c files - -vpath) - VPATH=$2; - shift; shift ;; - # -f allows you to select a makefile name - -f) - MAKE=$2 - shift; shift ;; - - # the -p flag produces "program: program.c" style dependencies - # so .o's don't get produced - -p) - SED='s;\.o;;' - shift ;; - *) - break ;; - esac -done - -if [ $# = 0 ] ; then - echo 'usage: mkdep [-vpath path] [-p] [-f makefile] [flags] file ...' - exit 1 -fi - -if [ ! -w $MAKE ]; then - echo "mkdep: no writeable file \"$MAKE\"" - exit 1 -fi - -TMP=mkdep$$ - -trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 - -cp $MAKE ${MAKE}.bak - -sed -e '/DO NOT DELETE THIS LINE/,$d' < $MAKE > $TMP - -cat << _EOF_ >> $TMP -# DO NOT DELETE THIS LINE -- mkdep uses it. -# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. - -_EOF_ - -# If your compiler doesn't have -M, add it. If you can't, the next two -# lines will try and replace the "cc -M". The real problem is that this -# hack can't deal with anything that requires a search path, and doesn't -# even try for anything using bracket (<>) syntax. -# -# egrep '^#include[ ]*".*"' /dev/null $* | -# sed -e 's/:[^"]*"\([^"]*\)".*/: \1/' -e 's/\.c/.o/' | - -if [ X"${VPATH}" != X ] ; then - for arg in $* ; do - case "$arg" in - -*) - newargs="$newargs $arg" - ;; - *) - newargs="$newargs $VPATH/$arg" - ;; - esac - done -else - newargs="$*"; -fi - -MKDEPPROG="@MKDEPPROG@" -if [ X"${MKDEPPROG}" != X ]; then - @SHELL@ -c "${MKDEPPROG} ${newargs}" -else - @MKDEPCC@ @MKDEPCFLAGS@ ${newargs} | - sed " - s; \\./; ;g - s; \\\\; ;g - @LIBTOOL_MKDEP_SED@ - $SED" | - awk '$1 ~ /:$/ { - if (rec != "") - print rec; - if (NF == 1) - rec = $1; - else - rec = $1 " " $2; - for (i = 3; i <= NF; i++) { - if (length(rec $i) > 76) { - print rec " \\"; - rec = " " $i; - } else { - rec = rec " " $i; - } - } - next; - } - { - for (i = 1; i <= NF; i++) { - if (length(rec $i) > 76) { - print rec, "\\"; - rec = " " $i; - } else { - rec = rec " " $i; - } - } - } - END { - print rec - }' >> $TMP -fi - -cat << _EOF_ >> $TMP - -# IF YOU PUT ANYTHING HERE IT WILL GO AWAY -_EOF_ - -# copy to preserve permissions -cp $TMP $MAKE -rm -f ${MAKE}.bak $TMP -exit 0 diff --git a/make/rules.in b/make/rules.in deleted file mode 100644 index e2658bffbd..0000000000 --- a/make/rules.in +++ /dev/null @@ -1,334 +0,0 @@ -# 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. - -### -### Common Makefile rules for BIND 9. -### - -### -### Paths -### -### Note: paths that vary by Makefile MUST NOT be listed -### here, or they won't get expanded correctly. - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -sbindir = @sbindir@ -includedir = @includedir@ -libdir = @libdir@ -sysconfdir = @sysconfdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -datarootdir = @datarootdir@ - -plugindir = ${libdir}/named - -DESTDIR = - -@SET_MAKE@ - -top_builddir = @BIND9_TOP_BUILDDIR@ - -### -### All -### -### Makefile may define: -### PREREQS -### TARGETS - -all: ${PREREQS} subdirs ${TARGETS} testdirs - -### -### Subdirectories -### -### Makefile may define: -### SUBDIRS -### DEPDIRS - -ALL_SUBDIRS = ${SUBDIRS} nulldir -ALL_TESTDIRS = ${TESTDIRS} nulldir - -# -# We use a single-colon rule so that additional dependencies of -# subdirectories can be specified after the inclusion of this file. -# The "depend" and "testdirs" targets are treated the same way. -# -subdirs: - @for i in ${ALL_SUBDIRS}; do \ - if [ "$$i" != "nulldir" -a -d $$i ]; then \ - echo "making all in `pwd`/$$i"; \ - (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \ - fi; \ - done - -# -# Tests are built after the targets instead of before -# -testdirs: subdirs ${TARGETS} - @for i in ${ALL_TESTDIRS}; do \ - if [ "$$i" != "nulldir" -a -d $$i ]; then \ - echo "making all in `pwd`/$$i"; \ - (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" all) || exit 1; \ - fi; \ - done - -install:: all - -install uninstall clean distclean maintainer-clean doc docclean man manclean:: - @for i in ${ALL_SUBDIRS} ${ALL_TESTDIRS}; do \ - if [ "$$i" != "nulldir" -a -d $$i -a -f $$i/Makefile ]; then \ - echo "making $@ in `pwd`/$$i"; \ - (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \ - fi; \ - done - -### -### C Programs -### -### Makefile must define -### CC -### Makefile may define -### CFLAGS -### LDFLAGS -### CINCLUDES -### CDEFINES -### CWARNINGS -### User may define externally -### EXT_CFLAGS - -CC = @CC@ -CFLAGS = @CFLAGS@ -LDFLAGS = @LDFLAGS@ -STD_CINCLUDES = @STD_CINCLUDES@ -STD_CDEFINES = @STD_CDEFINES@ -STD_CWARNINGS = @STD_CWARNINGS@ - -BUILD_CC = @BUILD_CC@ -BUILD_CFLAGS = @BUILD_CFLAGS@ -BUILD_CPPFLAGS = @BUILD_CPPFLAGS@ -BUILD_LDFLAGS = @BUILD_LDFLAGS@ -BUILD_LIBS = @BUILD_LIBS@ - -LFS_CFLAGS = @LFS_CFLAGS@ -LFS_LDFLAGS = @LFS_LDFLAGS@ -LFS_LIBS = @LFS_LIBS@ - -OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ -OPENSSL_LIBS = @OPENSSL_LIBS@ - -JSON_C_CFLAGS = @JSON_C_CFLAGS@ -JSON_C_LIBS = @JSON_C_LIBS@ - -LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ -LIBXML2_LIBS = @LIBXML2_LIBS@ - -LMDB_CFLAGS = @LMDB_CFLAGS@ -LMDB_LIBS = @LMDB_LIBS@ - -MAXMINDDB_CFLAGS = @MAXMINDDB_CFLAGS@ -MAXMINDDB_LIBS = @MAXMINDDB_LIBS@ - -ZLIB_CFLAGS = @ZLIB_CFLAGS@ -ZLIB_LIBS = @ZLIB_LIBS@ - -.SUFFIXES: -.SUFFIXES: .c .@O@ - -ALWAYS_INCLUDES = -include ${top_builddir}/config.h -I${top_builddir} -I${top_srcdir} -ALWAYS_DEFINES = @ALWAYS_DEFINES@ -ALWAYS_WARNINGS = - -ALL_CPPFLAGS = \ - ${ALWAYS_INCLUDES} ${CINCLUDES} ${STD_CINCLUDES} \ - ${ALWAYS_DEFINES} ${CDEFINES} ${STD_CDEFINES} - -ALL_CFLAGS = ${EXT_CFLAGS} ${ALL_CPPFLAGS} ${CFLAGS} \ - ${ALWAYS_WARNINGS} ${STD_CWARNINGS} ${CWARNINGS} - -@BIND9_CO_RULE@ - ${LIBTOOL_MODE_COMPILE} ${CC} ${ALL_CFLAGS} -c $< - -SHELL = @SHELL@ -LIBTOOL = @LIBTOOL@ -LIBTOOL_MODE_COMPILE = ${LIBTOOL} @LIBTOOL_MODE_COMPILE@ -LIBTOOL_MODE_INSTALL = ${LIBTOOL} @LIBTOOL_MODE_INSTALL@ -LIBTOOL_MODE_LINK = ${LIBTOOL} @LIBTOOL_MODE_LINK@ -LIBTOOL_MODE_UNINSTALL = ${LIBTOOL} @LIBTOOL_MODE_UNINSTALL@ -PURIFY = @PURIFY@ - -MKDEP = ${SHELL} ${top_builddir}/make/mkdep - -### -### This is a template compound command to build an executable binary with -### an internal symbol table. -### This process is tricky. We first link all objects including a tentative -### empty symbol table, then get a tentative list of symbols from the resulting -### binary ($@tmp0). Next, we re-link all objects, but this time with the -### symbol table just created ($tmp@1). The set of symbols should be the same, -### but the corresponding addresses would be changed due to the difference on -### the size of symbol tables. So we create the symbol table and re-create the -### objects once again. Finally, we check the symbol table embedded in the -### final binaryis consistent with the binary itself; otherwise the process is -### terminated. -### -### To minimize the overhead of creating symbol tables, the autoconf switch -### --enable-symtable takes an argument so that the symbol table can be created -### on a per application basis: unless the argument is set to "all", the symbol -### table is created only when a shell (environment) variable "MAKE_SYMTABLE" is -### set to a non-null value in the rule to build the executable binary. -### -### Each Makefile.in that uses this macro is expected to define "LIBS" and -### "NOSYMLIBS"; the former includes libisc with an empty symbol table, and -### the latter includes libisc without the definition of a symbol table. -### The rule to make the executable binary will look like this -### binary@EXEEXT@: ${OBJS} -### #export MAKE_SYMTABLE="yes"; \ <- enable if symtable is always needed -### export BASEOBJS="${OBJS}"; \ -### ${FINALBUILDCMD} -### -### Normally, ${LIBS} includes all necessary libraries to build the binary; -### there are some exceptions however, where the rule lists some of the -### necessary libraries explicitly in addition to (or instead of) ${LIBS}, -### like this: -### binary@EXEEXT@: ${OBJS} -### cc -o $@ ${OBJS} ${OTHERLIB1} ${OTHERLIB2} ${LIBS} -### in order to modify such a rule to use this compound command, a separate -### variable "LIBS0" should be deinfed for the explicitly listed libraries, -### while making sure ${LIBS} still includes libisc. So the above rule would -### be modified as follows: -### binary@EXEEXT@: ${OBJS} -### export BASEOBJS="${OBJS}"; \ -### export LIBS0="${OTHERLIB1} ${OTHERLIB2}"; \ -### ${FINALBUILDCMD} -### See bin/check/Makefile.in for a complete example of the use of LIBS0. -### -FINALBUILDCMD = ${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${ALL_CFLAGS} ${LDFLAGS} \ - -o $@ $${BASEOBJS} $${LIBS0} ${LIBS}; \ - -cleandir: distclean -superclean: maintainer-clean - -clean distclean maintainer-clean:: - rm -f *.@O@ *.o *.lo *.la core *.core *-symtbl.c *tmp0 *tmp1 *tmp2 - rm -rf .depend .libs - -distclean maintainer-clean:: - rm -f Makefile - -depend: - @for i in ${ALL_SUBDIRS} ${ALL_TESTDIRS}; do \ - if [ "$$i" != "nulldir" -a -d $$i ]; then \ - echo "making depend in `pwd`/$$i"; \ - (cd $$i; ${MAKE} ${MAKEDEFS} DESTDIR="${DESTDIR}" $@) || exit 1; \ - fi; \ - done - @if [ X"${srcdir}" != X. ] ; then \ - if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \ - echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - echo ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${MKDEP} -vpath ${srcdir} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${DEPENDEXTRA} \ - elif [ X"${SRCS}" != X ] ; then \ - echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${DEPENDEXTRA} \ - elif [ X"${PSRCS}" != X ] ; then \ - echo ${MKDEP} -vpath ${srcdir} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${MKDEP} -vpath ${srcdir} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${DEPENDEXTRA} \ - fi \ - else \ - if [ X"${SRCS}" != X -a X"${PSRCS}" != X ] ; then \ - echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - echo ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${MKDEP} -ap ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${DEPENDEXTRA} \ - elif [ X"${SRCS}" != X ] ; then \ - echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${SRCS}; \ - ${DEPENDEXTRA} \ - elif [ X"${PSRCS}" != X ] ; then \ - echo ${MKDEP} ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${MKDEP} -p ${ALL_CPPFLAGS} ${ALL_CFLAGS} ${PSRCS}; \ - ${DEPENDEXTRA} \ - fi \ - fi - -FORCE: - -### -### Libraries -### - -AR = @AR@ -ARFLAGS = @ARFLAGS@ -RANLIB = @RANLIB@ - -### -### Installation -### - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -LINK_PROGRAM = @LN_S@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_LIBRARY = @INSTALL_LIBRARY@ - -### -### Programs used when generating documentation. It's ok for these -### not to exist when not generating documentation. -### - -XSLTPROC = @XSLTPROC@ --novalid --xinclude --nonet -XMLLINT = @XMLLINT@ -PERL = @PERL@ -LATEX = @LATEX@ -PDFLATEX = @PDFLATEX@ -DBLATEX = @DBLATEX@ -W3M = @W3M@ -PANDOC = @PANDOC@ - -### -### DocBook -> HTML -### DocBook -> man page -### - -.SUFFIXES: .docbook .html .1 .2 .3 .4 .5 .6 .7 .8 - -.docbook.html: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-docbook-html.xsl $< - -.docbook.1: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.2: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.3: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.4: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.5: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.6: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.7: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - -.docbook.8: - ${XSLTPROC} -o $@ ${top_srcdir}/doc/xsl/isc-manpage.xsl $< - diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100644 index f945dbf2bc..0000000000 --- a/mkinstalldirs +++ /dev/null @@ -1,38 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/unit/.gitignore b/unit/.gitignore deleted file mode 100644 index db27d5b1d7..0000000000 --- a/unit/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -!config.h -Makefile -atf -unittest.sh diff --git a/unit/README b/unit/README deleted file mode 100644 index 9cdcf9b904..0000000000 --- a/unit/README +++ /dev/null @@ -1,8 +0,0 @@ -Unit tests for BIND 9 are based on the CMocka testing framework and -the Kyua test execution engine. - -If your distribution of choice doesn't include packages for kyua or cmocka, the -sources can be found here: - - * Kyua 0.13 - https://github.com/jmmv/kyua/releases - * CMocka 1.0 - https://cmocka.org/files/ diff --git a/unit/gdb b/unit/gdb deleted file mode 100755 index 68ccc10325..0000000000 --- a/unit/gdb +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -# `kyua debug` command does not work with libtool (see -# https://github.com/jmmv/kyua/issues/207). On some distributions `kyua debug` -# runs the first `gdb` it finds in $PATH, but on Debian and Ubuntu it looks for -# `/usr/bin/gdb`. This script expects `gdb` to be moved to `gdb.orig` and -# executed from there. -coredump="$6" -binary=$(gdb.orig --batch --core="${coredump}" 2>/dev/null | sed -ne "s/Core was generated by \`\(.*\)'./\1/p") -# GDB 6.3 from OpenBSD 6.6 does not tell the full path of the broken binary. -# We need to fix it. Either the binary or it's libtool script will do. -if [ ! -e "${binary}" ]; then - binary="$(find "${TOP}" -name "${binary}" | head -n 1)" -fi - -# $TOP points to BIND sources and should be set on `kyua debug` invocation. -"${TOP}/libtool" --mode=execute gdb.orig \ - --batch \ - --command="${TOP}/bin/tests/system/run.gdb" \ - --core="${coredump}" \ - -- \ - "${binary}" diff --git a/unit/unittest.sh.in b/unit/unittest.sh.in deleted file mode 100755 index 8224fef2cc..0000000000 --- a/unit/unittest.sh.in +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# Find the top of the BIND9 tree. -export TOP=@abs_top_builddir@ -KYUA=@KYUA@ -UNITTESTS=@UNITTESTS@ -CMOCKA_MESSAGE_OUTPUT=TAP -export CMOCKA_MESSAGE_OUTPUT -GDB="$(command -v gdb)" - -kyua_report() { - ${KYUA} --logfile /dev/null report --results-file "${KYUA_RESULT:-LATEST}" -} - -clear_kyua_work_dir() { - KYUA_WORK_DIR="$(grep -i -m1 "failed" "${1}" | sed -n 's|.*\(/tmp/kyua\.[A-Za-z0-9]*\).*|\1|p')" - if [ -n "${CI}" ] && [ -d "${KYUA_WORK_DIR}" ]; then - find "${KYUA_WORK_DIR}" \( -name 'core*' -o -name '*.core' \) -exec mv -v {} . \; - rm -rf "${KYUA_WORK_DIR}" - fi -} - -status=0 -if [ -n "${UNITTESTS}" ] && [ -f Kyuafile ] -then - echo "S:unit:$(date)" - echo "T:unit:1:A" - echo "I:unit tests (using kyua)" - - ${KYUA} -v parallelism="${TEST_PARALLEL_JOBS:-1}" --logfile kyua.log --loglevel debug test --results-file "${KYUA_RESULT:-NEW}" - status=$? - - kyua_report - - clear_kyua_work_dir kyua.log - - # Use kyua-debug(1) facility to gather additional data on failed tests. - # Some runs will just show verbose information from the run, some will - # show backtrace via gdb(1). - USER_ID=$(id -u) - BROKEN_TESTS=$(kyua_report | awk '$2 == "->" && ( $3 == "broken:" || $3 == "failed:" ) { print $1 }') - # Conditions for getting kyua debug info and GDB backtrace: runs under CI - # (safety), GDB present, root privileges, failed tests. - if [ -n "${CI}" ] && [ -n "${GDB}" ] && [ "${USER_ID:-1}" -eq 0 ] && [ -n "${BROKEN_TESTS}" ]; then - if [ "$(uname -s)" = "Linux" ] && ! sysctl -n "kernel.core_pattern" | grep -xq "core.%p"; then - echo "I:*** kernel.core_pattern is not set to 'core.%p'" - echo "I:*** kyua may not be able to find core dumps for broken tests" - fi - if [ "$(uname -s)" = "FreeBSD" ] && ! sysctl -n "kern.corefile" | grep -xq "core.%P"; then - echo "I:*** kern.corefile is not set to 'core.%P'" - echo "I:*** kyua may not be able to find core dumps for broken tests" - fi - # kyua debug command misidentifies broken binaries when libtool - # is used (see https://github.com/jmmv/kyua/issues/207). - # Here we try to "trick" kyua to use our custom gdb script instead - # of using gdb(1) directly. Hence this part needs to be run as root - # and, for safety reasons, only in the CI. - mv "${GDB}" "${GDB}.orig" - cp "${TOP}/unit/gdb" "${GDB}" - i=1 - for test in ${BROKEN_TESTS}; do - echo - echo "----- $test -----" - KYUA_DEBUG_LOG="kyua.debug.log.${i}" - ${KYUA} debug "${test}" 2>&1 | tee "${KYUA_DEBUG_LOG}" - clear_kyua_work_dir "${KYUA_DEBUG_LOG}" - i=$((i + 1)) - done - mv "${GDB}.orig" "${GDB}" - fi - - if [ "${status}" -eq 0 ] - then - rm -f kyua.log - echo "R:PASS" - else - echo "R:FAIL:status:${status}" - fi - echo "E:unit:$(date)" -fi -exit ${status} diff --git a/util/check-ans-prereq.sh b/util/check-ans-prereq.sh deleted file mode 100644 index 6c21d5c59d..0000000000 --- a/util/check-ans-prereq.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/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. - -status=0 - -for testscript in bin/tests/system/*/tests.sh; do - testdir="$(dirname "${testscript}")" - prereq="${testdir}/prereq.sh" - if [ -e "${prereq}" ] || [ -e "${prereq}.in" ]; then - continue - fi - if find "${testdir}" -type d -name "ans*" | grep -Eq "/ans[0-9]+$"; then - echo "missing ${prereq}" - status=1 - fi -done - -exit ${status} diff --git a/util/checklibs.sh b/util/checklibs.sh index b5b89390e2..7a07ef07d8 100755 --- a/util/checklibs.sh +++ b/util/checklibs.sh @@ -17,7 +17,7 @@ status=0 list=`git grep -l snprintf lib bin | grep '\.c$' | grep -vE -e '(lib/bind|lib/dns/rdata|lib/dns/gen.c)' \ - -e '(lib/isc/win32/time.c|dlzexternal/driver.c)' | + -e '(lib/isc/win32/time.c|dlzexternal/driver/driver.c)' | xargs grep -EL "(isc/print.h|print_p.h)" 2> /dev/null` [ -n "$list" ] && { status=1 diff --git a/util/copyrights b/util/copyrights index e132f70d0f..bcd70b5cfd 100644 --- a/util/copyrights +++ b/util/copyrights @@ -1,18 +1,14 @@ ./.gitlab-ci.yml X 2018,2019,2020 ./.pylintrc X 2020 ./.uncrustify.cfg X 2018,2019,2020 +./AUTHORS X 2020 ./CHANGES X 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./CODE_OF_CONDUCT X 2019,2020 -./CONTRIBUTING X 2017,2018,2019,2020 +./COPYING X 2020 ./COPYRIGHT TXT.TOP 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./HISTORY X 2010,2013,2016,2017,2018,2019,2020 -./Kyuafile X 2017,2018,2019,2020 ./LICENSE X 2016,2018,2019,2020 -./OPTIONS X 2017,2018,2019,2020 -./PLATFORMS X 2018,2019,2020 -./README X 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./aclocal.m4 X 1999,2000,2001,2012,2014,2018,2019,2020 -./autogen.sh SH 2015,2016,2018,2019,2020 +./Makefile.tests X 2020 +./Makefile.top X 2020 +./NEWS X 2020 ./bin/check/check-tool.c C 2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/check/check-tool.h C 2000,2001,2002,2004,2005,2007,2010,2011,2013,2014,2016,2018,2019,2020 ./bin/check/named-checkconf.8 MAN DOCBOOK @@ -68,11 +64,11 @@ ./bin/dig/dig.docbook SGML 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/dig.html HTML DOCBOOK ./bin/dig/dighost.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 +./bin/dig/dighost.h C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/host.1 MAN DOCBOOK ./bin/dig/host.c C 2000,2001,2002,2003,2004,2005,2006,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/host.docbook SGML 2000,2001,2002,2004,2005,2007,2008,2009,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/host.html HTML DOCBOOK -./bin/dig/include/dig/dig.h C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/nslookup.1 MAN DOCBOOK ./bin/dig/nslookup.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dig/nslookup.docbook SGML 2004,2005,2006,2007,2010,2013,2014,2015,2016,2017,2018,2019,2020 @@ -134,6 +130,7 @@ ./bin/dnssec/win32/dnssectool.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dnssec/win32/dnssectool.vcxproj.user X 2013,2018,2019,2020 ./bin/dnssec/win32/dsfromkey.vcxproj.filters.in X 2013,2015,2018,2019,2020 +./bin/dnssec/win32/dsfromkey.vcxproj.in X 2013,2018,2019,2020 ./bin/dnssec/win32/dsfromkey.vcxproj.user X 2013,2018,2019,2020 ./bin/dnssec/win32/importkey.vcxproj.filters.in X 2013,2015,2018,2019,2020 ./bin/dnssec/win32/importkey.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 @@ -157,12 +154,10 @@ ./bin/dnssec/win32/verify.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./bin/dnssec/win32/verify.vcxproj.user X 2013,2018,2019,2020 ./bin/named/bind9.xsl SGML 2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./bin/named/bind9.xsl.h X 2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/builtin.c C 2001,2002,2003,2004,2005,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/config.c C 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/control.c C 2001,2002,2003,2004,2005,2006,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/controlconf.c C 2001,2002,2003,2004,2005,2006,2007,2008,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./bin/named/convertxsl.pl PERL 2006,2007,2008,2012,2014,2016,2018,2019,2020 ./bin/named/fuzz.c C 2016,2017,2018,2019,2020 ./bin/named/geoip.c C 2013,2014,2016,2017,2018,2019,2020 ./bin/named/include/dlz/dlz_dlopen_driver.h C 2011,2016,2018,2019,2020 @@ -206,6 +201,7 @@ ./bin/named/win32/named.vcxproj.user X 2013,2018,2019,2020 ./bin/named/win32/ntservice.c C 1999,2000,2001,2002,2004,2006,2007,2009,2011,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/win32/os.c C 1999,2000,2001,2002,2004,2005,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 +./bin/named/xsl_p.h X 2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/named/zoneconf.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/nsupdate/nsupdate.1 MAN DOCBOOK ./bin/nsupdate/nsupdate.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -262,56 +258,9 @@ ./bin/rndc/win32/rndcutil.vcxproj.filters.in X 2013,2015,2018,2019,2020 ./bin/rndc/win32/rndcutil.vcxproj.in X 2013,2015,2016,2017,2018,2019,2020 ./bin/rndc/win32/rndcutil.vcxproj.user X 2013,2018,2019,2020 -./bin/tests/bigtest/README TXT.BRIEF 2013,2016,2018,2019,2020 -./bin/tests/bigtest/buildzones.sh SH 2013,2016,2018,2019,2020 -./bin/tests/bigtest/rndc.key X 2013,2018,2019,2020 -./bin/tests/bigtest/tests.sh SH 2013,2016,2018,2019,2020 -./bin/tests/bigtest/zones X 2013,2018,2019,2020 ./bin/tests/cfg_test.c C 2001,2002,2004,2005,2007,2009,2010,2011,2015,2016,2018,2019,2020 ./bin/tests/fromhex.pl PERL 2015,2016,2018,2019,2020 ./bin/tests/headerdep_test.sh.in SH 2000,2001,2004,2007,2012,2016,2018,2019,2020 -./bin/tests/makejournal.c C 2013,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/Kchild.example.+005+33180.key X 2018,2019,2020 -./bin/tests/optional/Kchild.example.+005+33180.private X 2018,2019,2020 -./bin/tests/optional/adb_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2013,2015,2016,2018,2019,2020 -./bin/tests/optional/backtrace_test.c C 2009,2013,2015,2016,2018,2019,2020 -./bin/tests/optional/byaddr_test.c C 2000,2001,2002,2004,2005,2007,2012,2015,2016,2018,2019,2020 -./bin/tests/optional/byname_test.c C 2000,2001,2004,2005,2007,2009,2012,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/db_test.c C 1999,2000,2001,2004,2005,2007,2008,2009,2011,2012,2013,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/fsaccess_test.c C 2000,2001,2004,2005,2007,2012,2015,2016,2018,2019,2020 -./bin/tests/optional/gsstest.c C 2018,2019,2020 -./bin/tests/optional/inter_test.c C 2000,2001,2003,2004,2005,2007,2008,2015,2016,2018,2019,2020 -./bin/tests/optional/lex_test.c C 1998,1999,2000,2001,2004,2005,2007,2015,2016,2018,2019,2020 -./bin/tests/optional/lfsr_test.c C 1999,2000,2001,2004,2005,2007,2015,2016,2018,2019,2020 -./bin/tests/optional/log_test.c C 1999,2000,2001,2004,2007,2011,2014,2015,2016,2018,2019,2020 -./bin/tests/optional/master_test.c C 1999,2000,2001,2004,2007,2009,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/mempool_test.c C 1999,2000,2001,2004,2007,2016,2018,2019,2020 -./bin/tests/optional/name_test.c C 1998,1999,2000,2001,2003,2004,2005,2007,2009,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/nsecify.c C 1999,2000,2001,2003,2004,2007,2008,2009,2011,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/ratelimiter_test.c C 1999,2000,2001,2004,2007,2015,2016,2018,2019,2020 -./bin/tests/optional/rbt_test.c C 1999,2000,2001,2004,2005,2007,2009,2011,2012,2014,2015,2016,2018,2019,2020 -./bin/tests/optional/rbt_test.out X 1999,2000,2001,2018,2019,2020 -./bin/tests/optional/rbt_test.txt SH 1999,2000,2001,2004,2007,2012,2016,2018,2019 -./bin/tests/optional/rwlock_test.c C 1998,1999,2000,2001,2004,2005,2007,2013,2016,2017,2018,2019,2020 -./bin/tests/optional/serial_test.c C 1999,2000,2001,2003,2004,2007,2015,2016,2018,2019,2020 -./bin/tests/optional/shutdown_test.c C 1998,1999,2000,2001,2004,2007,2011,2013,2016,2017,2018,2019,2020 -./bin/tests/optional/sig0_test.c C 2000,2001,2004,2005,2007,2008,2009,2012,2015,2016,2018,2019,2020 -./bin/tests/optional/sock_test.c C 1998,1999,2000,2001,2004,2007,2008,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./bin/tests/optional/sym_test.c C 1998,1999,2000,2001,2004,2005,2007,2015,2016,2018,2019,2020 -./bin/tests/optional/task_test.c C 1998,1999,2000,2001,2004,2007,2013,2014,2015,2016,2018,2019,2020 -./bin/tests/optional/timer_test.c C 1998,1999,2000,2001,2004,2007,2013,2014,2015,2016,2018,2019,2020 -./bin/tests/optional/zone_test.c C 1999,2000,2001,2002,2004,2005,2007,2009,2012,2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/README X 2014,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/create.c C 2014,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/find.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/genrsa.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/login.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/privrsa.c C 2014,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/pubrsa.c C 2014,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/session.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/sha1.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/sign.c C 2014,2015,2016,2018,2019,2020 -./bin/tests/pkcs11/benchmarks/verify.c C 2014,2015,2016,2018,2019,2020 ./bin/tests/prepare-softhsm2.sh SH 2020 ./bin/tests/startperf/README X 2011,2018,2019,2020 ./bin/tests/startperf/clean.sh SH 2011,2012,2016,2018,2019,2020 @@ -377,7 +326,6 @@ ./bin/tests/system/chain/ans4/ans.py PYTHON 2017,2018,2019,2020 ./bin/tests/system/chain/clean.sh SH 2011,2012,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/chain/ns2/sign.sh SH 2017,2018,2019,2020 -./bin/tests/system/chain/prereq.sh SH 2017,2018,2019,2020 ./bin/tests/system/chain/setup.sh SH 2017,2018,2019,2020 ./bin/tests/system/chain/tests.sh SH 2011,2012,2016,2017,2018,2019,2020 ./bin/tests/system/checkconf/clean.sh SH 2011,2012,2013,2014,2016,2018,2019,2020 @@ -418,7 +366,6 @@ ./bin/tests/system/digdelv/ans7/ans.pl PERL 2020 ./bin/tests/system/digdelv/clean.sh SH 2015,2016,2018,2019,2020 ./bin/tests/system/digdelv/ns2/sign.sh SH 2018,2019,2020 -./bin/tests/system/digdelv/prereq.sh SH 2018,2019,2020 ./bin/tests/system/digdelv/setup.sh SH 2018,2019,2020 ./bin/tests/system/digdelv/tests.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/digdelv/yamlget.py PYTHON 2019,2020 @@ -435,8 +382,8 @@ ./bin/tests/system/dlz/setup.sh SH 2018,2019,2020 ./bin/tests/system/dlz/tests.sh SH 2010,2011,2012,2013,2015,2016,2018,2019,2020 ./bin/tests/system/dlzexternal/clean.sh SH 2010,2012,2014,2015,2016,2018,2019,2020 -./bin/tests/system/dlzexternal/driver.c C 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./bin/tests/system/dlzexternal/driver.h C 2011,2016,2018,2019,2020 +./bin/tests/system/dlzexternal/driver/driver.c C 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 +./bin/tests/system/dlzexternal/driver/driver.h C 2011,2016,2018,2019,2020 ./bin/tests/system/dlzexternal/prereq.sh SH 2010,2011,2012,2014,2016,2018,2019,2020 ./bin/tests/system/dlzexternal/setup.sh SH 2010,2012,2014,2016,2017,2018,2019,2020 ./bin/tests/system/dlzexternal/tests.sh SH 2010,2011,2012,2013,2014,2015,2016,2018,2019,2020 @@ -459,7 +406,6 @@ ./bin/tests/system/dnssec/ns7/named.nosoa TXT.BRIEF 2010,2016,2018,2019,2020 ./bin/tests/system/dnssec/ns7/sign.sh SH 2014,2016,2017,2018,2019,2020 ./bin/tests/system/dnssec/ntadiff.pl PERL 2015,2016,2018,2019,2020 -./bin/tests/system/dnssec/prereq.sh SH 2000,2001,2002,2004,2006,2007,2009,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/dnssec/setup.sh SH 2000,2001,2004,2007,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/dnssec/signer/general/Kexample.com.+005+07065.key X 2018,2019,2020 ./bin/tests/system/dnssec/signer/general/Kexample.com.+005+07065.private X 2018,2019,2020 @@ -544,7 +490,6 @@ ./bin/tests/system/feature-test.c C 2016,2017,2018,2019,2020 ./bin/tests/system/fetchlimit/ans4/ans.pl PERL 2019,2020 ./bin/tests/system/fetchlimit/clean.sh SH 2015,2016,2018,2019,2020 -./bin/tests/system/fetchlimit/prereq.sh SH 2018,2019,2020 ./bin/tests/system/fetchlimit/setup.sh SH 2015,2016,2018,2019,2020 ./bin/tests/system/fetchlimit/tests.sh SH 2015,2016,2018,2019,2020 ./bin/tests/system/filter-aaaa/clean.sh SH 2010,2012,2014,2016,2018,2019,2020 @@ -564,7 +509,6 @@ ./bin/tests/system/forward/clean.sh SH 2000,2001,2004,2007,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/forward/ns1/example.db X 2000,2001,2018,2019 ./bin/tests/system/forward/ns2/example.db X 2000,2001,2018,2019 -./bin/tests/system/forward/prereq.sh SH 2019,2020 ./bin/tests/system/forward/setup.sh SH 2018,2019,2020 ./bin/tests/system/forward/tests.sh SH 2000,2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020 ./bin/tests/system/genzone.sh SH 2001,2002,2003,2004,2007,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -583,6 +527,7 @@ ./bin/tests/system/geoip2/prereq.sh SH 2019,2020 ./bin/tests/system/geoip2/setup.sh SH 2019,2020 ./bin/tests/system/geoip2/tests.sh SH 2019,2020 +./bin/tests/system/get_base_port.sh SH 2020 ./bin/tests/system/glue/clean.sh SH 2000,2001,2004,2007,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/glue/fi.good X 2000,2001,2018,2019,2020 ./bin/tests/system/glue/noglue.good X 2000,2001,2018,2019,2020 @@ -592,7 +537,7 @@ ./bin/tests/system/idna/setup.sh SH 2018,2019,2020 ./bin/tests/system/idna/tests.sh SH 2018,2019,2020 ./bin/tests/system/ifconfig.bat BAT 2016,2018,2019,2020 -./bin/tests/system/ifconfig.sh SH 2000,2001,2002,2003,2004,2007,2008,2009,2010,2012,2013,2016,2018,2019,2020 +./bin/tests/system/ifconfig.sh.in X 2000,2001,2002,2003,2004,2007,2008,2009,2010,2012,2013,2016,2018,2019,2020 ./bin/tests/system/include-multiplecfg/clean.sh SH 2020 ./bin/tests/system/include-multiplecfg/setup.sh SH 2020 ./bin/tests/system/include-multiplecfg/tests.sh SH 2020 @@ -611,7 +556,6 @@ ./bin/tests/system/ixfr/ans2/startme X 2011,2018,2019,2020 ./bin/tests/system/ixfr/clean.sh SH 2001,2004,2007,2011,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/ixfr/ixfr-stats.good X 2019,2020 -./bin/tests/system/ixfr/prereq.sh SH 2001,2004,2007,2012,2014,2016,2018,2019,2020 ./bin/tests/system/ixfr/setup.sh SH 2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020 ./bin/tests/system/ixfr/tests.sh SH 2001,2004,2007,2011,2012,2014,2016,2018,2019,2020 ./bin/tests/system/kasp/README TXT.BRIEF 2019,2020 @@ -669,6 +613,7 @@ ./bin/tests/system/logfileconfig/ns1/named.versconf X 2016,2018,2019,2020 ./bin/tests/system/logfileconfig/setup.sh SH 2011,2012,2014,2016,2018,2019,2020 ./bin/tests/system/logfileconfig/tests.sh SH 2011,2012,2013,2014,2016,2017,2018,2019,2020 +./bin/tests/system/makejournal.c C 2013,2015,2016,2017,2018,2019,2020 ./bin/tests/system/masterfile/clean.sh SH 2001,2004,2007,2010,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/masterfile/knowngood.dig.out X 2001,2004,2012,2018,2019,2020 ./bin/tests/system/masterfile/setup.sh SH 2018,2019,2020 @@ -729,13 +674,11 @@ ./bin/tests/system/nsupdate/ns8/machine.ccache X 2018,2019,2020 ./bin/tests/system/nsupdate/ns9/dns.keytab X 2018,2019,2020 ./bin/tests/system/nsupdate/ns9/machine.ccache X 2018,2019,2020 -./bin/tests/system/nsupdate/prereq.sh SH 2014,2015,2016,2018,2019,2020 ./bin/tests/system/nsupdate/setup.sh SH 2000,2001,2004,2007,2009,2010,2011,2012,2014,2016,2017,2018,2019,2020 ./bin/tests/system/nsupdate/tests.sh SH 2000,2001,2004,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/nsupdate/update_test.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/nsupdate/verylarge.in X 2013,2018,2019,2020 ./bin/tests/system/nzd2nzf/clean.sh SH 2016,2018,2019,2020 -./bin/tests/system/nzd2nzf/prereq.sh SH 2016,2018,2019,2020 ./bin/tests/system/nzd2nzf/setup.sh SH 2016,2018,2019,2020 ./bin/tests/system/nzd2nzf/tests.sh SH 2016,2018,2019,2020 ./bin/tests/system/org.isc.bind.system SH 2010,2012,2013,2016,2018,2019,2020 @@ -755,7 +698,6 @@ ./bin/tests/system/pipelined/input X 2014,2015,2018,2019,2020 ./bin/tests/system/pipelined/inputb X 2014,2015,2018,2019,2020 ./bin/tests/system/pipelined/pipequeries.c C 2014,2015,2015,2016,2017,2018,2019,2020 -./bin/tests/system/pipelined/prereq.sh SH 2020 ./bin/tests/system/pipelined/ref X 2014,2015,2018,2019,2020 ./bin/tests/system/pipelined/refb X 2014,2015,2018,2019,2020 ./bin/tests/system/pipelined/setup.sh SH 2014,2015,2016,2017,2018,2019,2020 @@ -768,7 +710,6 @@ ./bin/tests/system/qmin/ans3/ans.py PYTHON 2018,2019,2020 ./bin/tests/system/qmin/ans4/ans.py PYTHON 2018,2019,2020 ./bin/tests/system/qmin/clean.sh SH 2018,2019,2020 -./bin/tests/system/qmin/prereq.sh SH 2018,2019,2020 ./bin/tests/system/qmin/setup.sh SH 2018,2019,2020 ./bin/tests/system/qmin/tests.sh SH 2018,2019,2020 ./bin/tests/system/reclimit/README TXT.BRIEF 2014,2016,2017,2018,2019,2020 @@ -776,7 +717,6 @@ ./bin/tests/system/reclimit/ans4/ans.pl PERL 2018,2019,2020 ./bin/tests/system/reclimit/ans7/ans.pl PERL 2014,2016,2018,2019,2020 ./bin/tests/system/reclimit/clean.sh SH 2014,2016,2018,2019,2020 -./bin/tests/system/reclimit/prereq.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/reclimit/setup.sh SH 2014,2016,2018,2019,2020 ./bin/tests/system/reclimit/tests.sh SH 2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/redirect/clean.sh SH 2011,2012,2013,2014,2015,2016,2018,2019,2020 @@ -791,7 +731,6 @@ ./bin/tests/system/resolver/clean.sh SH 2008,2009,2010,2011,2012,2013,2014,2015,2016,2018,2019,2020 ./bin/tests/system/resolver/ns4/named.noaa TXT.BRIEF 2010,2016,2018,2019,2020 ./bin/tests/system/resolver/ns6/keygen.sh SH 2010,2012,2014,2016,2017,2018,2019,2020 -./bin/tests/system/resolver/prereq.sh SH 2000,2001,2004,2007,2012,2014,2016,2018,2019,2020 ./bin/tests/system/resolver/setup.sh SH 2010,2011,2012,2013,2014,2016,2017,2018,2019,2020 ./bin/tests/system/resolver/tests.sh SH 2000,2001,2004,2007,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/rndc/clean.sh SH 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -826,7 +765,6 @@ ./bin/tests/system/rpzrecurse/ans5/ans.pl PERL 2016,2018,2019,2020 ./bin/tests/system/rpzrecurse/clean.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/rpzrecurse/ns2/named.conf.header.in X 2015,2016,2017,2018,2019,2020 -./bin/tests/system/rpzrecurse/prereq.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/rpzrecurse/setup.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/rpzrecurse/testgen.pl PERL 2015,2016,2017,2018,2019,2020 ./bin/tests/system/rpzrecurse/tests.sh SH 2015,2016,2017,2018,2019,2020 @@ -875,11 +813,10 @@ ./bin/tests/system/rsabigexponent/ns2/Xexample.+005+51829.private X 2012,2018,2019,2020 ./bin/tests/system/rsabigexponent/ns2/dsset-example.in X 2012,2018,2019,2020 ./bin/tests/system/rsabigexponent/ns2/sign.sh SH 2012,2014,2016,2018,2019,2020 -./bin/tests/system/rsabigexponent/prereq.sh SH 2012,2014,2016,2017,2018,2019,2020 ./bin/tests/system/rsabigexponent/setup.sh SH 2012,2014,2016,2017,2018,2019,2020 ./bin/tests/system/rsabigexponent/tests.sh SH 2012,2016,2018,2019,2020 ./bin/tests/system/run.gdb X 2019,2020 -./bin/tests/system/run.sh SH 2000,2001,2004,2007,2010,2012,2014,2015,2016,2017,2018,2019,2020 +./bin/tests/system/run.sh.in X 2000,2001,2004,2007,2010,2012,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/runall.sh SH 2000,2001,2004,2007,2010,2011,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/runsequential.sh SH 2018,2019,2020 ./bin/tests/system/runtime/README TXT.BRIEF 2014,2016,2018,2019,2020 @@ -891,7 +828,6 @@ ./bin/tests/system/send.pl PERL 2001,2004,2007,2011,2012,2016,2018,2019,2020 ./bin/tests/system/serve-stale/ans2/ans.pl PERL 2017,2018,2019,2020 ./bin/tests/system/serve-stale/clean.sh SH 2017,2018,2019,2020 -./bin/tests/system/serve-stale/prereq.sh SH 2017,2018,2019,2020 ./bin/tests/system/serve-stale/setup.sh SH 2017,2018,2019,2020 ./bin/tests/system/serve-stale/tests.sh SH 2017,2018,2019,2020 ./bin/tests/system/setup.sh SH 2000,2001,2004,2007,2012,2014,2016,2018,2019,2020 @@ -911,7 +847,7 @@ ./bin/tests/system/spf/setup.sh SH 2018,2019,2020 ./bin/tests/system/spf/tests.sh SH 2013,2014,2016,2018,2019,2020 ./bin/tests/system/start.pl SH 2001,2004,2005,2006,2007,2008,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./bin/tests/system/start.sh SH 2000,2001,2004,2007,2012,2016,2018,2019,2020 +./bin/tests/system/start.sh.in X 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/staticstub/clean.sh SH 2010,2012,2014,2015,2016,2018,2019,2020 ./bin/tests/system/staticstub/knowngood.dig.out.rec X 2010,2013,2018,2019,2020 ./bin/tests/system/staticstub/ns3/sign.sh SH 2010,2012,2014,2015,2016,2018,2019,2020 @@ -920,14 +856,12 @@ ./bin/tests/system/staticstub/tests.sh SH 2010,2011,2012,2013,2015,2016,2018,2019,2020 ./bin/tests/system/statistics/ans4/ans.pl PERL 2012,2016,2018,2019,2020 ./bin/tests/system/statistics/clean.sh SH 2012,2014,2015,2016,2018,2019,2020 -./bin/tests/system/statistics/prereq.sh SH 2012,2014,2016,2018,2019,2020 ./bin/tests/system/statistics/setup.sh SH 2018,2019,2020 ./bin/tests/system/statistics/tests.sh SH 2012,2015,2016,2017,2018,2019,2020 ./bin/tests/system/statschannel/clean.sh SH 2015,2016,2017,2018,2019,2020 ./bin/tests/system/statschannel/fetch.pl PERL 2015,2016,2018,2019,2020 ./bin/tests/system/statschannel/mem-xml.pl PERL 2017,2018,2019,2020 ./bin/tests/system/statschannel/ns2/sign.sh SH 2019,2020 -./bin/tests/system/statschannel/prereq.sh SH 2015,2016,2018,2019,2020 ./bin/tests/system/statschannel/server-json.pl PERL 2015,2016,2017,2018,2019,2020 ./bin/tests/system/statschannel/server-xml.pl PERL 2015,2016,2017,2018,2019,2020 ./bin/tests/system/statschannel/setup.sh SH 2018,2019,2020 @@ -942,10 +876,9 @@ ./bin/tests/system/statschannel/zones-json.pl PERL 2019,2020 ./bin/tests/system/statschannel/zones-xml.pl PERL 2019,2020 ./bin/tests/system/stop.pl SH 2001,2004,2005,2006,2007,2012,2016,2017,2018,2019,2020 -./bin/tests/system/stop.sh SH 2000,2001,2004,2007,2012,2016,2018,2019,2020 +./bin/tests/system/stop.sh.in X 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/stopall.sh SH 2018,2019,2020 ./bin/tests/system/stress/clean.sh SH 2000,2001,2004,2007,2012,2014,2016,2018,2019,2020 -./bin/tests/system/stress/prereq.sh SH 2015,2016,2018,2019,2020 ./bin/tests/system/stress/setup.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/stress/setup.sh SH 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/stress/tests.sh SH 2000,2001,2004,2007,2012,2014,2015,2016,2018,2019,2020 @@ -959,10 +892,9 @@ ./bin/tests/system/synthfromdnssec/ns1/sign.sh SH 2017,2018,2019,2020 ./bin/tests/system/synthfromdnssec/setup.sh SH 2017,2018,2019,2020 ./bin/tests/system/synthfromdnssec/tests.sh SH 2017,2018,2019,2020 -./bin/tests/system/system-test-driver.sh X 2019,2020 +./bin/tests/system/system-test-driver.sh.in X 2020 ./bin/tests/system/tcp/ans6/ans.py PYTHON 2019,2020 ./bin/tests/system/tcp/clean.sh SH 2014,2016,2018,2019,2020 -./bin/tests/system/tcp/prereq.sh SH 2019,2020 ./bin/tests/system/tcp/setup.sh SH 2018,2019,2020 ./bin/tests/system/tcp/tests.sh SH 2014,2016,2018,2019,2020 ./bin/tests/system/testcrypto.sh SH 2014,2016,2017,2018,2019,2020 @@ -1010,7 +942,6 @@ ./bin/tests/system/upforwd/knowngood.after2 X 2000,2001,2018,2019,2020 ./bin/tests/system/upforwd/knowngood.before X 2000,2001,2018,2019,2020 ./bin/tests/system/upforwd/knowngood.ns2.before X 2000,2001,2018,2019,2020 -./bin/tests/system/upforwd/prereq.sh SH 2012,2014,2016,2018,2019,2020 ./bin/tests/system/upforwd/setup.sh SH 2000,2001,2004,2007,2011,2012,2014,2016,2017,2018,2019,2020 ./bin/tests/system/upforwd/tests.sh SH 2000,2001,2004,2007,2011,2012,2013,2014,2016,2018,2019,2020 ./bin/tests/system/verify/clean.sh SH 2012,2014,2016,2018,2019,2020 @@ -1039,6 +970,9 @@ ./bin/tests/system/win32/keydelete.vcxproj.filters.in X 2016,2018,2019,2020 ./bin/tests/system/win32/keydelete.vcxproj.in X 2016,2017,2018,2019,2020 ./bin/tests/system/win32/keydelete.vcxproj.user X 2016,2018,2019,2020 +./bin/tests/system/win32/makejournal.vcxproj.filters.in X 2016,2018,2019,2020 +./bin/tests/system/win32/makejournal.vcxproj.in X 2016,2017,2018,2019,2020 +./bin/tests/system/win32/makejournal.vcxproj.user X 2016,2018,2019,2020 ./bin/tests/system/win32/pipequeries.vcxproj.filters.in X 2016,2018,2019,2020 ./bin/tests/system/win32/pipequeries.vcxproj.in X 2016,2017,2018,2019,2020 ./bin/tests/system/win32/pipequeries.vcxproj.user X 2016,2018,2019,2020 @@ -1055,7 +989,6 @@ ./bin/tests/system/xfer/dig2.good X 2000,2001,2003,2004,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./bin/tests/system/xfer/knowngood.mapped X 2016,2018,2019,2020 ./bin/tests/system/xfer/ns4/named.conf.base X 2011,2013,2016,2018,2019,2020 -./bin/tests/system/xfer/prereq.sh SH 2011,2012,2014,2016,2018,2019,2020 ./bin/tests/system/xfer/setup.sh SH 2001,2002,2004,2007,2011,2012,2013,2014,2015,2016,2018,2019,2020 ./bin/tests/system/xfer/tests.sh SH 2000,2001,2004,2005,2007,2011,2012,2013,2014,2015,2016,2018,2019,2020 ./bin/tests/system/xferquota/clean.sh SH 2000,2001,2004,2007,2012,2014,2015,2016,2018,2019,2020 @@ -1064,7 +997,6 @@ ./bin/tests/system/xferquota/tests.sh SH 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./bin/tests/system/zero/ans5/ans.pl PERL 2016,2018,2019,2020 ./bin/tests/system/zero/clean.sh SH 2013,2014,2015,2016,2018,2019,2020 -./bin/tests/system/zero/prereq.sh SH 2018,2019,2020 ./bin/tests/system/zero/setup.sh SH 2013,2014,2016,2018,2019,2020 ./bin/tests/system/zero/tests.sh SH 2013,2016,2017,2018,2019,2020 ./bin/tests/system/zonechecks/clean.sh SH 2004,2007,2012,2014,2015,2016,2018,2019,2020 @@ -1080,9 +1012,6 @@ ./bin/tests/win32/inter_test.vcxproj.filters.in X 2013,2015,2018,2019,2020 ./bin/tests/win32/inter_test.vcxproj.in X 2013,2015,2016,2017,2018,2019,2020 ./bin/tests/win32/inter_test.vcxproj.user X 2013,2018,2019,2020 -./bin/tests/win32/makejournal.vcxproj.filters.in X 2016,2018,2019,2020 -./bin/tests/win32/makejournal.vcxproj.in X 2016,2017,2018,2019,2020 -./bin/tests/win32/makejournal.vcxproj.user X 2016,2018,2019,2020 ./bin/tests/win32/rwlock_test.vcxproj.filters.in X 2013,2015,2018,2019,2020 ./bin/tests/win32/rwlock_test.vcxproj.in X 2013,2015,2016,2017,2018,2019,2020 ./bin/tests/win32/rwlock_test.vcxproj.user X 2013,2018,2019,2020 @@ -1162,12 +1091,7 @@ ./bin/win32/BINDInstall/res/BINDInstall.rc2 X 2001,2018,2019,2020 ./bin/win32/BINDInstall/resource.h X 2001,2005,2009,2018,2019,2020 ./bind.keys X 2009,2010,2011,2017,2018,2019,2020 -./bind.keys.h X 2009,2010,2011,2012,2014,2017,2018,2019,2020 -./config.guess X 1998,1999,2000,2001,2004,2009,2013,2018,2019,2020 -./config.h.in X 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./config.h.win32 C 1999,2000,2001,2004,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./config.sub X 1998,1999,2000,2001,2004,2013,2018,2019,2020 -./config.threads.in X 2005,2006,2010,2011,2012,2013,2018,2019,2020 ./conftools/perllib/dnsconf/DNSConf-macros.h C 2000,2001,2004,2007,2016,2018,2019,2020 ./conftools/perllib/dnsconf/DNSConf.i C 2000,2001,2004,2007,2016,2018,2019,2020 ./conftools/perllib/dnsconf/Makefile.PL PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 @@ -1261,6 +1185,9 @@ ./contrib/dlz/modules/wildcard/dlz_wildcard_dynamic.c X 2013,2015,2016,2018,2019,2020 ./contrib/dlz/modules/wildcard/testing/named.conf X 2013,2018,2019 ./contrib/dnspriv/nginx.conf SH 2017,2018,2019 +./contrib/kasp/README X 2020 +./contrib/kasp/kasp.xml X 2020 +./contrib/kasp/policy.good X 2020 ./contrib/scripts/catzhash.py X 2020 ./contrib/scripts/check-secure-delegation.pl.in PERL 2010,2012,2014,2016,2018,2019,2020 ./contrib/scripts/check5011.pl X 2013,2014,2017,2018,2019,2020 @@ -1458,22 +1385,16 @@ ./fuzz/dns_rdata_fromwire_text.c C 2019,2020 ./fuzz/fuzz.h C 2018,2019,2020 ./fuzz/main.c C 2018,2019,2020 -./install-sh X 1998,1999,2000,2001,2018,2019,2020 -./lib/Kyuafile X 2017,2018,2019,2020 ./lib/bind9/api X 2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/bind9/check.c C 2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/bind9/getaddresses.c C 2001,2002,2004,2005,2007,2014,2015,2016,2017,2018,2019,2020 ./lib/bind9/include/bind9/check.h C 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/bind9/include/bind9/getaddresses.h C 2001,2004,2005,2006,2007,2009,2016,2017,2018,2019,2020 -./lib/bind9/include/bind9/version.h C 2001,2004,2005,2006,2007,2016,2018,2019,2020 -./lib/bind9/version.c C 2001,2004,2005,2007,2016,2018,2019,2020 ./lib/bind9/win32/DLLMain.c C 2001,2004,2007,2016,2018,2019,2020 ./lib/bind9/win32/libbind9.def X 2001,2018,2019,2020 ./lib/bind9/win32/libbind9.vcxproj.filters.in X 2013,2015,2016,2018,2019,2020 ./lib/bind9/win32/libbind9.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./lib/bind9/win32/libbind9.vcxproj.user X 2013,2018,2019,2020 -./lib/bind9/win32/version.c C 1998,1999,2000,2001,2004,2007,2016,2018,2019,2020 -./lib/dns/Kyuafile X 2017,2018,2019,2020 ./lib/dns/acl.c C 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2013,2014,2016,2017,2018,2019,2020 ./lib/dns/adb.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/api X 1999,2000,2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -1514,6 +1435,7 @@ ./lib/dns/gen.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/geoip2.c C 2019,2020 ./lib/dns/gssapi_link.c C 2000,2001,2002,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2018,2019,2020 +./lib/dns/gssapictx-dummy.c C 2020 ./lib/dns/gssapictx.c C 2000,2001,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/hmac_link.c C.NAI 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/acl.h C 1999,2000,2001,2002,2004,2005,2006,2007,2009,2011,2013,2014,2016,2017,2018,2019,2020 @@ -1608,7 +1530,6 @@ ./lib/dns/include/dns/types.h C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/update.h C 2011,2015,2016,2018,2019,2020 ./lib/dns/include/dns/validator.h C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2013,2014,2016,2018,2019,2020 -./lib/dns/include/dns/version.h C 2001,2004,2005,2006,2007,2012,2013,2016,2018,2019,2020 ./lib/dns/include/dns/view.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/include/dns/xfrin.h C 1999,2000,2001,2003,2004,2005,2006,2007,2009,2013,2016,2018,2019,2020 ./lib/dns/include/dns/zone.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -1629,7 +1550,6 @@ ./lib/dns/lib.c C 1999,2000,2001,2004,2005,2007,2009,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/log.c C 1999,2000,2001,2003,2004,2005,2006,2007,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/lookup.c C 2000,2001,2003,2004,2005,2007,2013,2016,2018,2019,2020 -./lib/dns/mapapi X 2013,2017,2018,2019,2020 ./lib/dns/master.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/masterdump.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/message.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 @@ -1837,18 +1757,12 @@ ./lib/dns/sdb.c C 2000,2001,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/sdlz.c C.PORTION 1999,2000,2001,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/soa.c C 2000,2001,2004,2005,2007,2009,2016,2018,2019,2020 -./lib/dns/spnego.asn1 X 2006,2018,2019,2020 -./lib/dns/spnego.c C 2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/dns/spnego.h C 2006,2007,2016,2018,2019,2020 -./lib/dns/spnego_asn1.c C 2006,2007,2012,2013,2015,2016,2018,2019,2020 -./lib/dns/spnego_asn1.pl PERL 2006,2007,2012,2016,2018,2019,2020 ./lib/dns/ssu.c C 2000,2001,2003,2004,2005,2006,2007,2008,2010,2011,2013,2014,2016,2017,2018,2019,2020 ./lib/dns/ssu_external.c C 2011,2012,2013,2016,2017,2018,2019,2020 ./lib/dns/stats.c C 2000,2001,2004,2005,2007,2008,2009,2012,2016,2018,2019,2020 ./lib/dns/tcpmsg.c C 1999,2000,2001,2004,2005,2006,2007,2015,2016,2018,2019,2020 ./lib/dns/tests/Kdh.+002+18602.key X 2014,2018,2019,2020 ./lib/dns/tests/Krsa.+005+29235.key X 2016,2018,2019,2020 -./lib/dns/tests/Kyuafile X 2017,2018,2019,2020 ./lib/dns/tests/acl_test.c C 2016,2018,2019,2020 ./lib/dns/tests/db_test.c C 2013,2015,2016,2017,2018,2019,2020 ./lib/dns/tests/dbdiff_test.c C 2011,2012,2016,2017,2018,2019,2020 @@ -1929,7 +1843,6 @@ ./lib/dns/ttl.c C 1999,2000,2001,2004,2005,2007,2011,2012,2013,2014,2016,2017,2018,2019,2020 ./lib/dns/update.c C 2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/validator.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/dns/version.c C 1998,1999,2000,2001,2004,2005,2007,2012,2013,2016,2018,2019,2020 ./lib/dns/view.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/win32/DLLMain.c C 2001,2004,2007,2016,2018,2019,2020 ./lib/dns/win32/gen.vcxproj.filters.in X 2013,2015,2018,2019,2020 @@ -1939,14 +1852,12 @@ ./lib/dns/win32/libdns.vcxproj.filters.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/win32/libdns.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/win32/libdns.vcxproj.user X 2013,2018,2019,2020 -./lib/dns/win32/version.c C 1998,1999,2000,2001,2004,2007,2013,2016,2018,2019,2020 ./lib/dns/xfrin.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/zone.c C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/dns/zone_p.h C 2018,2019,2020 ./lib/dns/zonekey.c C 2001,2003,2004,2005,2007,2016,2018,2019,2020 ./lib/dns/zoneverify.c C 2018,2019,2020 ./lib/dns/zt.c C 1999,2000,2001,2002,2004,2005,2006,2007,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/irs/Kyuafile X 2017,2018,2019,2020 ./lib/irs/api X 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/irs/context.c C 2009,2014,2016,2018,2019,2020 ./lib/irs/dnsconf.c C 2009,2012,2016,2018,2019,2020 @@ -1955,13 +1866,10 @@ ./lib/irs/getnameinfo.c C 2009,2011,2012,2013,2014,2016,2017,2018,2019,2020 ./lib/irs/include/irs/context.h C 2009,2016,2018,2019,2020 ./lib/irs/include/irs/dnsconf.h C 2009,2016,2018,2019,2020 -./lib/irs/include/irs/netdb.h.in C 2009,2016,2017,2018,2019,2020 -./lib/irs/include/irs/platform.h.in C 2009,2016,2018,2019,2020 +./lib/irs/include/irs/netdb.h C 2009,2016,2017,2018,2019,2020 ./lib/irs/include/irs/resconf.h C 2009,2014,2016,2018,2019,2020 ./lib/irs/include/irs/types.h C 2009,2016,2018,2019,2020 -./lib/irs/include/irs/version.h C 2009,2016,2018,2019,2020 ./lib/irs/resconf.c C 2009,2011,2012,2014,2015,2016,2017,2018,2019,2020 -./lib/irs/tests/Kyuafile X 2017,2018,2019,2020 ./lib/irs/tests/resconf_test.c C 2016,2018,2019,2020 ./lib/irs/tests/testdata/domain.conf CONF-SH 2016,2018,2019 ./lib/irs/tests/testdata/nameserver-v4.conf CONF-SH 2016,2018,2019 @@ -1980,17 +1888,13 @@ ./lib/irs/tests/testdata/sortlist-v4.conf CONF-SH 2016,2018,2019 ./lib/irs/tests/testdata/timeout.conf CONF-SH 2016,2018,2019 ./lib/irs/tests/testdata/unknown.conf CONF-SH 2016,2018,2019 -./lib/irs/version.c C 2009,2016,2018,2019,2020 ./lib/irs/win32/DLLMain.c C 2014,2016,2018,2019,2020 ./lib/irs/win32/include/irs/netdb.h C 2014,2016,2017,2018,2019,2020 -./lib/irs/win32/include/irs/platform.h C 2014,2016,2018,2019,2020 ./lib/irs/win32/libirs.def X 2014,2018,2019,2020 ./lib/irs/win32/libirs.vcxproj.filters.in X 2014,2015,2016,2018,2019,2020 ./lib/irs/win32/libirs.vcxproj.in X 2014,2015,2016,2017,2018,2019,2020 ./lib/irs/win32/libirs.vcxproj.user X 2014,2018,2019,2020 ./lib/irs/win32/resconf.c C 2018,2019,2020 -./lib/irs/win32/version.c C 2014,2016,2018,2019,2020 -./lib/isc/Kyuafile X 2017,2018,2019,2020 ./lib/isc/aes.c C 2014,2016,2017,2018,2019,2020 ./lib/isc/api X 1999,2000,2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isc/app.c C 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2013,2014,2015,2016,2017,2018,2019,2020 @@ -2023,6 +1927,7 @@ ./lib/isc/include/isc/assertions.h C 1997,1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2016,2017,2018,2019,2020 ./lib/isc/include/isc/astack.h C 2019,2020 ./lib/isc/include/isc/atomic.h C 2018,2019,2020 +./lib/isc/include/isc/attributes.h C 2020 ./lib/isc/include/isc/backtrace.h C 2009,2016,2018,2019,2020 ./lib/isc/include/isc/base32.h C 2008,2014,2016,2018,2019,2020 ./lib/isc/include/isc/base64.h C 1999,2000,2001,2004,2005,2006,2007,2016,2018,2019,2020 @@ -2103,7 +2008,6 @@ ./lib/isc/include/isc/tm.h C 2014,2016,2018,2019,2020 ./lib/isc/include/isc/types.h C 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2012,2013,2014,2016,2017,2018,2019,2020 ./lib/isc/include/isc/util.h C 1998,1999,2000,2001,2004,2005,2006,2007,2010,2011,2012,2015,2016,2017,2018,2019,2020 -./lib/isc/include/isc/version.h C 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isc/include/pk11/constants.h C 2014,2016,2017,2018,2019,2020 ./lib/isc/include/pk11/internal.h C 2014,2016,2018,2019,2020 ./lib/isc/include/pk11/pk11.h C 2014,2016,2018,2019,2020 @@ -2131,7 +2035,7 @@ ./lib/isc/netscope.c C 2002,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isc/nonce.c C 2018,2019,2020 ./lib/isc/openssl_shim.c C 2018,2019,2020 -./lib/isc/openssl_shim.h C 2018,2019,2020 +./lib/isc/openssl_shim.h C 2020 ./lib/isc/parseint.c C 2001,2002,2003,2004,2005,2007,2012,2016,2018,2019,2020 ./lib/isc/pk11.c C 2014,2015,2016,2017,2018,2019,2020 ./lib/isc/pk11_result.c C 2014,2015,2016,2018,2019,2020 @@ -2163,7 +2067,6 @@ ./lib/isc/task.c C 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isc/task_p.h C 2018,2019,2020 ./lib/isc/taskpool.c C 1999,2000,2001,2004,2005,2007,2011,2012,2013,2016,2018,2019,2020 -./lib/isc/tests/Kyuafile X 2017,2018,2019,2020 ./lib/isc/tests/aes_test.c C 2014,2016,2018,2019,2020 ./lib/isc/tests/buffer_test.c C 2014,2015,2016,2017,2018,2019,2020 ./lib/isc/tests/counter_test.c C 2014,2016,2018,2019,2020 @@ -2229,7 +2132,6 @@ ./lib/isc/unix/stdtime.c C 1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isc/unix/syslog.c C 2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isc/unix/time.c C 1998,1999,2000,2001,2003,2004,2005,2006,2007,2008,2011,2012,2014,2015,2016,2017,2018,2019,2020 -./lib/isc/version.c C 1998,1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isc/win32/DLLMain.c C 2001,2004,2007,2016,2018,2019,2020 ./lib/isc/win32/condition.c C 1998,1999,2000,2001,2004,2006,2007,2016,2018,2019,2020 ./lib/isc/win32/dir.c C 1999,2000,2001,2004,2007,2008,2009,2011,2012,2013,2016,2017,2018,2019,2020 @@ -2284,10 +2186,8 @@ ./lib/isc/win32/thread.c C 1998,1999,2000,2001,2004,2005,2007,2016,2017,2018,2019,2020 ./lib/isc/win32/time.c C 1998,1999,2000,2001,2003,2004,2006,2007,2008,2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isc/win32/unistd.h C 2000,2001,2004,2007,2008,2009,2016,2018,2019,2020 -./lib/isc/win32/version.c C 1998,1999,2000,2001,2004,2007,2016,2018,2019,2020 ./lib/isc/win32/win32os.c C 2002,2004,2007,2013,2014,2015,2016,2018,2019,2020 ./lib/isc/xoshiro128starstar.c C.PORTION 2018,2019,2020 -./lib/isccc/Kyuafile X 2018,2019,2020 ./lib/isccc/alist.c C.NOM 2001,2004,2005,2007,2015,2016,2018,2019,2020 ./lib/isccc/api X 2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccc/base64.c C.NOM 2001,2004,2005,2007,2013,2016,2018,2019,2020 @@ -2304,20 +2204,15 @@ ./lib/isccc/include/isccc/symtype.h C.NOM 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isccc/include/isccc/types.h C.NOM 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isccc/include/isccc/util.h C.NOM 2001,2004,2005,2006,2007,2014,2016,2018,2019,2020 -./lib/isccc/include/isccc/version.h C 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isccc/result.c C.NOM 2001,2003,2004,2005,2007,2015,2016,2018,2019,2020 ./lib/isccc/sexpr.c C.NOM 2001,2004,2005,2007,2014,2015,2016,2018,2019,2020 ./lib/isccc/symtab.c C.NOM 2001,2004,2005,2007,2016,2018,2019,2020 -./lib/isccc/tests/Kyuafile X 2018,2019,2020 ./lib/isccc/tests/result_test.c C 2018,2019,2020 -./lib/isccc/version.c C 1998,1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isccc/win32/DLLMain.c C 2001,2004,2007,2016,2018,2019,2020 ./lib/isccc/win32/libisccc.def X 2001,2016,2018,2019,2020 ./lib/isccc/win32/libisccc.vcxproj.filters.in X 2013,2015,2016,2018,2019,2020 ./lib/isccc/win32/libisccc.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccc/win32/libisccc.vcxproj.user X 2013,2018,2019,2020 -./lib/isccc/win32/version.c C 2001,2004,2007,2016,2018,2019,2020 -./lib/isccfg/Kyuafile X 2017,2018,2019,2020 ./lib/isccfg/aclconf.c C 1999,2000,2001,2002,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccfg/api X 2001,2006,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccfg/dnsconf.c C 2009,2016,2018,2019,2020 @@ -2328,22 +2223,17 @@ ./lib/isccfg/include/isccfg/kaspconf.h C 2019,2020 ./lib/isccfg/include/isccfg/log.h C 2001,2004,2005,2006,2007,2009,2016,2018,2019,2020 ./lib/isccfg/include/isccfg/namedconf.h C 2002,2004,2005,2006,2007,2009,2010,2014,2016,2018,2019,2020 -./lib/isccfg/include/isccfg/version.h C 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isccfg/kaspconf.c C 2019,2020 ./lib/isccfg/log.c C 2001,2004,2005,2006,2007,2016,2018,2019,2020 ./lib/isccfg/namedconf.c C 2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccfg/parser.c C 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./lib/isccfg/tests/Kyuafile X 2017,2018,2019,2020 ./lib/isccfg/tests/duration_test.c C 2019,2020 ./lib/isccfg/tests/parser_test.c C 2016,2018,2019,2020 -./lib/isccfg/version.c C 1998,1999,2000,2001,2004,2005,2007,2016,2018,2019,2020 ./lib/isccfg/win32/DLLMain.c C 2001,2004,2007,2016,2018,2019,2020 ./lib/isccfg/win32/libisccfg.def X 2001,2002,2005,2009,2010,2011,2013,2014,2015,2016,2018,2019,2020 ./lib/isccfg/win32/libisccfg.vcxproj.filters.in X 2013,2014,2015,2016,2018,2019,2020 ./lib/isccfg/win32/libisccfg.vcxproj.in X 2013,2014,2015,2016,2017,2018,2019,2020 ./lib/isccfg/win32/libisccfg.vcxproj.user X 2013,2018,2019,2020 -./lib/isccfg/win32/version.c C 1998,1999,2000,2001,2004,2007,2016,2018,2019,2020 -./lib/ns/Kyuafile X 2017,2018,2019,2020 ./lib/ns/api X 2017,2018,2019,2020 ./lib/ns/client.c C 2017,2018,2019,2020 ./lib/ns/hooks.c C 2018,2019,2020 @@ -2360,7 +2250,6 @@ ./lib/ns/include/ns/stats.h C 2017,2018,2019,2020 ./lib/ns/include/ns/types.h C 2017,2018,2019,2020 ./lib/ns/include/ns/update.h C 2017,2018,2019,2020 -./lib/ns/include/ns/version.h C 2017,2018,2019,2020 ./lib/ns/include/ns/xfrout.h C 2017,2018,2019,2020 ./lib/ns/interfacemgr.c C 2017,2018,2019,2020 ./lib/ns/lib.c C 2017,2018,2019,2020 @@ -2371,7 +2260,6 @@ ./lib/ns/server.c C 2017,2018,2019,2020 ./lib/ns/sortlist.c C 2017,2018,2019,2020 ./lib/ns/stats.c C 2017,2018,2019,2020 -./lib/ns/tests/Kyuafile X 2017,2018,2019,2020 ./lib/ns/tests/listenlist_test.c C 2017,2018,2019,2020 ./lib/ns/tests/notify_test.c C 2017,2018,2019,2020 ./lib/ns/tests/nstest.c C 2017,2018,2019,2020 @@ -2381,15 +2269,12 @@ ./lib/ns/tests/testdata/notify/notify1.msg X 2017,2018,2019,2020 ./lib/ns/tests/wrap.c C 2019,2020 ./lib/ns/update.c C 2017,2018,2019,2020 -./lib/ns/version.c C 2017,2018,2019,2020 ./lib/ns/win32/DLLMain.c C 2017,2018,2019,2020 ./lib/ns/win32/libns.def X 2017,2018,2019,2020 ./lib/ns/win32/libns.vcxproj.filters X 2017,2018,2019,2020 ./lib/ns/win32/libns.vcxproj.in X 2017,2018,2019,2020 ./lib/ns/win32/libns.vcxproj.user X 2017,2018,2019,2020 -./lib/ns/win32/version.c C 2017,2018,2019,2020 ./lib/ns/xfrout.c C 2017,2018,2019,2020 -./lib/samples/Makefile-postinstall.in MAKE 2009,2012,2013,2014,2016,2017,2018,2019,2020 ./lib/samples/nsprobe.c C 2009,2010,2011,2012,2013,2014,2015,2016,2018,2019,2020 ./lib/samples/resolve.c C 2009,2012,2013,2014,2015,2016,2017,2018,2019,2020 ./lib/samples/rootkey.sh SH 2013,2016,2018,2019,2020 @@ -2420,14 +2305,6 @@ ./lib/win32/bindevt/bindevt.vcxproj.filters.in X 2013,2015,2018,2019,2020 ./lib/win32/bindevt/bindevt.vcxproj.in X 2013,2014,2015,2016,2018,2019,2020 ./lib/win32/bindevt/bindevt.vcxproj.user X 2013,2018,2019,2020 -./ltmain.sh X 1999,2000,2001,2003,2004,2006,2009,2012,2018,2019,2020 -./make/includes.in MAKE 1999,2000,2001,2004,2005,2007,2012,2014,2016,2017,2018,2019,2020 -./make/mkdep.in X 1999,2000,2001,2006,2011,2014,2018,2019,2020 -./make/rules.in MAKE 1998,1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./mkinstalldirs X 1996,2018,2019,2020 -./unit/README X 2011,2013,2018,2019,2020 -./unit/gdb X 2020 -./unit/unittest.sh.in X 2011,2012,2015,2018,2019,2020 ./util/COPYRIGHT X 1996,1997,1998,1999,2000,2001,2004,2007,2016,2018,2019,2020 ./util/COPYRIGHT.BRIEF X 1996,1997,1998,1999,2000,2001,2004,2016,2018,2019,2020 ./util/COPYRIGHT.BSDI X 2000,2001,2004,2007,2016,2018,2019,2020 @@ -2438,7 +2315,6 @@ ./util/api-checker.sh SH 2020 ./util/bindkeys.pl PERL 2009,2010,2011,2012,2014,2016,2017,2018,2019,2020 ./util/branchsync.sh SH 2013,2016,2018,2019,2020 -./util/check-ans-prereq.sh SH 2019,2020 ./util/check-categories.sh SH 2015,2016,2017,2018,2019,2020 ./util/check-changes PERL 2002,2004,2007,2012,2016,2018,2019,2020 ./util/check-cocci X 2018,2019,2020 @@ -2468,8 +2344,6 @@ ./util/update-drafts.pl PERL 2000,2001,2004,2007,2012,2016,2018,2019,2020 ./util/update_branches PERL 2005,2007,2012,2016,2018,2019,2020 ./util/update_copyrights PERL 1998,1999,2000,2001,2004,2005,2006,2007,2008,2009,2010,2012,2013,2014,2015,2016,2017,2018,2019,2020 -./util/xc SH 2012,2013,2016,2018,2019,2020 -./version X 1998,1999,2000,2001,2003,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2016,2017,2018,2019,2020 ./win32utils/Configure PERL 2013,2014,2015,2016,2017,2018,2019,2020 ./win32utils/GeoIP.diff X 2013,2018,2019,2020 ./win32utils/bind9.sln.in X 2013,2014,2015,2016,2017,2018,2019,2020 diff --git a/util/merge_copyrights b/util/merge_copyrights index d00fb9e5ae..9f5b09447e 100644 --- a/util/merge_copyrights +++ b/util/merge_copyrights @@ -36,8 +36,9 @@ while () { /\.git/ | # git directory /\.gitignore | # .gitignore files /\.gitattributes | # .gitattributes files - /\.clang-format | # .clang-format files - Makefile.in | # build system doesn't need to have copyright + /\.clang-format | # .clang-format files + /ChangeLog | # + Makefile.(am|in) | # build system doesn't need to have copyright /m4/ | # build system doesn't need to have copyright /configure | # build system doesn't need to have copyright /fuzz/.*\.in/ | # ignore fuzz corpus @@ -112,7 +113,7 @@ while () { $file_types{$_} = "CONF-SH"; } elsif ($base =~ /\.md$/) { $file_types{$_} = "MKD"; - } elsif ($base =~ /(\/\.(gitignore|gitattributes)|Kyuafile|\.(gif|jpg))$/i) { + } elsif ($base =~ /(\/\.(gitignore|gitattributes)|\.(gif|jpg))$/i) { $file_types{$_} = "X"; } elsif ($base =~ /\.(def|dep|dsp|dsw|mak|sln)$/i) { $file_types{$_} = "X"; diff --git a/util/suppressions.txt b/util/suppressions.txt index ea5ff3b292..bb86dd6fb2 100644 --- a/util/suppressions.txt +++ b/util/suppressions.txt @@ -1,3 +1,5 @@ unmatchedSuppression:* preprocessorErrorDirective:* unknownMacro:* +uselessAssignmentPtrArg:libltdl/loaders/preopen.c:201 +deallocret:libltdl/lt__alloc.c:78 diff --git a/util/xc b/util/xc deleted file mode 100755 index 73b7b11202..0000000000 --- a/util/xc +++ /dev/null @@ -1,34 +0,0 @@ -# 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. - -# -# test cross compiler -# - -chmod= -next=0 -for t in ${BUILD_CC} gcc cc -do - type $t > /dev/null 2>&1 && cc=$t && break -done -for i in "$@" -do - [ $next = 1 ] && chmod="$i" - case "$i" in - -o) next=1;; - *) next=0;; - esac -done -if ${cc:-false} "$@" -then - [ "$chmod" != "" ] && chmod a-x "$chmod" - exit 0; -else - exit 1; -fi diff --git a/version b/version deleted file mode 100644 index 66268e7f1a..0000000000 --- a/version +++ /dev/null @@ -1,11 +0,0 @@ -# This file must follow /bin/sh rules. It is imported directly via -# configure. -# -PRODUCT=BIND -DESCRIPTION="(Development Release)" -MAJORVER=9 -MINORVER=17 -PATCHVER=1 -RELEASETYPE= -RELEASEVER= -EXTENSIONS= diff --git a/win32utils/Configure b/win32utils/Configure index d3c839540c..f15680f400 100644 --- a/win32utils/Configure +++ b/win32utils/Configure @@ -112,8 +112,8 @@ my @projectlist = ("..\\bin\\check\\win32\\checkconf.vcxproj", "..\\bin\\tests\\win32\\backtrace_test.vcxproj.filters", "..\\bin\\tests\\win32\\inter_test.vcxproj", "..\\bin\\tests\\win32\\inter_test.vcxproj.filters", - "..\\bin\\tests\\win32\\makejournal.vcxproj", - "..\\bin\\tests\\win32\\makejournal.vcxproj.filters", + "..\\bin\\tests\\system\\win32\\makejournal.vcxproj", + "..\\bin\\tests\\system\\win32\\makejournal.vcxproj.filters", "..\\bin\\tests\\win32\\rwlock_test.vcxproj", "..\\bin\\tests\\win32\\rwlock_test.vcxproj.filters", "..\\bin\\tests\\win32\\shutdown_test.vcxproj", @@ -173,7 +173,7 @@ my @projectlist = ("..\\bin\\check\\win32\\checkconf.vcxproj", my %configdefh; -my @substdefh = ("CONFIGARGS", +my @substdefh = ("PACKAGE_CONFIGARGS", "DNS_RDATASET_FIXED", "HAVE_GEOIP2", "HAVE_LIBXML2", @@ -290,7 +290,6 @@ my @substvar = ("BIND9_VERSION", "MACHINE", "OPENSSL_PATH", "PLATFORM", - "PKCS11_TOOLS", "PLATFORM_TOOLSET", "prefix", "PSSUSPEND", @@ -614,19 +613,19 @@ sub appargs { # escape backslashes and double quotes $arg =~ s/([\\"])/\\$1/g; $arg =~ s/([\s])/\\\\$1/g; - if (defined($configdefh{"CONFIGARGS"})) { - $configdefh{"CONFIGARGS"} .= " " . $arg; + if (defined($configdefh{"PACKAGE_CONFIGARGS"})) { + $configdefh{"PACKAGE_CONFIGARGS"} .= " " . $arg; } else { - $configdefh{"CONFIGARGS"} = $arg; + $configdefh{"PACKAGE_CONFIGARGS"} = $arg; } } -if (!$configdefh{"CONFIGARGS"}) { +if (!$configdefh{"PACKAGE_CONFIGARGS"}) { # CONFIGARGS default is "default" - $configdefh{"CONFIGARGS"} = "\"default\""; + $configdefh{"PACKAGE_CONFIGARGS"} = "\"default\""; } else { - my $val = $configdefh{"CONFIGARGS"}; - $configdefh{"CONFIGARGS"} = "\"'$val'\""; + my $val = $configdefh{"PACKAGE_CONFIGARGS"}; + $configdefh{"PACKAGE_CONFIGARGS"} = "\"'$val'\""; } # parse enable/disable @@ -1618,7 +1617,6 @@ if ($cryptolib ne "") { # with-pkcs11 if ($use_pkcs11 ne "no") { $configcond{"PKCS11"} = 1; - $configvar{"PKCS11_TOOLS"} = "pkcs11"; $configdefd{"PK11_LIB_LOCATION"} = "PK11_LIB_LOCATION=\"$pkcs11_path\""; } diff --git a/win32utils/bind9.sln.in b/win32utils/bind9.sln.in index e126677ffc..b7de279f19 100644 --- a/win32utils/bind9.sln.in +++ b/win32utils/bind9.sln.in @@ -519,7 +519,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "timer_test", "..\bin\tests\ EndProject @END XTESTS @IF STESTS -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makejournal", "..\bin\tests\win32\makejournal.vcxproj", "{31715139-2C27-47D2-8394-71B71A8AC3D5}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makejournal", "..\bin\tests\system\win32\makejournal.vcxproj", "{31715139-2C27-47D2-8394-71B71A8AC3D5}" ProjectSection(ProjectDependencies) = postProject {A3F71D12-F38A-4C77-8D87-8E8854CA74A1} = {A3F71D12-F38A-4C77-8D87-8E8854CA74A1} {3840E563-D180-4761-AA9C-E6155F02EAFF} = {3840E563-D180-4761-AA9C-E6155F02EAFF}