commit:     b580348546711590c0152a8371e3cf00393b4720
Author:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  7 20:42:38 2018 +0000
Commit:     Kristian Fiskerstrand <k_f <AT> gentoo <DOT> org>
CommitDate: Wed Feb  7 20:42:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5803485

app-crypt/gnupg: Add fix for missing IPv6 stack

Bug: https://bugs.gentoo.org/646194
Package-Manager: Portage-2.3.19, Repoman-2.3.6

 ...r-Handle-failures-related-to-missing-IPv6.patch |  31 +++++
 app-crypt/gnupg/gnupg-2.2.4-r2.ebuild              | 130 +++++++++++++++++++++
 2 files changed, 161 insertions(+)

diff --git 
a/app-crypt/gnupg/files/gnupg-2.2.4-dirmngr-Handle-failures-related-to-missing-IPv6.patch
 
b/app-crypt/gnupg/files/gnupg-2.2.4-dirmngr-Handle-failures-related-to-missing-IPv6.patch
new file mode 100644
index 00000000000..53843900b9f
--- /dev/null
+++ 
b/app-crypt/gnupg/files/gnupg-2.2.4-dirmngr-Handle-failures-related-to-missing-IPv6.patch
@@ -0,0 +1,31 @@
+From b7f48a0095a5b010b94f8192f4adc1adf8697567 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Wed, 31 Jan 2018 16:57:19 +0100
+Subject: [PATCH] dirmngr: Handle failures related to missing IPv6 gracefully
+
+Handle the two possible connect failures related to missing IPv6 support
+gracefully by marking the host dead and retrying with another one.
+If IPv6 is disabled via procfs, connect() will return EADDRNOTAVAIL.
+If IPv6 is not compiled into the kernel, it will return EAFNOSUPPORT.
+This makes it possible to use dual-stack hkp servers on hosts not having
+IPv6 without random connection failures.
+---
+ dirmngr/ks-engine-hkp.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c
+index 4a0b08f4f..a9bb93666 100644
+--- a/dirmngr/ks-engine-hkp.c
++++ b/dirmngr/ks-engine-hkp.c
+@@ -1353,6 +1353,8 @@ handle_send_request_error (ctrl_t ctrl, gpg_error_t err, 
const char *request,
+     case GPG_ERR_UNKNOWN_HOST:
+     case GPG_ERR_NETWORK:
+     case GPG_ERR_EIO:  /* Sometimes used by estream cookie functions.  */
++    case GPG_ERR_EADDRNOTAVAIL:  /* e.g. when IPv6 is disabled */
++    case GPG_ERR_EAFNOSUPPORT:  /* e.g. when IPv6 is not compiled in */
+       if (mark_host_dead (request) && *tries_left)
+         retry = 1;
+       break;
+-- 
+2.16.1
+

diff --git a/app-crypt/gnupg/gnupg-2.2.4-r2.ebuild 
b/app-crypt/gnupg/gnupg-2.2.4-r2.ebuild
new file mode 100644
index 00000000000..73881ec3b1b
--- /dev/null
+++ b/app-crypt/gnupg/gnupg-2.2.4-r2.ebuild
@@ -0,0 +1,130 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI="6"
+
+inherit systemd toolchain-funcs
+
+MY_P="${P/_/-}"
+
+DESCRIPTION="The GNU Privacy Guard, a GPL OpenPGP implementation"
+HOMEPAGE="http://www.gnupg.org/";
+SRC_URI="mirror://gnupg/gnupg/${MY_P}.tar.bz2"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 
~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux 
~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris 
~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="bzip2 doc ldap nls readline selinux +smartcard ssl tofu tools usb 
wks-server"
+
+COMMON_DEPEND_LIBS="
+       >=dev-libs/npth-1.2
+       >=dev-libs/libassuan-2.5.0
+       >=dev-libs/libgcrypt-1.7.3
+       >=dev-libs/libgpg-error-1.24
+       >=dev-libs/libksba-1.3.4
+       >=net-misc/curl-7.10
+       ssl? ( >=net-libs/gnutls-3.0:0= )
+       sys-libs/zlib
+       ldap? ( net-nds/openldap )
+       bzip2? ( app-arch/bzip2 )
+       readline? ( sys-libs/readline:0= )
+       smartcard? ( usb? ( virtual/libusb:0 ) )
+       tofu? ( >=dev-db/sqlite-3.7 )
+       "
+COMMON_DEPEND_BINS="app-crypt/pinentry
+       !app-crypt/dirmngr"
+
+# Existence of executables is checked during configuration.
+DEPEND="${COMMON_DEPEND_LIBS}
+       ${COMMON_DEPEND_BINS}
+       nls? ( sys-devel/gettext )
+       doc? ( sys-apps/texinfo )"
+
+RDEPEND="${COMMON_DEPEND_LIBS}
+       ${COMMON_DEPEND_BINS}
+       selinux? ( sec-policy/selinux-gpg )
+       nls? ( virtual/libintl )"
+
+S="${WORKDIR}/${MY_P}"
+
+DOCS=(
+       ChangeLog NEWS README THANKS TODO VERSION
+       doc/FAQ doc/DETAILS doc/HACKING doc/TRANSLATE doc/OpenPGP doc/KEYSERVER
+)
+
+PATCHES=(
+       
"${FILESDIR}/${PN}-2.1.20-gpgscm-Use-shorter-socket-path-lengts-to-improve-tes.patch"
+       "${FILESDIR}/${P}-dirmngr-Handle-failures-related-to-missing-IPv6.patch"
+)
+
+src_configure() {
+       local myconf=()
+
+       if use smartcard; then
+               myconf+=(
+                       --enable-scdaemon
+                       $(use_enable usb ccid-driver)
+               )
+       else
+               myconf+=( --disable-scdaemon )
+       fi
+
+       if use elibc_SunOS || use elibc_AIX; then
+               myconf+=( --disable-symcryptrun )
+       else
+               myconf+=( --enable-symcryptrun )
+       fi
+
+       # glib fails and picks up clang's internal stdint.h causing weird errors
+       [[ ${CC} == *clang ]] && \
+               export gl_cv_absolute_stdint_h=/usr/include/stdint.h
+
+       econf \
+               "${myconf[@]}" \
+               $(use_enable bzip2) \
+               $(use_enable ssl gnutls) \
+               $(use_enable nls) \
+               $(use_enable tofu) \
+               $(use_enable wks-server wks-tools) \
+               $(use_with ldap) \
+               $(use_with readline) \
+               --enable-gpg \
+               --enable-gpgsm \
+               --enable-large-secmem \
+               --enable-all-tests \
+               CC_FOR_BUILD="$(tc-getBUILD_CC)"
+}
+
+src_compile() {
+       default
+
+       use doc && emake -C doc html
+}
+
+src_test() {
+       #Bug: 638574
+       use tofu && export TESTFLAGS=--parallel
+       default
+}
+
+src_install() {
+       default
+
+       use tools &&
+               dobin \
+                       tools/{convert-from-106,gpg-check-pattern} \
+                       
tools/{gpg-zip,gpgconf,gpgsplit,lspgpot,mail-signed-keys} \
+                       tools/make-dns-cert
+
+       dosym gpg /usr/bin/gpg2
+       dosym gpgv /usr/bin/gpgv2
+       echo ".so man1/gpg.1" > "${ED}"/usr/share/man/man1/gpg2.1 || die
+       echo ".so man1/gpgv.1" > "${ED}"/usr/share/man/man1/gpgv2.1 || die
+
+       dodir /etc/env.d
+       echo "CONFIG_PROTECT=/usr/share/gnupg/qualified.txt" >> 
"${ED}"/etc/env.d/30gnupg || die
+
+       use doc && dodoc doc/gnupg.html/* doc/*.png
+
+       systemd_douserunit doc/examples/systemd-user/*.{service,socket}
+}

Reply via email to