nixpkgs-suyu/pkgs/tools/networking/isync/default.nix
Michael Weiss fe02c5ee1a
isync: Disable the XOAUTH2 support by default as it caused regressions
The XOAUTH2 support was recently added in 47eda8e00a but apparently it
causes regressions when using other SASL methods.
An example error message:
```
IMAP command 'AUTHENTICATE XOAUTH2 SOMEHASH=' returned an error: NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
```

The cause seems to be that overriding `SASL_PATH` drops all available
SASL mechanisms from `cyrus_sasl`, so only `XOAUTH2` (and `EXTERNAL`)
will be left. See [0] and the following comments for more details.

We'd need to set `SASL_PATH` to a combination/merge of
`${cyrus_sasl}/lib/sasl2` and `${cyrus-sasl-xoauth2}/lib/sasl2`.
Anyway, it seems best to disable the XOAUTH2 support by default due to
the two other concerns mentioned in the comment.

[0]: https://github.com/NixOS/nixpkgs/pull/235148#issuecomment-1575432154

Reported-by: Dominik Schrempf <dominik.schrempf@gmail.com>
2023-06-04 22:03:22 +02:00

51 lines
1.9 KiB
Nix

{ lib, stdenv, fetchurl, pkg-config, perl
, openssl, db, cyrus_sasl, zlib
, Security
# Disabled by default as XOAUTH2 is an "OBSOLETE" SASL mechanism and this relies
# on a package that isn't really maintained anymore:
, withCyrusSaslXoauth2 ? false, cyrus-sasl-xoauth2, makeWrapper
}:
stdenv.mkDerivation rec {
pname = "isync";
version = "1.4.4";
src = fetchurl {
url = "mirror://sourceforge/isync/${pname}-${version}.tar.gz";
sha256 = "1zq0wwvmqsl9y71546dr0aygzn9gjjfiw19hlcq87s929y4p6ckw";
};
patches = [
# Fixes "Fatal: buffer too small" error
./0001-Increase-imap_vprintf-buffer-size.patch
# Fix #202595: SSL error "Socket error: ... unexpected eof while reading"
# Source: https://sourceforge.net/p/isync/isync/ci/b6c36624f04cd388873785c0631df3f2f9ac4bf0/
./work-around-unexpected-EOF-error-messages-at-end-of-SSL-connections.patch
];
nativeBuildInputs = [ pkg-config perl ]
++ lib.optionals withCyrusSaslXoauth2 [ makeWrapper ];
buildInputs = [ openssl db cyrus_sasl zlib ]
++ lib.optionals stdenv.isDarwin [ Security ];
postInstall = lib.optionalString withCyrusSaslXoauth2 ''
wrapProgram "$out/bin/mbsync" \
--prefix SASL_PATH : "${lib.makeSearchPath "lib/sasl2" [ cyrus-sasl-xoauth2 ]}"
'';
meta = with lib; {
homepage = "http://isync.sourceforge.net/";
# https://sourceforge.net/projects/isync/
changelog = "https://sourceforge.net/p/isync/isync/ci/v${version}/tree/NEWS";
description = "Free IMAP and MailDir mailbox synchronizer";
longDescription = ''
mbsync (formerly isync) is a command line application which synchronizes
mailboxes. Currently Maildir and IMAP4 mailboxes are supported. New
messages, message deletions and flag changes can be propagated both ways.
'';
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = with maintainers; [ primeos lheckemann ];
mainProgram = "mbsync";
};
}