aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNecktwi Ozfguah <necktwi@ferryfair.com>2019-05-17 21:40:39 +0530
committerAnthony G. Basile <blueness@gentoo.org>2019-05-20 12:24:02 -0400
commit5737876a6788901842f3ae3b4dc35789ca487b13 (patch)
tree74ef8c68352fc86b75895c810748b52129c86c8e /mail-filter
parentsys-devel/gcc: 8.3.0-r1 stable on all musl arches (diff)
downloadmusl-5737876a6788901842f3ae3b4dc35789ca487b13.tar.gz
musl-5737876a6788901842f3ae3b4dc35789ca487b13.tar.bz2
musl-5737876a6788901842f3ae3b4dc35789ca487b13.zip
mail-filter/libspf2: check for res_close() before using it
Check with HAVE_RES_CLOSE. Signed-off-by: Necktwi Ozfguah <necktwi@ferryfair.com> Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'mail-filter')
-rw-r--r--mail-filter/libspf2/Manifest2
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.10-dn_skipname.patch120
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.10-expand.patch16
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.10-gcc5.patch22
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.10-musl.patch15
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.10-netdb.patch17
-rw-r--r--mail-filter/libspf2/files/libspf2-1.2.9-ipv6.patch61
-rw-r--r--mail-filter/libspf2/libspf2-1.2.10.ebuild48
-rw-r--r--mail-filter/libspf2/libspf2-1.2.9-r3.ebuild42
-rw-r--r--mail-filter/libspf2/metadata.xml9
10 files changed, 352 insertions, 0 deletions
diff --git a/mail-filter/libspf2/Manifest b/mail-filter/libspf2/Manifest
new file mode 100644
index 0000000..359d949
--- /dev/null
+++ b/mail-filter/libspf2/Manifest
@@ -0,0 +1,2 @@
+DIST libspf2-1.2.10.tar.gz 508842 BLAKE2B d15a44f64c5e3da20aa349e61a6cc02a15f83ed3acff93fe4c23970e30533d6424b1db35d7d60ff488c9a239d343f8544426fbf8fcb66271237155e0b57df1b5 SHA512 162ce382628c6fcadac3e11f5a12442db622bb23f7ec503e16f5ba7fc88afdd777bce6b093c12a58210355985fd11b74b140f08fab347334d82d953dd183b130
+DIST libspf2-1.2.9.tar.gz 518001 BLAKE2B 711a10d8d7799a09f4f0a801ed7a4c7e82611bd8a6dd9a55f616827548761dae9924ca65c64c7271f8cf0f6f605ccb98ff5e8e3035fc3776ee4e7604ec0a02cd SHA512 3137571f438704c176c5251e7b93fd0a8b6b04e52ad37218685b42b1fc5da6286baee578da1a14291d185216bd2a909cca3e55d64ffe580e71be059d1043a248
diff --git a/mail-filter/libspf2/files/libspf2-1.2.10-dn_skipname.patch b/mail-filter/libspf2/files/libspf2-1.2.10-dn_skipname.patch
new file mode 100644
index 0000000..e53001f
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.10-dn_skipname.patch
@@ -0,0 +1,120 @@
+From 808b584d22106828aaaa3f2a52b1d076b6e66040 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 11 Sep 2014 08:09:34 +0000
+Subject: [PATCH] provide dn_skipname
+
+---
+ configure.ac | 2 +-
+ src/libreplace/__dn_skipname.c | 87 ++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 88 insertions(+), 1 deletion(-)
+ create mode 100644 src/libreplace/__dn_skipname.c
+
+diff --git a/configure.ac b/configure.ac
+index 63e398c..739da3b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -274,7 +274,7 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strspn strtoul])
+ AC_CHECK_FUNCS([gethostbyname inet_ntoa select strrchr strstr strtol])
+
+ AC_REPLACE_FUNCS([getopt_long_only strncasecmp])
+-AC_REPLACE_FUNCS([__ns_initparse __ns_name_uncompress __ns_msg_getflag])
++AC_REPLACE_FUNCS([__ns_initparse __ns_name_uncompress __ns_msg_getflag __dn_skipname])
+ dnl Magnus Holmgren says this avoids linking a private function
+ AC_LIBOBJ([__ns_get16])
+
+diff --git a/src/libreplace/__dn_skipname.c b/src/libreplace/__dn_skipname.c
+new file mode 100644
+index 0000000..88d48b5
+--- /dev/null
++++ b/src/libreplace/__dn_skipname.c
+@@ -0,0 +1,87 @@
++/* taken from OpenBSD source */
++/*
++ * ++Copyright++ 1985, 1993
++ * -
++ * Copyright (c) 1985, 1993
++ * The Regents of the University of California. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ * may be used to endorse or promote products derived from this software
++ * without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ * -
++ * Portions Copyright (c) 1993 by Digital Equipment Corporation.
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies, and that
++ * the name of Digital Equipment Corporation not be used in advertising or
++ * publicity pertaining to distribution of the document or software without
++ * specific, written prior permission.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL
++ * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT
++ * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ * SOFTWARE.
++ * -
++ * --Copyright--
++ */
++
++/*
++ * Skip over a compressed domain name. Return the size or -1.
++ */
++#include <sys/types.h>
++#include <resolv.h>
++
++int
++__dn_skipname(const u_char *comp_dn, const u_char *eom)
++{
++ const u_char *cp;
++ int n;
++
++ cp = comp_dn;
++ while (cp < eom && (n = *cp++)) {
++ /*
++ * check for indirection
++ */
++ switch (n & INDIR_MASK) {
++ case 0: /* normal case, n == len */
++ cp += n;
++ continue;
++ case INDIR_MASK: /* indirection */
++ cp++;
++ break;
++ default: /* illegal type */
++ return (-1);
++ }
++ break;
++ }
++ if (cp > eom)
++ return (-1);
++ return (cp - comp_dn);
++}
++
++
+--
+2.1.0
+
diff --git a/mail-filter/libspf2/files/libspf2-1.2.10-expand.patch b/mail-filter/libspf2/files/libspf2-1.2.10-expand.patch
new file mode 100644
index 0000000..77d6d78
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.10-expand.patch
@@ -0,0 +1,16 @@
+diff --git a/src/libreplace/arpa_nameser.h b/src/libreplace/arpa_nameser.h
+index e59ca3d..35e32b3 100644
+--- a/src/libreplace/arpa_nameser.h
++++ b/src/libreplace/arpa_nameser.h
+@@ -59,11 +59,6 @@
+ # define __P(x) x
+ #endif
+
+-#if defined( HAVE_ARPA_NAMESER_H ) && defined( HAVE_NS_TYPE )
+-#define dn_expand __dn_expand
+-int dn_expand __P((const u_char *, const u_char *, const u_char *,
+- char *, int));
+-#endif
+ #define dn_skipname __dn_skipname
+ int dn_skipname __P((const u_char *, const u_char *));
+
diff --git a/mail-filter/libspf2/files/libspf2-1.2.10-gcc5.patch b/mail-filter/libspf2/files/libspf2-1.2.10-gcc5.patch
new file mode 100644
index 0000000..d36ec96
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.10-gcc5.patch
@@ -0,0 +1,22 @@
+https://github.com/shevek/libspf2/issues/13
+https://bugs.gentoo.org/show_bug.cgi?id=570486
+
+Index: libspf2-1.2.10/src/include/spf_log.h
+===================================================================
+--- libspf2-1.2.10/src/include/spf_log.h
++++ libspf2-1.2.10/src/include/spf_log.h 2015-10-20 23:23:04.579055906 +0200
+@@ -60,10 +60,10 @@
+
+ #if defined( __STDC_VERSION__ ) && __STDC_VERSION__ >= 199901L
+
+-#define SPF_errorf(format, ... ) SPF_errorx( __FILE__, __LINE__, format, __VA_ARGS__ )
+-#define SPF_warningf(format, ... ) SPF_warningx( __FILE__, __LINE__, format, __VA_ARGS__ )
+-#define SPF_infof(format, ... ) SPF_infox( __FILE__, __LINE__, format, __VA_ARGS__ )
+-#define SPF_debugf(format, ... ) SPF_debugx( __FILE__, __LINE__, format, __VA_ARGS__ )
++#define SPF_errorf(...) SPF_errorx( __FILE__, __LINE__, __VA_ARGS__ )
++#define SPF_warningf(...) SPF_warningx( __FILE__, __LINE__, __VA_ARGS__ )
++#define SPF_infof(...) SPF_infox( __FILE__, __LINE__, __VA_ARGS__ )
++#define SPF_debugf(...) SPF_debugx( __FILE__, __LINE__, __VA_ARGS__ )
+
+ #elif defined( __GNUC__ )
+
diff --git a/mail-filter/libspf2/files/libspf2-1.2.10-musl.patch b/mail-filter/libspf2/files/libspf2-1.2.10-musl.patch
new file mode 100644
index 0000000..97c3431
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.10-musl.patch
@@ -0,0 +1,15 @@
+musl does not have res_close and if it had, it would have been a NOP
+
+diff --git a/src/libspf2/spf_dns_resolv.c b/src/libspf2/spf_dns_resolv.c
+index 8f795ce..e3563d8 100644
+--- a/src/libspf2/spf_dns_resolv.c
++++ b/src/libspf2/spf_dns_resolv.c
+@@ -606,7 +606,7 @@ SPF_dns_resolv_free(SPF_dns_server_t *spf_dns_server)
+ {
+ SPF_ASSERT_NOTNULL(spf_dns_server);
+
+-#if ! HAVE_DECL_RES_NINIT
++#if ! HAVE_DECL_RES_NINIT && HAVE_RES_CLOSE
+ res_close();
+ #endif
+
diff --git a/mail-filter/libspf2/files/libspf2-1.2.10-netdb.patch b/mail-filter/libspf2/files/libspf2-1.2.10-netdb.patch
new file mode 100644
index 0000000..0f87882
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.10-netdb.patch
@@ -0,0 +1,17 @@
+--- ./src/include/spf_dns.h.orig
++++ ./src/include/spf_dns.h
+@@ -99,11 +99,13 @@
+ */
+
+ #if !defined(HAVE_NETDB_H) && !defined(_WIN32)
+-#define NETDB_SUCCESS 0
+ #define HOST_NOT_FOUND 1 /**< NXDOMAIN (authoritative answer)*/
+ #define TRY_AGAIN 2 /**< SERVFAIL (no authoritative answer)*/
+ #define NO_RECOVERY 3 /**< invalid/unimplmeneted query */
+ #define NO_DATA 4 /**< host found, but no RR of req type*/
++#endif
++#ifndef NETDB_SUCCESS
++#define NETDB_SUCCESS 0
+ #endif
+ typedef int SPF_dns_stat_t;
+
diff --git a/mail-filter/libspf2/files/libspf2-1.2.9-ipv6.patch b/mail-filter/libspf2/files/libspf2-1.2.9-ipv6.patch
new file mode 100644
index 0000000..76e8cd3
--- /dev/null
+++ b/mail-filter/libspf2/files/libspf2-1.2.9-ipv6.patch
@@ -0,0 +1,61 @@
+$NetBSD: patch-aa,v 1.1 2009/09/08 10:36:27 tron Exp $
+
+Fix an abort() caused by miscalculating the size of an internal buffer.
+This can crash applications using "libspf2" (e.g. "milter-greylist")
+in an e-mail gets delivered via SMTP over IPv6 depending on the
+remote machine's IPv6 address.
+
+--- src/libspf2/spf_expand.c.orig 2008-11-03 21:29:00.000000000 +0000
++++ src/libspf2/spf_expand.c 2009-09-08 11:27:52.000000000 +0100
+@@ -245,7 +245,7 @@
+ case PARM_CLIENT_IP: /* SMTP client IP */
+ #ifdef COMPUTE
+ if (compute_length) {
+- len = sizeof(ip6_buf);
++ len = sizeof(ip6_rbuf);
+ if (d->dv.url_encode)
+ len *= 3;
+ buflen += len;
+
+http://www.gossamer-threads.com/lists/spf/devel/35098
+
+--- src/libspf2/spf_compile.c 2008-11-03 15:37:33.000000000 -0500
++++ src/libspf2/spf_compile.c 2009-09-07 23:46:02.000000000 -0400
+@@ -778,7 +778,7 @@
+ const char *end;
+ const char *p;
+
+- char buf[ INET_ADDRSTRLEN ];
++ char buf[ INET6_ADDRSTRLEN ];
+ size_t len;
+ int err;
+
+--- src/libspf2/spf_interpret.c 2008-10-22 11:47:43.000000000 -0400
++++ src/libspf2/spf_interpret.c 2009-09-08 00:42:25.000000000 -0400
+@@ -505,7 +505,7 @@
+ char dst_ip6_buf[ INET6_ADDRSTRLEN ];
+
+ struct in6_addr src_ipv6;
+- int cidr, mask;
++ int cidr, cidr_save, mask;
+ int i;
+ int match;
+
+@@ -517,6 +517,7 @@
+ cidr = SPF_i_mech_cidr(spf_request, mech);
+ if ( cidr == 0 )
+ cidr = 128;
++ cidr_save = cidr;
+
+ match = TRUE;
+ for( i = 0; i < array_elem( ipv6.s6_addr ) && match; i++ )
+@@ -538,7 +539,7 @@
+ INET_NTOP(AF_INET6, &ipv6.s6_addr,
+ dst_ip6_buf, sizeof(dst_ip6_buf));
+ SPF_debugf( "ip_match: %s == %s (/%d): %d",
+- src_ip6_buf, dst_ip6_buf, cidr, match );
++ src_ip6_buf, dst_ip6_buf, cidr_save, match );
+ }
+
+ return match;
+
diff --git a/mail-filter/libspf2/libspf2-1.2.10.ebuild b/mail-filter/libspf2/libspf2-1.2.10.ebuild
new file mode 100644
index 0000000..4ee1989
--- /dev/null
+++ b/mail-filter/libspf2/libspf2-1.2.10.ebuild
@@ -0,0 +1,48 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+inherit autotools eutils
+
+DESCRIPTION="libspf2 implements the Sender Policy Framework, a part of the SPF/SRS protocols"
+HOMEPAGE="http://www.libspf2.org"
+SRC_URI="http://www.libspf2.org/spf/libspf2-${PV}.tar.gz"
+
+LICENSE="|| ( LGPL-2.1 BSD-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="static static-libs"
+
+DEPEND=""
+RDEPEND="!dev-perl/Mail-SPF-Query"
+REQUIRED_USE="static? ( static-libs )"
+
+src_prepare() {
+ if ! use static; then
+ sed -i -e '/bin_PROGRAMS/s/spfquery_static//' src/spfquery/Makefile.am \
+ -e '/bin_PROGRAMS/s/spftest_static//' src/spftest/Makefile.am \
+ -e '/bin_PROGRAMS/s/spfd_static//' src/spfd/Makefile.am \
+ -e '/bin_PROGRAMS/s/spf_example_static//' src/spf_example/Makefile.am \
+ || die
+ #eautoreconf
+ fi
+ epatch "${FILESDIR}"/${P}-gcc5.patch #570486
+ epatch "${FILESDIR}"/${PN}-1.2.10-musl.patch
+ epatch "${FILESDIR}"/${PN}-1.2.10-netdb.patch
+ epatch "${FILESDIR}"/${PN}-1.2.10-dn_skipname.patch
+ epatch "${FILESDIR}"/${PN}-1.2.10-expand.patch
+ sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/' configure.ac || die
+ eautoreconf
+}
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc README TODO INSTALL
+
+ use static-libs || rm -f "${D}"/usr/lib*/libspf2.la
+}
diff --git a/mail-filter/libspf2/libspf2-1.2.9-r3.ebuild b/mail-filter/libspf2/libspf2-1.2.9-r3.ebuild
new file mode 100644
index 0000000..6e99cae
--- /dev/null
+++ b/mail-filter/libspf2/libspf2-1.2.9-r3.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=4
+inherit eutils autotools
+
+DESCRIPTION="libspf2 implements the Sender Policy Framework, a part of the SPF/SRS protocols"
+HOMEPAGE="http://www.libspf2.org"
+SRC_URI="http://www.libspf2.org/spf/libspf2-${PV}.tar.gz"
+
+LICENSE="|| ( LGPL-2.1 BSD-2 )"
+SLOT="0"
+KEYWORDS="alpha amd64 hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
+IUSE="static static-libs"
+
+DEPEND=""
+RDEPEND="!dev-perl/Mail-SPF-Query"
+REQUIRED_USE="static? ( static-libs )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${P}-ipv6.patch"
+ if ! use static; then
+ sed -i -e '/bin_PROGRAMS/s/spfquery_static//' src/spfquery/Makefile.am \
+ -e '/bin_PROGRAMS/s/spftest_static//' src/spftest/Makefile.am \
+ -e '/bin_PROGRAMS/s/spfd_static//' src/spfd/Makefile.am \
+ -e '/bin_PROGRAMS/s/spf_example_static//' src/spf_example/Makefile.am \
+ || die
+ eautoreconf
+ fi
+}
+
+src_configure() {
+ econf \
+ $(use_enable static-libs static)
+}
+
+src_install() {
+ emake DESTDIR="${D}" install
+ dodoc README TODO INSTALL
+
+ use static-libs || rm -f "${D}"/usr/lib*/libspf2.la
+}
diff --git a/mail-filter/libspf2/metadata.xml b/mail-filter/libspf2/metadata.xml
new file mode 100644
index 0000000..47e3c49
--- /dev/null
+++ b/mail-filter/libspf2/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer type="project">
+ <email>net-mail@gentoo.org</email>
+ <name>Net-Mail</name>
+</maintainer>
+<longdescription>libspf2 implements the Sender Policy Framework, a part of the SPF/SRS protocol pair. libspf2 is a library which allows email systems such as Sendmail, Postfix, Exim, Zmailer and MS Exchange to check SPF records and make sure that the email is authorized by the domain name that it is coming from. This prevents email forgery, commonly used by spammers, scammers and email viruses/worms.</longdescription>
+</pkgmetadata>