From nobody Fri Oct 20 16:23:05 2023 X-Original-To: dev-commits-ports-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4SBqd60vYtz4xy1D; Fri, 20 Oct 2023 16:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4SBqd60MXgz3Mj6; Fri, 20 Oct 2023 16:23:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697818986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gP6QRmyAhlKxX5NFFOsy6CqwtDiGY2mG7QAs8/26NA0=; b=Es9AuBUSXoKuMmQ0gRBh3DlAOM9UahJIcJtrIAJ51E/38QgM708XWtHVw2flfvJLUUC61C RHXtBlGjC/W9zB3ul+reHrJX2sl0tYJ0e/zGdW8uSS7T0sFnns5TfeE3HgS8CeSQSIU0M4 YcT6eWdzsVJM15KYDWAgTIaPsHfRzLAbDcMjDYa79ptXlOweI0o45p/bzT1K/5NYpbWyCc SeSJu1BjWPqf5k26lUxgiWQMxFGRs1iN+eMPyQPdOHeY1xa2z4+RYnTE9XHflAWjSNygF2 P/SZWSX6Zhp8X1IJZg2wWdEElU7j8dmIAtEXWijYlIsmkonXwMq1M86PMwzf5Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1697818986; a=rsa-sha256; cv=none; b=itv7deo1QNNdsTF149Ip+ZeC/VyLN3rqQflr6nt93a0biQLnzMJJ/NKb7EFcrx7JMy6vLe Jm0VB/5Kczhxvy9PKwt5t161JreEN+hCUzuaceLlZ2GI86i6LyrYjAAUIeH0RFEPDmTgkL PwCnFssVkd4u52i+gzykOHHQNwEaMZZ9ZCRyUYnapCjqWpd0JaX4jQ9yyohSWRDcr7ggvw opUvb4DIy80LMwAkj3RaA9Jn62MfA84yY/EHAwbtIZhOrhhiM6dFN6UsMtQ3gdxoMhq9ys NdBxt4vCOiFHWF8bdSdMem80Hzi+a78fSlM2qY78Aqnnc7ahvaMJ+kTr473dQA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1697818986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gP6QRmyAhlKxX5NFFOsy6CqwtDiGY2mG7QAs8/26NA0=; b=ndkI8Jbr6lseEzaMtwK+8c3L4TRt/+zYqjdi/m/mmTm4+pZCHXB5NTzj2ILIRzVapvxyrI xpXWMy5ccYuzO5yeJNuca6kKY5MdNdQ7BSA5nMs1LXXVUTxKnGtzpt8NLK7awZ4Mw0XYPI QhDxz7YO4/2OSUcTZcSuPpmPITE9+TaFd8e/vwF+s/5yAx/qn2b7MtmtRHUISjdM1S00Tp 2tEP7xEGWf44JUafI+0SWV4usfci5/P7u4Xz9ZIvj+DiA8OFVAt6O+hrZMvuYreWXsQ6/d noRgC+tybr1Fw3zzMKLY/j5V8huluUWpe8Y0Y0s/baWN9swE7TafXgSEfoQSQQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4SBqd56WsBzgH6; Fri, 20 Oct 2023 16:23:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 39KGN5Y3072555; Fri, 20 Oct 2023 16:23:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 39KGN59W072552; Fri, 20 Oct 2023 16:23:05 GMT (envelope-from git) Date: Fri, 20 Oct 2023 16:23:05 GMT Message-Id: <202310201623.39KGN59W072552@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Emanuel Haupt Subject: git: b6aa231a7a47 - 2023Q4 - mail/isync: Resolve "unexpected EOF" SSL error List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-branches@freebsd.org X-BeenThere: dev-commits-ports-branches@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: ehaupt X-Git-Repository: ports X-Git-Refname: refs/heads/2023Q4 X-Git-Reftype: branch X-Git-Commit: b6aa231a7a473ac3cf35a59a3beaf90023e041b2 Auto-Submitted: auto-generated The branch 2023Q4 has been updated by ehaupt: URL: https://cgit.FreeBSD.org/ports/commit/?id=b6aa231a7a473ac3cf35a59a3beaf90023e041b2 commit b6aa231a7a473ac3cf35a59a3beaf90023e041b2 Author: François Charlier AuthorDate: 2023-10-20 16:15:41 +0000 Commit: Emanuel Haupt CommitDate: 2023-10-20 16:22:59 +0000 mail/isync: Resolve "unexpected EOF" SSL error Fixes an issue where some IMAP servers, such as Gmail, do not send a close notification (SSL_shutdown()) before closing the TCP socket, leading to "unexpected EOF" errors with OpenSSL 3.0. Now mbsync gracefully handles this scenario, preventing the following error: Socket error: secure read from imap.gmail.com ([IPv6 Address Redacted]:993): error:0A000126:SSL routines::unexpected eof while reading PR: 274604 (cherry picked from commit a4ef2ba2e61e3a4190f04c889ded4f6688163354) --- mail/isync/Makefile | 1 + mail/isync/files/patch-src_drv__imap.c | 25 +++++++++++++++++++++++++ mail/isync/files/patch-src_socket.c | 18 ++++++++++++++++++ mail/isync/files/patch-src_socket.h | 10 ++++++++++ 4 files changed, 54 insertions(+) diff --git a/mail/isync/Makefile b/mail/isync/Makefile index 2bc408fa5f33..9de86aec08f2 100644 --- a/mail/isync/Makefile +++ b/mail/isync/Makefile @@ -1,5 +1,6 @@ PORTNAME= isync PORTVERSION= 1.4.4 +PORTREVISION= 1 CATEGORIES= mail MASTER_SITES= SF diff --git a/mail/isync/files/patch-src_drv__imap.c b/mail/isync/files/patch-src_drv__imap.c new file mode 100644 index 000000000000..bd3e044136a8 --- /dev/null +++ b/mail/isync/files/patch-src_drv__imap.c @@ -0,0 +1,25 @@ +--- src/drv_imap.c.orig 2021-12-03 10:56:16 UTC ++++ 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 @@ imap_cleanup_p2( imap_store_t *ctx, + 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 *******************/ diff --git a/mail/isync/files/patch-src_socket.c b/mail/isync/files/patch-src_socket.c new file mode 100644 index 000000000000..61b4a1872c87 --- /dev/null +++ b/mail/isync/files/patch-src_socket.c @@ -0,0 +1,18 @@ +--- src/socket.c.orig 2021-12-03 10:56:16 UTC ++++ 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 ) + { diff --git a/mail/isync/files/patch-src_socket.h b/mail/isync/files/patch-src_socket.h new file mode 100644 index 000000000000..986b52657e8e --- /dev/null +++ b/mail/isync/files/patch-src_socket.h @@ -0,0 +1,10 @@ +--- src/socket.h.orig 2021-12-03 10:56:16 UTC ++++ src/socket.h +@@ -142,6 +142,7 @@ void socket_expect_activity( conn_t *sock, int expect + 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;