feat: add full Zonemaster stack with Docker and Spanish UI

- Clone all 5 Zonemaster component repos (LDNS, Engine, CLI, Backend, GUI)
- Dockerfile.backend: 8-stage multi-stage build LDNS→Engine→CLI→Backend
- Dockerfile.gui: Astro static build served via nginx
- docker-compose.yml: backend (internal) + frontend (port 5353)
- nginx.conf: root redirects to /es/, /api/ proxied to backend
- zonemaster-gui/config.ts: defaultLanguage set to 'es' (Spanish)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-21 08:19:24 +02:00
commit 8d4eaa1489
1567 changed files with 204155 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
## Purpose
This PR...
## Context
(e.g. Fixes #9999, Follow-up to #9999, etc.)
## Changes
...
## How to test this PR
...

View File

@@ -0,0 +1,54 @@
name: CI
on:
push:
branches:
- develop
- master
- 'release/**'
pull_request:
branches:
- develop
- master
- 'release/**'
env:
TEST_WITH_NETWORK: 1
jobs:
run-tests:
strategy:
fail-fast: false
matrix:
perl:
- '5.40'
- '5.36'
- '5.26'
runner:
- ubuntu-22.04
runs-on: ${{ matrix.runner }}
steps:
- uses: actions/checkout@v4
- uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
- name: perl version
run: perl -v
- name: apt install
run: sudo apt install -y libidn2-dev
- name: cpan module
run: cpanm Devel::CheckLib ExtUtils::PkgConfig Module::Install Module::Install::XSUtil Test::Exception Test::Fatal
- name: installation
run: cpanm --verbose --notest --configure-args="--no-ed25519" .
- name: test
run: prove -bl

17
zonemaster-ldns/.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
Makefile.old
MYMETA.*
META.yml
/Makefile
*.bs
*.o
blib
pm_to_blib
LDNS.c
inc
ppport.h
MANIFEST.bak
Zonemaster-*
Zonemaster-*.tar.gz
# Emacs backup files
*~

3
zonemaster-ldns/.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "ldns"]
path = ldns
url = https://github.com/NLnetLabs/ldns.git

View File

@@ -0,0 +1,18 @@
-ole=unix
-se
-bext=~
-l=120
-i=4
-ci=2
-nsbl
-cti=0
-pt=0
-sbt=1
-bt=1
-bbt=0
-sfs
-tso
-csc
-csci=20
-nbbc
-bom

View File

@@ -0,0 +1,30 @@
# Contributing to Zonemaster::LDNS
Contribution to this repository is welcome. Contribution can be either an issue
report or a code or a documentation update. Also see the information in the
[main README][Zonemaster/Zonemaster README] in the main Zonemaster respository.
## Issue
First search for a similar issue in the [issues list]. If a relevant issue is
found, add your information as a comment. If no relevant issue is found, create
[a new issue][create issue]. Give as many details as you have and describe, if
possible, how the issue can be reproduced.
## Pull request
If you would like to contribute an update, first please look for issues and open
[pull requests] that are about the same thing. If nothing relevant is found or
you have a different solution, create [a new pull request][create pull request].
Creating a pull request assumes that you have your proposal in a fork repository.
When you create a pull request, please always start with the `develop` branch
and create the pull request against the same branch.
[issues list]: https://github.com/zonemaster/zonemaster-ldns/issues
[create issue]: https://github.com/zonemaster/zonemaster-ldns/issues/new
[pull requests]: https://github.com/zonemaster/zonemaster-ldns/pulls
[create pull request]: https://github.com/zonemaster/zonemaster-ldns/compare
[Zonemaster/Zonemaster README]: https://github.com/zonemaster/zonemaster#readme

View File

@@ -0,0 +1,9 @@
This module is based on the ldns library from NLnet Labs <https://www.nlnetlabs.nl/projects/ldns/>
Contributors to this module:
Calle Dybedahl <calle@init.se>
Mattias Päivärinta <mattias.paivarinta@iis.se>
Wieger Opmeer <opmeer@strato-rz.de>
Calle Dybedahl <github@cyberpomo.com>
Jerry Lundström <lundstrom.jerry@gmail.com>
Patrik Wallström <pawal@blipp.com>

236
zonemaster-ldns/Changes Normal file
View File

@@ -0,0 +1,236 @@
Release history for Zonemaster component Zonemaster-LDNS
5.0.2 2026-03-04 (part of Zonemaster v2025.2.1 release)
[Fixes]
- Adds check for cryptographic SHA-1 support at installation
(#245)
- Declares Test::Exception as a test-time dependency at
installation (#244)
- Makes it more robust when dealing with unknown resource
record types (#241)
5.0.1 2025-12-17 (part of Zonemaster v2025.2 release)
[Fixes]
- Updates LDNS submodule to v1.8.4 #202
- RRList.pm: drop misplaced =back #233
5.0.0 2025-06-26 (part of Zonemaster v2025.1 release)
[Breaking changes]
- Raises minimum Perl version to v5.26.0 #228
[Features]
- Improves performance by removing dubious code #217
[Fixes]
- Updates Dockerfile for release 2025.1 #229
- Removes unused feature "randomized capitalization" #207
- Fixes export of methods #219
4.1.0 2024-12-09 (part of Zonemaster v2024.2 release)
[Deprecation]
- Deprecates case randomization feature, to be removed in v2025.1 release (#206)
[Features]
- Adds a method to compute the hash of a name based on the settings of a NSEC3
or NSEC3PARAM record (#211)
- Allows construction of empty Zonemaster::LDNS::RRList objects (#209)
- Extends the functionalities of Zonemaster::LDNS::RRList (#203)
- Extends CDS/CDNSKEY support (#199)
[Fixes]
- Uses ExtUtils::PkgConfig to discover the CFLAGS and LDFLAGS for external
libraries (#210, #212)
- Makes to_idn() croak with locale-independent message (#205)
- Fixes compiler warning in XS code (#204)
4.0.2 2024-07-01 (part of Zonemaster v2024.1 release)
[Fixes]
- Fixes broken links in README.md (#189)
4.0.1 2024-03-28
[Fixes]
- Corrects test requirements (#185)
4.0.0 2024-03-18 (public release version)
[Breaking change]
- Fix crashing induced by Zonemaster::LDNS::RR::NSEC3::salt()
method (#177)
- Fix other methods in Zonemaster::LDNS::RR::NSEC3 and
::NSEC3PARAM (#178)
[Fixes]
- Ignore incomplete RRs (#136)
- Validate inputs to Zonemaster::LDNS::RR::NSEC3::covers()
(#176)
3.2.0 2023-06-21 (public fix version)
[Feature]
- Expand DNAME support (#170)
[Fixes]
- Ignore DNSKEY RRs with incalculable key sizes (#135)
3.1.0 2023-01-31 (public fix version)
[Feature]
- Includes the OPT RDATA from the edns_data function
(needed to fix a bug in Zonemaster-Engine) (#166)
3.0.0 2022-12-19
[Breaking change]
- Improves access to text data in TXT and SPF resource records
(#157, #155)
[Features]
- Uses internal LDNS for docker image (#162)
- Adds support for NSID option (#151)
- Updates internal LDNS to 1.8.3 (#151, #143)
- Adds options to build with Libidn and LDNS in custom locations
(#152)
[Fixes]
- Fixes a bug when building LDNS with link to OpenSSL (#161)
- Corrects the license statement in LDNS.pm (#159)
- Fixes unsafe string manipulations in XS code (#153, #149)
- Automatically reconfigures internal libldns on "ldns/Changelog"
updates (#158)
- URL fragments referring to internal headings in lowercase
(#154)
2.2.2 2022-06-09
[Features]
- Gives more freedom when configuring (#134, #129, #96)
- Replaces libidn with libidn2 (#133, #131)
[Fixes]
- Clarifies README on --ed25519 (#142)
2.2.1 2021-12-03
[Features]
- Adds support for Docker (#125, #124)
2.2.0 2021-05-28
[Features]
- Adds (minimal) support for CDNSKEY records (#113)
2.1.0 2020-04-30
[Features]
- Updated to use libldns 1.7.0 or 1.7.1 (#85)
- Support for Ed25519 (algorithm 15) added (#85, #51, #84)
- Allow specifying which OpenSSL library to use (#97)
[Fixed]
- Exclude more ldns files from MANIFEST (#92)
- Fixing links and table of contents in main README.md (#94)
- Exclude LDNS.bs from distribution file (#101, #95)
- Eliminated locale dependency from unit test (#102, #103)
2.0.1 2019-05-21
- Removed
- Ubuntu 14.04 is no longer supported (#74)
- Changed
- inc::Module::install is no longer bundled (#72)
- Dependency declarations have been cleaned up (#73)
2.0.0 2019-01-25 (pre-release version)
- Status
- This is a pre-release version not fully tested on all supported
OS's and Perl versions. This version will not be available on
CPAN.
- API change
- Change set_edns_present/unset_edns_present methods returned
values (part of #62)
- Features
- Added support to access EDNS (OPT record) to be able to implement
test cases for ENDS and DNS Flag Day https://dnsflagday.net/ e.g.
(#62):
- New EDNS accessor
- Add EDNS RDATA get/set functions
- Add interface to "fallback" resolver flag
- Fixed
- All link references on Github now to zonemaster/zonemaster instead
of old dotse/zonemaster #60
- Updated supported perl versions for travis (#62)
1.1.0 2018-06-25
- Features
- Ldns 1.7.0 using submodule (#41)
- Changing from having a patched fork of LDNS to using standard LDNS.
- All ldns sources are removed from the repo - instead a git
submodule is added for ldns (currently pointing to the tag
release-1.7.0).
- Makefile.PL is updated to build `libldns.a` from the new location.
- Remove legacy parameters from Makefile.PL (#44)
- Allow loading ldns as an ordinary dependency (#49)
- Make IDN support explicit (#45)
- Fixed
- Updated installation tests to adjust for changes in live data (#39)
- Update .travis.yml with installation of Test::More (#38)
- Update README.md (#42) updated installation instructions.
- Fix some issues raised by CPANTS (#46)
- Reorganize README and add TOC (#49)
- Updated to have correct description of what to_idn() does. (#50)
- Update to Module::Install 1.19 (#52)
1.0.2 2018-01-12
- Fixed
- Skip unit tests that depend on the Internet by default (#26)
- Update unit test assumptions to match contemporary Internet (#26)
1.0.1 2017-11-02
- Fixed
- Fixed licensing discrepancy (#20, #21)
- Explicitly avoid distributing C file generated from XS
1.0.0 2017-10-06
- Switch to Semantic Versioning.
- Rename module to Zonemaster::LDNS.
- Fix test suite (for the time being).
- Make it possible to run tests without network.
- Add Travis integration.
- Introduce CONTRIBUTORS.txt.
0.75 2015-04-07
- Add method to get/set source IP address on resolvers.
- Do SvGETMAGIC on SVs we get from outside.
- Packets created from wireformat were not properly cloned.
- Remove checks that did more harm than good (SvOK does not process get magic).
0.74 2015-03-23
- A number of memory leaks plugged.
0.73 2015-03-19
- Thread safety.
0.71 2015-02-18
- Ship the ldns code with the module rather than relying on an externally installed library.
0.70 2014-10-27

View File

@@ -0,0 +1,39 @@
FROM alpine:3.22 as build
RUN apk add --no-cache \
# Compile-time dependencies
build-base \
libidn2-dev \
make \
openssl-dev \
perl-app-cpanminus \
perl-dev \
perl-devel-checklib \
perl-extutils-depends \
perl-extutils-pkgconfig \
perl-lwp-protocol-https \
perl-mime-base32 \
perl-module-install \
perl-test-differences \
perl-test-fatal \
perl-test-nowarnings \
&& cpanm --notest --no-wget --from=https://cpan.metacpan.org/ \
Module::Install::XSUtil
ARG version
COPY ./Zonemaster-LDNS-${version}.tar.gz ./Zonemaster-LDNS-${version}.tar.gz
RUN cpanm --notest --no-wget \
./Zonemaster-LDNS-${version}.tar.gz
FROM alpine:3.22
# Include only Zonemaster LDNS modules
COPY --from=build /usr/local/lib/perl5/site_perl/auto/Zonemaster /usr/local/lib/perl5/site_perl/auto/Zonemaster
COPY --from=build /usr/local/lib/perl5/site_perl/Zonemaster /usr/local/lib/perl5/site_perl/Zonemaster
RUN apk add --no-cache \
# Run-time dependencies
libidn2 \
perl

46
zonemaster-ldns/LICENSE Normal file
View File

@@ -0,0 +1,46 @@
### Code license
In some situations sources from the ldns library by NLnet Labs are
included in the ldns directory. For files under the ldns directory,
see ldns/LICENSE. For all other sources, as below.
Copyright (c) The Swedish Internet Foundation (<https://internetstiftelsen.se/en/>)
Copyright (c) AFNIC (<https://www.afnic.fr/en/>)
All rights reserved.
Copyright belongs to external contributor where applicable.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
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 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 HOLDER 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.
### Documentation license
Copyright (c) The Swedish Internet Foundation (<https://internetstiftelsen.se/en/>)
Copyright (c) AFNIC (<https://www.afnic.fr/en/>)
All rights reserved.
Copyright belongs to external contributor where applicable.
Creative Commons Attribution 4.0 International License
You should have received a copy of the license along with this
work. If not, see <https://creativecommons.org/licenses/by/4.0/>.

200
zonemaster-ldns/MANIFEST Normal file
View File

@@ -0,0 +1,200 @@
Changes
CONTRIBUTORS.txt
CONTRIBUTING.md
inc/Module/Install.pm
inc/Module/Install/Base.pm
inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
inc/Module/Install/XSUtil.pm
include/LDNS.h
ldns/.github/FUNDING.yml
ldns/.github/workflows/testsuite.yml
ldns/buffer.c
ldns/Changelog
ldns/compat/asctime_r.c
ldns/compat/b64_ntop.c
ldns/compat/b64_pton.c
ldns/compat/strlcpy.c
ldns/config.guess
ldns/config.sub
ldns/configure
ldns/dane.c
ldns/dname.c
ldns/dnssec.c
ldns/dnssec_sign.c
ldns/dnssec_verify.c
ldns/dnssec_zone.c
ldns/duration.c
ldns/edns.c
ldns/error.c
ldns/higher.c
ldns/host2str.c
ldns/host2wire.c
ldns/install-sh
ldns/keys.c
ldns/ldns/buffer.h
ldns/ldns/common.h.in
ldns/ldns/config.h.in
ldns/ldns/dane.h
ldns/ldns/dname.h
ldns/ldns/dnssec.h
ldns/ldns/dnssec_sign.h
ldns/ldns/dnssec_verify.h
ldns/ldns/dnssec_zone.h
ldns/ldns/duration.h
ldns/ldns/edns.h
ldns/ldns/error.h
ldns/ldns/higher.h
ldns/ldns/host2str.h
ldns/ldns/host2wire.h
ldns/ldns/keys.h
ldns/ldns/ldns.h
ldns/ldns/net.h.in
ldns/ldns/packet.h
ldns/ldns/parse.h
ldns/ldns/radix.h
ldns/ldns/rbtree.h
ldns/ldns/rdata.h
ldns/ldns/resolver.h
ldns/ldns/rr.h
ldns/ldns/rr_functions.h
ldns/ldns/sha1.h
ldns/ldns/sha2.h
ldns/ldns/str2host.h
ldns/ldns/tsig.h
ldns/ldns/update.h
ldns/ldns/util.h.in
ldns/ldns/wire2host.h
ldns/ldns/zone.h
ldns/libdns.doxygen.in
ldns/LICENSE
ldns/ltmain.sh
ldns/Makefile.in
ldns/net.c
ldns/packaging/ldns-config.in
ldns/packaging/libldns.pc.in
ldns/packet.c
ldns/parse.c
ldns/radix.c
ldns/rbtree.c
ldns/rdata.c
ldns/resolver.c
ldns/rr.c
ldns/rr_functions.c
ldns/sha1.c
ldns/sha2.c
ldns/str2host.c
ldns/tsig.c
ldns/update.c
ldns/util.c
ldns/wire2host.c
ldns/zone.c
lib/Zonemaster/LDNS.pm
lib/Zonemaster/LDNS/Packet.pm
lib/Zonemaster/LDNS/RR.pm
lib/Zonemaster/LDNS/RR/A.pm
lib/Zonemaster/LDNS/RR/A6.pm
lib/Zonemaster/LDNS/RR/AAAA.pm
lib/Zonemaster/LDNS/RR/AFSDB.pm
lib/Zonemaster/LDNS/RR/APL.pm
lib/Zonemaster/LDNS/RR/ATMA.pm
lib/Zonemaster/LDNS/RR/CAA.pm
lib/Zonemaster/LDNS/RR/CDNSKEY.pm
lib/Zonemaster/LDNS/RR/CDS.pm
lib/Zonemaster/LDNS/RR/CERT.pm
lib/Zonemaster/LDNS/RR/CNAME.pm
lib/Zonemaster/LDNS/RR/DHCID.pm
lib/Zonemaster/LDNS/RR/DLV.pm
lib/Zonemaster/LDNS/RR/DNAME.pm
lib/Zonemaster/LDNS/RR/DNSKEY.pm
lib/Zonemaster/LDNS/RR/DS.pm
lib/Zonemaster/LDNS/RR/EID.pm
lib/Zonemaster/LDNS/RR/EUI48.pm
lib/Zonemaster/LDNS/RR/EUI64.pm
lib/Zonemaster/LDNS/RR/GID.pm
lib/Zonemaster/LDNS/RR/GPOS.pm
lib/Zonemaster/LDNS/RR/HINFO.pm
lib/Zonemaster/LDNS/RR/HIP.pm
lib/Zonemaster/LDNS/RR/HTTPS.pm
lib/Zonemaster/LDNS/RR/IPSECKEY.pm
lib/Zonemaster/LDNS/RR/ISDN.pm
lib/Zonemaster/LDNS/RR/KEY.pm
lib/Zonemaster/LDNS/RR/KX.pm
lib/Zonemaster/LDNS/RR/L32.pm
lib/Zonemaster/LDNS/RR/L64.pm
lib/Zonemaster/LDNS/RR/LOC.pm
lib/Zonemaster/LDNS/RR/LP.pm
lib/Zonemaster/LDNS/RR/MAILA.pm
lib/Zonemaster/LDNS/RR/MAILB.pm
lib/Zonemaster/LDNS/RR/MB.pm
lib/Zonemaster/LDNS/RR/MD.pm
lib/Zonemaster/LDNS/RR/MF.pm
lib/Zonemaster/LDNS/RR/MG.pm
lib/Zonemaster/LDNS/RR/MINFO.pm
lib/Zonemaster/LDNS/RR/MR.pm
lib/Zonemaster/LDNS/RR/MX.pm
lib/Zonemaster/LDNS/RR/NAPTR.pm
lib/Zonemaster/LDNS/RR/NID.pm
lib/Zonemaster/LDNS/RR/NIMLOC.pm
lib/Zonemaster/LDNS/RR/NINFO.pm
lib/Zonemaster/LDNS/RR/NS.pm
lib/Zonemaster/LDNS/RR/NSAP.pm
lib/Zonemaster/LDNS/RR/NSEC.pm
lib/Zonemaster/LDNS/RR/NSEC3.pm
lib/Zonemaster/LDNS/RR/NSEC3PARAM.pm
lib/Zonemaster/LDNS/RR/NULL.pm
lib/Zonemaster/LDNS/RR/NXT.pm
lib/Zonemaster/LDNS/RR/PTR.pm
lib/Zonemaster/LDNS/RR/PX.pm
lib/Zonemaster/LDNS/RR/RKEY.pm
lib/Zonemaster/LDNS/RR/RP.pm
lib/Zonemaster/LDNS/RR/RRSIG.pm
lib/Zonemaster/LDNS/RR/RT.pm
lib/Zonemaster/LDNS/RR/SIG.pm
lib/Zonemaster/LDNS/RR/SINK.pm
lib/Zonemaster/LDNS/RR/SOA.pm
lib/Zonemaster/LDNS/RR/SPF.pm
lib/Zonemaster/LDNS/RR/SRV.pm
lib/Zonemaster/LDNS/RR/SSHFP.pm
lib/Zonemaster/LDNS/RR/SVCB.pm
lib/Zonemaster/LDNS/RR/TA.pm
lib/Zonemaster/LDNS/RR/TALINK.pm
lib/Zonemaster/LDNS/RR/TKEY.pm
lib/Zonemaster/LDNS/RR/TLSA.pm
lib/Zonemaster/LDNS/RR/TXT.pm
lib/Zonemaster/LDNS/RR/TYPE.pm
lib/Zonemaster/LDNS/RR/UID.pm
lib/Zonemaster/LDNS/RR/UINFO.pm
lib/Zonemaster/LDNS/RR/UNSPEC.pm
lib/Zonemaster/LDNS/RR/URI.pm
lib/Zonemaster/LDNS/RR/WKS.pm
lib/Zonemaster/LDNS/RR/X25.pm
lib/Zonemaster/LDNS/RRList.pm
LICENSE
Makefile.PL
MANIFEST This list of files
META.yml
ppport.h
README.md
src/assist.c
src/LDNS.xs
src/typemap
t/axfr.t
t/dnssec.t
t/example.org
t/idn.t
t/load_zonefile.t
t/netldns.t
t/nsid.t
t/packet.t
t/regression.t
t/resolver.t
t/rr.t
t/rrlist.t
t/serialize.t
t/utils.t
t/wireformat.t

View File

@@ -0,0 +1,139 @@
\.o$
\.lo$
^MANIFEST\.SKIP$
^\.travis\.yml$
^LDNS.bs$
^Dockerfile$
# Avoid the dist tarball
^Zonemaster-LDNS-.*\.tar\.gz$
# Avoid tooling control files
^\.github/
^\.perltidyrc$
# Avoid autotools input files
\.m4$
\.ac$
# Avoid ldns files we don't need
^ldns/README$
^ldns/README\.
^ldns/\.libs/
^ldns/aclocal\.m4$
^ldns/autom4te.cache/
^ldns/compat/calloc\.c$
^ldns/compat/ctime_r\.c$
^ldns/compat/fake-rfc2553\.c$
^ldns/compat/fake-rfc2553\.h$
^ldns/compat/gmtime_r\.c$
^ldns/compat/inet_aton\.c$
^ldns/compat/inet_ntop\.c$
^ldns/compat/inet_pton\.c$
^ldns/compat/isascii\.c$
^ldns/compat/isblank\.c$
^ldns/compat/localtime_r\.c$
^ldns/compat/malloc\.c$
^ldns/compat/memmove\.c$
^ldns/compat/realloc\.c$
^ldns/compat/snprintf\.c$
^ldns/compat/timegm\.c$
^ldns/config\.log$
^ldns/config\.status$
^ldns/contrib/
^ldns/doc/
^ldns/drill/
^ldns/examples/
^ldns/.gitlab-ci.yml
^ldns/ldns/\.c-mode-rc.el$
^ldns/ldns/common\.h$
^ldns/ldns/config\.h$
^ldns/ldns/net\.h$
^ldns/ldns/util\.h$
^ldns/libdns\.doxygen$
^ldns/libdns\.vim$
^ldns/libldns\.la$
^ldns/libtool$
^ldns/linktest\.c$
^ldns/lua/
^ldns/m4/libtool\.m4$
^ldns/m4/ltoptions\.m4$
^ldns/m4/ltsugar\.m4$
^ldns/m4/ltversion\.m4$
^ldns/m4/lt~obsolete\.m4$
^ldns/makedist\.sh$
^ldns/makewin.sh
^ldns/masterdont/
^ldns/packaging/fedora/ldns\.spec$
^ldns/packaging/ldns-config$
^ldns/packaging/ldns-config\.1$
^ldns/packaging/libldns\.pc$
^ldns/pcat/
^ldns/test/
^ldns/.travis.yml
# Avoid C files generated from XS
^src/LDNS\.c$
#!start included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
\B\.svn\b
\B\.git\b
\B\.gitignore\b
\B\.gitmodules$
\b_darcs\b
\B\.cvsignore$
# Avoid VMS specific MakeMaker generated files
\bDescrip.MMS$
\bDESCRIP.MMS$
\bdescrip.mms$
# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak
\bMakefile$
\bblib/
\bMakeMaker-\d
\bpm_to_blib\.ts$
\bpm_to_blib$
\bblibdirs\.ts$ # 6.18 through 6.25 generated this
# Avoid Module::Build generated and utility files.
\bBuild$
\b_build/
\bBuild.bat$
\bBuild.COM$
\bBUILD.COM$
\bbuild.com$
# Avoid temp and backup files.
~$
\.old$
\#$
\b\.#
\.bak$
\.tmp$
\.#
\.rej$
# Avoid OS-specific files/dirs
# Mac OSX metadata
\B\.DS_Store
# Mac OSX SMB mount metadata files
\B\._
# Avoid Devel::Cover and Devel::CoverX::Covered files.
\bcover_db\b
\bcovered\b
# Avoid MYMETA files
^MYMETA\.
# Avoid MANIFEST test
t/manifest.t
#!end included /usr/share/perl/5.20/ExtUtils/MANIFEST.SKIP

501
zonemaster-ldns/Makefile.PL Normal file
View File

@@ -0,0 +1,501 @@
use v5.14;
use inc::Module::Install;
use Devel::CheckLib;
use ExtUtils::PkgConfig;
use File::Spec::Functions;
use Getopt::Long;
BEGIN {
if ( $Module::Install::AUTHOR ) {
use Module::Install::XSUtil;
}
}
name 'Zonemaster-LDNS';
all_from 'lib/Zonemaster/LDNS.pm';
repository 'https://github.com/zonemaster/zonemaster-ldns';
bugtracker 'https://github.com/zonemaster/zonemaster-ldns/issues';
=head1 Optional features
=over
=item --[no-]ed25519
Enable (or disable) support for Ed25519 in both openssl and ldns.
Enabled by default.
=item --[no-]idn
Enable (or disable) support for converting IDN labels in U-label format (with
non-ASCII Unicode characters) to the same IDN labels in A-label format (encoded
in ASCII).
Enabled by default.
=item --[no-]internal-ldns
When enabled, an included version of ldns is statically linked into
Zonemaster::LDNS.
When disabled, libldns is dynamically linked just like other dependencies.
Enabled by default.
=item --prefix-openssl=PATH
Search for OpenSSL headers and libraries in PATH.
The LDNS script will look for an "include" and a "lib" folder.
=item --openssl-inc=PATH
Search for OpenSSL include in PATH.
The PATH is passed to the LDNS compiler via the CFLAGS variable.
=item --openssl-lib=PATH
Search for OpenSSL library in PATH.
The PATH is passed to the LDNS compiler via the LDFLAGS variable.
=item --libidn-inc=PATH
Search for Libidn include in PATH.
=item --libidn-lib=PATH
Search for Libidn library in PATH.
=item --ldns-inc=PATH
Search for LDNS include in PATH.
=item --ldns-lib=PATH
Search for LDNS library in PATH.
=item --debug
Enable debug mode, more verbose output.
=back
=cut
my $opt_ed25519 = 1;
my $opt_idn = 1;
my $opt_internal_ldns = 1;
my $opt_debug = 0;
my $opt_assets = {
openssl => {
prefix => "",
inc => "",
lib => ""
},
ldns => {
inc => "",
lib => ""
},
libidn => {
inc => "",
lib => ""
}
};
GetOptions(
'ed25519!' => \$opt_ed25519,
'idn!' => \$opt_idn,
'internal-ldns!' => \$opt_internal_ldns,
'debug!' => \$opt_debug,
'prefix-openssl=s' => \$$opt_assets{openssl}{prefix},
'openssl-inc=s' => \$$opt_assets{openssl}{inc},
'openssl-lib=s' => \$$opt_assets{openssl}{lib},
'libidn-inc=s' => \$$opt_assets{libidn}{inc},
'libidn-lib=s' => \$$opt_assets{libidn}{lib},
'ldns-inc=s' => \$$opt_assets{ldns}{inc},
'ldns-lib=s' => \$$opt_assets{ldns}{lib},
);
perl_version '5.026000'; # Perl v5.26.0 or higher is required for installation.
configure_requires 'Devel::CheckLib' => 0;
configure_requires 'ExtUtils::PkgConfig' => 0;
configure_requires 'Module::Install' => 1.19;
configure_requires 'Module::Install::XSUtil' => 0;
#
test_requires 'JSON::PP' => 0;
test_requires 'MIME::Base32' => 0;
test_requires 'Test::Fatal' => 0;
test_requires 'Test::Differences' => 0;
test_requires 'Test::Exception' => 0;
test_requires 'Test::More' => 1.302015;
test_requires 'Test::NoWarnings' => 0;
use_ppport 3.19;
cc_include_paths 'include';
cc_src_paths 'src';
my %assert_lib_args = (
openssl => {},
libidn => {},
ldns => {}
);
sub custom_assets {
my ( $href ) = @_;
# $href = { key => "openssl", lib => "crypto", name => "OpenSSL" }
my $key = $href->{key};
my $name = $href->{name};
my $lib = $href->{lib};
my $pcname = $href->{pcname};
my $input_prefix = $opt_assets->{$key}{prefix};
my $input_inc = $opt_assets->{$key}{inc};
my $input_lib = $opt_assets->{$key}{lib};
my $custom_lib = ( $input_prefix or $input_inc or $input_lib );
if ( $custom_lib ) {
my $incpath = "";
my $libpath = "";
if ( $input_prefix ) {
print "Custom prefix for $name: $input_prefix\n";
$incpath = "$input_prefix/include";
$libpath = "$input_prefix/lib";
}
if ( $input_inc ) {
print "Custom include directory for $name: $input_inc\n";
$incpath = "$input_inc";
}
if ( $input_lib ) {
print "Custom library directory for $name: $input_lib\n";
$libpath = "$input_lib";
}
cc_include_paths "$incpath";
cc_libs "-L$libpath", "$lib";
$assert_lib_args{$key}{incpath} = "$incpath";
$assert_lib_args{$key}{libpath} = "$libpath";
} ## end if ( $custom_lib )
else {
my %pkg_info = eval { ExtUtils::PkgConfig->find( $pcname ); };
if ( $@ ) {
warn "$@\n";
say "Guessing LDFLAGS for $name: -l${lib}";
cc_libs $lib;
}
else {
if ( ( my $cflags = $pkg_info{cflags} ) ne '' ) {
say "Adding CFLAGS for $name using pkg-config: $cflags";
cc_include_paths $cflags;
}
if ( ( my $libs = $pkg_info{libs} ) ne '' ) {
say "Adding LDFLAGS for $name using pkg-config: $libs";
cc_libs $libs;
}
}
}
} ## end sub custom_assets
# OpenSSL
custom_assets(
{
name => "OpenSSL",
lib => "crypto",
key => "openssl",
pcname => "openssl"
}
);
cc_assert_lib(
debug => $opt_debug,
lib => 'crypto',
header => 'openssl/crypto.h',
function => 'if(SSLeay()) return 0; else return 1;',
%{ $assert_lib_args{openssl} },
);
if ( $opt_ed25519 ) {
print "Feature Ed25519 enabled\n";
cc_assert_lib(
debug => $opt_debug,
lib => 'crypto',
header => 'openssl/evp.h',
function => 'EVP_PKEY_ED25519; return 0;',
%{ $assert_lib_args{openssl} },
);
}
else {
print "Feature Ed25519 disabled\n";
}
# LDNS and NSID
my $ldns_has_nsid;
if ( $opt_internal_ldns ) {
print "Feature internal ldns enabled\n";
cc_libs '-Lldns/lib';
cc_include_paths 'ldns';
$ldns_has_nsid = 1;
}
else {
print "Feature internal ldns disabled\n";
custom_assets(
{
name => "LDNS",
lib => "ldns",
key => "ldns",
pcname => "libldns"
}
);
if ( $opt_ed25519 ) {
cc_assert_lib(
debug => $opt_debug,
lib => 'ldns',
header => 'ldns/ldns.h',
%{ $assert_lib_args{ldns} },
ccflags => '-DUSE_ED25519',
function => 'if(LDNS_ED25519) return 0; else return 1;'
);
}
# NSID feature requires LDNS version >= 1.8.2
$ldns_has_nsid = check_lib(
debug => $opt_debug,
lib => 'ldns',
header => 'ldns/util.h',
%{ $assert_lib_args{ldns} },
function => 'if ( LDNS_REVISION >= ((1<<16)|(8<<8)|(2)) ) return 0; else return 1;'
);
} ## end else [ if ( $opt_internal_ldns)]
if ( $ldns_has_nsid ) {
print "Feature NSID enabled\n";
cc_define '-DNSID_SUPPORT';
}
else {
print "Feature NSID disabled\n";
}
# Libidn
if ( $opt_idn ) {
print "Feature idn enabled\n";
custom_assets(
{
name => "Libidn",
lib => "idn2",
key => "libidn",
pcname => "libidn2"
}
);
check_lib_or_exit(
debug => $opt_debug,
lib => 'idn2',
header => 'idn2.h',
%{ $assert_lib_args{libidn} },
function => 'return IDN2_OK;'
);
cc_define '-DWE_CAN_HAZ_IDN';
} ## end if ( $opt_idn )
else {
print "Feature idn disabled\n";
}
# OpenSSL with SHA-1 support
check_lib(
header => [ 'openssl/crypto.h', 'openssl/evp.h', 'openssl/x509.h' ],
lib => 'crypto',
function => q{
/* 2048-bit RSA public key in DER format. */
static const unsigned char pubkey_der[] =
"\x30\x82\x01\x22\x30\x0d\x06\x09\x2a\x86\x48\x86\xf7\x0d\x01\x01"
"\x01\x05\x00\x03\x82\x01\x0f\x00\x30\x82\x01\x0a\x02\x82\x01\x01"
"\x00\x9c\x46\x86\x8a\x41\xf0\x8c\x69\x47\xc6\x88\xaf\x53\x82\x21"
"\xb2\x91\x39\xc3\xcd\xfe\x02\xcb\x2a\xb3\xe2\x18\x09\xa0\x3c\x9f"
"\x8f\x87\x90\x7b\xcf\xb7\x53\xdd\x12\x80\x4b\x9a\x12\x3f\x2d\xae"
"\xd0\x88\x7d\x43\x77\x92\xfd\xcb\x02\x82\x48\xed\x6c\xe2\x2f\x5f"
"\xef\xc3\xaa\x0e\xc4\x69\x18\x73\x52\x99\x48\x84\x53\x19\xa2\x52"
"\x2f\x0c\x03\xdc\xa7\x3b\xd3\x74\x44\x20\x18\x10\x78\xaa\xd2\x87"
"\xe2\xc3\xe2\xd6\x08\x02\x2e\xd7\x86\x9f\x75\x3a\x8d\x71\x62\x1c"
"\xeb\x50\x23\xb4\x11\x39\x2c\xf2\xec\x20\x53\xcd\x0f\x12\x92\xa4"
"\xaf\x9b\x07\xa5\x21\x73\x89\x70\x6c\x9b\x7a\xda\x1c\x12\x12\xd1"
"\xe4\x4b\xc7\xcf\x13\xe5\xbd\xa6\xc3\x7d\xde\xb7\x53\x52\x17\x29"
"\x46\xba\x8e\xf9\x7d\xe4\x29\xe6\xaf\x6b\x07\x2f\x69\x68\x6e\x43"
"\x7e\x3a\xb3\xcf\xea\x22\xed\xd1\xbe\x28\x15\x70\x2e\xa2\x0a\x8c"
"\x9a\x77\xac\x56\xfc\x26\x14\x4d\x39\xa3\x4e\x68\x80\x04\x6e\x35"
"\x15\xab\xbf\x12\x0f\xd3\xc3\x92\xa8\x65\x91\x3e\xd0\x12\x59\xd4"
"\x6e\x25\xfa\x87\x3a\x55\x52\xf3\xe6\x80\x17\x28\x1e\xc5\x57\xc8"
"\x63\x2f\x74\x0b\x91\x40\x27\x75\xef\xfe\xa1\xe5\x93\x77\xc8\xc3"
"\x3d\x02\x03\x01\x00\x01";
static const unsigned char corpus[] = "sha1 signature probe\n";
/* SHA-1 digest of corpus, signed with the private key of pubkey_der */
static const unsigned char signature[] =
"\x54\xb2\x10\x37\x8f\x21\xba\x90\x33\xe7\x22\x43\xc4\x2c\x97\xc2"
"\x38\x38\x36\x99\x07\xdd\x97\x79\x51\x7b\x8e\x89\x4e\x4b\x1d\x0e"
"\x54\x5a\x18\x9d\xb0\x0d\x7d\x07\xc2\x20\xe3\x12\x99\xba\x39\x6a"
"\xd8\x46\xae\xbb\xc4\x71\xb2\xd7\xef\x4a\xbb\x6d\xdf\x51\xe9\x51"
"\x1e\x00\x5f\x25\x54\xb3\x54\xbf\x84\x13\x06\xe3\x70\x77\x01\xab"
"\x8f\xf5\x56\x90\x12\xc3\x56\xb3\x4b\xd7\x82\x5b\x96\x18\x1b\x5b"
"\x4a\x2f\x22\x62\x19\x65\x20\xe6\xb2\xa4\x90\xab\x85\xea\x95\x4d"
"\xfe\xbb\x9f\xb1\x41\xfa\x5f\x39\xf4\x6a\x88\x68\xd7\x35\x83\x91"
"\xaa\x8c\x08\x7e\x9d\x34\x59\x47\x24\xa4\xe2\x0e\x38\x54\x6b\x3e"
"\x12\x7c\x9e\xb5\xa2\x9f\x4a\xda\x5e\x28\xac\xc7\xf7\x48\x5c\x43"
"\x6e\x54\xfa\x85\x3f\x95\x7d\x70\xa9\xa4\x28\x24\xab\x16\x19\x5a"
"\xfc\xbf\x11\x4d\xf5\x69\x5e\x85\x0a\xaf\xa6\xb2\xc0\x66\x0b\x26"
"\x98\x59\x21\xa3\xe3\xf7\x3a\x79\xe1\xdd\x0e\x45\x67\x31\xed\xe6"
"\xa3\x02\x5c\x41\xc5\x45\x7a\x47\x94\x57\x71\x65\x36\x5b\x06\x8a"
"\xb7\x06\x58\xf8\x5d\x12\x7c\x3d\xc8\x59\x7c\xdb\x36\xd4\xf2\xd7"
"\xd0\x93\x2a\xd7\xed\x4b\x17\x17\x8b\x9b\xf1\x06\x7d\x9b\x1b\x6a";
const unsigned char *p = pubkey_der;
EVP_PKEY *pkey = d2i_PUBKEY(NULL, &p, (long)(sizeof(pubkey_der) - 1));
if (pkey == NULL)
return 1;
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
if (ctx == NULL) {
EVP_PKEY_free(pkey);
return 1;
}
int ok =
(EVP_DigestVerifyInit(ctx, NULL, EVP_sha1(), NULL, pkey) == 1) &&
(EVP_DigestVerify(ctx,
signature, sizeof(signature) - 1,
corpus, sizeof(corpus) - 1) == 1);
EVP_MD_CTX_free(ctx);
EVP_PKEY_free(pkey);
return ok ? 0 : 1;
},
)
or do {
print STDERR "wrong result: Failed to verify cryptographic SHA-1 support in OpenSSL.\n"
. " To enable SHA-1 for runtime purposes, see\n"
. " https://doc.zonemaster.net/latest/installation/zonemaster-engine.html\n"
. " To enable SHA-1 for package test purposes, see\n"
. " https://fedoraproject.org/wiki/SHA1SignaturesGuidance\n";
exit 2; # Mimic exit status of assert_lib
};
sub MY::postamble {
my $contributors_make = <<'END_CONTRIBUTORS';
CONTRIBUTORS.txt:
@( \
echo "This module is based on the ldns library from NLnet Labs <https://www.nlnetlabs.nl/projects/ldns/>" ; \
echo ; \
echo "Contributors to this module:" ; \
git shortlog -sne | cut -b8- \
) >| CONTRIBUTORS.txt
END_CONTRIBUTORS
my $docker_make = <<'END_DOCKER';
docker-build:
docker build --tag zonemaster/ldns:local --build-arg version=$(VERSION) .
docker-tag-version:
docker tag zonemaster/ldns:local zonemaster/ldns:$(VERSION)
docker-tag-latest:
docker tag zonemaster/ldns:local zonemaster/ldns:latest
END_DOCKER
my $configure_flags_make = <<'END_CONFIGURE_FLAGS';
CONFIGURE_FLAGS += --disable-ldns-config --disable-dane
END_CONFIGURE_FLAGS
my $openssl_make = <<END_OPENSSL_MAKE;
CONFIGURE_FLAGS += --with-ssl=$$opt_assets{openssl}{prefix}
END_OPENSSL_MAKE
my $openssl_flags = <<END_OPENSSL_FLAGS;
CFLAGS += -I$$opt_assets{openssl}{inc}
LDFLAGS += -L$$opt_assets{openssl}{lib}
END_OPENSSL_FLAGS
my $ed25519_make = <<'END_ED25519';
CONFIGURE_FLAGS += --enable-ed25519
END_ED25519
my $no_ed25519_make = <<'END_NO_ED25519';
CONFIGURE_FLAGS += --disable-ed25519
END_NO_ED25519
my $internal_ldns_make = <<'END_INTERNAL_LDNS';
CFLAGS += -fPIC
LDFROM += ldns/.libs/libldns.a
config :: ldns/.libs/libldns.a
ldns/.libs/libldns.a: ldns/configure
cd ldns ;\
./configure CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" $(CONFIGURE_FLAGS) ;\
make lib
ldns/configure: ldns/Changelog
cd ldns ; libtoolize -ci
cd ldns ; autoreconf -fi
ldns/Changelog:
git submodule init
git submodule sync
git submodule update
END_INTERNAL_LDNS
my $postamble = '';
$postamble .= $contributors_make;
$postamble .= $docker_make;
if ( $opt_internal_ldns ) {
$postamble .= $configure_flags_make;
$postamble .= $openssl_make if $$opt_assets{openssl}{prefix};
$postamble .= $ed25519_make if $opt_ed25519;
$postamble .= $no_ed25519_make if !$opt_ed25519;
$postamble .= $openssl_flags if ( $$opt_assets{openssl}{inc} or $$opt_assets{openssl}{lib} );
$postamble .= $internal_ldns_make;
}
return $postamble;
} ## end sub MY::postamble
sub MY::test_via_harness {
local $_ = shift()->MM::test_via_harness( @_ );
s/\bPERL_DL_NONLAZY=1 +//g;
return $_;
}
sub MY::test_via_script {
local $_ = shift()->MM::test_via_script( @_ );
s/\bPERL_DL_NON_LAZY=1 +//g;
return $_;
}
WriteAll;

239
zonemaster-ldns/README.md Normal file
View File

@@ -0,0 +1,239 @@
# Zonemaster LDNS
## Table of contents
* [Introduction](#introduction)
* [Dependencies and Compatibility](#dependencies-and-compatibility)
* [Installation and verification](#installation-and-verification)
* [Recommended installation](#recommended-installation)
* [Docker](#docker)
* [Installation from source](#installation-from-source)
* [Post-installation sanity check](#post-installation-sanity-check)
* [Testing](#testing)
* [Optional features](#optional-features)
* [Ed25519]
* [IDN]
* [Internal ldns]
* [Custom OpenSSL]
* [Custom LDNS]
* [Custom Libidn]
* [Debug]
* [License](#license)
## Introduction
This module provides a Perl interface to the [ldns library] from [NLnet Labs]
and depends on it being available. The module can either compile and use those
libraries internally or link to already available ldns library given that the
version is high enough. In both cases it relies on a sufficiently recent version
of OpenSSL being present.
This module is written as part of the [Zonemaster project], and therefore
primarily exposes the functionality needed for that. Since Zonemaster is a
diagnostic tool, that means the functions most used are those for looking things
up and inspecting them.
If you want a module that specifically aims to be a complete and transparent
interface to ldns, [DNS::LDNS] is a better fit than this module.
Initially this module was named Net::LDNS.
## Dependencies and compatibility
Run-time dependencies:
* `openssl` (openssl >= 1.1.1 unless [Ed25519] is disabled)
* `libidn2` (if [IDN] is enabled)
* `libldns` (if [Internal ldns] is disabled; libldns >= 1.7.0, or
libldns >= 1.7.1 if [Ed25519] is enabled)
Compile-time dependencies (only when installing from source):
* `make`
* `Devel::CheckLib`
* `ExtUtils::PkgConfig`
* `Module::Install`
* `Module::Install::XSUtil`
* `Test::More >= 1.302015`
* `git` (if [Internal ldns] is enabled)
* `libtool` (if [Internal ldns] is enabled)
* `autoconf` (if [Internal ldns] is enabled)
* `automake` (if [Internal ldns] is enabled)
Test-time dependencies:
* `MIME::Base32`
* `Test::Fatal`
There is a small part in the code that may not be compatible with non-Unix
operating systems, in that it assumes that the file /dev/null exists.
## Installation and verification
### Recommended installation
The recommended way to install Zonemaster::LDNS is to follow the
[installation instructions for Zonemaster::Engine] where you will find all
prerequisites and dependencies for Zonemaster::LDNS before installing it.
### Docker
Zonemaster-CLI is available on [Docker Hub], and can be conveniently downloaded
and run without any installation. See [USING] Zonemaster-CLI for how to run
Zonemaster-CLI on Docker.
To build your own Docker image, see the [Docker Image Creation] documentation.
### Installation from source
Override the default set of features by appending `--FEATURE` and/or
`--no-FEATURE` options to the `perl Makefile.PL` command.
```sh
git clone https://github.com/zonemaster/zonemaster-ldns
cd zonemaster-ldns
perl Makefile.PL
make
make test
make install
```
> **Note:** The source ZIP files downloaded from Github are broken with
> respect to this instruction.
### Post-installation sanity check
```sh
perl -MZonemaster::LDNS -E 'say Zonemaster::LDNS->new("8.8.8.8")->query("zonemaster.net")->string'
```
The above command should print some `dig`-like output.
### Testing
Some of the unit tests depend on data on the Internet, which may change. To avoid
false fails, those unit tests are only run if the environment variable
`TEST_WITH_NETWORK` is `true`. By default that variable is unset (those tests are
not run). To run all tests, execute
```sh
TEST_WITH_NETWORK=1 make test
```
## Optional features
When installing from source, you can choose to enable or disable a number
of optional features using command line options to the `perl Makefile.PL`
commands.
### Ed25519
Enabled by default.
Disabled with `--no-ed25519`
Requires support for algorithms Ed25519 and Ed448 in both openssl and ldns.
>
> *Note:* Zonemaster Engine relies on this feature for its analysis when Ed25519
> (DNSKEY algorithm 15) or Ed448 (DNSKEY algorithm 16) is being used in DNSSEC
> signatures.
>
### IDN
Enabled by default.
Disable with `--no-idn`.
If the IDN feature is enabled, the GNU `libidn2` library will be used to
add a simple function that converts strings from Perl's internal encoding
to IDNA domain name format.
In order to convert strings from whatever encoding you have to Perl's
internal format, use L<Encode>.
If you need any kind of control or options, use L<Net::LibIDN>.
The included function here is only meant to assist in the most basic case,
although that should cover a lot of real-world use cases.
> **Note:** The Zonemaster Engine test suite assumes this feature
> is enabled.
### Internal ldns
Enabled by default.
Disable with `--no-internal-ldns`.
When enabled, an included version of ldns is statically linked into
Zonemaster::LDNS.
When disabled, libldns is dynamically linked just like other dependencies.
### Custom OpenSSL
Disabled by default.
Enabled with `--prefix-openssl=/path/to/openssl` or
`--openssl-inc=/path/to/openssl_inc` or `--openssl-lib=/path/to/openssl_lib`.
Enabling this makes the build tools look for OpenSSL in a non-standard place.
Technically this does two things:
* Libcrypto is sought in the `lib` directory under the given directory.
* The `include` directory under the given directory is added to the include
path.
> **Note:** The `lib` directory under the given path must be known to the
> dynamic linker or feature checks will fail.
If both headers and libraries directories (`include` and `lib`) are not in the
same parent directory, use `--openssl-inc` and `--openssl-lib` options to
specify both paths.
### Custom LDNS
Disabled by default.
Enabled with `--ldns-inc=/path/to/ldns_inc` or `--ldns-lib=/path/to/ldns_lib`.
Enabling this makes the build tools look for LDNS in a non-standard place.
> Requires [Internal LDNS] to be disabled.
### Custom Libidn
Disabled by default.
Enabled with `--libidn-inc=/path/to/libidn_inc` or
`--libidn-lib=/path/to/ldns_lib`.
Enabling this makes the build tools look for Libidn in a non-standard place.
> Requires [IDN] to be enabled.
### Debug
Disabled by default.
Enabled with `--debug`.
Gives a more verbose output.
## License
This is free software under a 2-clause BSD license. The full text of the license can
be found in the [LICENSE](LICENSE) file included in this respository.
[Custom LDNS]: #custom-ldns
[Custom Libidn]: #custom-libidn
[Custom OpenSSL]: #custom-openssl
[Debug]: #debug
[DNS::LDNS]: http://search.cpan.org/~erikoest/DNS-LDNS/
[Docker Hub]: https://hub.docker.com/u/zonemaster
[Docker Image Creation]: https://github.com/zonemaster/zonemaster/blob/master/docs/internal/maintenance/ReleaseProcess-create-docker-image.md
[Ed25519]: #ed25519
[IDN]: #idn
[Installation instructions for Zonemaster::Engine]: https://github.com/zonemaster/zonemaster/blob/master/docs/public/installation/zonemaster-engine.md
[Internal ldns]: #internal-ldns
[Ldns library]: https://www.nlnetlabs.nl/projects/ldns/
[NLnet Labs]: https://www.nlnetlabs.nl/
[USING]: https://github.com/zonemaster/zonemaster/blob/master/docs/public/using/cli.md
[Zonemaster project]: http://github.com/zonemaster/zonemaster

View File

@@ -0,0 +1,123 @@
#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"
#define NEED_newSVpvn_share
#define NEED_sv_2pv_flags
#define NEED_newRV_noinc
#include "ppport.h"
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <ldns/ldns.h>
#ifdef WE_CAN_HAZ_IDN
#include <idn2.h>
#endif
/* ldns 1.6.17 does not have this in its header files, but it is in the published documentation and we need it */
/* It looks like 1.6.18 will have it, but we'll fix that when it happens. */
#if (LDNS_REVISION) >= ((1<<16)|(6<<8)|(17))
void ldns_axfr_abort(ldns_resolver *obj);
#endif
typedef ldns_resolver *Zonemaster__LDNS;
typedef ldns_pkt *Zonemaster__LDNS__Packet;
typedef ldns_rr_list *Zonemaster__LDNS__RRList;
typedef ldns_rr *Zonemaster__LDNS__RR;
typedef ldns_rr *Zonemaster__LDNS__RR__A;
typedef ldns_rr *Zonemaster__LDNS__RR__A6;
typedef ldns_rr *Zonemaster__LDNS__RR__AAAA;
typedef ldns_rr *Zonemaster__LDNS__RR__AFSDB;
typedef ldns_rr *Zonemaster__LDNS__RR__APL;
typedef ldns_rr *Zonemaster__LDNS__RR__ATMA;
typedef ldns_rr *Zonemaster__LDNS__RR__CAA;
typedef ldns_rr *Zonemaster__LDNS__RR__CDS;
typedef ldns_rr *Zonemaster__LDNS__RR__CERT;
typedef ldns_rr *Zonemaster__LDNS__RR__CNAME;
typedef ldns_rr *Zonemaster__LDNS__RR__DHCID;
typedef ldns_rr *Zonemaster__LDNS__RR__DLV;
typedef ldns_rr *Zonemaster__LDNS__RR__DNAME;
typedef ldns_rr *Zonemaster__LDNS__RR__DNSKEY;
typedef ldns_rr *Zonemaster__LDNS__RR__DS;
typedef ldns_rr *Zonemaster__LDNS__RR__EID;
typedef ldns_rr *Zonemaster__LDNS__RR__EUI48;
typedef ldns_rr *Zonemaster__LDNS__RR__EUI64;
typedef ldns_rr *Zonemaster__LDNS__RR__GID;
typedef ldns_rr *Zonemaster__LDNS__RR__GPOS;
typedef ldns_rr *Zonemaster__LDNS__RR__HINFO;
typedef ldns_rr *Zonemaster__LDNS__RR__HIP;
typedef ldns_rr *Zonemaster__LDNS__RR__IPSECKEY;
typedef ldns_rr *Zonemaster__LDNS__RR__ISDN;
typedef ldns_rr *Zonemaster__LDNS__RR__KEY;
typedef ldns_rr *Zonemaster__LDNS__RR__KX;
typedef ldns_rr *Zonemaster__LDNS__RR__L32;
typedef ldns_rr *Zonemaster__LDNS__RR__L64;
typedef ldns_rr *Zonemaster__LDNS__RR__LOC;
typedef ldns_rr *Zonemaster__LDNS__RR__LP;
typedef ldns_rr *Zonemaster__LDNS__RR__MAILA;
typedef ldns_rr *Zonemaster__LDNS__RR__MAILB;
typedef ldns_rr *Zonemaster__LDNS__RR__MB;
typedef ldns_rr *Zonemaster__LDNS__RR__MD;
typedef ldns_rr *Zonemaster__LDNS__RR__MF;
typedef ldns_rr *Zonemaster__LDNS__RR__MG;
typedef ldns_rr *Zonemaster__LDNS__RR__MINFO;
typedef ldns_rr *Zonemaster__LDNS__RR__MR;
typedef ldns_rr *Zonemaster__LDNS__RR__MX;
typedef ldns_rr *Zonemaster__LDNS__RR__NAPTR;
typedef ldns_rr *Zonemaster__LDNS__RR__NID;
typedef ldns_rr *Zonemaster__LDNS__RR__NIMLOC;
typedef ldns_rr *Zonemaster__LDNS__RR__NINFO;
typedef ldns_rr *Zonemaster__LDNS__RR__NS;
typedef ldns_rr *Zonemaster__LDNS__RR__NSAP;
typedef ldns_rr *Zonemaster__LDNS__RR__NSEC;
typedef ldns_rr *Zonemaster__LDNS__RR__NSEC3;
typedef ldns_rr *Zonemaster__LDNS__RR__NSEC3PARAM;
typedef ldns_rr *Zonemaster__LDNS__RR__NULL;
typedef ldns_rr *Zonemaster__LDNS__RR__NXT;
typedef ldns_rr *Zonemaster__LDNS__RR__PTR;
typedef ldns_rr *Zonemaster__LDNS__RR__PX;
typedef ldns_rr *Zonemaster__LDNS__RR__RKEY;
typedef ldns_rr *Zonemaster__LDNS__RR__RP;
typedef ldns_rr *Zonemaster__LDNS__RR__RRSIG;
typedef ldns_rr *Zonemaster__LDNS__RR__RT;
typedef ldns_rr *Zonemaster__LDNS__RR__SIG;
typedef ldns_rr *Zonemaster__LDNS__RR__SINK;
typedef ldns_rr *Zonemaster__LDNS__RR__SOA;
typedef ldns_rr *Zonemaster__LDNS__RR__SPF;
typedef ldns_rr *Zonemaster__LDNS__RR__SRV;
typedef ldns_rr *Zonemaster__LDNS__RR__SSHFP;
typedef ldns_rr *Zonemaster__LDNS__RR__TA;
typedef ldns_rr *Zonemaster__LDNS__RR__TALINK;
typedef ldns_rr *Zonemaster__LDNS__RR__TKEY;
typedef ldns_rr *Zonemaster__LDNS__RR__TLSA;
typedef ldns_rr *Zonemaster__LDNS__RR__TXT;
typedef ldns_rr *Zonemaster__LDNS__RR__TYPE;
typedef ldns_rr *Zonemaster__LDNS__RR__UID;
typedef ldns_rr *Zonemaster__LDNS__RR__UINFO;
typedef ldns_rr *Zonemaster__LDNS__RR__UNSPEC;
typedef ldns_rr *Zonemaster__LDNS__RR__URI;
typedef ldns_rr *Zonemaster__LDNS__RR__WKS;
typedef ldns_rr *Zonemaster__LDNS__RR__X25;
#define D_STRING(what,where) ldns_rdf2str(ldns_rr_rdf(what,where))
#define D_U8(what,where) ldns_rdf2native_int8(ldns_rr_rdf(what,where))
#define D_U16(what,where) ldns_rdf2native_int16(ldns_rr_rdf(what,where))
#define D_U32(what,where) ldns_rdf2native_int32(ldns_rr_rdf(what,where))
SV *rr2sv(ldns_rr *rr);
void strip_newline(char* in);
#ifdef USE_ITHREADS
void net_ldns_remember_resolver(SV *rv);
void net_ldns_remember_rr(SV *rv);
void net_ldns_remember_rrlist(SV *rv);
void net_ldns_remember_packet(SV *rv);
void net_ldns_remember(SV *rv, const char *hashname);
void net_ldns_forget();
void net_ldns_clone_resolvers();
void net_ldns_clone_rrs();
void net_ldns_clone_rrlists();
void net_ldns_clone_packets();
#endif

View File

@@ -0,0 +1,219 @@
package Zonemaster::LDNS;
use 5.014;
our $VERSION = '5.0.2';
use parent 'Exporter';
our @EXPORT_OK = qw[lib_version to_idn has_idn has_gost load_zonefile];
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
require XSLoader;
XSLoader::load( __PACKAGE__, $VERSION );
use Zonemaster::LDNS::RR;
use Zonemaster::LDNS::RRList;
use Zonemaster::LDNS::Packet;
1;
=head1 NAME
Zonemaster::LDNS - Perl wrapper for the ldns DNS library.
=head1 SYNOPSIS
my $resolver = Zonemaster::LDNS->new('8.8.8.8');
my $packet = $resolver->query('www.iis.se');
say $packet->string;
=head1 DESCRIPTION
C<Zonemaster::LDNS> represents a resolver, which is the part of the system responsible for sending queries and receiving answers to them.
=head1 EXPORTABLE FUNCTIONS
=over
=item lib_version()
Returns the ldns version string.
=item to_idn($name, ...)
Takes a number of domain names (in string format) and returns them with all
labels converted to A-labels unless they are already in ASCII.
Assumes that the strings have been converted to Perl's internal encoding before
it's called. Can be exported, but is not by default.
This function requires that GNU libidn2 was present when L<Zonemaster::LDNS> was
compiled. If not, calling C<to_idn> will result in an exception getting thrown.
=item has_idn()
Takes no arguments. Returns true if libidn2 was present at compilation, false if not.
=item has_gost()
Takes no arguments. Returns true if GOST support was present at compilation, false if not.
=item load_zonefile($filename)
Load all resource records in a zone file, returning them as a list.
=back
=head1 CLASS METHOD
=over
=item new($addr,...)
Creates a new resolver object. If given no arguments, if will pick up nameserver addresses from the system configuration (F</etc/resolv.conf> or
equivalent). If given a single argument that is C<undef>, it will not know of any nameservers and all attempts to send queries will throw
exceptions. If given one or more arguments that are not C<undef>, attempts to parse them as IPv4 and IPv6 addresses will be made, and if successful
make up a list of servers to send queries to. If an argument cannot be parsed as an IP address, an exception will be thrown.
=back
=head1 INSTANCE METHODS
=over
=item query($name, $type, $class)
Send a query for the given triple. If type or class are not provided they default to A and IN, respectively. Returns a L<Zonemaster::LDNS::Packet> or
undef.
=item query_with_pkt($packet)
Send a L<Zonemaster::LDNS::Packet>. Returns a L<Zonemaster::LDNS::Packet> or undef.
=item name2addr($name)
Asks this resolver to look up A and AAAA records for the given name, and return a list of the IP addresses (as strings). In scalar context, returns
the number of addresses found.
=item addr2name($addr)
Takes an IP address, asks the resolver to do PTR lookups and returns the names found. In scalar context, returns the number of names found.
=item recurse($flag)
Returns the setting of the recursion flag. If given an argument, it will be treated as a boolean and the flag set accordingly.
=item debug($flag)
Gets and optionally sets the debug flag.
=item dnssec($flag)
Get and optionally sets the DNSSEC flag.
=item cd($flag)
Get and optionally sets the CD flag.
=item igntc($flag)
Get and optionally sets the igntc flag.
=item fallback($flag)
Get and optionally sets the fallback flag.
=item usevc($flag)
Get and optionally sets the usevc flag.
=item retry($count)
Get and optionally set the number of retries.
=item retrans($seconds)
Get and optionally set the number of seconds between retries.
=item port($port)
Get and optionally set the destination port for requests.
=item edns_size($size)
Get and optionally set the EDNS0 UDP maximum size.
=item axfr( $domain, $callback, $class )
Perform an AXFR operation. C<$callback> must be a code reference, which will be
called once for every received resource record with the RR object as its one
and only argument. After every such call, the return value of the callback will
be examined, and if the value is false the AXFR process will be aborted. The
return value of the C<axfr()> method itself will be true if the transfer
completed normally, and false if it was aborted because the callback returned a
false value.
If anything goes wrong during the process, an exception will be thrown.
As an example, saving all the RRs received from an AXFR can be done like this:
my @rrs;
$resolver->axfr( $domain, sub { my ($rr) = @_; push @rrs, $rr; return 1;} );
=item axfr_start($domain,$class)
Deprecated. Use L<axfr()> instead.
Set this resolver object up for a zone transfer of the specified domain. If C<$class> is not given, it defaults to IN.
=item axfr_next()
Deprecated. Use L<axfr()> instead.
Get the next RR in the zone transfer. L<axfr_start()> must have been done before this is called, and after this is called L<axfr_complete()>
should be used to check if there are more records to get. If there's any problem, an exception will be thrown. Basically, the sequence should be
something like:
$res->axfr_start('example.org');
do {
push @rrlist, $res->axfr_next;
} until $res->axfr_complete;
=item axfr_complete()
Deprecated. Use L<axfr()> instead.
Returns false if there is a started zone transfer with more records to get, and true if the started transfer has completed.
=item axfr_last_packet()
Deprecated. Use L<axfr()> instead.
If L<axfr_next()> threw an exception, this method returns the L<Zonemaster::LDNS::Packet> that made it do so. The packet's RCODE is likely to say what
the problem was (for example, NOTAUTH or NXDOMAIN).
=item timeout($time)
Get and/or set the socket timeout for the resolver.
=item source($addr)
Get and/or set the IP address the resolver should try to send its queries from.
=back
=head1 AUTHORS
Mattias P <mattias.paivarinta@iis.se>
- Current maintainer
Calle Dybedahl <calle@init.se>
- Original author
=head1 LICENSE
This is free software under a 2-clause BSD license. The full text of the license can
be found in the F<LICENSE> file included with this distribution.
=cut

View File

@@ -0,0 +1,313 @@
package Zonemaster::LDNS::Packet;
use strict;
use warnings;
use Zonemaster::LDNS;
use Zonemaster::LDNS::RRList;
use MIME::Base64;
sub TO_JSON {
my ( $self ) = @_;
return {
'Zonemaster::LDNS::Packet' => {
data => encode_base64( $self->wireformat, '' ),
answerfrom => $self->answerfrom,
timestamp => $self->timestamp,
querytime => $self->querytime,
}
};
}
sub data {
my ( $self ) = @_;
return $self->wireformat;
}
sub question_rrlist {
my ( $self ) = @_;
my @records = sort $self->question();
return Zonemaster::LDNS::RRList->new( \@records );
}
sub answer {
my ( $self ) = @_;
my @records = $self->answer_unfiltered;
for ( my $i = $#records ; $i >= 0 ; --$i ) {
if ( !$records[$i]->check_rd_count()
|| ( $records[$i]->type() eq 'DNSKEY' && $records[$i]->keysize() == -1 ) )
{
splice @records, $i, 1;
}
}
return @records;
}
sub answer_rrlist {
my ( $self ) = @_;
my @records = sort $self->answer();
return Zonemaster::LDNS::RRList->new( \@records );
}
sub authority {
my ( $self ) = @_;
my @records = $self->authority_unfiltered;
for ( my $i = $#records ; $i >= 0 ; --$i ) {
if ( !$records[$i]->check_rd_count() ) {
splice @records, $i, 1;
}
}
return @records;
}
sub authority_rrlist {
my ( $self ) = @_;
my @records = sort $self->authority();
return Zonemaster::LDNS::RRList->new( \@records );
}
sub additional {
my ( $self ) = @_;
my @records = $self->additional_unfiltered;
for ( my $i = $#records ; $i >= 0 ; --$i ) {
if ( !$records[$i]->check_rd_count() ) {
splice @records, $i, 1;
}
}
return @records;
}
sub additional_rrlist {
my ( $self ) = @_;
my @records = sort $self->additional();
return Zonemaster::LDNS::RRList->new( \@records );
}
1;
=head1 NAME
Zonemaster::LDNS::Packet - objects representing DNS packets
=head1 SYNOPSIS
my $p = $resolver->query('www.iis.se');
foreach my $rr ($p->answer) {
say $rr->string if $rr->type eq 'A';
}
=head1 CLASS METHODS
=over
=item new($name, $type, $class)
Creates a new L<Zonemaster::LDNS::Packet> object, holding nothing but a query record for the provided triplet.
C<$name> corresponds to the QNAME. C<$type> and C<$class> are optional, and default to A and IN respectively.
=item new_from_wireformat($data)
Creates a new L<Zonemaster::LDNS::Packet> object from the given wireformat data, if possible. Throws an exception if not.
=back
=head1 INSTANCE METHODS
=over
=item rcode([$string])
Returns the packet RCODE. If given an argument, tries to set the RCODE to the
relevant value. If the given string isn't recognized as an RCODE, an exception
will be thrown.
=item opcode([$string])
Returns the packet OPCODE. If given an argument, tries to set the OPCODE to the
relevant value. If the given string isn't recognized as an OPCODE, an exception
will be thrown.
=item id([$value])
Returns the packet id number. If given an argument, sets the ID value to that
value.
=item qr()
=item aa()
=item tc()
=item rd()
=item cd()
=item ra()
=item ad()
=item do()
Reads and/or sets the equivalently named flags.
=item size()
Returns the length of the packet's wireformat form in octets.
=item edns_size()
Gets and/or sets the EDNS0 UDP size.
=item edns_rcode()
Gets and/or sets the EDNS0 Extended RCODE field.
=item ends_z()
Gets and/or sets the EDNS0 Z bits.
=item edns_data()
Gets and/or sets the EDNS0 RDATA. See LDNS.xs for more details.
=item needs_edns()
This method returns true if the packet has the DO flag set, an EDNS0 size set,
and EDNS0 extended RCODE set or if the OPT pseudo-RR has one or more RDATA
fields. It can fail to correctly flag a packet with an OPT pseudo-RR as having
EDNS, if the pseudo-RR specifies an UDP size of zero, an extended RCODE of zero
and the DO flag is unset. Since any UDP size less than 512 must be interpreted
as 512, packets like that should be very rare in practice if they exist at all.
Note that the OPT pseudo-RR is not visible as an RR in the packet, nor is it
included in the RR count header fields.
=item has_edns()
An alias for needs_edns().
=item edns_version($version)
Get or set the EDNS version in the packet. For incoming packets, returns 0 if
the packet does not have an OPT pseudo-RR and 0 if it's an EDNS0 packet. It's
thus rather pointless until such time as EDNS1 is defined.
=item set_edns_present
Set edns_present flag to true.
This flag can be set when creating a packet with EDNS corner cases data that
could not be detected by need_edns/has_edns methods.
When set, need_edns/has_edns methods return true value.
=item unset_edns_present
Set edns_present flag to false.
=item querytime([$value])
Returns the time the query this packet is the answer to took to execute, in
milliseconds. If given a value, sets the querytime to that value.
=item answerfrom($ipaddr)
Returns and optionally sets the IP address the packet was received from. If an attempt is made to set it to a string that cannot be parsed as an
IPv4 or IPv6 address, an exception is thrown.
=item timestamp($time)
The time when the query was sent or received (the ldns docs don't specify), as a floating-point value on the Unix time_t scale (that is, the same
kind of value used by L<Time::HiRes::time()>). Conversion effects between floating-point and C<struct timeval> means that the precision of the
value is probably not reliable at the microsecond level, even if you computer's clock happen to be.
=item all()
Returns a L<Zonemaster::LDNS::RRList> object, containing the resource records from all sections except for the question section.
=item question()
Returns a list of objects representing the RRs in the question section. They will be of classes appropriate to their types, but all will have
L<Zonemaster::LDNS::RR> as a base class.
=item question_rrlist()
Similar to L<question()>, but instead returns a single (and sorted) L<Zonemaster::LDNS::RRList> object.
=item answer()
Similar to L<answer_unfiltered()>, but ignores incomplete resource records.
=item answer_rrlist()
Similar to L<answer()>, but instead returns a single (and sorted) L<Zonemaster::LDNS::RRList> object.
=item answer_unfiltered()
Returns a list of objects representing the RRs in the answer section. They will be of classes appropriate to their types, but all will have
L<Zonemaster::LDNS::RR> as a base class.
=item authority()
Similar to L<authority_unfiltered()>, but ignores incomplete resource records.
=item authority_rrlist()
Similar to L<authority()>, but instead returns a single (and sorted) L<Zonemaster::LDNS::RRList> object.
=item authority_unfiltered()
Returns a list of objects representing the RRs in the authority section. They will be of classes appropriate to their types, but all will have
L<Zonemaster::LDNS::RR> as a base class.
=item additional()
Similar to L<additional_unfiltered()>, but ignores incomplete resource records.
=item additional_rrlist()
Similar to L<additional()>, but instead returns a single (and sorted) L<Zonemaster::LDNS::RRList> object.
=item additional_unfiltered()
Returns a list of objects representing the RRs in the additional section. They will be of classes appropriate to their types, but all will have
L<Zonemaster::LDNS::RR> as a base class.
=item unique_push($section, $rr)
Push an RR object into the given section, if an identical RR isn't already present. If the section isn't one of "question", "answer", "authority"
or "additional" an exception will be thrown. C<$rr> must be a L<Zonemaster::LDNS::RR> subclass.
=item string()
Returns a string with the packet and its contents in common presentation format.
=item wireformat()
Returns a Perl string holding the packet in wire format.
=item type()
Returns the ldns library's guess as to the content of the packet. One of the strings C<question>, C<referral>, C<answer>, C<nxdomain>, C<nodata> or C<unknown>.
=back

View File

@@ -0,0 +1,207 @@
package Zonemaster::LDNS::RR;
use strict;
use warnings;
use Zonemaster::LDNS::RR::A;
use Zonemaster::LDNS::RR::A6;
use Zonemaster::LDNS::RR::AAAA;
use Zonemaster::LDNS::RR::AFSDB;
use Zonemaster::LDNS::RR::APL;
use Zonemaster::LDNS::RR::ATMA;
use Zonemaster::LDNS::RR::CAA;
use Zonemaster::LDNS::RR::CDNSKEY;
use Zonemaster::LDNS::RR::CDS;
use Zonemaster::LDNS::RR::CERT;
use Zonemaster::LDNS::RR::CNAME;
use Zonemaster::LDNS::RR::DHCID;
use Zonemaster::LDNS::RR::DLV;
use Zonemaster::LDNS::RR::DNAME;
use Zonemaster::LDNS::RR::DNSKEY;
use Zonemaster::LDNS::RR::DS;
use Zonemaster::LDNS::RR::EID;
use Zonemaster::LDNS::RR::EUI48;
use Zonemaster::LDNS::RR::EUI64;
use Zonemaster::LDNS::RR::GID;
use Zonemaster::LDNS::RR::GPOS;
use Zonemaster::LDNS::RR::HINFO;
use Zonemaster::LDNS::RR::HIP;
use Zonemaster::LDNS::RR::HTTPS;
use Zonemaster::LDNS::RR::IPSECKEY;
use Zonemaster::LDNS::RR::ISDN;
use Zonemaster::LDNS::RR::KEY;
use Zonemaster::LDNS::RR::KX;
use Zonemaster::LDNS::RR::L32;
use Zonemaster::LDNS::RR::L64;
use Zonemaster::LDNS::RR::LOC;
use Zonemaster::LDNS::RR::LP;
use Zonemaster::LDNS::RR::MAILA;
use Zonemaster::LDNS::RR::MAILB;
use Zonemaster::LDNS::RR::MB;
use Zonemaster::LDNS::RR::MD;
use Zonemaster::LDNS::RR::MF;
use Zonemaster::LDNS::RR::MG;
use Zonemaster::LDNS::RR::MINFO;
use Zonemaster::LDNS::RR::MR;
use Zonemaster::LDNS::RR::MX;
use Zonemaster::LDNS::RR::NAPTR;
use Zonemaster::LDNS::RR::NID;
use Zonemaster::LDNS::RR::NIMLOC;
use Zonemaster::LDNS::RR::NINFO;
use Zonemaster::LDNS::RR::NS;
use Zonemaster::LDNS::RR::NSAP;
use Zonemaster::LDNS::RR::NSEC;
use Zonemaster::LDNS::RR::NSEC3;
use Zonemaster::LDNS::RR::NSEC3PARAM;
use Zonemaster::LDNS::RR::NULL;
use Zonemaster::LDNS::RR::NXT;
use Zonemaster::LDNS::RR::PTR;
use Zonemaster::LDNS::RR::PX;
use Zonemaster::LDNS::RR::RKEY;
use Zonemaster::LDNS::RR::RP;
use Zonemaster::LDNS::RR::RRSIG;
use Zonemaster::LDNS::RR::RT;
use Zonemaster::LDNS::RR::SIG;
use Zonemaster::LDNS::RR::SINK;
use Zonemaster::LDNS::RR::SOA;
use Zonemaster::LDNS::RR::SPF;
use Zonemaster::LDNS::RR::SRV;
use Zonemaster::LDNS::RR::SSHFP;
use Zonemaster::LDNS::RR::SVCB;
use Zonemaster::LDNS::RR::TA;
use Zonemaster::LDNS::RR::TALINK;
use Zonemaster::LDNS::RR::TKEY;
use Zonemaster::LDNS::RR::TLSA;
use Zonemaster::LDNS::RR::TXT;
use Zonemaster::LDNS::RR::TYPE;
use Zonemaster::LDNS::RR::UID;
use Zonemaster::LDNS::RR::UINFO;
use Zonemaster::LDNS::RR::UNSPEC;
use Zonemaster::LDNS::RR::URI;
use Zonemaster::LDNS::RR::WKS;
use Zonemaster::LDNS::RR::X25;
use Carp;
use overload '<=>' => \&do_compare, 'cmp' => \&do_compare, '""' => \&to_string;
sub new {
my ( $class, $string ) = @_;
if ( $string ) {
return $class->new_from_string( $string );
}
else {
croak "Must provide string to create RR";
}
}
sub name {
my ( $self ) = @_;
return $self->owner;
}
sub do_compare {
my ( $self, $other, $swapped ) = @_;
return $self->compare( $other );
}
sub to_string {
my ( $self ) = @_;
return $self->string;
}
1;
=head1 NAME
Zonemaster::LDNS::RR - common baseclass for all classes representing resource records.
=head1 SYNOPSIS
my $rr = Zonemaster::LDNS::RR->new('www.iis.se IN A 91.226.36.46');
=head1 OVERLOADS
This class overloads stringify and comparisons ('""', '<=>' and 'cmp').
=head1 CLASS METHOD
=over
=item new($string)
Creates a new RR object, which is an instance of a suitable subclass of
L<Zonemaster::LDNS::RR>, given a string representing an RR in common
presentation format.
If a subclass of L<Zonemaster::LDNS::RR> exists that is suitable for the
resource records type (e.g. L<Zonemaster::LDNS::RR::AAAA>,
L<Zonemaster::LDNS::RR::TXT>, etc.), then the resulting object is an instance
of that subclass.
If no such subclass exists (e.g. when passed a resource record of an unknown
type or a type not yet supported by Zonemaster-LDNS), the resulting object is
an instance of L<Zonemaster::LDNS::RR>. The instance methods defined in this
class will still work, but there is no support for structured access to the
resource records RDATA.
=back
=head1 INSTANCE METHODS
=over
=item owner()
Returns the owner name of the RR.
=item name()
An alias of L<owner()>.
=item ttl()
Returns the ttl of the RR.
=item type()
Return the type of the RR.
=item class()
Returns the class of the RR.
=item string()
Returns a string with the RR in presentation format.
=item compare($other)
Compares two L<Zonemaster::LDNS::RR>. The TTL field is ignored, and the comparison of domain names is case insensitive.
Returns an integer, where 0 indicates equality.
=item do_compare($other)
Calls the XS C<compare> method with the arguments it needs, rather than the ones overloading gives.
=item to_string
Calls the XS C<string> method with the arguments it needs, rather than the ones overloading gives. Functionally identical to L<string()> from the
Perl level, except for being a tiny little bit slower.
=item rd_count()
The number of RDATA objects in this RR.
=item rdf($postion)
The raw data of the RDATA object in the given position. The first item is in
position 0. If an attempt is made to fetch RDATA from a position that doesn't
have any, an exception will be thrown.
=back

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::A;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::A - Type A record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item address()
Returns the address.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::A6;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::A6 - Type A6 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::AAAA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::AAAA - Type AAAA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item address()
Returns the address.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::AFSDB;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::AFSDB - Type AFSDB record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::APL;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::APL - Type APL record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::ATMA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::ATMA - Type ATMA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::CAA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::CAA - Type CAA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,24 @@
package Zonemaster::LDNS::RR::CDNSKEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR::DNSKEY';
1;
=head1 NAME
Zonemaster::LDNS::RR::CDNSKEY - Type CDNSKEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR::DNSKEY>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No other specific methods implemented.
Note that the inherited parent methods L<Zonemaster::LDNS::RR::DNSKEY/keytag()> and L<Zonemaster::LDNS::RR::DNSKEY/ds($hash)> will always return 0, as LDNS currently only supports the DNSKEY RR type for those methods.
=cut

View File

@@ -0,0 +1,24 @@
package Zonemaster::LDNS::RR::CDS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR::DS';
1;
=head1 NAME
Zonemaster::LDNS::RR::CDS - Type CDS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR::DS>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No other specific methods implemented.
Note that the inherited parent methods L<Zonemaster::LDNS::RR::DS/verify($other)> will always return false, as LDNS currently only supports the DS and DNSKEY RR types for this method.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::CERT;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::CERT - Type CERT record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::CNAME;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::CNAME - Type CNAME record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item cname()
Returns the canonical name.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::DHCID;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::DHCID - Type DHCID record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::DLV;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::DLV - Type DLV record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::DNAME;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::DNAME - Type DNAME record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item dname()
Returns the delegation name, i.e. the <target> field from the RDATA of a DNAME record.
=back

View File

@@ -0,0 +1,116 @@
package Zonemaster::LDNS::RR::DNSKEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
sub keysize {
my ( $self ) = @_;
my $algo = $self->algorithm;
my $data = $self->keydata;
# RSA variants
if ( $algo == 1 || $algo == 5 || $algo == 7 || $algo == 8 || $algo == 10 ) {
# Read first byte
return -1
if length $data < 1;
my $byte = unpack( "c1", $data );
my $remaining;
if ( $byte > 0 ) {
$remaining = length( $data ) - 1 - $byte;
}
else {
# Read bytes 1 and 2 as big-endian
return -1
if length $data < 3;
my $short = unpack( "x1s>1", $data );
$remaining = length( $data ) - 3 - $short;
}
if ( $remaining < 0 ) {
return -1;
}
else {
return 8 * $remaining;
}
}
# DSA variants
elsif ( $algo == 3 || $algo == 6 ) {
# Read first byte (the T value)
return -1
if length $data < 1;
return unpack( "c1", $data );
}
# Diffie-Hellman
elsif ( $algo == 2 ) {
# Read bytes 4 and 5 as big-endian
return -1
if length $data < 6;
return unpack( "x4s>1", $data );
}
# No idea what this is
else {
return 0;
}
}
1;
=head1 NAME
Zonemaster::LDNS::RR::DNSKEY - Type DNSKEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item flags()
Returns the flag field as a number.
=item protocol()
Returns the protocol number.
=item algorithm()
Returns the algorithm number.
=item keydata()
Returns the cryptographic key in binary form.
=item hexkeydata()
Returns the cryptographic key as a hexadecimal string.
=item keytag()
Calculates the keytag.
=item ds($hash)
Returns a L<Zonemaster::LDNS::RR::DS> record matching this key. The argument must be one of the strings 'sha1', 'sha256', 'sha384' or 'gost'. GOST may not
be available, depending on how you ldns library was compiled.
=item keysize()
The size of the key stored in the record. For RSA variants, it's the length in bits of the prime number. For DSA variants, it's the key's "T" value
(see RFC2536). For DH, it's the value of the "prime length" field (and probably useless, since DH keys can't have signature records).
If there is insufficient data in the public key field to calculate the key size, C<-1> is returned.
=back

View File

@@ -0,0 +1,47 @@
package Zonemaster::LDNS::RR::DS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::DS - Type DS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item keytag()
Returns the keytag value.
=item algorithm()
Returns the algorithm number.
=item digtype()
Returns the numeric digest type.
=item digest()
Returns the cryptographic digest in binary form.
=item hexdigest()
Returns the cryptographic digest as a hexadecimal string.
=item verify($other)
Checks if the current object is derived from the other object (if it's a DNSKEY) or was derived from the same DNSKEY as the other object (if it's a
DS). If used with any other type of RR, it always returns false.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::EID;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::EID - Type EID record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::EUI48;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::EUI48 - Type EUI48 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::EUI64;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::EUI64 - Type EUI64 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::GID;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::GID - Type GID record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::GPOS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::GPOS - Type GPOS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::HINFO;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::HINFO - Type HINFO record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::HIP;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::HIP - Type HIP record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::HTTPS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::HTTPS - Type HTTPS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::IPSECKEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::IPSECKEY - Type IPSECKEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::ISDN;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::ISDN - Type ISDN record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,40 @@
package Zonemaster::LDNS::RR::KEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::KEY - Type KEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item flags()
Returns the flag field as a number.
=item protocol()
Returns the protocol number.
=item algorithm()
Returns the algorithm number.
=item keydata()
Returns the cryptographic key in binary form.
=back
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::KX;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::KX - Type KX record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::L32;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::L32 - Type L32 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::L64;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::L64 - Type L64 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::LOC;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::LOC - Type LOC record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::LP;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::LP - Type LP record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MAILA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MAILA - Type MAILA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MAILB;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MAILB - Type MAILB record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MB;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MB - Type MB record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MD;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MD - Type MD record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MF;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MF - Type MF record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MG;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MG - Type MG record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MINFO;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MINFO - Type MINFO record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::MR;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MR - Type MR record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,30 @@
package Zonemaster::LDNS::RR::MX;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::MX - Type MX record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item exchange()
Returns the name of the mail server.
=item preference()
Returns the preference value of the record.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NAPTR;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NAPTR - Type NAPTR record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NID;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NID - Type NID record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NIMLOC;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NIMLOC - Type NIMLOC record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NINFO;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NINFO - Type NINFO record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::NS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NS - Type NS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item nsdname()
Returns the name of the nameserver.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NSAP;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NSAP - Type NSAP record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,47 @@
package Zonemaster::LDNS::RR::NSEC;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
sub nxtdname {
return $_[0]->next;
}
1;
=head1 NAME
Zonemaster::LDNS::RR::NSEC - Type NSEC record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item next()
Returns the next name.
=item nxtdname()
Alias for C<next()>.
=item typelist()
Returns a string with the typelist. The string has the type names separated by spaces.
=item typehref()
Returns a reference to a hash, where the keys are the type names and the corresponding values are true. That is, if you look for a type in this hash
you get a true value back if the record covers it and false if not.
=item covers($name)
Returns true or false depending on if the record covers the given name or not.
=back

View File

@@ -0,0 +1,62 @@
package Zonemaster::LDNS::RR::NSEC3;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NSEC3 - Type NSEC3 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item algorithm()
Returns the algorithm number.
=item flags()
Returns the flags field.
=item optout()
Returns the optout flag.
=item iterations()
Returns the iteration count.
=item salt()
Returns the contents of the salt field as a binary string, if non-empty; otherwise, returns an empty string. If there was a problem accessing the salt field, returns undef.
=item next_owner()
Returns the next hashed owner name field, in binary form. To convert the return value to the human-readable presentation format, use L<MIME::Base32/encode_base32hex>.
=item typelist()
Returns the typelist as a space-separated string.
=item typehref()
Returns the typelist as a reference to a hash where the included types are keys storing true values.
=item covers($name)
Returns true or false depending on if the record covers the given name or not.
=item hash_name($name)
Computes and returns a hash, in canonical form, of the given name using the parameters (algorithm, iterations, salt) of the resource record.
=back

View File

@@ -0,0 +1,42 @@
package Zonemaster::LDNS::RR::NSEC3PARAM;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NSEC3PARAM - Type NSEC3PARAM record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item algorithm()
Returns the algorithm number.
=item flags()
Returns the flags field.
=item iterations()
Returns the iteration count.
=item salt()
Returns the contents of the salt field as a binary string, if non-empty; otherwise, returns an empty string.
=item hash_name($name)
Computes and returns a hash, in canonical form, of the given name using the parameters (algorithm, iterations, salt) of the resource record.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NULL;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NULL - Type NULL record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::NXT;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::NXT - Type NXT record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,26 @@
package Zonemaster::LDNS::RR::PTR;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::PTR - Type PTR record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item ptrdname()
Returns the domain name.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::PX;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::PX - Type PX record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::RKEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::RKEY - Type RKEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::RP;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::RP - Type RP record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,91 @@
package Zonemaster::LDNS::RR::RRSIG;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
sub verify {
my ( $self, $rrset, $keys ) = @_;
my $msg = '';
return $self->verify_time( $rrset, $keys, time(), $msg );
}
sub verify_str {
my ( $self, $rrset, $keys ) = @_;
my $msg = '';
$self->verify_time( $rrset, $keys, time(), $msg );
return $msg;
}
1;
=head1 NAME
Zonemaster::LDNS::RR::RRSIG - Type RRSIG record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item typecovered()
Returns a string with the name of the RR type this signature covers.
=item algorithm()
Returns the algorithm number.
=item labels()
Returns the number of labels that was used to calculate the signature.
=item origttl()
Returns the original TTL value.
=item expiration()
Returns the expiration time, as a time_t.
=item inception()
Returns the inception time, as a time_t.
=item keytag()
Returns the keytag.
=item signer()
Returns the signer name.
=item signature()
Returns the cryptographic signture in binary form.
=item verify($rrset_ref, $key_ref)
Cryptographically verifies that the signature in this object matches the given RRset and at least one of the given keys. C<$rrset_ref> should be a
reference to an array of RR objects, and C<$key_ref> a reference to an array of L<Zonemaster::LDNS::RR::DNSKEY> objects. This method simply returns a true
or false value, depending on the result och the check.
=item verify_str($rrset_ref, $key_ref)
Takes exactly the same arguments as L<verify()> and performs the same action, but instead of true/false it returns a string describing the result.
In the case of a successful result the message will be "All OK". For negative results, the string will describe the reason the verification failed.
=item verify_time($rrset_ref, $key_ref, $time, $msg)
This is the XS method doing the work for the previous two methods. C<$rrset_ref> and C<$key_ref> are the same as for the other methods. C<$time> is
the C<time_t> value for which the validation should be made (for the previous two methods it is set to the current computer time). C<$msg> should be
a writable scalar, and the string message describing the result will be but in it. The return value from the method is true/false.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::RT;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::RT - Type RT record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,58 @@
package Zonemaster::LDNS::RR::SIG;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SIG - Type SIG record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item typecovered()
Returns a string with the name of the RR type this signature covers.
=item algorithm()
Returns the algorithm number.
=item labels()
Returns the number of labels that was used to calculate the signature.
=item origttl()
Returns the original TTL value.
=item expiration()
Returns the expiration time, as a time_t.
=item inception()
Returns the inception time, as a time_t.
=item keytag()
Returns the keytag.
=item signer()
Returns the signer name.
=item signature()
Returns the cryptographic signture in binary form.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::SINK;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SINK - Type SINK record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,44 @@
package Zonemaster::LDNS::RR::SOA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SOA - Type SOA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item mname()
Returns the master server name.
=item rname()
Returns the contact mail address, in DNAME format.
=item serial()
Returns the serial number.
=item refresh()
=item retry()
=item refresh()
=item minimum()
Returns the respective timing values from the record.
=back

View File

@@ -0,0 +1,38 @@
package Zonemaster::LDNS::RR::SPF;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
sub spfdata() {
my ($rr) = @_;
return join( "", map { substr($rr->rdf($_ - 1), 1) } 1..$rr->rd_count() );
}
1;
=head1 NAME
Zonemaster::LDNS::RR::SPF - Type SPF record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item spfdata()
Returns the concatenation of all the strings composing the data of the resource record.
For example, if an SPF resource record has the following presentation format:
test.example. 3600 IN SPF "v=spf1 " "mx " "a " "-all"
then C<spfdata()> returns the string C<"v=spf1 mx a -all">.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::SRV;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SRV - Type SRV record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::SSHFP;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SSHFP - Type SSHFP record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::SVCB;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::SVCB - Type SVCB record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::TA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::TA - Type TA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::TALINK;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::TALINK - Type TALINK record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::TKEY;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::TKEY - Type TKEY record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::TLSA;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::TLSA - Type TLSA record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,38 @@
package Zonemaster::LDNS::RR::TXT;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
sub txtdata() {
my ($rr) = @_;
return join( "", map { substr($rr->rdf($_ - 1), 1) } 1..$rr->rd_count() );
}
1;
=head1 NAME
Zonemaster::LDNS::RR::TXT - Type TXT record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
=over
=item txtdata()
Returns the concatenation of all the strings composing the data of the resource record.
For example, if a TXT resource record has the following presentation format:
txt.test.example. 3600 IN TXT "I " "am " "split up in " "lit" "tle pieces"
then C<txtdata()> returns the string C<"I am split up in little pieces">.
=back

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::TYPE;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::TYPE - Type TYPE record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::UID;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::UID - Type UID record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::UINFO;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::UINFO - Type UINFO record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::UNSPEC;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::UNSPEC - Type UNSPEC record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::URI;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::URI - Type URI record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::WKS;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::WKS - Type WKS record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,22 @@
package Zonemaster::LDNS::RR::X25;
use strict;
use warnings;
use parent 'Zonemaster::LDNS::RR';
1;
=head1 NAME
Zonemaster::LDNS::RR::X25 - Type X25 record
=head1 DESCRIPTION
A subclass of L<Zonemaster::LDNS::RR>, so it has all the methods of that class available in addition to the ones documented here.
=head1 METHODS
No RDATA methods implemented yet.
=cut

View File

@@ -0,0 +1,100 @@
package Zonemaster::LDNS::RRList;
use strict;
use warnings;
use overload '<=>' => \&do_compare, 'cmp' => \&do_compare, '""' => \&to_string;
sub do_compare {
my ( $self, $other, $swapped ) = @_;
return $self->compare( $other );
}
sub to_string {
my ( $self ) = @_;
return $self->string;
}
1;
=head1 NAME
Zonemaster::LDNS::RRList - class representing lists of resource records.
=head1 SYNOPSIS
my $rrlist = Zonemaster::LDNS::RRList->new( $rrs_aref );
=head1 CLASS METHODS
=over
=item new()
Creates a new empty L<Zonemaster::LDNS::RRList> object.
=item new($rrs)
Creates a new L<Zonemaster::LDNS::RRList> object for the given resource records.
Takes a reference to an array of L<Zonemaster::LDNS::RR> objects.
Returns a L<Zonemaster::LDNS::RRList> object.
=back
=head1 INSTANCE METHODS
=over
=item count()
Returns the number of RRs in the list.
=item compare($other)
Compares two L<Zonemaster::LDNS::RRList>. The order of L<Zonemaster::LDNS::RR> objects in the list does not matter.
The TTL field is ignored, and the comparison of domain names is case insensitive.
Returns an integer, where 0 indicates equality.
=item get($pos)
my $rr = Zonemaster::LDNS::RRList->get( 0 );
Retrieves the RR in the given position from the list.
Takes an integer.
Returns a L<Zonemaster::LDNS::RR> object, or C<undef> if there was no RR.
=item push($rr)
Pushes an RR onto the list.
=item pop()
Pops an RR off the list.
=item is_rrset()
Returns true or false depending on if the list is an RRset or not.
Note that the underlying LDNS function appears to have a bug as the comparison of the owner name field is case sensitive. See https://github.com/NLnetLabs/ldns/pull/251.
=item string()
Returns a string with the list of RRs in presentation format.
=item do_compare($other)
Calls the XS C<compare> method with the arguments it needs, rather than the ones overloading gives.
=item to_string
Calls the XS C<string> method with the arguments it needs, rather than the ones overloading gives. Functionally identical to L<string()> from the
Perl level, except for being a tiny little bit slower.
=back

2741
zonemaster-ldns/src/LDNS.xs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,44 @@
#include <LDNS.h>
#define RR_CLASSNAME_MAX_LEN 34
SV *
rr2sv(ldns_rr *rr)
{
char rrclass[RR_CLASSNAME_MAX_LEN];
char *type;
type = ldns_rr_type2str(ldns_rr_get_type(rr));
snprintf(rrclass, RR_CLASSNAME_MAX_LEN, "Zonemaster::LDNS::RR::%s", type);
SV* rr_sv = newSV(0);
if (strncmp(type, "TYPE", 4)==0)
{
sv_setref_pv(rr_sv, "Zonemaster::LDNS::RR", rr);
}
else
{
sv_setref_pv(rr_sv, rrclass, rr);
}
free(type);
return rr_sv;
}
void
strip_newline(char* in)
{
size_t length;
if (in == NULL || in[0] == '\0')
{
return;
}
length = strlen(in);
if (in[length - 1] == '\n')
{
in[length - 1] = '\0';
}
}

View File

@@ -0,0 +1,80 @@
Zonemaster::LDNS T_PTROBJ
Zonemaster::LDNS::Packet T_PTROBJ
Zonemaster::LDNS::RRList T_PTROBJ
Zonemaster::LDNS::RR T_PTROBJ
Zonemaster::LDNS::RR::A T_PTROBJ
Zonemaster::LDNS::RR::A6 T_PTROBJ
Zonemaster::LDNS::RR::AAAA T_PTROBJ
Zonemaster::LDNS::RR::AFSDB T_PTROBJ
Zonemaster::LDNS::RR::APL T_PTROBJ
Zonemaster::LDNS::RR::ATMA T_PTROBJ
Zonemaster::LDNS::RR::CAA T_PTROBJ
Zonemaster::LDNS::RR::CDS T_PTROBJ
Zonemaster::LDNS::RR::CERT T_PTROBJ
Zonemaster::LDNS::RR::CNAME T_PTROBJ
Zonemaster::LDNS::RR::DHCID T_PTROBJ
Zonemaster::LDNS::RR::DLV T_PTROBJ
Zonemaster::LDNS::RR::DNAME T_PTROBJ
Zonemaster::LDNS::RR::DNSKEY T_PTROBJ
Zonemaster::LDNS::RR::DS T_PTROBJ
Zonemaster::LDNS::RR::EID T_PTROBJ
Zonemaster::LDNS::RR::EUI48 T_PTROBJ
Zonemaster::LDNS::RR::EUI64 T_PTROBJ
Zonemaster::LDNS::RR::GID T_PTROBJ
Zonemaster::LDNS::RR::GPOS T_PTROBJ
Zonemaster::LDNS::RR::HINFO T_PTROBJ
Zonemaster::LDNS::RR::HIP T_PTROBJ
Zonemaster::LDNS::RR::HTTPS T_PTROBJ
Zonemaster::LDNS::RR::IPSECKEY T_PTROBJ
Zonemaster::LDNS::RR::ISDN T_PTROBJ
Zonemaster::LDNS::RR::KEY T_PTROBJ
Zonemaster::LDNS::RR::KX T_PTROBJ
Zonemaster::LDNS::RR::L32 T_PTROBJ
Zonemaster::LDNS::RR::L64 T_PTROBJ
Zonemaster::LDNS::RR::LOC T_PTROBJ
Zonemaster::LDNS::RR::LP T_PTROBJ
Zonemaster::LDNS::RR::MAILA T_PTROBJ
Zonemaster::LDNS::RR::MAILB T_PTROBJ
Zonemaster::LDNS::RR::MB T_PTROBJ
Zonemaster::LDNS::RR::MD T_PTROBJ
Zonemaster::LDNS::RR::MF T_PTROBJ
Zonemaster::LDNS::RR::MG T_PTROBJ
Zonemaster::LDNS::RR::MINFO T_PTROBJ
Zonemaster::LDNS::RR::MR T_PTROBJ
Zonemaster::LDNS::RR::MX T_PTROBJ
Zonemaster::LDNS::RR::NAPTR T_PTROBJ
Zonemaster::LDNS::RR::NID T_PTROBJ
Zonemaster::LDNS::RR::NIMLOC T_PTROBJ
Zonemaster::LDNS::RR::NINFO T_PTROBJ
Zonemaster::LDNS::RR::NS T_PTROBJ
Zonemaster::LDNS::RR::NSAP T_PTROBJ
Zonemaster::LDNS::RR::NSEC T_PTROBJ
Zonemaster::LDNS::RR::NSEC3 T_PTROBJ
Zonemaster::LDNS::RR::NSEC3PARAM T_PTROBJ
Zonemaster::LDNS::RR::NULL T_PTROBJ
Zonemaster::LDNS::RR::NXT T_PTROBJ
Zonemaster::LDNS::RR::PTR T_PTROBJ
Zonemaster::LDNS::RR::PX T_PTROBJ
Zonemaster::LDNS::RR::RKEY T_PTROBJ
Zonemaster::LDNS::RR::RP T_PTROBJ
Zonemaster::LDNS::RR::RRSIG T_PTROBJ
Zonemaster::LDNS::RR::RT T_PTROBJ
Zonemaster::LDNS::RR::SIG T_PTROBJ
Zonemaster::LDNS::RR::SINK T_PTROBJ
Zonemaster::LDNS::RR::SOA T_PTROBJ
Zonemaster::LDNS::RR::SPF T_PTROBJ
Zonemaster::LDNS::RR::SRV T_PTROBJ
Zonemaster::LDNS::RR::SSHFP T_PTROBJ
Zonemaster::LDNS::RR::SVCB T_PTROBJ
Zonemaster::LDNS::RR::TA T_PTROBJ
Zonemaster::LDNS::RR::TALINK T_PTROBJ
Zonemaster::LDNS::RR::TKEY T_PTROBJ
Zonemaster::LDNS::RR::TLSA T_PTROBJ
Zonemaster::LDNS::RR::TXT T_PTROBJ
Zonemaster::LDNS::RR::TYPE T_PTROBJ
Zonemaster::LDNS::RR::UID T_PTROBJ
Zonemaster::LDNS::RR::UINFO T_PTROBJ
Zonemaster::LDNS::RR::UNSPEC T_PTROBJ
Zonemaster::LDNS::RR::URI T_PTROBJ
Zonemaster::LDNS::RR::WKS T_PTROBJ
Zonemaster::LDNS::RR::X25 T_PTROBJ

29
zonemaster-ldns/t/axfr.t Normal file
View File

@@ -0,0 +1,29 @@
use Test::More;
use Test::Fatal;
BEGIN { use_ok( 'Zonemaster::LDNS' ) }
SKIP: {
skip 'no network', 3 unless $ENV{TEST_WITH_NETWORK};
my $res = Zonemaster::LDNS->new( '46.21.106.227' );
my $res2 = Zonemaster::LDNS->new( '192.36.144.107' );
my $counter = 0;
my $return = $res->axfr( 'cyberpomo.com',
sub {
my ($rr) = @_;
$counter += 1;
if ($rr->type eq 'CNAME') {
return 0;
} else {
return 1;
}
});
ok(!$return, 'Terminated early');
ok(($counter > 1), 'Saw more than one entry (' . $counter . ')');
like( exception { $res2->axfr( 'iis.se', sub { return 1 })}, qr/NOTAUTH/, 'Expected exception');
}
done_testing;

Some files were not shown because too many files have changed in this diff Show More