commit f61a3227391e35031572932e4968b628fe530d77 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:54:42 2019 -0400 Package init diff --git a/ldns-1.7.0-multilib.patch b/ldns-1.7.0-multilib.patch new file mode 100644 index 0000000..428dc78 --- /dev/null +++ b/ldns-1.7.0-multilib.patch @@ -0,0 +1,77 @@ +diff --git a/ldns-1.7.0/configure b/ldns-1.7.0/configure +index cd087de..aeec9fb 100755 +--- a/ldns-1.7.0/configure ++++ b/ldns-1.7.0/configure +@@ -684,6 +684,7 @@ PYTHON_SITE_PKG + PYTHON_LDFLAGS + PYTHON_CPPFLAGS + PYTHON ++PYTHON_LIB + PYTHON_VERSION + UNINSTALL_CONFIG_MANPAGE + UNINSTALL_CONFIG +@@ -14311,6 +14312,7 @@ EOD` + # use the official shared library + ac_python_library=`echo "$ac_python_library" | sed "s/^lib//"` + PYTHON_LDFLAGS="-L$ac_python_libdir -l$ac_python_library" ++ PYTHON_LIB="$ac_python_library" + else + # old way: use libpython from python_configdir + ac_python_libdir=`$PYTHON -c \ +@@ -14318,6 +14320,7 @@ EOD` + import os; \ + print (os.path.join(f(plat_specific=1, standard_lib=1), 'config'));"` + PYTHON_LDFLAGS="-L$ac_python_libdir -lpython$ac_python_version" ++ PYTHON_LIB="python$ac_python_version" + fi + + if test -z "PYTHON_LDFLAGS"; then +diff --git a/ldns-1.7.0/packaging/ldns-config.in b/ldns-1.7.0/packaging/ldns-config.in +index ffb2c57..950c135 100755 +--- a/ldns-1.7.0/packaging/ldns-config.in ++++ b/ldns-1.7.0/packaging/ldns-config.in +@@ -3,13 +3,26 @@ + prefix="@prefix@" + exec_prefix="@exec_prefix@" + VERSION="@PACKAGE_VERSION@" +-CFLAGS="@CFLAGS@" + CPPFLAGS="@CPPFLAGS@ @LIBSSL_CPPFLAGS@ @PYTHON_CPPFLAGS@" +-LDFLAGS="@LDFLAGS@ @LIBSSL_LDFLAGS@ @PYTHON_LDFLAGS@" + LIBS="@LIBS@ @LIBSSL_LIBS@" +-LIBDIR="@libdir@" + INCLUDEDIR="@includedir@" + LIBVERSION="@VERSION_INFO@" ++ARCH="`uname -m`" ++ ++case $ARCH in ++ x86_64 | amd64 | sparc64 | s390x | ppc64) ++ ++ LIBDIR="/usr/lib64" ++ LIBDIR_SEC="/usr/lib" ++ ;; ++ * ) ++ LIBDIR="/usr/lib" ++ LIBDIR_SEC="/usr/lib64" ++ ;; ++esac ++ ++LDFLAGS="@LDFLAGS@ @LIBSSL_LDFLAGS@ -L$LIBDIR -l@PYTHON_LIB@" ++LDFLAGS_SEC="@LDFLAGS@ @LIBSSL_LDFLAGS@ -L$LIBDIR_SEC -l@PYTHON_LIB@" + + for arg in $@ + do +@@ -21,9 +34,13 @@ do + then + echo "${LDFLAGS} -L${LIBDIR} ${LIBS} -lldns" + fi ++ if [ $arg = "--libs_sec" ] ++ then ++ echo "${LDFLAGS_SEC} -L${LIBDIR_SEC} ${LIBS} -lldns" ++ fi + if [ $arg = "-h" ] || [ $arg = "--help" ] + then +- echo "Usage: $0 [--cflags] [--libs] [--version]" ++ echo "Usage: $0 [--cflags] [--libs] [--libs_sec] [--version]" + fi + if [ $arg = "--version" ] + then diff --git a/ldns-1.7.0-parse-limit.patch b/ldns-1.7.0-parse-limit.patch new file mode 100644 index 0000000..2c2abe8 --- /dev/null +++ b/ldns-1.7.0-parse-limit.patch @@ -0,0 +1,28 @@ +From c8391790c96d4c8a2c10f9ab1460fda83b509fc2 Mon Sep 17 00:00:00 2001 +From: Willem Toorop +Date: Thu, 27 Apr 2017 00:14:58 +0200 +Subject: [PATCH] Check parse limit before t increment + +Thanks Stephan Zeisberg +--- + parse.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/parse.c b/parse.c +index e68627c..947dbb8 100644 +--- a/parse.c ++++ b/parse.c +@@ -118,6 +118,10 @@ ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *li + if (line_nr) { + *line_nr = *line_nr + 1; + } ++ if (limit > 0 && (i >= limit || (size_t)(t-token) >= limit)) { ++ *t = '\0'; ++ return -1; ++ } + *t++ = ' '; + prev_c = c; + continue; +-- +2.9.5 + diff --git a/ldns-1.7.0-realloc.patch b/ldns-1.7.0-realloc.patch new file mode 100644 index 0000000..25be44d --- /dev/null +++ b/ldns-1.7.0-realloc.patch @@ -0,0 +1,30 @@ +From 3bdeed02505c9bbacb3b64a97ddcb1de967153b7 Mon Sep 17 00:00:00 2001 +From: Willem Toorop +Date: Thu, 27 Apr 2017 00:25:20 +0200 +Subject: [PATCH] bugfix #1257: Free after reallocing to 0 size + +Thanks Stephan Zeisberg +--- + str2host.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/str2host.c b/str2host.c +index b274b17..f2a317b 100644 +--- a/str2host.c ++++ b/str2host.c +@@ -1525,8 +1525,10 @@ ldns_str2rdf_long_str(ldns_rdf **rd, const char *str) + if (! str) { + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } +- length = (size_t)(dp - data); +- ++ if (!(length = (size_t)(dp - data))) { ++ LDNS_FREE(data); ++ return LDNS_STATUS_SYNTAX_EMPTY; ++ } + /* Lose the overmeasure */ + data = LDNS_XREALLOC(dp = data, uint8_t, length); + if (! data) { +-- +2.9.5 + diff --git a/ldns-1.7.0.tar.gz b/ldns-1.7.0.tar.gz new file mode 100644 index 0000000..4128ef2 Binary files /dev/null and b/ldns-1.7.0.tar.gz differ diff --git a/ldns.spec b/ldns.spec new file mode 100644 index 0000000..9b7045d --- /dev/null +++ b/ldns.spec @@ -0,0 +1,328 @@ +%global _hardened_build 1 + +%bcond_without perl +%bcond_without ecdsa + +%bcond_without eddsa +%bcond_without dane_ta + +%bcond_with gost + +%{?!snapshot: %global snapshot 0} + +%if %{with_python2} || %{with_python3} +%{?filter_setup: +%global _ldns_internal_filter /^_ldns[.]so.*/d; +%filter_from_requires %{_ldns_internal_filter} +%filter_from_provides %{_ldns_internal_filter} +%filter_setup +} +%global _ldns_internal _ldns[.]so[.].* +%global __requires_exclude ^(%{_ldns_internal})$ +%global __provides_exclude ^(%{_ldns_internal})$ +%endif + +%if %{with perl} +%{?perl_default_filter} +%endif + +Name: ldns +Version: 1.7.0 +Release: 22 +Summary: Low-level DNS(SEC) library with API + +License: BSD +Url: https://www.nlnetlabs.nl/projects/%{name}/about/ +Source0: https://www.nlnetlabs.nl/downloads/%{name}/%{name}-%{version}.tar.gz + +Patch1: %{name}-1.7.0-multilib.patch +Patch2: %{name}-1.7.0-parse-limit.patch +Patch3: %{name}-1.7.0-realloc.patch + +%if 0%{snapshot} +BuildRequires: libtool autoconf automake +%endif + +BuildRequires: gcc make libpcap-devel gcc-c++ doxygen +%if %{with dane_ta} +BuildRequires: openssl-devel >= 1.1.0 +%else +BuildRequires: openssl-devel >= 1.0.2k +%endif + +%if %{with_python2} +BuildRequires: python2-devel, swig +%endif +%if %{with_python3} +BuildRequires: python3-devel, swig +%endif +%if %{with perl} +BuildRequires: perl-devel perl-ExtUtils-MakeMaker +BuildRequires: perl-generators perl(Devel::CheckLib) +%endif +Requires: ca-certificates + +%description +The goal of ldns is to simplify DNS programming, it supports recent RFCs +like the DNSSEC documents, and allows developers to easily create software +conforming to current RFCs, and experimental software for current Internet +Drafts. A secondary benefit of using ldns is speed; ldns is written in C +it should be a lot faster than Perl. + +%package devel +Summary: Development files for %{name} +Requires: %{name} = %{version}-%{release} +Requires: pkgconfig openssl-devel + +Provides: %{name}-utils +Obsoletes: %{name}-utils + +%description devel +%{name}-devel contains the header files for developing +applications that want to make use of %{name}. + +%if %{with python2} +%package -n python2-%{name} +Summary: Python2 extensions for %{name} +Requires: %{name} = %{version}-%{release} +%{?python_provide:%python_provide python2-%{name}} + +%description -n python2-%{name} +Python2 packages for %{name} +%endif + + +%if %{with python3} +%package -n python3-%{name} +Summary: Python3 extensions for %{name} +Requires: %{name} = %{version}-%{release} +%{?python_provide:%python_provide python3-%{name}} + +%description -n python3-%{name} +Python3 packages for %{name} +%endif + +%if %{with perl} +%package -n perl-%{name} +Summary: Perl information for %{name} +Requires: %{name} = %{version}-%{release} +Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) + +%description -n perl-%{name} +Perl packages for %{name} +%endif + +%package help +Summary: Documents for %{name} +Buildarch: noarch +Requires: man info + +Provides: %{name}-doc +Obsoletes: %{name}-doc + +%description help +Man pages and other related documents for %{name}. + +%prep +%{?extra_version:%global pkgname %{name}-%{version}%{extra_version}}%{!?extra_version:%global pkgname %{name}-%{version}} + +%setup -qcn %{pkgname} +pushd %{pkgname} + +%patch1 -p2 -b .multilib +%patch2 -p1 -b .limit +%patch3 -p1 -b .realloc + +%if 0%{snapshot} + rm config.guess config.sub ltmain.sh + aclocal + libtoolize -c --install + autoreconf --install +%endif + +sed -i "s/@includedir@/@includedir@\/ldns/" packaging/libldns.pc.in + +cp -pr doc LICENSE README* Changelog ../ +cp -p contrib/ldnsx/LICENSE ../LICENSE.ldnsx +cp -p contrib/ldnsx/README ../README.ldnsx +popd + +%if %{with python3} +mv %{pkgname} %{pkgname}_python3 +%endif + +%if %{with python2} +cp -a %{pkgname}_python3 %{pkgname}_python2 +%endif + +%build +CFLAGS="%{optflags} -fPIC" +CXXFLAGS="%{optflags} -fPIC" +LDFLAGS="$RPM_LD_FLAGS -Wl,-z,now -pie" +export CFLAGS CXXFLAGS LDFLAGS + +%if %{with gost} + %global enable_gost --enable-gost +%else + %global enable_gost --disable-gost +%endif + +%if %{with ecdsa} + %global enable_ecdsa --enable-ecdsa +%else + %global enable_ecdsa --disable-ecdsa +%endif + +%if %{with eddsa} + %global enable_eddsa --enable-ed25519 --enable-ed448 +%else + %global enable_eddsa --disable-ed25519 --disable-ed448 +%endif + +%if ! %{with dane_ta} + %global disable_dane_ta --disable-dane-ta-usage +%endif + +%global common_args \\\ + --disable-rpath \\\ + %{enable_gost} %{enable_ecdsa} %{enable_eddsa} %{?disable_dane_ta} \\\ + --with-ca-file=/etc/pki/tls/certs/ca-bundle.trust.crt \\\ + --with-ca-path=/etc/pki/tls/certs/ \\\ + --with-trust-anchor=%{_sharedstatedir}/unbound/root.key \\\ + --disable-static \\\ + + +%if 0%{with_python3} +pushd %{pkgname}_python3 +%else +pushd %{pkgname} +%endif + +%configure \ + %{common_args} \ + --with-examples \ + --with-drill \ +%if %{with_python3} + --with-pyldns PYTHON=%{__python3} +%endif + +make %{?_smp_mflags} +make %{?_smp_mflags} doc + +%if %{with perl} + pushd contrib/DNS-LDNS + LD_LIBRARY_PATH="../../lib:$LD_LIBRARY_PATH" perl \ + Makefile.PL INSTALLDIRS=vendor INC="-I. -I../.." LIBS="-L../../lib" + make + popd +%endif + +sed -i "s~$RPM_LD_FLAGS~~" packaging/ldns-config +popd + +%if %{with_python2} + pushd %{pkgname}_python2 + %configure \ + %{common_args} \ + --with-pyldns PYTHON=%{__python2} + + make %{?_smp_mflags} + popd +%endif + +%install +rm -rf %{buildroot} + +%if %{with_python3} +pushd %{pkgname}_python3 +%else +pushd %{pkgname} +%endif + +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-doc + +%delete_la +%if %{with_python3} +rm -rf %{buildroot}%{python3_sitearch}/*.la +%endif + +install -D -m644 packaging/libldns.pc %{buildroot}%{_libdir}/pkgconfig/ldns.pc +%if %{with perl} + make -C contrib/DNS-LDNS DESTDIR=%{buildroot} pure_install + chmod 755 %{buildroot}%{perl_vendorarch}/auto/DNS/LDNS/LDNS.so + rm -f %{buildroot}%{perl_vendorarch}/auto/DNS/LDNS/{.packlist,LDNS.bs} +%endif +popd + +%if %{with_python2} + pushd %{pkgname}_python2 + make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-pyldns install-pyldnsx + rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python2_sitearch}/*.la + popd +%endif + + +rm doc/*.xml + +rm doc/doxyparse.pl + +rm -rf doc/man + +%ldconfig_scriptlets + +%files +%defattr(-,root,root) +%license LICENSE +%{_bindir}/%{name}-config +%{_libdir}/libldns.so.* + +%files devel +%defattr(-,root,root) +%{_bindir}/drill +%{_bindir}/ldnsd +%{_bindir}/%{name}-* +%{_libdir}/libldns.so +%{_libdir}/pkgconfig/%{name}.pc +%dir %{_includedir}/%{name} +%{_includedir}/%{name}/*.h + +%if %{with_python2} +%files -n python2-%{name} +%defattr(-,root,root) +%license LICENSE.ldnsx +%{python2_sitearch}/* +%endif + +%if %{with_python3} +%files -n python3-ldns +%defattr(-,root,root) +%license LICENSE.ldnsx +%{python3_sitearch}/* +%endif + +%if %{with perl} +%files -n perl-ldns +%defattr(-,root,root) +%{perl_vendorarch}/* +%exclude %dir %{perl_vendorarch}/auto/DNS/ +%endif + +%files help +%defattr(-,root,root) +%doc doc README Changelog README.git +%{_mandir}/man1/* +%{_mandir}/man3/*.3.gz +%if %{with_python2} +%doc %{pkgname}_python2/contrib/python/Changelog README.ldnsx +%endif +%if %{with_python3} +%doc %{pkgname}_python3/contrib/python/Changelog README.ldnsx +%endif +%if %{with perl} +%{_mandir}/man3/* +%endif + +%changelog +* Sat Sep 21 2019 openEuler Buildteam - 0.17.9-4 +- Package init