Bug 274604 - mail/isync: work around "unexpected EOF" error messages at end of SSL connections
Summary: mail/isync: work around "unexpected EOF" error messages at end of SSL connect...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Emanuel Haupt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-10-20 08:31 UTC by François Charlier
Modified: 2023-10-20 16:23 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (ehaupt)


Attachments
patch (3.19 KB, patch)
2023-10-20 08:31 UTC, François Charlier
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description François Charlier 2023-10-20 08:31:42 UTC
Created attachment 245754 [details]
patch

Some imap servers (gmail) apparently doesn't send a close notification (SSL_shutdown()) before closing the TCP socket.

mbsync exits with the following error with OpenSSL 3.0:

Socket error: secure read from imap.gmail.com ([2a00:1450:400c:c02::6d]:993): error:0A000126:SSL routines::unexpected eof while reading

Add patch available upstream [1] but yet unreleased.

[1] https://sourceforge.net/p/isync/isync/ci/b6c36624f04cd388873785c0631df3f2f9ac4bf0/

Tested on FreeBSD 12.4-RELEASE, built with poudriere.
Build log available here (for 15 days) https://pkg.ploup.net/data/FreeBSD:12:amd64-default/2023-10-20_08h11m00s/logs/isync-1.4.4_1.log
Comment 1 commit-hook freebsd_committer freebsd_triage 2023-10-20 16:23:22 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a4ef2ba2e61e3a4190f04c889ded4f6688163354

commit a4ef2ba2e61e3a4190f04c889ded4f6688163354
Author:     François Charlier <fcharlier@ploup.net>
AuthorDate: 2023-10-20 16:15:41 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
CommitDate: 2023-10-20 16:15:41 +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

 mail/isync/Makefile                          |  1 +
 mail/isync/files/patch-src_drv__imap.c (new) | 25 +++++++++++++++++++++++++
 mail/isync/files/patch-src_socket.c (new)    | 18 ++++++++++++++++++
 mail/isync/files/patch-src_socket.h (new)    | 10 ++++++++++
 4 files changed, 54 insertions(+)
Comment 2 commit-hook freebsd_committer freebsd_triage 2023-10-20 16:23:23 UTC
A commit in branch 2023Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b6aa231a7a473ac3cf35a59a3beaf90023e041b2

commit b6aa231a7a473ac3cf35a59a3beaf90023e041b2
Author:     François Charlier <fcharlier@ploup.net>
AuthorDate: 2023-10-20 16:15:41 +0000
Commit:     Emanuel Haupt <ehaupt@FreeBSD.org>
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 (new) | 25 +++++++++++++++++++++++++
 mail/isync/files/patch-src_socket.c (new)    | 18 ++++++++++++++++++
 mail/isync/files/patch-src_socket.h (new)    | 10 ++++++++++
 4 files changed, 54 insertions(+)
Comment 3 Emanuel Haupt freebsd_committer freebsd_triage 2023-10-20 16:23:50 UTC
Committed, thanks!