commit:     84e254f1f64ce956b1cee42f71728c5dbabcd5d1
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 15 06:08:40 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Nov 15 06:37:00 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84e254f1

net-mail/isync: backport openssl3 fix

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../isync/files/isync-1.4.4-openssl3-eof.patch     | 65 ++++++++++++++++++++++
 net-mail/isync/isync-1.4.4-r1.ebuild               | 47 ++++++++++++++++
 2 files changed, 112 insertions(+)

diff --git a/net-mail/isync/files/isync-1.4.4-openssl3-eof.patch 
b/net-mail/isync/files/isync-1.4.4-openssl3-eof.patch
new file mode 100644
index 000000000000..482a11e6c50f
--- /dev/null
+++ b/net-mail/isync/files/isync-1.4.4-openssl3-eof.patch
@@ -0,0 +1,65 @@
+https://sourceforge.net/p/isync/mailman/isync-devel/thread/Y2jnr8hESp1PUW%2B6%40bulldog/#msg37731764
+https://sourceforge.net/p/isync/bugs/68/
+https://sourceforge.net/p/isync/isync/ci/b6c36624f04cd388873785c0631df3f2f9ac4bf0/
+
+From b6c36624f04cd388873785c0631df3f2f9ac4bf0 Mon Sep 17 00:00:00 2001
+From: Oswald Buddenhagen <[email protected]>
+Date: Mon, 6 Jun 2022 11:55:37 +0200
+Subject: [PATCH] work around "unexpected EOF" error messages at end of SSL
+ connections
+
+gmail apparently doesn't send a close notification (SSL_shutdown())
+before closing the TCP socket.
+--- a/src/drv_imap.c
++++ b/src/drv_imap.c
+@@ -1620,6 +1620,7 @@ imap_socket_read( void *aux )
+                                       error( "IMAP error: unexpected BYE 
response: %s\n", cmd );
+                                       /* We just wait for the server to close 
the connection now. */
+                                       ctx->expectEOF = 1;
++                                      socket_expect_eof( &ctx->conn );
+                               } else {
+                                       /* We still need to wait for the 
LOGOUT's tagged OK. */
+                               }
+@@ -1882,10 +1883,12 @@ static void
+ imap_cleanup_p2( imap_store_t *ctx,
+                  imap_cmd_t *cmd ATTR_UNUSED, int response )
+ {
+-      if (response == RESP_NO)
++      if (response == RESP_NO) {
+               imap_cancel_store( &ctx->gen );
+-      else if (response == RESP_OK)
++      } else if (response == RESP_OK) {
+               ctx->expectEOF = 1;
++              socket_expect_eof( &ctx->conn );
++      }
+ }
+ 
+ /******************* imap_open_store *******************/
+--- a/src/socket.c
++++ b/src/socket.c
+@@ -810,6 +810,15 @@ socket_expect_activity( conn_t *conn, int expect )
+               conf_wakeup( &conn->fd_timeout, expect ? conn->conf->timeout : 
-1 );
+ }
+ 
++void
++socket_expect_eof( conn_t *sock )
++{
++#ifdef SSL_OP_IGNORE_UNEXPECTED_EOF  // implies HAVE_LIBSSL
++      if (sock->ssl)
++              SSL_set_options( sock->ssl, SSL_OP_IGNORE_UNEXPECTED_EOF );
++#endif
++}
++
+ int
+ socket_read( conn_t *conn, char *buf, uint len )
+ {
+--- a/src/socket.h
++++ b/src/socket.h
+@@ -142,6 +142,7 @@ void socket_start_tls(conn_t *conn, void (*cb)( int ok, 
void *aux ) );
+ void socket_start_deflate( conn_t *conn );
+ void socket_close( conn_t *sock );
+ void socket_expect_activity( conn_t *sock, int expect );
++void socket_expect_eof( conn_t *sock );
+ int socket_read( conn_t *sock, char *buf, uint len ); /* never waits */
+ char *socket_read_line( conn_t *sock ); /* don't free return value; never 
waits */
+ typedef enum { KeepOwn = 0, GiveOwn } ownership_t;

diff --git a/net-mail/isync/isync-1.4.4-r1.ebuild 
b/net-mail/isync/isync-1.4.4-r1.ebuild
new file mode 100644
index 000000000000..bf6eb20fef6f
--- /dev/null
+++ b/net-mail/isync/isync-1.4.4-r1.ebuild
@@ -0,0 +1,47 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="MailDir mailbox synchronizer"
+HOMEPAGE="http://isync.sourceforge.net/";
+LICENSE="GPL-2"
+SLOT="0"
+
+if [[ ${PV} == 9999 ]]; then
+       EGIT_REPO_URI="https://git.code.sf.net/p/${PN}/${PN}";
+       inherit git-r3 autotools
+else
+       SRC_URI="mirror://sourceforge/${PN}/${PN}/${PV}/${P}.tar.gz"
+       KEYWORDS="~amd64 ~arm ~arm64 ~ppc ~ppc64 ~riscv ~x86"
+fi
+
+IUSE="berkdb sasl ssl zlib"
+
+RDEPEND="
+       berkdb? ( >=sys-libs/db-4.2:= )
+       sasl?   ( dev-libs/cyrus-sasl )
+       ssl?    ( >=dev-libs/openssl-0.9.6:0= )
+       zlib?   ( sys-libs/zlib:0= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       dev-lang/perl
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-openssl3-eof.patch
+)
+
+src_prepare() {
+       default
+       [[ ${PV} == 9999 ]] && eautoreconf
+}
+
+src_configure() {
+       use berkdb || export ac_cv_berkdb4=no
+       econf \
+               $(use_with ssl) \
+               $(use_with sasl) \
+               $(use_with zlib)
+}

Reply via email to