diff options
author | Daniel Salzman <daniel.salzman@nic.cz> | 2018-03-12 15:47:31 +0100 |
---|---|---|
committer | Daniel Salzman <daniel.salzman@nic.cz> | 2018-03-13 15:43:13 +0100 |
commit | 4db58b261475f4bd7fa4ee177b81d6cb21c4afbb (patch) | |
tree | bc724c96a5f2257eec49ded9e6a438e4cb1c003f | |
parent | Update license in previously changed files (diff) | |
download | knot-4db58b261475f4bd7fa4ee177b81d6cb21c4afbb.tar.xz knot-4db58b261475f4bd7fa4ee177b81d6cb21c4afbb.zip |
libs: build cleanup, remove pykeymgr
74 files changed, 830 insertions, 1562 deletions
diff --git a/.gitignore b/.gitignore index e89f587f4..f241ed4fe 100644 --- a/.gitignore +++ b/.gitignore @@ -7,25 +7,13 @@ *.lo *.rej *.pyc +*.pc .libs/ .deps/ .dirstamp /tmp /Knot.creator.user* /Doxyfile -/Makefile -/Makefile.in -/src/Makefile -/src/Makefile.in -/src/libzscanner/Makefile -/src/libzscanner/Makefile.in -/python/Makefile -/python/Makefile.in -/samples/Makefile -/samples/Makefile.in -/samples/knot.sample.conf -/doc/Makefile -/doc/Makefile.in /aclocal.m4 /ar-lib /autoscan.log @@ -46,18 +34,19 @@ /src/config.h /src/config.h.in /src/stamp-* -/doc/html/ /INSTALL /m4/libtool.m4 /m4/ltoptions.m4 /m4/ltsugar.m4 /m4/ltversion.m4 /m4/lt~obsolete.m4 -/src/knotd.pc -/src/libknot/libknot.pc -/src/libknot/version.h -/src/knot/modules/static_modules.h /test-driver +Makefile +Makefile.in +version.h + +/samples/knot.sample.conf +/src/knot/modules/static_modules.h # dnstap /src/contrib/dnstap/Makefile @@ -66,9 +55,7 @@ /src/contrib/dnstap/dnstap.pb-c.h # zscanner -/src/libzscanner/libzscanner.pc /src/libzscanner/scanner.c -/src/libzscanner/version.h # Binaries /src/kdig @@ -80,7 +67,6 @@ /src/knsec3hash /src/knsupdate /src/kzonecheck -/src/utils/pykeymgr/pykeymgr # Generated tarballs /knot-*.tar.xz diff --git a/configure.ac b/configure.ac index 6ad5f8f0b..ddca34bf1 100644 --- a/configure.ac +++ b/configure.ac @@ -60,9 +60,9 @@ LT_INIT PKG_PROG_PKG_CONFIG m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], [AC_SUBST([pkgconfigdir], ['${libdir}/pkgconfig'])]) AC_CONFIG_FILES([src/knotd.pc - src/libknot/libknot.pc - src/libdnssec/libdnssec.pc - src/libzscanner/libzscanner.pc + src/libknot.pc + src/libdnssec.pc + src/libzscanner.pc ]) # Build Knot DNS daemon @@ -587,13 +587,9 @@ AC_CONFIG_FILES([Makefile samples/Makefile python/Makefile src/Makefile - src/contrib/dnstap/Makefile src/knot/modules/static_modules.h - src/libdnssec/Makefile - src/libzscanner/Makefile ]) -AC_CONFIG_FILES([src/utils/pykeymgr/pykeymgr], [chmod +x src/utils/pykeymgr/pykeymgr]) AC_CONFIG_FILES([doc/modules.rst], [cp doc/modules.rst ${srcdir}/doc/modules.rst 2>/dev/null; ln -s -f $(readlink -f ${srcdir})/src/knot/modules ${srcdir}/doc 2>/dev/null]) diff --git a/doc/.gitignore b/doc/.gitignore index 40d047987..d35d64294 100644 --- a/doc/.gitignore +++ b/doc/.gitignore @@ -8,7 +8,6 @@ /man/knotc.8 /man/knotd.8 /man/keymgr.8 -/man/pykeymgr.8 /man/kdig.1 /man/khost.1 /man/kjournalprint.1 diff --git a/doc/Makefile.am b/doc/Makefile.am index ced7badcd..b5769b20e 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -3,7 +3,6 @@ MANPAGES_IN = \ man/knotc.8in \ man/knotd.8in \ man/keymgr.8in \ - man/pykeymgr.8in \ man/kdig.1in \ man/khost.1in \ man/kjournalprint.1in \ @@ -15,7 +14,6 @@ MANPAGES_RST = \ man_knotc.rst \ man_knotd.rst \ man_keymgr.rst \ - man_pykeymgr.rst \ man_kdig.rst \ man_khost.rst \ man_kjournalprint.rst \ @@ -93,7 +91,6 @@ if HAVE_UTILS if HAVE_DAEMON man_MANS += \ man/keymgr.8 \ - man/pykeymgr.8 \ man/kjournalprint.1 \ man/kzonecheck.1 endif # HAVE_DAEMON @@ -109,7 +106,6 @@ man/knot.conf.5: man/knot.conf.5in man/knotc.8: man/knotc.8in man/knotd.8: man/knotd.8in man/keymgr.8: man/keymgr.8in -man/pykeymgr.8: man/pykeymgr.8in man/kdig.1: man/kdig.1in man/khost.1: man/khost.1in man/kjournalprint.1: man/kjournalprint.1in diff --git a/doc/conf.py b/doc/conf.py index 5fa69155a..0ae8963fe 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -222,7 +222,6 @@ man_pages = [ ('man_knotc', 'knotc', 'Knot DNS control utility', author, 8), ('man_knotd', 'knotd', 'Knot DNS server daemon', author, 8), ('man_keymgr', 'keymgr', 'Knot DNS key management utility', author, 8), - ('man_pykeymgr', 'pykeymgr', 'Knot DNS key management utility', author, 8), ('man_kdig', 'kdig', 'Advanced DNS lookup utility', author, 1), ('man_khost', 'khost', 'Simple DNS lookup utility', author, 1), ('man_kjournalprint', 'kjournalprint', 'Knot DNS journal print utility', author, 1), diff --git a/doc/man/pykeymgr.8in b/doc/man/pykeymgr.8in deleted file mode 100644 index 41de7e069..000000000 --- a/doc/man/pykeymgr.8in +++ /dev/null @@ -1,108 +0,0 @@ -.\" Man page generated from reStructuredText. -. -.TH "PYKEYMGR" "8" "@RELEASE_DATE@" "@VERSION@" "Knot DNS" -.SH NAME -pykeymgr \- Knot DNS key management utility -. -.nr rst2man-indent-level 0 -. -.de1 rstReportMargin -\\$1 \\n[an-margin] -level \\n[rst2man-indent-level] -level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] -- -\\n[rst2man-indent0] -\\n[rst2man-indent1] -\\n[rst2man-indent2] -.. -.de1 INDENT -.\" .rstReportMargin pre: -. RS \\$1 -. nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] -. nr rst2man-indent-level +1 -.\" .rstReportMargin post: -.. -.de UNINDENT -. RE -.\" indent \\n[an-margin] -.\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] -.nr rst2man-indent-level -1 -.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] -.in \\n[rst2man-indent\\n[rst2man-indent-level]]u -.. -.SH SYNOPSIS -.sp -\fBpykeymgr\fP [\fIglobal\-options\fP] [\fIcommand\fP\&...] [\fIarguments\fP\&...] -.SH DESCRIPTION -.sp -The \fBpykeymgr\fP utility serves for key management in Knot DNS server. -.sp -Functions for DNSSEC keys and KASP (Key And Signature Policy) -management are provided. -.sp -The DNSSEC and KASP configuration is stored in a so called KASP database. -The database is backed by LMDB. -.sp -The utility requires installed python LMDB module, installed e.g. by: -.INDENT 0.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ pip install lmdb -.ft P -.fi -.UNINDENT -.UNINDENT -.SS Global options -.INDENT 0.0 -.TP -\fB\-f\fP, \fB\-\-force\fP -Skip some of consistency checks and continue with performed action with a warning. -.TP -\fB\-h\fP, \fB\-\-help\fP -Print the program help. -.UNINDENT -.SS Main commands -.INDENT 0.0 -.TP -\fB\-i\fP, \fB\-\-import\fP \fIKASP_db_dir\fP -Import the legacy JSON\-format KASP database into the current LMDB\-backed one. -(You can import multiple databases at once by repeating this option.) -.UNINDENT -.SS Parameters -.INDENT 0.0 -.TP -\fIKASP_db_dir\fP -A path to the KASP db. It is the directory where \fIdata.mdb\fP and \fIlock.mdb\fP -files are usually stored as well as legacy JSON configuration and \fIkeys\fP -subdirectory containing PEM files. -.UNINDENT -.SH EXAMPLES -.INDENT 0.0 -.IP 1. 3 -Import legacy JSON\-based KASP db from Knot 2.4.x after upgrade: -.INDENT 3.0 -.INDENT 3.5 -.sp -.nf -.ft C -$ pykemgr \-i ${knot_data_dir}/keys -.ft P -.fi -.UNINDENT -.UNINDENT -.UNINDENT -.SH SEE ALSO -.sp -\fI\%RFC 6781\fP \- DNSSEC Operational Practices. -.sp -\fBknot.conf(5)\fP, -\fBknotc(8)\fP, -\fBknotd(8)\fP\&. -.SH AUTHOR -CZ.NIC Labs <http://www.knot-dns.cz> -.SH COPYRIGHT -Copyright 2010–2018, CZ.NIC, z.s.p.o. -.\" Generated by docutils manpage writer. -. diff --git a/doc/man_pykeymgr.rst b/doc/man_pykeymgr.rst deleted file mode 100644 index af320ecef..000000000 --- a/doc/man_pykeymgr.rst +++ /dev/null @@ -1,64 +0,0 @@ -.. highlight:: console - -pykeymgr – Key management utility -================================= - -Synopsis --------- - -:program:`pykeymgr` [*global-options*] [*command*...] [*arguments*...] - -Description ------------ - -The :program:`pykeymgr` utility serves for key management in Knot DNS server. - -Functions for DNSSEC keys and KASP (Key And Signature Policy) -management are provided. - -The DNSSEC and KASP configuration is stored in a so called KASP database. -The database is backed by LMDB. - -The utility requires installed python LMDB module, installed e.g. by:: - - $ pip install lmdb - -Global options -.............. - -**-f**, **--force** - Skip some of consistency checks and continue with performed action with a warning. - -**-h**, **--help** - Print the program help. - -Main commands -............. - -**-i**, **--import** *KASP_db_dir* - Import the legacy JSON-format KASP database into the current LMDB-backed one. - (You can import multiple databases at once by repeating this option.) - -Parameters -.......... - -*KASP_db_dir* - A path to the KASP db. It is the directory where `data.mdb` and `lock.mdb` - files are usually stored as well as legacy JSON configuration and `keys` - subdirectory containing PEM files. - -Examples --------- - -1. Import legacy JSON-based KASP db from Knot 2.4.x after upgrade:: - - $ pykemgr -i ${knot_data_dir}/keys - -See Also --------- - -:rfc:`6781` - DNSSEC Operational Practices. - -:manpage:`knot.conf(5)`, -:manpage:`knotc(8)`, -:manpage:`knotd(8)`. diff --git a/doc/migration.rst b/doc/migration.rst index b814e68ad..c00276bbc 100644 --- a/doc/migration.rst +++ b/doc/migration.rst @@ -39,7 +39,9 @@ KASP DB migration Knot DNS version 2.4.x and earlier uses JSON files to store DNSSEC keys metadata, one for each zone. 2.5.x versions store those in binary format in a LMDB, all zones -together. The migration is possible with ``pykeymgr`` script:: +together. The migration is possible with the +`pykeymgr <https://gitlab.labs.nic.cz/knot/knot-dns/blob/2.6/src/utils/pykeymgr/pykeymgr.in>`_ +script:: $ pykeymgr -i path/to/keydir diff --git a/doc/utilities.rst b/doc/utilities.rst index 4ff0d827d..2180942ee 100644 --- a/doc/utilities.rst +++ b/doc/utilities.rst @@ -12,7 +12,6 @@ the server. This section collects manual pages for all provided binaries: man_kdig man_keymgr - man_pykeymgr man_khost man_kjournalprint man_knotc diff --git a/src/Makefile.am b/src/Makefile.am index 4ec202912..247cea946 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,11 +1,3 @@ -ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4 -SUBDIRS = libzscanner libdnssec contrib/dnstap . - -lib_LTLIBRARIES = \ - libknot.la -noinst_LTLIBRARIES = \ - libcontrib.la - AM_CPPFLAGS = \ -include $(top_builddir)/src/config.h \ -DCONFIG_DIR='"${config_dir}"' \ @@ -14,501 +6,16 @@ AM_CPPFLAGS = \ -DMODULE_DIR='"${module_dir}"' \ -DMODULE_INSTDIR='"${module_instdir}"' -###################### -# Knot DNS Libraries # -###################### - -EXTRA_DIST = \ - contrib/licenses/0BSD \ - contrib/licenses/BSD-3-Clause \ - contrib/licenses/LGPL-2.0 \ - contrib/licenses/OLDAP-2.8 \ - contrib/lmdb/LICENSE \ - contrib/openbsd/LICENSE \ - contrib/ucw/LICENSE \ - utils/pykeymgr/pykeymgr.in - -# static: libcontrib sources -libcontrib_la_SOURCES = \ - contrib/asan.h \ - contrib/base32hex.c \ - contrib/base32hex.h \ - contrib/base64.c \ - contrib/base64.h \ - contrib/ctype.h \ - contrib/dynarray.h \ - contrib/files.c \ - contrib/files.h \ - contrib/getline.c \ - contrib/getline.h \ - contrib/macros.h \ - contrib/mempattern.c \ - contrib/mempattern.h \ - contrib/net.c \ - contrib/net.h \ - contrib/qp-trie/trie.c \ - contrib/qp-trie/trie.h \ - contrib/sockaddr.c \ - contrib/sockaddr.h \ - contrib/string.c \ - contrib/string.h \ - contrib/strtonum.h \ - contrib/time.c \ - contrib/time.h \ - contrib/tolower.h \ - contrib/trim.h \ - contrib/wire_ctx.h \ - contrib/openbsd/siphash.c \ - contrib/openbsd/siphash.h \ - contrib/openbsd/strlcat.c \ - contrib/openbsd/strlcat.h \ - contrib/openbsd/strlcpy.c \ - contrib/openbsd/strlcpy.h \ - contrib/ucw/array-sort.h \ - contrib/ucw/binsearch.h \ - contrib/ucw/heap.c \ - contrib/ucw/heap.h \ - contrib/ucw/lists.c \ - contrib/ucw/lists.h \ - contrib/ucw/mempool.c \ - contrib/ucw/mempool.h - -if !HAVE_LMDB -libcontrib_la_SOURCES += \ - contrib/lmdb/lmdb.h \ - contrib/lmdb/mdb.c \ - contrib/lmdb/midl.c \ - contrib/lmdb/midl.h -endif !HAVE_LMDB - -libcontrib_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) -libcontrib_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAG_EXCLUDE_LIBS) - -# libknot headers -libknot_ladir = $(includedir) -nobase_libknot_la_HEADERS = \ - libknot/attribute.h \ - libknot/codes.h \ - libknot/consts.h \ - libknot/control/control.h \ - libknot/cookies.h \ - libknot/descriptor.h \ - libknot/dname.h \ - libknot/endian.h \ - libknot/errcode.h \ - libknot/error.h \ - libknot/libknot.h \ - libknot/lookup.h \ - libknot/mm_ctx.h \ - libknot/db/db.h \ - libknot/db/db_lmdb.h \ - libknot/db/db_trie.h \ - libknot/packet/compr.h \ - libknot/packet/pkt.h \ - libknot/packet/rrset-wire.h \ - libknot/packet/wire.h \ - libknot/rdata.h \ - libknot/rdataset.h \ - libknot/rrset-dump.h \ - libknot/rrset.h \ - libknot/rrtype/dnskey.h \ - libknot/rrtype/ds.h \ - libknot/rrtype/naptr.h \ - libknot/rrtype/nsec.h \ - libknot/rrtype/nsec3.h \ - libknot/rrtype/nsec3param.h \ - libknot/rrtype/opt.h \ - libknot/rrtype/rdname.h \ - libknot/rrtype/rrsig.h \ - libknot/rrtype/soa.h \ - libknot/rrtype/tsig.h \ - libknot/tsig-op.h \ - libknot/tsig.h \ - libknot/wire.h \ - libknot/yparser/yparser.h \ - libknot/yparser/ypformat.h \ - libknot/yparser/ypschema.h \ - libknot/yparser/yptrafo.h \ - libknot/version.h - -# dynamic: libknot sources -libknot_la_SOURCES = \ - libknot/codes.c \ - libknot/control/control.c \ - libknot/cookies.c \ - libknot/descriptor.c \ - libknot/dname.c \ - libknot/error.c \ - libknot/db/db_lmdb.c \ - libknot/db/db_trie.c \ - libknot/packet/pkt.c \ - libknot/packet/rrset-wire.c \ - libknot/rdataset.c \ - libknot/rrset-dump.c \ - libknot/rrset.c \ - libknot/rrtype/naptr.c \ - libknot/rrtype/opt.c \ - libknot/rrtype/tsig.c \ - libknot/tsig-op.c \ - libknot/tsig.c \ - libknot/yparser/yparser.c \ - libknot/yparser/ypbody.c \ - libknot/yparser/ypformat.c \ - libknot/yparser/ypschema.c \ - libknot/yparser/yptrafo.c \ - $(nobase_libknot_la_HEADERS) - -libknot_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(lmdb_CFLAGS) -libknot_la_LDFLAGS = $(AM_LDFLAGS) $(libknot_VERSION_INFO) $(lmdb_LIBS) \ - $(LDFLAG_EXCLUDE_LIBS) -libknot_la_LIBADD = libdnssec/libdnssec.la libcontrib.la - -# pkg-config -pkgconfig_DATA = knotd.pc libknot/libknot.pc - -# static: utilities shared -libknotus_la_SOURCES = \ - utils/common/cert.c \ - utils/common/cert.h \ - utils/common/exec.c \ - utils/common/exec.h \ - utils/common/hex.c \ - utils/common/hex.h \ - utils/common/lookup.c \ - utils/common/lookup.h \ - utils/common/msg.c \ - utils/common/msg.h \ - utils/common/netio.c \ - utils/common/netio.h \ - utils/common/params.c \ - utils/common/params.h \ - utils/common/resolv.c \ - utils/common/resolv.h \ - utils/common/sign.c \ - utils/common/sign.h \ - utils/common/tls.c \ - utils/common/tls.h \ - utils/common/token.c \ - utils/common/token.h - -libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libidn2_LIBS) \ - $(libidn_CFLAGS) $(libedit_CFLAGS) $(gnutls_CFLAGS) -libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAG_EXCLUDE_LIBS) -libknotus_la_LIBADD = libcontrib.la libknot.la $(libidn2_LIBS) $(libidn_LIBS) \ - $(libedit_LIBS) $(gnutls_LIBS) - -libknotd_la_SOURCES = \ - knot/conf/base.c \ - knot/conf/base.h \ - knot/conf/conf.c \ - knot/conf/conf.h \ - knot/conf/confdb.c \ - knot/conf/confdb.h \ - knot/conf/confio.c \ - knot/conf/confio.h \ - knot/conf/migration.c \ - knot/conf/migration.h \ - knot/conf/module.h \ - knot/conf/module.c \ - knot/conf/schema.c \ - knot/conf/schema.h \ - knot/conf/tools.c \ - knot/conf/tools.h \ - knot/ctl/commands.c \ - knot/ctl/commands.h \ - knot/ctl/process.c \ - knot/ctl/process.h \ - knot/dnssec/context.c \ - knot/dnssec/context.h \ - knot/dnssec/ds_query.c \ - knot/dnssec/ds_query.h \ - knot/dnssec/kasp/kasp_db.c \ - knot/dnssec/kasp/kasp_db.h \ - knot/dnssec/kasp/kasp_zone.c \ - knot/dnssec/kasp/kasp_zone.h \ - knot/dnssec/kasp/keystate.c \ - knot/dnssec/kasp/keystate.h \ - knot/dnssec/kasp/keystore.c \ - knot/dnssec/kasp/keystore.h \ - knot/dnssec/kasp/policy.h \ - knot/dnssec/key-events.c \ - knot/dnssec/key-events.h \ - knot/dnssec/nsec-chain.c \ - knot/dnssec/nsec-chain.h \ - knot/dnssec/nsec3-chain.c \ - knot/dnssec/nsec3-chain.h \ - knot/dnssec/policy.c \ - knot/dnssec/policy.h \ - knot/dnssec/rrset-sign.c \ - knot/dnssec/rrset-sign.h \ - knot/dnssec/zone-events.c \ - knot/dnssec/zone-events.h \ - knot/dnssec/zone-keys.c \ - knot/dnssec/zone-keys.h \ - knot/dnssec/zone-nsec.c \ - knot/dnssec/zone-nsec.h \ - knot/dnssec/zone-sign.c \ - knot/dnssec/zone-sign.h \ - knot/events/events.c \ - knot/events/events.h \ - knot/events/handlers.h \ - knot/events/handlers/dnssec.c \ - knot/events/handlers/expire.c \ - knot/events/handlers/flush.c \ - knot/events/handlers/freeze_thaw.c \ - knot/events/handlers/load.c \ - knot/events/handlers/notify.c \ - knot/events/handlers/nsec3resalt.c \ - knot/events/handlers/refresh.c \ - knot/events/handlers/update.c \ - knot/events/handlers/parent_ds_query.c \ - knot/events/log.c \ - knot/events/log.h \ - knot/events/replan.c \ - knot/events/replan.h \ - knot/nameserver/axfr.c \ - knot/nameserver/axfr.h \ - knot/nameserver/chaos.c \ - knot/nameserver/chaos.h \ - knot/nameserver/internet.c \ - knot/nameserver/internet.h \ - knot/nameserver/ixfr.c \ - knot/nameserver/ixfr.h \ - knot/nameserver/log.h \ - knot/nameserver/notify.c \ - knot/nameserver/notify.h \ - knot/nameserver/nsec_proofs.c \ - knot/nameserver/nsec_proofs.h \ - knot/nameserver/process_query.c \ - knot/nameserver/process_query.h \ - knot/nameserver/query_module.c \ - knot/nameserver/query_module.h \ - knot/nameserver/tsig_ctx.c \ - knot/nameserver/tsig_ctx.h \ - knot/nameserver/update.c \ - knot/nameserver/update.h \ - knot/nameserver/xfr.c \ - knot/nameserver/xfr.h \ - knot/query/capture.c \ - knot/query/capture.h \ - knot/query/layer.h \ - knot/query/query.c \ - knot/query/query.h \ - knot/query/requestor.c \ - knot/query/requestor.h \ - knot/common/evsched.c \ - knot/common/evsched.h \ - knot/common/fdset.c \ - knot/common/fdset.h \ - knot/common/log.c \ - knot/common/log.h \ - knot/common/process.c \ - knot/common/process.h \ - knot/common/ref.c \ - knot/common/ref.h \ - knot/common/stats.c \ - knot/common/stats.h \ - knot/server/dthreads.c \ - knot/server/dthreads.h \ - knot/journal/journal.c \ - knot/journal/journal.h \ - knot/journal/serialization.c \ - knot/journal/serialization.h \ - knot/server/server.c \ - knot/server/server.h \ - knot/server/tcp-handler.c \ - knot/server/tcp-handler.h \ - knot/server/udp-handler.c \ - knot/server/udp-handler.h \ - knot/updates/acl.c \ - knot/updates/acl.h \ - knot/updates/apply.c \ - knot/updates/apply.h \ - knot/updates/changesets.c \ - knot/updates/changesets.h \ - knot/updates/ddns.c \ - knot/updates/ddns.h \ - knot/updates/zone-update.c \ - knot/updates/zone-update.h \ - knot/worker/pool.c \ - knot/worker/pool.h \ - knot/worker/queue.c \ - knot/worker/queue.h \ - knot/zone/contents.c \ - knot/zone/contents.h \ - knot/zone/node.c \ - knot/zone/node.h \ - knot/zone/semantic-check.c \ - knot/zone/semantic-check.h \ - knot/zone/serial.c \ - knot/zone/serial.h \ - knot/zone/timers.c \ - knot/zone/timers.h \ - knot/zone/zone-diff.c \ - knot/zone/zone-diff.h \ - knot/zone/zone-dump.c \ - knot/zone/zone-dump.h \ - knot/zone/zone-load.c \ - knot/zone/zone-load.h \ - knot/zone/zone-tree.c \ - knot/zone/zone-tree.h \ - knot/zone/zone.c \ - knot/zone/zone.h \ - knot/zone/zonedb-load.c \ - knot/zone/zonedb-load.h \ - knot/zone/zonedb.c \ - knot/zone/zonedb.h \ - knot/zone/zonefile.c \ - knot/zone/zonefile.h - -libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(systemd_CFLAGS) \ - $(liburcu_CFLAGS) -DKNOTD_MOD_STATIC -libknotd_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^knotd_' -libknotd_la_LIBADD = libknot.la libzscanner/libzscanner.la $(systemd_LIBS) \ - $(liburcu_LIBS) - -################### -# Knot DNS Daemon # -################### - -if HAVE_DAEMON - -sbin_PROGRAMS = knotc knotd keymgr -sbin_SCRIPTS = utils/pykeymgr/pykeymgr -noinst_LTLIBRARIES += libknotd.la libknotus.la -CLEAN_FILES = $(sbin_SCRIPTS) - -knotddir = $(includedir)/knot -knotd_HEADERS = \ - knot/include/module.h - -knotc_SOURCES = \ - utils/knotc/commands.c \ - utils/knotc/commands.h \ - utils/knotc/estimator.c \ - utils/knotc/estimator.h \ - utils/knotc/interactive.c \ - utils/knotc/interactive.h \ - utils/knotc/process.c \ - utils/knotc/process.h \ - utils/knotc/main.c - -knotd_SOURCES = \ - utils/knotd/main.c - -keymgr_SOURCES = \ - utils/keymgr/bind_privkey.c \ - utils/keymgr/bind_privkey.h \ - utils/keymgr/functions.c \ - utils/keymgr/functions.h \ - utils/keymgr/main.c - -knotd_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(liburcu_CFLAGS) -knotd_LDADD = libknotd.la libcontrib.la $(liburcu_LIBS) -knotd_LDFLAGS = $(AM_LDFLAGS) -rdynamic -knotc_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libedit_CFLAGS) -knotc_LDADD = libknotd.la libcontrib.la libknotus.la $(libedit_LIBS) -knotc_LDFLAGS = $(AM_LDFLAGS) -rdynamic -keymgr_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libdnssec $(gnutls_CFLAGS) -keymgr_LDADD = libknotd.la libcontrib.la libknotus.la libdnssec/libdnssec.la \ - libdnssec/libshared.la libzscanner/libzscanner.la - -#################################### -# Optional Knot DNS Daemon modules # -#################################### - -# Create storage and run-time directories -install-data-hook: - $(INSTALL) -d $(DESTDIR)/@config_dir@ - $(INSTALL) -d $(DESTDIR)/@run_dir@ - $(INSTALL) -d $(DESTDIR)/@storage_dir@ - -endif # HAVE_DAEMON - -###################### -# Knot DNS Utilities # -###################### - -if HAVE_UTILS - -bin_PROGRAMS = kdig khost knsec3hash knsupdate -if HAVE_DAEMON -bin_PROGRAMS += kzonecheck kjournalprint -endif # HAVE_DAEMON - -kdig_SOURCES = \ - utils/kdig/kdig_exec.c \ - utils/kdig/kdig_exec.h \ - utils/kdig/kdig_main.c \ - utils/kdig/kdig_params.c \ - utils/kdig/kdig_params.h - -khost_SOURCES = \ - utils/kdig/kdig_exec.c \ - utils/kdig/kdig_exec.h \ - utils/kdig/kdig_params.c \ - utils/kdig/kdig_params.h \ - utils/khost/khost_main.c \ - utils/khost/khost_params.c \ - utils/khost/khost_params.h - -knsec3hash_SOURCES = \ - utils/knsec3hash/knsec3hash.c - -knsupdate_SOURCES = \ - utils/knsupdate/knsupdate_exec.c \ - utils/knsupdate/knsupdate_exec.h \ - utils/knsupdate/knsupdate_main.c \ - utils/knsupdate/knsupdate_params.c \ - utils/knsupdate/knsupdate_params.h - -kzonecheck_SOURCES = \ - utils/kzonecheck/main.c \ - utils/kzonecheck/zone_check.c \ - utils/kzonecheck/zone_check.h - -kjournalprint_SOURCES = \ - utils/kjournalprint/main.c - -# bin programs -kdig_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) -kdig_LDADD = libknotus.la -khost_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) -khost_LDADD = libknotus.la -knsupdate_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) -knsupdate_LDADD = libknotus.la libzscanner/libzscanner.la -knsec3hash_CPPFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libdnssec -knsec3hash_LDADD = libknot.la libcontrib.la libdnssec/libdnssec.la libdnssec/libshared.la -kzonecheck_CPPFLAGS = $(AM_CPPFLAGS) -kzonecheck_LDADD = libknotd.la libcontrib.la -kjournalprint_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) -kjournalprint_LDADD = libknotd.la libcontrib.la - -####################################### -# Optional Knot DNS Utilities modules # -####################################### - -if HAVE_DNSTAP -kdig_LDADD += $(DNSTAP_LIBS) contrib/dnstap/libdnstap.la -khost_LDADD += $(DNSTAP_LIBS) contrib/dnstap/libdnstap.la -kdig_CPPFLAGS += $(DNSTAP_CFLAGS) -khost_CPPFLAGS += $(DNSTAP_CFLAGS) -endif # HAVE_DNSTAP - -endif # HAVE_UTILS - -KNOTD_MOD_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) -KNOTD_MOD_LDFLAGS = $(AM_LDFLAGS) -module -shared -avoid-version - -pkglibdir = $(module_instdir) -pkglib_LTLIBRARIES = - -include $(srcdir)/knot/modules/cookies/Makefile.inc -include $(srcdir)/knot/modules/dnsproxy/Makefile.inc -include $(srcdir)/knot/modules/dnstap/Makefile.inc -include $(srcdir)/knot/modules/noudp/Makefile.inc -include $(srcdir)/knot/modules/onlinesign/Makefile.inc -include $(srcdir)/knot/modules/rrl/Makefile.inc -include $(srcdir)/knot/modules/stats/Makefile.inc -include $(srcdir)/knot/modules/synthrecord/Makefile.inc -include $(srcdir)/knot/modules/whoami/Makefile.inc +EXTRA_DIST = +CLEANFILES = +BUILT_SOURCES = +lib_LTLIBRARIES = +noinst_LTLIBRARIES = +pkgconfig_DATA = + +include $(srcdir)/contrib/Makefile.inc +include $(srcdir)/libdnssec/Makefile.inc +include $(srcdir)/libknot/Makefile.inc +include $(srcdir)/libzscanner/Makefile.inc +include $(srcdir)/knot/Makefile.inc +include $(srcdir)/utils/Makefile.inc diff --git a/src/contrib/Makefile.inc b/src/contrib/Makefile.inc new file mode 100644 index 000000000..7d2914010 --- /dev/null +++ b/src/contrib/Makefile.inc @@ -0,0 +1,98 @@ +noinst_LTLIBRARIES += libcontrib.la + +libcontrib_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) +libcontrib_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAG_EXCLUDE_LIBS) + +EXTRA_DIST += \ + contrib/licenses/0BSD \ + contrib/licenses/BSD-3-Clause \ + contrib/licenses/LGPL-2.0 \ + contrib/licenses/OLDAP-2.8 \ + contrib/lmdb/LICENSE \ + contrib/openbsd/LICENSE \ + contrib/ucw/LICENSE \ + contrib/dnstap/dnstap.proto + +libcontrib_la_SOURCES = \ + contrib/asan.h \ + contrib/base32hex.c \ + contrib/base32hex.h \ + contrib/base64.c \ + contrib/base64.h \ + contrib/ctype.h \ + contrib/dynarray.h \ + contrib/files.c \ + contrib/files.h \ + contrib/getline.c \ + contrib/getline.h \ + contrib/macros.h \ + contrib/mempattern.c \ + contrib/mempattern.h \ + contrib/net.c \ + contrib/net.h \ + contrib/qp-trie/trie.c \ + contrib/qp-trie/trie.h \ + contrib/sockaddr.c \ + contrib/sockaddr.h \ + contrib/string.c \ + contrib/string.h \ + contrib/strtonum.h \ + contrib/time.c \ + contrib/time.h \ + contrib/tolower.h \ + contrib/trim.h \ + contrib/wire_ctx.h \ + contrib/openbsd/siphash.c \ + contrib/openbsd/siphash.h \ + contrib/openbsd/strlcat.c \ + contrib/openbsd/strlcat.h \ + contrib/openbsd/strlcpy.c \ + contrib/openbsd/strlcpy.h \ + contrib/ucw/array-sort.h \ + contrib/ucw/binsearch.h \ + contrib/ucw/heap.c \ + contrib/ucw/heap.h \ + contrib/ucw/lists.c \ + contrib/ucw/lists.h \ + contrib/ucw/mempool.c \ + contrib/ucw/mempool.h + +if !HAVE_LMDB +libcontrib_la_SOURCES += \ + contrib/lmdb/lmdb.h \ + contrib/lmdb/mdb.c \ + contrib/lmdb/midl.c \ + contrib/lmdb/midl.h +endif !HAVE_LMDB + +if HAVE_DNSTAP +SUFFIXES = .proto .pb-c.c .pb-c.h + +.proto.pb-c.c: + $(AM_V_GEN)@PROTOC_C@ --c_out=. -I$(srcdir) $< + +.proto.pb-c.h: + $(AM_V_GEN)@PROTOC_C@ --c_out=. -I$(srcdir) $< + +libcontrib_la_SOURCES += \ + contrib/dnstap/convert.c \ + contrib/dnstap/convert.h \ + contrib/dnstap/dnstap.c \ + contrib/dnstap/dnstap.h \ + contrib/dnstap/message.c \ + contrib/dnstap/message.h \ + contrib/dnstap/reader.c \ + contrib/dnstap/reader.h \ + contrib/dnstap/writer.c \ + contrib/dnstap/writer.h + +nodist_libcontrib_la_SOURCES = \ + contrib/dnstap/dnstap.pb-c.c \ + contrib/dnstap/dnstap.pb-c.h + +libcontrib_la_CPPFLAGS += $(DNSTAP_CFLAGS) +libcontrib_la_LDFLAGS += $(DNSTAP_LIBS) + +BUILT_SOURCES += $(nodist_libcontrib_la_SOURCES) +CLEANFILES += $(nodist_libcontrib_la_SOURCES) +endif HAVE_DNSTAP diff --git a/src/contrib/dnstap/Makefile.am b/src/contrib/dnstap/Makefile.am deleted file mode 100644 index 186487f91..000000000 --- a/src/contrib/dnstap/Makefile.am +++ /dev/null @@ -1,51 +0,0 @@ -ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4 -AM_CPPFLAGS = \ - -include $(top_builddir)/src/config.h \ - -I$(top_srcdir)/src - -EXTRA_DIST = \ - dnstap.proto - -if HAVE_DNSTAP - -SUFFIXES = .proto .pb-c.c .pb-c.h - -.proto.pb-c.c: - $(AM_V_GEN)@PROTOC_C@ --c_out=. -I$(srcdir) $< - -.proto.pb-c.h: - $(AM_V_GEN)@PROTOC_C@ --c_out=. -I$(srcdir) $< - -noinst_LTLIBRARIES = libdnstap.la - -libdnstap_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(CFLAG_VISIBILITY) - -libdnstap_la_CFLAGS = \ - $(DNSTAP_CFLAGS) - -libdnstap_la_LDFLAGS = \ - $(DNSTAP_LIBS) \ - $(LDFLAG_EXCLUDE_LIBS) - -libdnstap_la_SOURCES = \ - convert.c \ - convert.h \ - dnstap.c \ - dnstap.h \ - message.c \ - message.h \ - reader.c \ - reader.h \ - writer.c \ - writer.h - -nodist_libdnstap_la_SOURCES = \ - dnstap.pb-c.c \ - dnstap.pb-c.h - -BUILT_SOURCES = $(nodist_libdnstap_la_SOURCES) -CLEANFILES = $(nodist_libdnstap_la_SOURCES) - -endif diff --git a/src/contrib/files.c b/src/contrib/files.c index 581e809ed..3181386c1 100644 --- a/src/contrib/files.c +++ b/src/contrib/files.c @@ -14,18 +14,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "files.h" - #include <assert.h> #include <dirent.h> #include <fcntl.h> #include <ftw.h> -#include <stdbool.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> + +#include "contrib/files.h" #include "contrib/string.h" #include "libknot/errcode.h" diff --git a/src/knot/Makefile.inc b/src/knot/Makefile.inc new file mode 100644 index 000000000..e992fd3ba --- /dev/null +++ b/src/knot/Makefile.inc @@ -0,0 +1,194 @@ +libknotd_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(systemd_CFLAGS) \ + $(liburcu_CFLAGS) -DKNOTD_MOD_STATIC +libknotd_la_LDFLAGS = $(AM_LDFLAGS) -export-symbols-regex '^knotd_' +libknotd_la_LIBADD = libcontrib.la libknot.la libzscanner.la $(systemd_LIBS) \ + $(liburcu_LIBS) + +include_libknotddir = $(includedir)/knot +include_libknotd_HEADERS = \ + knot/include/module.h + +libknotd_la_SOURCES = \ + knot/conf/base.c \ + knot/conf/base.h \ + knot/conf/conf.c \ + knot/conf/conf.h \ + knot/conf/confdb.c \ + knot/conf/confdb.h \ + knot/conf/confio.c \ + knot/conf/confio.h \ + knot/conf/migration.c \ + knot/conf/migration.h \ + knot/conf/module.h \ + knot/conf/module.c \ + knot/conf/schema.c \ + knot/conf/schema.h \ + knot/conf/tools.c \ + knot/conf/tools.h \ + knot/ctl/commands.c \ + knot/ctl/commands.h \ + knot/ctl/process.c \ + knot/ctl/process.h \ + knot/dnssec/context.c \ + knot/dnssec/context.h \ + knot/dnssec/ds_query.c \ + knot/dnssec/ds_query.h \ + knot/dnssec/kasp/kasp_db.c \ + knot/dnssec/kasp/kasp_db.h \ + knot/dnssec/kasp/kasp_zone.c \ + knot/dnssec/kasp/kasp_zone.h \ + knot/dnssec/kasp/keystate.c \ + knot/dnssec/kasp/keystate.h \ + knot/dnssec/kasp/keystore.c \ + knot/dnssec/kasp/keystore.h \ + knot/dnssec/kasp/policy.h \ + knot/dnssec/key-events.c \ + knot/dnssec/key-events.h \ + knot/dnssec/nsec-chain.c \ + knot/dnssec/nsec-chain.h \ + knot/dnssec/nsec3-chain.c \ + knot/dnssec/nsec3-chain.h \ + knot/dnssec/policy.c \ + knot/dnssec/policy.h \ + knot/dnssec/rrset-sign.c \ + knot/dnssec/rrset-sign.h \ + knot/dnssec/zone-events.c \ + knot/dnssec/zone-events.h \ + knot/dnssec/zone-keys.c \ + knot/dnssec/zone-keys.h \ + knot/dnssec/zone-nsec.c \ + knot/dnssec/zone-nsec.h \ + knot/dnssec/zone-sign.c \ + knot/dnssec/zone-sign.h \ + knot/events/events.c \ + knot/events/events.h \ + knot/events/handlers.h \ + knot/events/handlers/dnssec.c \ + knot/events/handlers/expire.c \ + knot/events/handlers/flush.c \ + knot/events/handlers/freeze_thaw.c \ + knot/events/handlers/load.c \ + knot/events/handlers/notify.c \ + knot/events/handlers/nsec3resalt.c \ + knot/events/handlers/refresh.c \ + knot/events/handlers/update.c \ + knot/events/handlers/parent_ds_query.c \ + knot/events/log.c \ + knot/events/log.h \ + knot/events/replan.c \ + knot/events/replan.h \ + knot/nameserver/axfr.c \ + knot/nameserver/axfr.h \ + knot/nameserver/chaos.c \ + knot/nameserver/chaos.h \ + knot/nameserver/internet.c \ + knot/nameserver/internet.h \ + knot/nameserver/ixfr.c \ + knot/nameserver/ixfr.h \ + knot/nameserver/log.h \ + knot/nameserver/notify.c \ + knot/nameserver/notify.h \ + knot/nameserver/nsec_proofs.c \ + knot/nameserver/nsec_proofs.h \ + knot/nameserver/process_query.c \ + knot/nameserver/process_query.h \ + knot/nameserver/query_module.c \ + knot/nameserver/query_module.h \ + knot/nameserver/tsig_ctx.c \ + knot/nameserver/tsig_ctx.h \ + knot/nameserver/update.c \ + knot/nameserver/update.h \ + knot/nameserver/xfr.c \ + knot/nameserver/xfr.h \ + knot/query/capture.c \ + knot/query/capture.h \ + knot/query/layer.h \ + knot/query/query.c \ + knot/query/query.h \ + knot/query/requestor.c \ + knot/query/requestor.h \ + knot/common/evsched.c \ + knot/common/evsched.h \ + knot/common/fdset.c \ + knot/common/fdset.h \ + knot/common/log.c \ + knot/common/log.h \ + knot/common/process.c \ + knot/common/process.h \ + knot/common/ref.c \ + knot/common/ref.h \ + knot/common/stats.c \ + knot/common/stats.h \ + knot/server/dthreads.c \ + knot/server/dthreads.h \ + knot/journal/journal.c \ + knot/journal/journal.h \ + knot/journal/serialization.c \ + knot/journal/serialization.h \ + knot/server/server.c \ + knot/server/server.h \ + knot/server/tcp-handler.c \ + knot/server/tcp-handler.h \ + knot/server/udp-handler.c \ + knot/server/udp-handler.h \ + knot/updates/acl.c \ + knot/updates/acl.h \ + knot/updates/apply.c \ + knot/updates/apply.h \ + knot/updates/changesets.c \ + knot/updates/changesets.h \ + knot/updates/ddns.c \ + knot/updates/ddns.h \ + knot/updates/zone-update.c \ + knot/updates/zone-update.h \ + knot/worker/pool.c \ + knot/worker/pool.h \ + knot/worker/queue.c \ + knot/worker/queue.h \ + knot/zone/contents.c \ + knot/zone/contents.h \ + knot/zone/node.c \ + knot/zone/node.h \ + knot/zone/semantic-check.c \ + knot/zone/semantic-check.h \ + knot/zone/serial.c \ + knot/zone/serial.h \ + knot/zone/timers.c \ + knot/zone/timers.h \ + knot/zone/zone-diff.c \ + knot/zone/zone-diff.h \ + knot/zone/zone-dump.c \ + knot/zone/zone-dump.h \ + knot/zone/zone-load.c \ + knot/zone/zone-load.h \ + knot/zone/zone-tree.c \ + knot/zone/zone-tree.h \ + knot/zone/zone.c \ + knot/zone/zone.h \ + knot/zone/zonedb-load.c \ + knot/zone/zonedb-load.h \ + knot/zone/zonedb.c \ + knot/zone/zonedb.h \ + knot/zone/zonefile.c \ + knot/zone/zonefile.h + +if HAVE_DAEMON +noinst_LTLIBRARIES += libknotd.la +pkgconfig_DATA += knotd.pc +endif HAVE_DAEMON + +KNOTD_MOD_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) +KNOTD_MOD_LDFLAGS = $(AM_LDFLAGS) -module -shared -avoid-version + +pkglibdir = $(module_instdir) +pkglib_LTLIBRARIES = + +include $(srcdir)/knot/modules/cookies/Makefile.inc +include $(srcdir)/knot/modules/dnsproxy/Makefile.inc +include $(srcdir)/knot/modules/dnstap/Makefile.inc +include $(srcdir)/knot/modules/noudp/Makefile.inc +include $(srcdir)/knot/modules/onlinesign/Makefile.inc +include $(srcdir)/knot/modules/rrl/Makefile.inc +include $(srcdir)/knot/modules/stats/Makefile.inc +include $(srcdir)/knot/modules/synthrecord/Makefile.inc +include $(srcdir)/knot/modules/whoami/Makefile.inc diff --git a/src/knot/modules/dnstap/Makefile.inc b/src/knot/modules/dnstap/Makefile.inc index 8c6bef006..aefe0c77f 100644 --- a/src/knot/modules/dnstap/Makefile.inc +++ b/src/knot/modules/dnstap/Makefile.inc @@ -4,12 +4,12 @@ EXTRA_DIST += knot/modules/dnstap/dnstap.rst if STATIC_MODULE_dnstap libknotd_la_SOURCES += $(knot_modules_dnstap_la_SOURCES) libknotd_la_CPPFLAGS += $(DNSTAP_CFLAGS) -libknotd_la_LIBADD += $(DNSTAP_LIBS) contrib/dnstap/libdnstap.la +libknotd_la_LIBADD += $(DNSTAP_LIBS) libcontrib.la endif if SHARED_MODULE_dnstap knot_modules_dnstap_la_LDFLAGS = $(KNOTD_MOD_LDFLAGS) knot_modules_dnstap_la_CPPFLAGS = $(KNOTD_MOD_CPPFLAGS) $(DNSTAP_CFLAGS) -knot_modules_dnstap_la_LIBADD = $(DNSTAP_LIBS) contrib/dnstap/libdnstap.la libcontrib.la +knot_modules_dnstap_la_LIBADD = $(DNSTAP_LIBS) libcontrib.la pkglib_LTLIBRARIES += knot/modules/dnstap.la endif diff --git a/src/libdnssec/libdnssec.pc.in b/src/libdnssec.pc.in index 7b2a68c5c..7b2a68c5c 100644 --- a/src/libdnssec/libdnssec.pc.in +++ b/src/libdnssec.pc.in diff --git a/src/libdnssec/.gitignore b/src/libdnssec/.gitignore deleted file mode 100644 index e781c625f..000000000 --- a/src/libdnssec/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/libdnssec.pc -/Makefile -/Makefile.in -/version.h diff --git a/src/libdnssec/Makefile.am b/src/libdnssec/Makefile.am deleted file mode 100644 index 50c9108a9..000000000 --- a/src/libdnssec/Makefile.am +++ /dev/null @@ -1,95 +0,0 @@ -AM_CPPFLAGS = \ - -include $(top_builddir)/src/config.h \ - -I$(top_srcdir)/src \ - $(gnutls_CFLAGS) - -noinst_LTLIBRARIES = libshared.la -lib_LTLIBRARIES = libdnssec.la - -libshared_la_CPPFLAGS = \ - $(AM_CPPFLAGS) - -libshared_la_SOURCES = \ - shared/bignum.c \ - shared/bignum.h \ - shared/binary_wire.h \ - shared/dname.c \ - shared/dname.h \ - shared/fs.c \ - shared/fs.h \ - shared/hex.c \ - shared/hex.h \ - shared/keyid_gnutls.c \ - shared/keyid_gnutls.h \ - shared/pem.c \ - shared/pem.h \ - shared/shared.h - -libdnssec_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(CFLAG_VISIBILITY) - -libdnssec_la_LDFLAGS = \ - $(gnutls_LIBS) \ - $(libdnssec_VERSION_INFO) - -libdnssec_la_LIBADD = \ - libshared.la - -include_libdnssecdir=$(includedir)/libdnssec -include_libdnssec_HEADERS = \ - binary.h \ - crypto.h \ - dnssec.h \ - error.h \ - key.h \ - keyid.h \ - keystore.h \ - keytag.h \ - list.h \ - nsec.h \ - random.h \ - sign.h \ - tsig.h \ - version.h - -libdnssec_la_SOURCES = \ - contrib/vpool.c \ - contrib/vpool.h \ - binary.c \ - crypto.c \ - error.c \ - key/algorithm.c \ - key/algorithm.h \ - key/convert.c \ - key/convert.h \ - key/dnskey.c \ - key/dnskey.h \ - key/ds.c \ - key/internal.h \ - key/key.c \ - key/keytag.c \ - key/privkey.c \ - key/privkey.h \ - key/simple.c \ - keyid.c \ - keystore/internal.h \ - keystore/keystore.c \ - keystore/pkcs11.c \ - keystore/pkcs8.c \ - keystore/pkcs8_dir.c \ - list/list.c \ - list/ucw_clists.h \ - nsec/bitmap.c \ - nsec/hash.c \ - nsec/nsec.c \ - p11/p11.c \ - p11/p11.h \ - random.c \ - sign/der.c \ - sign/der.h \ - sign/sign.c \ - tsig.c - -# pkg-config -pkgconfig_DATA = libdnssec.pc diff --git a/src/libdnssec/Makefile.inc b/src/libdnssec/Makefile.inc new file mode 100644 index 000000000..0f6bd2e88 --- /dev/null +++ b/src/libdnssec/Makefile.inc @@ -0,0 +1,82 @@ +lib_LTLIBRARIES += libdnssec.la +pkgconfig_DATA += libdnssec.pc + +noinst_LTLIBRARIES += libshared.la + +libshared_la_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) + +libshared_la_SOURCES = \ + libdnssec/shared/bignum.c \ + libdnssec/shared/bignum.h \ + libdnssec/shared/binary_wire.h \ + libdnssec/shared/dname.c \ + libdnssec/shared/dname.h \ + libdnssec/shared/fs.c \ + libdnssec/shared/fs.h \ + libdnssec/shared/hex.c \ + libdnssec/shared/hex.h \ + libdnssec/shared/keyid_gnutls.c \ + libdnssec/shared/keyid_gnutls.h \ + libdnssec/shared/pem.c \ + libdnssec/shared/pem.h \ + libdnssec/shared/shared.h + +libdnssec_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(gnutls_CFLAGS) +libdnssec_la_LDFLAGS = $(AM_LDFLAGS) $(libdnssec_VERSION_INFO) $(gnutls_LIBS) \ + $(LDFLAG_EXCLUDE_LIBS) +libdnssec_la_LIBADD = libshared.la + +include_libdnssecdir = $(includedir)/libdnssec +include_libdnssec_HEADERS = \ + libdnssec/binary.h \ + libdnssec/crypto.h \ + libdnssec/dnssec.h \ + libdnssec/error.h \ + libdnssec/key.h \ + libdnssec/keyid.h \ + libdnssec/keystore.h \ + libdnssec/keytag.h \ + libdnssec/list.h \ + libdnssec/nsec.h \ + libdnssec/random.h \ + libdnssec/sign.h \ + libdnssec/tsig.h \ + libdnssec/version.h + +libdnssec_la_SOURCES = \ + libdnssec/contrib/vpool.c \ + libdnssec/contrib/vpool.h \ + libdnssec/binary.c \ + libdnssec/crypto.c \ + libdnssec/error.c \ + libdnssec/key/algorithm.c \ + libdnssec/key/algorithm.h \ + libdnssec/key/convert.c \ + libdnssec/key/convert.h \ + libdnssec/key/dnskey.c \ + libdnssec/key/dnskey.h \ + libdnssec/key/ds.c \ + libdnssec/key/internal.h \ + libdnssec/key/key.c \ + libdnssec/key/keytag.c \ + libdnssec/key/privkey.c \ + libdnssec/key/privkey.h \ + libdnssec/key/simple.c \ + libdnssec/keyid.c \ + libdnssec/keystore/internal.h \ + libdnssec/keystore/keystore.c \ + libdnssec/keystore/pkcs11.c \ + libdnssec/keystore/pkcs8.c \ + libdnssec/keystore/pkcs8_dir.c \ + libdnssec/list/list.c \ + libdnssec/list/ucw_clists.h \ + libdnssec/nsec/bitmap.c \ + libdnssec/nsec/hash.c \ + libdnssec/nsec/nsec.c \ + libdnssec/p11/p11.c \ + libdnssec/p11/p11.h \ + libdnssec/random.c \ + libdnssec/sign/der.c \ + libdnssec/sign/der.h \ + libdnssec/sign/sign.c \ + libdnssec/tsig.c diff --git a/src/libdnssec/binary.c b/src/libdnssec/binary.c index 96705cf1b..a57b421c6 100644 --- a/src/libdnssec/binary.c +++ b/src/libdnssec/binary.c @@ -17,16 +17,16 @@ #include <assert.h> #include <string.h> -#include "binary.h" -#include "error.h" -#include "shared/shared.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/shared/shared.h" // Workaround for symbol redefinition if linked statically. #define base64_encode base64encode #define base64_decode base64decode #define base64_encode_alloc base64encodealloc #define base64_decode_alloc base64decodealloc -#include "../contrib/base64.c" +#include "contrib/base64.c" /* -- public API ----------------------------------------------------------- */ diff --git a/src/libdnssec/contrib/vpool.c b/src/libdnssec/contrib/vpool.c index a61f8723f..d2e1006e2 100644 --- a/src/libdnssec/contrib/vpool.c +++ b/src/libdnssec/contrib/vpool.c @@ -22,7 +22,7 @@ #include <stdlib.h> #include <string.h> -#include "contrib/vpool.h" +#include "libdnssec/contrib/vpool.h" static void vpool_shift(struct vpool *pool); static int vpool_new_size(struct vpool *pool, size_t datsize, diff --git a/src/libdnssec/crypto.c b/src/libdnssec/crypto.c index 44f138e23..f54e20f86 100644 --- a/src/libdnssec/crypto.c +++ b/src/libdnssec/crypto.c @@ -17,9 +17,9 @@ #include <gnutls/gnutls.h> #include <gnutls/pkcs11.h> -#include "crypto.h" -#include "p11/p11.h" -#include "shared/shared.h" +#include "libdnssec/crypto.h" +#include "libdnssec/p11/p11.h" +#include "libdnssec/shared/shared.h" _public_ void dnssec_crypto_init(void) diff --git a/src/libdnssec/key/algorithm.c b/src/libdnssec/key/algorithm.c index 5db6907b3..84f538600 100644 --- a/src/libdnssec/key/algorithm.c +++ b/src/libdnssec/key/algorithm.c @@ -16,10 +16,10 @@ #include <gnutls/gnutls.h> -#include "error.h" -#include "key.h" -#include "key/algorithm.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/shared/shared.h" /* -- internal ------------------------------------------------------------- */ diff --git a/src/libdnssec/key/algorithm.h b/src/libdnssec/key/algorithm.h index 3d76e0054..586682cc0 100644 --- a/src/libdnssec/key/algorithm.h +++ b/src/libdnssec/key/algorithm.h @@ -18,7 +18,7 @@ #include <gnutls/gnutls.h> -#include "key.h" +#include "libdnssec/key.h" /*! * Convert DNSKEY algorithm identifier to GnuTLS identifier. diff --git a/src/libdnssec/key/convert.c b/src/libdnssec/key/convert.c index 852d231aa..b8ebb7d59 100644 --- a/src/libdnssec/key/convert.c +++ b/src/libdnssec/key/convert.c @@ -21,14 +21,14 @@ #include <stdint.h> #include <string.h> -#include "shared/bignum.h" -#include "binary.h" -#include "error.h" -#include "key.h" -#include "key/algorithm.h" -#include "key/dnskey.h" -#include "shared/shared.h" -#include "shared/binary_wire.h" +#include "libdnssec/shared/bignum.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/binary_wire.h" /* -- wrappers for GnuTLS types -------------------------------------------- */ diff --git a/src/libdnssec/key/convert.h b/src/libdnssec/key/convert.h index 0e6366d36..bd2196e0f 100644 --- a/src/libdnssec/key/convert.h +++ b/src/libdnssec/key/convert.h @@ -18,8 +18,8 @@ #include <gnutls/abstract.h> -#include "binary.h" -#include "key.h" +#include "libdnssec/binary.h" +#include "libdnssec/key.h" /*! * Encode public key into the format used in DNSKEY RDATA. diff --git a/src/libdnssec/key/dnskey.c b/src/libdnssec/key/dnskey.c index f86fec44e..dc89bcde5 100644 --- a/src/libdnssec/key/dnskey.c +++ b/src/libdnssec/key/dnskey.c @@ -14,11 +14,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "binary.h" -#include "error.h" -#include "key/dnskey.h" -#include "key/convert.h" -#include "shared/binary_wire.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/key/convert.h" +#include "libdnssec/shared/binary_wire.h" /* -- internal API --------------------------------------------------------- */ diff --git a/src/libdnssec/key/dnskey.h b/src/libdnssec/key/dnskey.h index 4fc1a76c7..de681c8cb 100644 --- a/src/libdnssec/key/dnskey.h +++ b/src/libdnssec/key/dnskey.h @@ -18,8 +18,8 @@ #include <gnutls/abstract.h> -#include "binary.h" -#include "error.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" /*! * DNSKEY RDATA fields offsets. diff --git a/src/libdnssec/key/ds.c b/src/libdnssec/key/ds.c index 75b355c71..dcb4afe6b 100644 --- a/src/libdnssec/key/ds.c +++ b/src/libdnssec/key/ds.c @@ -14,14 +14,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "binary.h" -#include "error.h" -#include "key.h" -#include "shared/shared.h" - -#include "key/internal.h" -#include "shared/dname.h" -#include "shared/binary_wire.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/shared/dname.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/binary_wire.h" #include <gnutls/gnutls.h> #include <gnutls/crypto.h> diff --git a/src/libdnssec/key/internal.h b/src/libdnssec/key/internal.h index 1aba1bb90..e2c912581 100644 --- a/src/libdnssec/key/internal.h +++ b/src/libdnssec/key/internal.h @@ -19,8 +19,8 @@ #include <gnutls/abstract.h> #include <stdint.h> -#include "key.h" -#include "shared/dname.h" +#include "libdnssec/key.h" +#include "libdnssec/shared/dname.h" /*! * DNSSEC key. diff --git a/src/libdnssec/key/key.c b/src/libdnssec/key/key.c index 0e109ee6a..d144d6406 100644 --- a/src/libdnssec/key/key.c +++ b/src/libdnssec/key/key.c @@ -20,19 +20,19 @@ #include <stdlib.h> #include <string.h> -#include "binary.h" -#include "error.h" -#include "key.h" -#include "key/algorithm.h" -#include "key/convert.h" -#include "key/dnskey.h" -#include "key/internal.h" -#include "shared/keyid_gnutls.h" -#include "keystore.h" -#include "keytag.h" -#include "shared/pem.h" -#include "shared/shared.h" -#include "shared/binary_wire.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/key/convert.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/shared/keyid_gnutls.h" +#include "libdnssec/keystore.h" +#include "libdnssec/keytag.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/binary_wire.h" #include "contrib/wire_ctx.h" /*! diff --git a/src/libdnssec/key/keytag.c b/src/libdnssec/key/keytag.c index 4d7ccd53a..edff6846b 100644 --- a/src/libdnssec/key/keytag.c +++ b/src/libdnssec/key/keytag.c @@ -18,10 +18,10 @@ #include <stdint.h> #include <string.h> -#include "binary.h" -#include "error.h" -#include "key/dnskey.h" -#include "shared/shared.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/shared/shared.h" /*! * Compute keytag for RSA/MD5 key. diff --git a/src/libdnssec/key/privkey.c b/src/libdnssec/key/privkey.c index cc8616041..ec1dcbd9d 100644 --- a/src/libdnssec/key/privkey.c +++ b/src/libdnssec/key/privkey.c @@ -17,15 +17,15 @@ #include <gnutls/abstract.h> #include <gnutls/gnutls.h> -#include "binary.h" -#include "error.h" -#include "key/algorithm.h" -#include "key/convert.h" -#include "key/dnskey.h" -#include "key/internal.h" -#include "key/privkey.h" -#include "shared/shared.h" -#include "shared/binary_wire.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/key/convert.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/key/privkey.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/binary_wire.h" /* -- internal functions --------------------------------------------------- */ diff --git a/src/libdnssec/key/privkey.h b/src/libdnssec/key/privkey.h index 885f1172c..c0c5bb2c7 100644 --- a/src/libdnssec/key/privkey.h +++ b/src/libdnssec/key/privkey.h @@ -18,7 +18,7 @@ #include <gnutls/abstract.h> -#include "key.h" +#include "libdnssec/key.h" /*! * Load a private key into a DNSSEC key, create a public part if necessary. diff --git a/src/libdnssec/key/simple.c b/src/libdnssec/key/simple.c index 3028474d1..a2d8ea49c 100644 --- a/src/libdnssec/key/simple.c +++ b/src/libdnssec/key/simple.c @@ -17,14 +17,14 @@ #include <gnutls/abstract.h> #include <gnutls/gnutls.h> -#include "binary.h" -#include "error.h" -#include "key.h" -#include "key/dnskey.h" -#include "key/internal.h" -#include "key/privkey.h" -#include "shared/pem.h" -#include "shared/shared.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/key/privkey.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" /* -- public API ----------------------------------------------------------- */ diff --git a/src/libdnssec/keyid.c b/src/libdnssec/keyid.c index f4807c74d..c99a6578c 100644 --- a/src/libdnssec/keyid.c +++ b/src/libdnssec/keyid.c @@ -17,12 +17,12 @@ #include <assert.h> #include <string.h> -#include "error.h" -#include "keyid.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/keyid.h" +#include "libdnssec/shared/shared.h" -#include "../contrib/ctype.h" -#include "../contrib/tolower.h" +#include "contrib/ctype.h" +#include "contrib/tolower.h" /* -- public API ----------------------------------------------------------- */ diff --git a/src/libdnssec/keystore/internal.h b/src/libdnssec/keystore/internal.h index 3904edf12..a87dd0397 100644 --- a/src/libdnssec/keystore/internal.h +++ b/src/libdnssec/keystore/internal.h @@ -19,10 +19,10 @@ #include <gnutls/gnutls.h> #include <gnutls/abstract.h> -#include "binary.h" -#include "key.h" -#include "keystore.h" -#include "list.h" +#include "libdnssec/binary.h" +#include "libdnssec/key.h" +#include "libdnssec/keystore.h" +#include "libdnssec/list.h" typedef struct keystore_functions { // construction of internal context diff --git a/src/libdnssec/keystore/keystore.c b/src/libdnssec/keystore/keystore.c index 4ca3da7f7..203441a31 100644 --- a/src/libdnssec/keystore/keystore.c +++ b/src/libdnssec/keystore/keystore.c @@ -17,16 +17,16 @@ #include <assert.h> #include <stdlib.h> -#include "error.h" -#include "key.h" -#include "key/algorithm.h" -#include "key/dnskey.h" -#include "key/internal.h" -#include "key/privkey.h" -#include "keyid.h" -#include "keystore.h" -#include "keystore/internal.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/key/dnskey.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/key/privkey.h" +#include "libdnssec/keyid.h" +#include "libdnssec/keystore.h" +#include "libdnssec/keystore/internal.h" +#include "libdnssec/shared/shared.h" /* -- internal API --------------------------------------------------------- */ diff --git a/src/libdnssec/keystore/pkcs11.c b/src/libdnssec/keystore/pkcs11.c index f4621691d..dbe1a3729 100644 --- a/src/libdnssec/keystore/pkcs11.c +++ b/src/libdnssec/keystore/pkcs11.c @@ -17,15 +17,15 @@ #include <gnutls/gnutls.h> #include <pthread.h> -#include "error.h" -#include "shared/hex.h" -#include "keyid.h" -#include "shared/keyid_gnutls.h" -#include "keystore.h" -#include "keystore/internal.h" -#include "p11/p11.h" -#include "shared/pem.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/shared/hex.h" +#include "libdnssec/keyid.h" +#include "libdnssec/shared/keyid_gnutls.h" +#include "libdnssec/keystore.h" +#include "libdnssec/keystore/internal.h" +#include "libdnssec/p11/p11.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" #ifdef ENABLE_PKCS11 diff --git a/src/libdnssec/keystore/pkcs8.c b/src/libdnssec/keystore/pkcs8.c index d2f43587c..f05eda0c1 100644 --- a/src/libdnssec/keystore/pkcs8.c +++ b/src/libdnssec/keystore/pkcs8.c @@ -16,13 +16,13 @@ #include <assert.h> -#include "error.h" -#include "key/algorithm.h" -#include "keyid.h" -#include "keystore.h" -#include "keystore/internal.h" -#include "shared/pem.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/key/algorithm.h" +#include "libdnssec/keyid.h" +#include "libdnssec/keystore.h" +#include "libdnssec/keystore/internal.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" /*! * PKCS #8 key store context. diff --git a/src/libdnssec/keystore/pkcs8_dir.c b/src/libdnssec/keystore/pkcs8_dir.c index 016bec3a2..bc67ad576 100644 --- a/src/libdnssec/keystore/pkcs8_dir.c +++ b/src/libdnssec/keystore/pkcs8_dir.c @@ -22,13 +22,13 @@ #include <sys/stat.h> #include <sys/types.h> -#include "binary.h" -#include "error.h" -#include "shared/fs.h" -#include "key.h" -#include "keystore.h" -#include "keystore/internal.h" -#include "shared/shared.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/shared/fs.h" +#include "libdnssec/key.h" +#include "libdnssec/keystore.h" +#include "libdnssec/keystore/internal.h" +#include "libdnssec/shared/shared.h" #define DIR_INIT_MODE 0750 diff --git a/src/libdnssec/list/list.c b/src/libdnssec/list/list.c index 74be28990..5d9aded81 100644 --- a/src/libdnssec/list/list.c +++ b/src/libdnssec/list/list.c @@ -17,9 +17,9 @@ #include <stdlib.h> #include "libdnssec/list.h" -#include "error.h" -#include "list/ucw_clists.h" -#include "shared/shared.h" +#include "libdnssec/list/ucw_clists.h" +#include "libdnssec/error.h" +#include "libdnssec/shared/shared.h" struct dnssec_list { clist list; diff --git a/src/libdnssec/nsec/bitmap.c b/src/libdnssec/nsec/bitmap.c index 613c4abd2..001613a3a 100644 --- a/src/libdnssec/nsec/bitmap.c +++ b/src/libdnssec/nsec/bitmap.c @@ -18,8 +18,8 @@ #include <stdint.h> #include <string.h> -#include "nsec.h" -#include "shared/shared.h" +#include "libdnssec/nsec.h" +#include "libdnssec/shared/shared.h" #define BITMAP_WINDOW_SIZE 256 #define BITMAP_WINDOW_BYTES (BITMAP_WINDOW_SIZE/CHAR_BIT) diff --git a/src/libdnssec/nsec/hash.c b/src/libdnssec/nsec/hash.c index f012c1617..897320fa8 100644 --- a/src/libdnssec/nsec/hash.c +++ b/src/libdnssec/nsec/hash.c @@ -19,9 +19,9 @@ #include <gnutls/crypto.h> #include <string.h> -#include "error.h" -#include "nsec.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/nsec.h" +#include "libdnssec/shared/shared.h" /*! * Compute NSEC3 hash for given data and algorithm. diff --git a/src/libdnssec/nsec/nsec.c b/src/libdnssec/nsec/nsec.c index 2f652d9e7..60a804449 100644 --- a/src/libdnssec/nsec/nsec.c +++ b/src/libdnssec/nsec/nsec.c @@ -15,8 +15,8 @@ */ #include "libdnssec/nsec.h" -#include "shared/shared.h" -#include "shared/binary_wire.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/binary_wire.h" #include "libdnssec/binary.h" #include "libdnssec/error.h" diff --git a/src/libdnssec/p11/p11.c b/src/libdnssec/p11/p11.c index c8726a8b1..07f34f2f5 100644 --- a/src/libdnssec/p11/p11.c +++ b/src/libdnssec/p11/p11.c @@ -14,14 +14,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "p11/p11.h" -#include "error.h" - #include <assert.h> #include <gnutls/pkcs11.h> #include <stdlib.h> #include <string.h> +#include "libdnssec/p11/p11.h" +#include "libdnssec/error.h" + #ifdef ENABLE_PKCS11 #define PKCS11_MODULES_MAX 16 diff --git a/src/libdnssec/random.c b/src/libdnssec/random.c index 4e73869f2..30b0c2df6 100644 --- a/src/libdnssec/random.c +++ b/src/libdnssec/random.c @@ -20,9 +20,9 @@ #include <stddef.h> #include <stdint.h> -#include "error.h" -#include "random.h" -#include "shared/shared.h" +#include "libdnssec/error.h" +#include "libdnssec/random.h" +#include "libdnssec/shared/shared.h" /* -- public API ----------------------------------------------------------- */ diff --git a/src/libdnssec/shared/bignum.c b/src/libdnssec/shared/bignum.c index b450cb9ec..921a1e6ec 100644 --- a/src/libdnssec/shared/bignum.c +++ b/src/libdnssec/shared/bignum.c @@ -17,7 +17,7 @@ #include <assert.h> #include <string.h> -#include "shared/bignum.h" +#include "libdnssec/shared/bignum.h" static void skip_leading_zeroes(dnssec_binary_t *value) { diff --git a/src/libdnssec/shared/bignum.h b/src/libdnssec/shared/bignum.h index a2df053ba..4186a63e9 100644 --- a/src/libdnssec/shared/bignum.h +++ b/src/libdnssec/shared/bignum.h @@ -18,7 +18,7 @@ #include <stdlib.h> -#include "binary.h" +#include "libdnssec/binary.h" #include "contrib/wire_ctx.h" /*! diff --git a/src/libdnssec/shared/binary_wire.h b/src/libdnssec/shared/binary_wire.h index 534b4e06e..78ccff09b 100644 --- a/src/libdnssec/shared/binary_wire.h +++ b/src/libdnssec/shared/binary_wire.h @@ -19,7 +19,7 @@ #include <stdlib.h> #include "contrib/wire_ctx.h" -#include "binary.h" +#include "libdnssec/binary.h" static inline wire_ctx_t binary_init(const dnssec_binary_t *binary) { diff --git a/src/libdnssec/shared/dname.c b/src/libdnssec/shared/dname.c index f07e7a9df..51605f649 100644 --- a/src/libdnssec/shared/dname.c +++ b/src/libdnssec/shared/dname.c @@ -19,9 +19,10 @@ #include <stdlib.h> #include <stdint.h> #include <string.h> -#include "shared/dname.h" -#include "shared/shared.h" -#include "../contrib/tolower.h" + +#include "libdnssec/shared/dname.h" +#include "libdnssec/shared/shared.h" +#include "contrib/tolower.h" /*! * Get length of a domain name in wire format. diff --git a/src/libdnssec/shared/fs.c b/src/libdnssec/shared/fs.c index 4f2da2f9c..10c25d9a5 100644 --- a/src/libdnssec/shared/fs.c +++ b/src/libdnssec/shared/fs.c @@ -14,14 +14,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "error.h" - #include <assert.h> #include <stdbool.h> #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> +#include "libdnssec/error.h" + int fs_mkdir(const char *path, mode_t mode, bool ignore_existing) { if (mkdir(path, mode) == 0) { diff --git a/src/libdnssec/shared/hex.c b/src/libdnssec/shared/hex.c index f9928f757..03c149192 100644 --- a/src/libdnssec/shared/hex.c +++ b/src/libdnssec/shared/hex.c @@ -18,10 +18,10 @@ #include <string.h> #include <stdbool.h> -#include "binary.h" -#include "error.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" -#include "../contrib/ctype.h" +#include "contrib/ctype.h" /* -- binary to hex -------------------------------------------------------- */ diff --git a/src/libdnssec/shared/hex.h b/src/libdnssec/shared/hex.h index afc1106c5..5a47cf4e4 100644 --- a/src/libdnssec/shared/hex.h +++ b/src/libdnssec/shared/hex.h @@ -16,7 +16,7 @@ #pragma once -#include "binary.h" +#include "libdnssec/binary.h" /*! * Convert binary data to preallocated hexadecimal string. diff --git a/src/libdnssec/shared/keyid_gnutls.c b/src/libdnssec/shared/keyid_gnutls.c index 67e6de8f2..4fde08e7e 100644 --- a/src/libdnssec/shared/keyid_gnutls.c +++ b/src/libdnssec/shared/keyid_gnutls.c @@ -20,12 +20,12 @@ #include <gnutls/x509.h> #include <string.h> -#include "binary.h" -#include "error.h" -#include "keyid.h" -#include "shared/keyid_gnutls.h" -#include "shared/shared.h" -#include "shared/hex.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/keyid.h" +#include "libdnssec/shared/keyid_gnutls.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/shared/hex.h" /*! * Get binary key ID from a key (public or private). diff --git a/src/libdnssec/shared/keyid_gnutls.h b/src/libdnssec/shared/keyid_gnutls.h index 3d9cae7cf..27ee4cdcd 100644 --- a/src/libdnssec/shared/keyid_gnutls.h +++ b/src/libdnssec/shared/keyid_gnutls.h @@ -18,7 +18,8 @@ #include <gnutls/abstract.h> #include <gnutls/gnutls.h> -#include "binary.h" + +#include "libdnssec/binary.h" int keyid_x509(gnutls_x509_privkey_t key, dnssec_binary_t *id); diff --git a/src/libdnssec/shared/pem.c b/src/libdnssec/shared/pem.c index 2016cb4d8..0e5ba0057 100644 --- a/src/libdnssec/shared/pem.c +++ b/src/libdnssec/shared/pem.c @@ -19,13 +19,13 @@ #include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include "binary.h" -#include "error.h" -#include "key.h" -#include "keyid.h" -#include "shared/keyid_gnutls.h" -#include "shared/pem.h" -#include "shared/shared.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/keyid.h" +#include "libdnssec/shared/keyid_gnutls.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" /* -- internal API --------------------------------------------------------- */ diff --git a/src/libdnssec/shared/pem.h b/src/libdnssec/shared/pem.h index 1ded031b0..c96065b0f 100644 --- a/src/libdnssec/shared/pem.h +++ b/src/libdnssec/shared/pem.h @@ -18,7 +18,7 @@ #include <gnutls/gnutls.h> -#include "binary.h" +#include "libdnssec/binary.h" /*! * Create GnuTLS X.509 private key from unencrypted PEM data. diff --git a/src/libdnssec/shared/shared.h b/src/libdnssec/shared/shared.h index 6a1b9a960..1f55033e6 100644 --- a/src/libdnssec/shared/shared.h +++ b/src/libdnssec/shared/shared.h @@ -28,7 +28,7 @@ #include <gnutls/gnutls.h> #include <gnutls/x509.h> -#include "binary.h" +#include "libdnssec/binary.h" #define _public_ __attribute__((visibility("default"))) #define _hidden_ __attribute__((visibility("hidden"))) diff --git a/src/libdnssec/sign/der.c b/src/libdnssec/sign/der.c index c5df0b7c4..4d79876bf 100644 --- a/src/libdnssec/sign/der.c +++ b/src/libdnssec/sign/der.c @@ -16,11 +16,11 @@ #include <stdbool.h> -#include "shared/bignum.h" -#include "binary.h" -#include "error.h" -#include "sign/der.h" -#include "shared/binary_wire.h" +#include "libdnssec/shared/bignum.h" +#include "libdnssec/binary.h" +#include "libdnssec/error.h" +#include "libdnssec/sign/der.h" +#include "libdnssec/shared/binary_wire.h" /* * In fact, this is a very tiny subset of ASN.1 encoding format implementation, diff --git a/src/libdnssec/sign/der.h b/src/libdnssec/sign/der.h index d728429be..db8e910de 100644 --- a/src/libdnssec/sign/der.h +++ b/src/libdnssec/sign/der.h @@ -16,7 +16,7 @@ #pragma once -#include "binary.h" +#include "libdnssec/binary.h" /* * The ECDSA signatures in DNSSEC are encoded differently than in X.509 diff --git a/src/libdnssec/sign/sign.c b/src/libdnssec/sign/sign.c index 599a8c07d..16b4e6492 100644 --- a/src/libdnssec/sign/sign.c +++ b/src/libdnssec/sign/sign.c @@ -20,16 +20,16 @@ #include <gnutls/gnutls.h> #include <gnutls/crypto.h> -#include "shared/bignum.h" -#include "error.h" -#include "key.h" -#include "key/internal.h" -#include "shared/shared.h" -#include "sign.h" -#include "sign/der.h" -#include "shared/binary_wire.h" #include "contrib/macros.h" -#include "contrib/vpool.h" +#include "libdnssec/shared/bignum.h" +#include "libdnssec/error.h" +#include "libdnssec/key.h" +#include "libdnssec/key/internal.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/sign.h" +#include "libdnssec/sign/der.h" +#include "libdnssec/shared/binary_wire.h" +#include "libdnssec/contrib/vpool.h" /*! * Signature format conversion callback. diff --git a/src/libdnssec/tsig.c b/src/libdnssec/tsig.c index e5b8758d8..3edc8a3ca 100644 --- a/src/libdnssec/tsig.c +++ b/src/libdnssec/tsig.c @@ -22,10 +22,10 @@ #include <stdlib.h> #include <string.h> -#include "shared/dname.h" -#include "error.h" -#include "shared/shared.h" -#include "tsig.h" +#include "libdnssec/shared/dname.h" +#include "libdnssec/error.h" +#include "libdnssec/shared/shared.h" +#include "libdnssec/tsig.h" struct dnssec_tsig_ctx { gnutls_mac_algorithm_t algorithm; diff --git a/src/libknot/libknot.pc.in b/src/libknot.pc.in index 8cf08209a..8cf08209a 100644 --- a/src/libknot/libknot.pc.in +++ b/src/libknot.pc.in diff --git a/src/libknot/Makefile.inc b/src/libknot/Makefile.inc new file mode 100644 index 000000000..409fc246d --- /dev/null +++ b/src/libknot/Makefile.inc @@ -0,0 +1,78 @@ +lib_LTLIBRARIES += libknot.la +pkgconfig_DATA += libknot.pc + +libknot_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(lmdb_CFLAGS) +libknot_la_LDFLAGS = $(AM_LDFLAGS) $(libknot_VERSION_INFO) $(lmdb_LIBS) \ + $(LDFLAG_EXCLUDE_LIBS) +libknot_la_LIBADD = libcontrib.la libdnssec.la + +include_libknotdir = $(includedir) +nobase_include_libknot_HEADERS = \ + libknot/attribute.h \ + libknot/codes.h \ + libknot/consts.h \ + libknot/control/control.h \ + libknot/cookies.h \ + libknot/descriptor.h \ + libknot/dname.h \ + libknot/endian.h \ + libknot/errcode.h \ + libknot/error.h \ + libknot/libknot.h \ + libknot/lookup.h \ + libknot/mm_ctx.h \ + libknot/db/db.h \ + libknot/db/db_lmdb.h \ + libknot/db/db_trie.h \ + libknot/packet/compr.h \ + libknot/packet/pkt.h \ + libknot/packet/rrset-wire.h \ + libknot/packet/wire.h \ + libknot/rdata.h \ + libknot/rdataset.h \ + libknot/rrset-dump.h \ + libknot/rrset.h \ + libknot/rrtype/dnskey.h \ + libknot/rrtype/ds.h \ + libknot/rrtype/naptr.h \ + libknot/rrtype/nsec.h \ + libknot/rrtype/nsec3.h \ + libknot/rrtype/nsec3param.h \ + libknot/rrtype/opt.h \ + libknot/rrtype/rdname.h \ + libknot/rrtype/rrsig.h \ + libknot/rrtype/soa.h \ + libknot/rrtype/tsig.h \ + libknot/tsig-op.h \ + libknot/tsig.h \ + libknot/wire.h \ + libknot/yparser/yparser.h \ + libknot/yparser/ypformat.h \ + libknot/yparser/ypschema.h \ + libknot/yparser/yptrafo.h \ + libknot/version.h + +libknot_la_SOURCES = \ + libknot/codes.c \ + libknot/control/control.c \ + libknot/cookies.c \ + libknot/descriptor.c \ + libknot/dname.c \ + libknot/error.c \ + libknot/db/db_lmdb.c \ + libknot/db/db_trie.c \ + libknot/packet/pkt.c \ + libknot/packet/rrset-wire.c \ + libknot/rdataset.c \ + libknot/rrset-dump.c \ + libknot/rrset.c \ + libknot/rrtype/naptr.c \ + libknot/rrtype/opt.c \ + libknot/rrtype/tsig.c \ + libknot/tsig-op.c \ + libknot/tsig.c \ + libknot/yparser/yparser.c \ + libknot/yparser/ypbody.c \ + libknot/yparser/ypformat.c \ + libknot/yparser/ypschema.c \ + libknot/yparser/yptrafo.c diff --git a/src/libzscanner/libzscanner.pc.in b/src/libzscanner.pc.in index 1ace23c27..1ace23c27 100644 --- a/src/libzscanner/libzscanner.pc.in +++ b/src/libzscanner.pc.in diff --git a/src/libzscanner/Makefile.am b/src/libzscanner/Makefile.am deleted file mode 100644 index 6bb0972e4..000000000 --- a/src/libzscanner/Makefile.am +++ /dev/null @@ -1,46 +0,0 @@ -ACLOCAL_AMFLAGS = -I $(top_srcdir)/m4 -AM_CPPFLAGS = \ - -include $(top_builddir)/src/config.h \ - -I$(top_srcdir)/src - -lib_LTLIBRARIES = libzscanner.la - -libzscanner_ladir = $(includedir)/libzscanner -nobase_libzscanner_la_HEADERS = \ - error.h \ - scanner.h \ - version.h - -# pkg-config -pkgconfig_DATA = libzscanner.pc - -EXTRA_DIST = \ - scanner.rl \ - scanner_body.rl \ - scanner.c.g2 \ - scanner.c.t0 - -BUILT_SOURCES = scanner.c -CLEANFILES = scanner.c - -if FAST_PARSER -scanner.c: scanner.c.g2 - cp $(srcdir)/$@.g2 $@ - @echo "NOTE: Compilation of scanner.c can take several minutes!" -else -scanner.c: scanner.c.t0 - cp $(srcdir)/$@.t0 $@ -endif - -libzscanner_la_SOURCES = \ - error.c \ - functions.h \ - functions.c \ - $(nobase_libzscanner_la_HEADERS) - -nodist_libzscanner_la_SOURCES = \ - scanner.c - -libzscanner_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) -libzscanner_la_LDFLAGS = \ - $(libzscanner_VERSION_INFO) diff --git a/src/libzscanner/Makefile.inc b/src/libzscanner/Makefile.inc new file mode 100644 index 000000000..1f887d8d2 --- /dev/null +++ b/src/libzscanner/Makefile.inc @@ -0,0 +1,38 @@ +lib_LTLIBRARIES += libzscanner.la +pkgconfig_DATA += libzscanner.pc + +libzscanner_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) +libzscanner_la_LDFLAGS = $(AM_LDFLAGS) $(libzscanner_VERSION_INFO) $(LDFLAG_EXCLUDE_LIBS) + +EXTRA_DIST += \ + libzscanner/scanner.rl \ + libzscanner/scanner_body.rl \ + libzscanner/scanner.c.g2 \ + libzscanner/scanner.c.t0 +include_libzscannerdir = $(includedir)/libzscanner + +include_libzscanner_HEADERS = \ + libzscanner/error.h \ + libzscanner/scanner.h \ + libzscanner/version.h + +libzscanner_la_SOURCES = \ + libzscanner/error.c \ + libzscanner/functions.h \ + libzscanner/functions.c \ + $(include_libzscanner_HEADERS) + +BUILT_SOURCES += libzscanner/scanner.c +CLEANFILES += libzscanner/scanner.c + +nodist_libzscanner_la_SOURCES = \ + libzscanner/scanner.c + +if FAST_PARSER +libzscanner/scanner.c: libzscanner/scanner.c.g2 + @cp $(srcdir)/$@.g2 $@ + @echo "NOTE: Compilation of scanner.c can take several minutes!" +else +libzscanner/scanner.c: libzscanner/scanner.c.t0 + @cp $(srcdir)/$@.t0 $@ +endif diff --git a/src/utils/Makefile.inc b/src/utils/Makefile.inc new file mode 100644 index 000000000..158ff6776 --- /dev/null +++ b/src/utils/Makefile.inc @@ -0,0 +1,124 @@ +if HAVE_UTILS +noinst_LTLIBRARIES += libknotus.la + +libknotus_la_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libidn2_LIBS) \ + $(libidn_CFLAGS) $(libedit_CFLAGS) $(gnutls_CFLAGS) +libknotus_la_LDFLAGS = $(AM_LDFLAGS) $(LDFLAG_EXCLUDE_LIBS) +libknotus_la_LIBADD = libcontrib.la libknot.la $(libidn2_LIBS) $(libidn_LIBS) \ + $(libedit_LIBS) $(gnutls_LIBS) + +libknotus_la_SOURCES = \ + utils/common/cert.c \ + utils/common/cert.h \ + utils/common/exec.c \ + utils/common/exec.h \ + utils/common/hex.c \ + utils/common/hex.h \ + utils/common/lookup.c \ + utils/common/lookup.h \ + utils/common/msg.c \ + utils/common/msg.h \ + utils/common/netio.c \ + utils/common/netio.h \ + utils/common/params.c \ + utils/common/params.h \ + utils/common/resolv.c \ + utils/common/resolv.h \ + utils/common/sign.c \ + utils/common/sign.h \ + utils/common/tls.c \ + utils/common/tls.h \ + utils/common/token.c \ + utils/common/token.h + +bin_PROGRAMS = kdig khost knsec3hash knsupdate + +kdig_SOURCES = \ + utils/kdig/kdig_exec.c \ + utils/kdig/kdig_exec.h \ + utils/kdig/kdig_main.c \ + utils/kdig/kdig_params.c \ + utils/kdig/kdig_params.h + +khost_SOURCES = \ + utils/kdig/kdig_exec.c \ + utils/kdig/kdig_exec.h \ + utils/kdig/kdig_params.c \ + utils/kdig/kdig_params.h \ + utils/khost/khost_main.c \ + utils/khost/khost_params.c \ + utils/khost/khost_params.h + +knsec3hash_SOURCES = \ + utils/knsec3hash/knsec3hash.c + +knsupdate_SOURCES = \ + utils/knsupdate/knsupdate_exec.c \ + utils/knsupdate/knsupdate_exec.h \ + utils/knsupdate/knsupdate_main.c \ + utils/knsupdate/knsupdate_params.c \ + utils/knsupdate/knsupdate_params.h + +kdig_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) +kdig_LDADD = libknotus.la +khost_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) +khost_LDADD = libknotus.la +knsec3hash_CPPFLAGS = $(AM_CPPFLAGS) +knsec3hash_LDADD = libcontrib.la libdnssec.la libknot.la libshared.la +knsupdate_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) +knsupdate_LDADD = libknotus.la libzscanner.la + +if HAVE_DAEMON +# Create storage and run-time directories +install-data-hook: + $(INSTALL) -d $(DESTDIR)/@config_dir@ + $(INSTALL) -d $(DESTDIR)/@run_dir@ + $(INSTALL) -d $(DESTDIR)/@storage_dir@ + +bin_PROGRAMS += kzonecheck +sbin_PROGRAMS = knotc knotd keymgr kjournalprint + +kzonecheck_SOURCES = \ + utils/kzonecheck/main.c \ + utils/kzonecheck/zone_check.c \ + utils/kzonecheck/zone_check.h + +knotc_SOURCES = \ + utils/knotc/commands.c \ + utils/knotc/commands.h \ + utils/knotc/estimator.c \ + utils/knotc/estimator.h \ + utils/knotc/interactive.c \ + utils/knotc/interactive.h \ + utils/knotc/process.c \ + utils/knotc/process.h \ + utils/knotc/main.c + +knotd_SOURCES = \ + utils/knotd/main.c + +keymgr_SOURCES = \ + utils/keymgr/bind_privkey.c \ + utils/keymgr/bind_privkey.h \ + utils/keymgr/functions.c \ + utils/keymgr/functions.h \ + utils/keymgr/main.c + +kjournalprint_SOURCES = \ + utils/kjournalprint/main.c + +kzonecheck_CPPFLAGS = $(AM_CPPFLAGS) +kzonecheck_LDADD = libcontrib.la libknotd.la +knotc_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(libedit_CFLAGS) +knotc_LDADD = libcontrib.la libknotd.la libknotus.la $(libedit_LIBS) +knotc_LDFLAGS = $(AM_LDFLAGS) -rdynamic +knotd_CPPFLAGS = $(AM_CPPFLAGS) $(CFLAG_VISIBILITY) $(liburcu_CFLAGS) +knotd_LDADD = libcontrib.la libknotd.la $(liburcu_LIBS) +knotd_LDFLAGS = $(AM_LDFLAGS) -rdynamic +keymgr_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) +keymgr_LDADD = libcontrib.la libknotd.la libknotus.la libdnssec.la \ + libshared.la libzscanner.la +kjournalprint_CPPFLAGS = $(AM_CPPFLAGS) $(gnutls_CFLAGS) +kjournalprint_LDADD = libcontrib.la libknotd.la +endif HAVE_DAEMON +endif HAVE_UTILS diff --git a/src/utils/keymgr/bind_privkey.c b/src/utils/keymgr/bind_privkey.c index b036661df..7e140e495 100644 --- a/src/utils/keymgr/bind_privkey.c +++ b/src/utils/keymgr/bind_privkey.c @@ -20,8 +20,8 @@ #include "contrib/strtonum.h" #include "libdnssec/binary.h" #include "libdnssec/error.h" -#include "shared/pem.h" -#include "shared/shared.h" +#include "libdnssec/shared/pem.h" +#include "libdnssec/shared/shared.h" #include "utils/keymgr/bind_privkey.h" /* -- private key params conversion ---------------------------------------- */ diff --git a/src/utils/pykeymgr/pykeymgr.in b/src/utils/pykeymgr/pykeymgr.in deleted file mode 100755 index a238f973d..000000000 --- a/src/utils/pykeymgr/pykeymgr.in +++ /dev/null @@ -1,458 +0,0 @@ -#!/usr/bin/env python -# vim: et ts=4 sw=4 sts=4 -# -# Manipulate LMDB-beckended KASP database (import from obsolete JSON KASP, list, modify...). -# - -from __future__ import print_function - -import datetime -import time -import json -import sys -import re -import glob -import argparse -import time -import traceback -import os -import hashlib -import importlib -import codecs - -opt_force = False -lmdb = None - -def lmdb_requirement(): - global lmdb - - try: - lmdb = importlib.import_module('lmdb') - except ImportError: - print("Error: unable to import module LMDB.") - print("Probably you need to 'pip install lmdb' or so.") - sys.exit(10) - -# workarounding that python 2 doesn't have int.to_bytes() -def to_bytes(n, length, endianness='big'): - h = '%x' % n - assert len(h) <= length * 2 - s = ('0'*(len(h) % 2) + h).zfill(length * 2) - if sys.version_info >= (3,0): - sb = codecs.decode(s, 'hex') - else: - sb = s.decode('hex') - return bytearray(sb) if endianness == 'big' else bytearray(sb[::-1]) - -def from_bytes(ba, endianness='big'): - x = ba if endianness == 'big' else bytearray(s[::-1]) - if sys.version_info >= (3,0): - hx = codecs.encode(x, 'hex') - else: - hx = str(x).encode('hex') - return int(hx, 16) - -# aka knot_dname_from_str_alloc() -def str2dname(s): - if s.endswith('.') is False: - s += '.' - res = bytearray(b"") - nodes = s.lower().split('.') - if nodes[-1] != "": - nodes.append("") - - for node in nodes: - res.append(len(node)) - res.extend(bytearray(node.lower(), 'ascii')) - - return res - -def dname2str(dn): - res = "" - beg = 0 - end = ord(dn[0]) + 1 - while ord(dn[beg]) > 0: - res += str(dn[beg+1:end]) + "." - beg = end - end = beg + ord(dn[beg]) + 1 - - return res - -# this is just helper for shuffling time -def shuffle_unixtime(base_time, shuffle_years, shuffle_months): - rsm = shuffle_months + 12 * shuffle_years - dt = datetime.datetime.fromtimestamp(base_time) - newmonth = (dt.month - 1 + rsm) % 12 + 1 # in python, % always returns [0, 11] - sameyear = dt.month + rsm % 12 - newyear = dt.year + rsm / 12 + (0 if sameyear in range(1, 13) else 1) # in python, (-1)/12 = -1 - dt2 = dt.replace(month=newmonth, year=newyear) - print(dt2.month, "/", dt2.year) - ttuple = dt2.timetuple() - return int(time.mktime(ttuple)) - -def timespec2unix(spec): - if re.match(r"^\d+$", spec): - return int(spec) - - now = int(time.time()) - s = re.sub(r"^now", "t", spec) - if s == "t": - return now - - unitmap = { "" : 1, "mi" : 60, "h" : 3600, "d" : 86400 } - unitmap_mo = { "mo" : 1, "y" : 12 } - - if re.match(r"^t[-+]\d+", s): - unit = re.sub(r"^t[-+]\d+", "", s) - cutend = len(s) if unit == "" else -len(unit) - if unit in list(unitmap.keys()): - return now + int(s[1:cutend]) * unitmap[unit] - elif unit in list(unitmap_mo.keys()): - return shuffle_unixtime(now, 0, int(s[1:cutend]) * unitmap_mo[unit]) - else: - print("Error in time unit specification") - - print("Error in time specification") - -class Keykey: - '''Kasp DB key serialized (type, zone_name, key_id)''' - - def __init__(self, raw_bytearray): - self.raw = bytearray(raw_bytearray) - - @classmethod - def from_params(self, valtype, zone_name, key_id): - selfraw = to_bytes(valtype, 1) - if zone_name is not None: - selfraw.extend(zone_name) - if key_id is not None: - selfraw.extend(bytearray(key_id.encode("ascii"))) - selfraw.append(0) - return Keykey(selfraw) - - def getRaw(self): - return bytearray(self.raw) - - def getType(self): - return self.raw[0] - - def __getSplit(self): - x = self.raw.find(to_bytes(0, 1)) - assert x > 0 - return x + 1 - - def getZone(self): - if self.getType() == 2: - return None - return str(self.raw[1:self.__getSplit()]) - - def getKeyid(self): - if self.getType() != 1: - return None - return str(self.raw[self.__getSplit():]) - -class Keyparams: - '''Serialized key parameters for kasp-db.''' - - def __init__(self, raw_bytearray): - self.raw = bytearray(raw_bytearray) - self.timers_dict = { "created" : [ 0, 20, 28 ], - "publish" : [ 1, 28, 36 ], - "ready" : [ 2, 36, 44 ], - "active" : [ 3, 44, 52 ], - "retire" : [ 4, 52, 60 ], - "remove" : [ 5, 60, 68 ] } - - @classmethod - def from_params(self, pubkey, keytag, algorithm, isksk, timers): - assert len(timers) == 6 - if sys.version_info >= (3,0): - pk = codecs.decode(bytearray(pubkey, 'ascii'), "base64") - else: - pk = pubkey.decode("base64") - selfraw = to_bytes(len(pk), 8) - selfraw.extend(to_bytes(0, 8)) # zero length of unused-future - selfraw.extend(to_bytes(int(keytag), 2)) - selfraw.extend(to_bytes(int(algorithm), 1)) - selfraw.extend(to_bytes((1 if isksk else 0), 1)) - for t in timers: - if t < 0: - print("keytag=%i timers=(%i, %i, %i, %i, %i, %i)" % (keytag, - timers[0], timers[1], timers[2], timers[3], timers[4], timers[5])) - assert False - selfraw.extend(to_bytes(t, 8)) - selfraw.extend(pk) - return Keyparams(selfraw) - - def _check(self): - assert len(self.raw) >= 16 - pkl = from_bytes(self.raw[0:8]) - ufl = from_bytes(self.raw[8:16]) - assert len(self.raw) == 68 + pkl + ufl - assert self.raw[19] < 2 - - def getRaw(self): - self._check() - return bytearray(self.raw) - - def getAlgorithm(self): - self._check() - return int(self.raw[18]) - - def setAlgorithm(self, algorithm): - self._check() - self.raw[18] = to_bytes(algorithm, 1)[0] - - def isKSK(self): - self._check() - return 1 if self.raw[19] != 0 else 0 - - def setKSK(self, isksk): - self._check() - self.raw[11] = (b"\01" if isksk else b"\00")[0] - - def getKeytag(self): - self._check() - return from_bytes(self.raw[16:18]) - - def setKeytag(self, keytag): - self._check() - self.raw[16:18] = to_bytes(keytag, 2) - - def getTimers(self): - self._check() - res = [ 0, 0, 0, 0, 0, 0 ] - for i, x, y in list(self.timers_dict.values()): - res[i] = from_bytes(self.raw[x:y]) - return res - - def getTimersString(self): - self._check() - res = "[" - for ti in list(self.timers_dict.keys()): - _, x, y = self.timers_dict[ti]; - res += (" " if res == "[" else ", ") + ti + ": " + str(from_bytes(self.raw[x:y])) - return res + " ]" - - def setTimers(self, timers): - self._check() - assert len(timers) == 5 - for i, x, y in list(self.timers_dict.values()): - self.raw[x:y] = to_bytes(timers[i], 8) - - def getPubKey(self): - self._check() - pkl = from_bytes(self.raw[0:8]) - return self.raw[68:68+pkl].encode("base64") - - def getParams(self): - return [ self.getPubKey(), self.getKeytag(), self.getAlgorithm(), - self.isKSK(), self.getTimers() ]; - - def setByParamName(self, param_name, new_val): - if param_name == "algorithm": - self.setAlgorithm(int(new_val)) - elif param_name == "isksk": - if new_val in ("1", "True", "true", "on", "yes", "Yes"): - self.setKSK(True) - elif new_val in ("0", "False", "false", "off", "no", "No"): - self.setKSK(False) - else: - print("Error: bad true/false value", new_val) - elif param_name == "keytag": - self.setKeytag(int(new_val)) - elif param_name in list(self.timers_dict.keys()): - _, x, y = self.timers_dict[param_name] - self.raw[x:y] = to_bytes(timespec2unix(new_val), 8) - else: - print("Error: bad parameter", param_name) - - def computeDS(self, zone_str, digestalg): - ds_raw = bytearray(str2dname(zone_str)) - ds_raw.extend(to_bytes(257 if self.isKSK() else 256, 2)) - ds_raw.extend(b"\x03") # protocol is always == 3 - ds_raw.extend(self.raw[18:19]) # algorithm - pkl = from_bytes(self.raw[0:8]) - ds_raw.extend(self.raw[68:68+pkl]) # pubkey - if digestalg == "sha1": - ds_hash = hashlib.sha1(ds_raw).hexdigest() - algno = " 1 " - elif digestalg == "sha256": - ds_hash = hashlib.sha256(ds_raw).hexdigest() - algno = " 2 " - elif digestalg == "sha384": - ds_hash = hashlib.sha384(ds_raw).hexdigest() - algno = " 4 " - else: - print("Error: bad DS digest algorith", ds_hash) - return - return zone_str + ' DS ' + str(self.getKeytag()) + ' ' + str(self.getAlgorithm()) + algno + ds_hash - - def isPublished(self, moment): - tmrs = self.getTimers() - if tmrs[self.timers_dict["publish"][0]] <= moment: - if moment < tmrs[self.timers_dict["remove"][0]]: - return True - return False - - def isReady(self, moment): - tmrs = self.getTimers() - if tmrs[self.timers_dict["ready"][0]] <= moment: - if moment < tmrs[self.timers_dict["ready"][0]]: - return True - return False - - def isActive(self, moment): - tmrs = self.getTimers() - if tmrs[self.timers_dict["active"][0]] <= moment: - if moment < tmrs[self.timers_dict["retire"][0]]: - return True - return False - - def isRetired(self, moment): - tmrs = self.getTimers() - if tmrs[self.timers_dict["retire"][0]] <= moment: - return True - return False - - def isRemoved(self, moment): - tmrs = self.getTimers() - if tmrs[self.timers_dict["remove"][0]] <= moment: - return True - return False - -# static: just for use in following method -def arr_ind2unix(arr, ind, defaul): - try: - ttuple = datetime.datetime.strptime(arr[ind], "%Y-%m-%dT%H:%M:%S+0000").timetuple() - res = int(time.mktime(ttuple)) - return res if res >= 0 else 0 - except KeyError: - return defaul - -def import_nsec3salt(keys, env, db_keys, zname): - try: - with lmdb.Transaction(env, db_keys, write=True) as txn_keys: - dbk1 = Keykey.from_params(3, zname, None).getRaw() - dbv1 = keys["nsec3_salt"] - if dbv1 is None: - return - if sys.version_info >= (3,0): - dbv1d = codecs.decode(bytearray(dbv1, 'ascii'), "base64") - else: - dbv1d = dbv1.decode("base64") - txn_keys.put(dbk1, dbv1d, dupdata=False, overwrite=True) - - dbk2 = Keykey.from_params(4, zname, None).getRaw() - dbv2 = to_bytes(arr_ind2unix(keys, "nsec3_salt_created", 0), 8) - txn_keys.put(dbk2, dbv2, dupdata=False, overwrite=True) - except (KeyError, AttributeError): - pass # nsec3salt not configured or set to null, no problem - -# import single JSON zone config into open LMDB env -def import_file(fname, env, db_keys): - try: - with open(fname) as f: - keys = json.load(f) - - except ValueError: - print("Warning: not imported ", fname) - return False - - try: - zname_str = re.sub(r'^zone_', '', re.sub(r'\.json$', '', re.sub(r'.*/', '', fname))) - print("Importing zone", zname_str) - zname = str2dname(zname_str) - import_nsec3salt(keys, env, db_keys, zname) - - import_now = int(time.time()) - - for key in keys["keys"]: - dbk3 = Keykey.from_params(1, zname, key["id"]).getRaw() - - infty = 0x00ffffffffffff00 # time infinity, this is year 142'715'360 - - dbv3 = Keyparams.from_params(key["public_key"], key["keytag"], - key["algorithm"], key["ksk"], [ - arr_ind2unix(key, "created", 0), - arr_ind2unix(key, "publish", 0), - arr_ind2unix(key, "active", 0), # taking active for ready - arr_ind2unix(key, "active", 0), - arr_ind2unix(key, "retire", infty), - arr_ind2unix(key, "remove", infty) - ]) - - if dbv3.isRemoved(import_now): - continue - - with lmdb.Transaction(env, db_keys, write=True) as txn_keys: - txn_keys.put(dbk3, dbv3.getRaw(), dupdata=False, overwrite=True) - - except (KeyError, KeyboardInterrupt, TypeError): - print("Warning: not imported ", fname) - return False - - return True - -def import_dir(dirname): - print("Importing json key config in", dirname) - if os.path.isfile(dirname + "/data.mdb"): - print("Warning: LMDB key configuration in", dirname, "already exists.") - if opt_force: - print("...deleting it.") - os.remove(dirname + "/data.mdb") - os.remove(dirname + "/lock.mdb") - else: - print("If you want to delete it and import again, use 'force' option.") - return False - - env = lmdb.open(dirname, max_dbs=2, map_size=500*1024*1024) - db_keys = env.open_db(b"keys_db") - something_imported = False - for json_file in glob.glob(dirname + "/*.json"): - something_imported = import_file(json_file, env, db_keys) or something_imported - - if not something_imported: - print("Warning: nothing imported in", dirname) - -class VersionAction(argparse.Action): - def __init__(self, option_strings, version=None, dest=argparse.SUPPRESS, - default=argparse.SUPPRESS, help="show program's version number and exit"): - super(VersionAction, self).__init__(option_strings=option_strings, dest=dest, - default=default, nargs=0, help=help) - self.version = version - - def __call__(self, parser, namespace, values, option_string=None): - version = self.version - if version is None: - version = parser.version - formatter = parser._get_formatter() - formatter.add_text(version) - sys.stdout.write(formatter.format_help()) - sys.exit(0) - -def main(): - global opt_force - parser = argparse.ArgumentParser(description="Knot DNSSEC PyKeyManager", - formatter_class=argparse.RawTextHelpFormatter) - parser.add_argument("-i", "--import", action="append", nargs="?", dest="importdir", - help='''Import zone-key configuration from JSON. -Syntax: -i <key_dir> -(You can import multiple key_dirs at once by repeating this option.)''') - parser.add_argument("-f", "--force", action="store_true", dest="force", help="Do stuff even if dangerous.") - parser.add_argument("-V", "--version", action=VersionAction, version="pykeymgr (Knot DNS), version @VERSION@") - args = parser.parse_args() - opt_force = args.force - - if args.importdir is not None: - lmdb_requirement() - if isinstance(args.importdir, (list, tuple)): - importdir = args.importdir - else: - importdir = [args.importdir] - - for dirn in importdir: - import_dir(dirn) - -if __name__ == "__main__": - main() diff --git a/tests-fuzz/Makefile.am b/tests-fuzz/Makefile.am index aca04fc6b..acb6ae063 100644 --- a/tests-fuzz/Makefile.am +++ b/tests-fuzz/Makefile.am @@ -42,7 +42,7 @@ fuzz_packet_LDADD = $(top_builddir)/src/libknot.la fuzz_zscanner_SOURCES = fuzz_zscanner.c fuzz_zscanner_CPPFLAGS = $(AM_CPPFLAGS) -fuzz_zscanner_LDADD = $(top_builddir)/src/libzscanner/libzscanner.la +fuzz_zscanner_LDADD = $(top_builddir)/src/libzscanner.la if OSS_FUZZ diff --git a/tests/.gitignore b/tests/.gitignore index 4cd0863aa..539cf651a 100644 --- a/tests/.gitignore +++ b/tests/.gitignore @@ -1,5 +1,3 @@ -/Makefile -/Makefile.in /runtests.log /contrib/test_base32hex diff --git a/tests/Makefile.am b/tests/Makefile.am index 4a214c12f..d55043589 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,4 +1,3 @@ -ACLOCAL_AMFLAGS = -I m4 SUBDIRS = _libtap . AM_CPPFLAGS = \ @@ -11,11 +10,11 @@ AM_CPPFLAGS = \ LDADD = \ $(top_builddir)/tests/_libtap/libtap.la \ - $(top_builddir)/src/libdnssec/libdnssec.la \ $(top_builddir)/src/libknot.la \ $(top_builddir)/src/libknotd.la \ + $(top_builddir)/src/libdnssec.la \ $(top_builddir)/src/libcontrib.la \ - $(top_builddir)/src/libzscanner/libzscanner.la + $(top_builddir)/src/libzscanner.la EXTRA_DIST = \ libdnssec/sample_keys.h \ |