Hello community, here is the log from the commit of package isync for openSUSE:Factory checked in at 2020-03-09 11:42:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/isync (Old) and /work/SRC/openSUSE:Factory/.isync.new.26092 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "isync" Mon Mar 9 11:42:42 2020 rev:3 rq:782851 version:1.3.1 Changes: -------- --- /work/SRC/openSUSE:Factory/isync/isync.changes 2018-01-05 01:00:01.039999661 +0100 +++ /work/SRC/openSUSE:Factory/.isync.new.26092/isync.changes 2020-03-09 11:42:55.937341887 +0100 @@ -1,0 +2,21 @@ +Wed Feb 26 07:21:40 UTC 2020 - Michal Hrusecky <michal.hruse...@opensuse.org> + +- drop sources signature as there is no published key to verify them + +------------------------------------------------------------------- +Thu Jan 16 10:57:17 UTC 2020 - Michal Hrusecky <michal.hruse...@opensuse.org> + +- Update to version 1.3.1 + - SSL now uses SNI, which for example GMail requires + - fixed fallbacks for missing UIDPLUS extension (with e.g. DavMail) + - fixed UIDVALIDITY recovery with really long Message-id headers + - fixed GSSAPI authentication with Kerberos + - fixed support for IMAP servers which do not sort search results (e.g., + poczta.o2.pl) + - fixed CopyArrivalDate on platforms without glibc + - fixed useless SASL warnings with certain plugins + - the perl 5.14 requirement is now made explicit + - improved OpenBSD support + - fixed a bunch of compiler warnings + +------------------------------------------------------------------- Old: ---- isync-1.3.0.tar.gz isync-1.3.0.tar.gz.asc isync.keyring New: ---- isync-1.3.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ isync.spec ++++++ --- /var/tmp/diff_new_pack.mlYyqy/_old 2020-03-09 11:42:56.929342423 +0100 +++ /var/tmp/diff_new_pack.mlYyqy/_new 2020-03-09 11:42:56.933342426 +0100 @@ -1,7 +1,7 @@ # # spec file for package isync # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -12,20 +12,18 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# Please submit bugfixes or comments via https://bugs.opensuse.org/ # Name: isync -Version: 1.3.0 +Version: 1.3.1 Release: 0 Summary: Utility to synchronize IMAP mailboxes with local maildir folders -License: GPL-2.0 +License: GPL-2.0-only Group: Productivity/Networking/Email/Utilities -Url: http://isync.sf.net/ +URL: http://isync.sf.net/ Source: http://prdownloads.sourceforge.net/isync/%{name}-%{version}.tar.gz -Source2: http://prdownloads.sourceforge.net/isync/%{name}-%{version}.tar.gz.asc -Source3: isync.keyring BuildRequires: db-devel BuildRequires: pkgconfig BuildRequires: pkgconfig(libsasl2) @@ -56,7 +54,8 @@ %files %defattr(-,root,root,-) -%doc COPYING README AUTHORS ChangeLog +%license COPYING +%doc README AUTHORS ChangeLog %{_bindir}/mbsync-get-cert %{_bindir}/isync %{_bindir}/mbsync ++++++ isync-1.3.0.tar.gz -> isync-1.3.1.tar.gz ++++++ ++++ 2149 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/ChangeLog new/isync-1.3.1/ChangeLog --- old/isync-1.3.0/ChangeLog 2017-10-01 15:01:43.000000000 +0200 +++ new/isync-1.3.1/ChangeLog 2019-05-28 15:53:46.000000000 +0200 @@ -1,3 +1,237 @@ +2019-05-28 13:44 Oswald Buddenhagen <o...@users.sf.net> + + * configure.ac: + + make output of perl check more tidy + + amends c75001aa. + +2019-03-10 10:30 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_imap.c: + + fix spacing in "SASL mechanism(s) not available" error message + + amends fdb03b91. + +2019-02-20 18:19 Klemens Nanni <k...@openbsd.org> + + * src/drv_imap.c: + + Fix CopyArrivalDate on platforms without glibc + + strptime(3)'s "%d" day of the month conversion specifier does not accept + leading blanks in case of single digit numbers. "%e" does that. + + While implementation details and differences between the two + day-of-month conversion specifiers vary, none of the major libcs + (incl. OpenBSD, FreeBSD, Illumos, musl) consume a leading blank for "%d" + except glibc, which consumes any number of spaces like in the "%e" case. + + Using "%e" ensures that date strings like " 4-Mar-2018 16:49:25 -0500" + are successfully parsed by all major implementations in compliance to + X/Open Portability Guide Issue 4, Version 2 ("XPG4.2"). musl is now the + only one that still treats "%d" and "%e" without stripping any space. + + Issue analysed and reported by Evan Silberman <e...@jklol.net> who found + mbsync 1.3.0 on OpenBSD 6.4 to fail with `CopyArrivalDate' set when + syncing mails with the above mentioned timestamp. + + See https://marc.info/?l=openbsd-tech&m=155044284526535 for details. + +2019-02-05 10:23 Gergely Risko <gerg...@risko.hu> + + * src/drv_imap.c: + + Work around useless SASL warnings + + Ater sasl_client_step() is called and the Cyrus SASL library forwards + it to the client plugin, if the result value is OK (authentication + succeeded), the clientout is filled out to be an empty string, even if + the client plugin wanted to return NULL. + + To avoid that mbsync complains at this point, check the returned length + instead of the pointer. + +2019-01-04 23:00 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_proxy_gen.pl: + + fix formatting of uint in callback debug stubs + + amends bb632d1c. + +2018-11-24 13:15 Oswald Buddenhagen <o...@users.sf.net> + + * src/: driver.c, driver.h, drv_imap.c: + + sort messages from UID FETCH request + + turns out that some IMAP servers (e.g., poczta.o2.pl) do not return + messages in ascending UID order in response to a UID FETCH request, + which makes the driver violate the API contract. + + counter this by sorting the messages. this also addresses the + long-standing (but hypothetical) issue that parallel UID FETCH requests + could be handled out-of-order and thus also lead to mixed up results. + + based on patch by Marcin Niestroj <macius19...@gmail.com>. + +2018-09-09 11:35 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_imap.c: + + bump IMAP command buffer size to 4KiB + + while only 1KiB is required by the IMAP spec, AUTHENTICATE GSSAPI with + Kerberos requires about 1700 bytes. + accomodate that, plus some reserve. + + fix suggested by Tollef Fog Heen <tfh...@err.no> via Debian BTS. + +2018-09-08 16:36 Oswald Buddenhagen <o...@users.sf.net> + + * src/socket.c: + + use SNI when connecting with SSL + + based on patch by Vincent Bernat <vinc...@bernat.ch>. + +2018-07-01 11:22 Oswald Buddenhagen <o...@users.sf.net> + + * src/: drv_imap.c, socket.h: + + fix type of 'port' and check its range in config reader + +2018-05-18 13:24 Klemens Nanni <k...@openbsd.org> + + * src/: drv_maildir.c, drv_proxy.c: + + Fix time_t format strings + + For time_t, long long handles dates after Y2038 and should be safe on + 32-bit architectures. + + From Jeremie Courreges-Anglas <j...@openbsd.org>. + +2018-05-18 13:11 Klemens Nanni <k...@openbsd.org> + + * src/socket.c: + + User functions provided by recent LibreSSL versions + + At least on OpenBSD, this enables new APIs out of the box provided by + LibreSSL 2.7.1 and higher. + + From Jeremie Courreges-Anglas <j...@openbsd.org>. + +2018-07-01 09:05 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_imap.c: + + fix IMAP UID sequence also in imap_find_new_msgs() + + use just * instead of the rather nonsensical *:* (which davmail happens + to actually barf at). + + amends 72be55b0 (and 0a5a8479). + +2018-04-08 16:10 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_maildir.c: + + fix uidvalidity recovery with really long message-id headers + + re-using the file name buffer for the headers wasn't such a great idea, + as _POSIX_PATH_MAX is only 256, while RFC2822 permits lines up to 1000 + chars. and sure enough, i have a message with a whopping 470-char + message-id header ... + +2017-11-18 08:57 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_imap.c: + + fix IMAP UID sequence in UIDNEXT determination fallback + + use just * instead of the rather nonsensical *:* (which davmail happens + to actually barf at). + + amends 72be55b0. + +2017-10-15 14:52 Oswald Buddenhagen <o...@users.sf.net> + + * src/util.c: + + make more use of equals() + +2017-10-15 14:14 Oswald Buddenhagen <o...@users.sf.net> + + * src/: config.c, main.c, sync.c, util.c: + + make map_name() interpret empty strings as "no separator" + + empty strings were previously meaningless, and starting with 72c2d695a, + failure to handle them lead to bogus results when the IMAP hierarchy + separator is legitimately empty (when the server genuinely supports none + and none is manually configured). non-null can be asserted more cleanly + than null-or-non-empty, so change the api like that. + incidentally, this also removes the need to work around gcc's bogus + warning in -Os mode. + + problem found by "Casper Ti. Vector" <caspervec...@gmail.com> + +2017-10-15 14:46 Oswald Buddenhagen <o...@users.sf.net> + + * src/drv_imap.c: + + remove pointless conditional in assignment of ctx->delimiter + + amends 72c2d695a. + +2017-10-15 09:34 Oswald Buddenhagen <o...@users.sf.net> + + * configure.ac: + + add check for perl and its version + +2017-10-07 12:30 Oswald Buddenhagen <o...@users.sf.net> + + * src/util.c: + + limit -Wmaybe-uninitialized suppression to gcc >= 4.3 + + apple gcc 4.2 complains about the use of the pragma inside a function. + clang also complains, but because the pragma is entirely unknown to it. + + as neither compiler emits the bogus warning in the first place, there is + no point in suppressing it anyway. + +2017-10-07 12:09 Oswald Buddenhagen <o...@users.sf.net> + + * src/socket.h: + + don't forward-declare SSL types any more + + our current project structure precludes the clash between some indirect + include of ssl.h and our definition of 'S' (or 'M', i don't remember) + that happened on some system, so there is no need to avoid including it + any more. + + this avoids complaints from some more picky compilers, as re-defining + typedefs (even to the same thing) is illegal before C11. + +2017-10-07 12:46 Oswald Buddenhagen <o...@users.sf.net> + + * .gitignore: + + git-ignore tar ball signatures + +2017-10-07 12:17 Oswald Buddenhagen <o...@users.sf.net> + + * configure.ac: + + bump version + 2017-10-01 12:59 Oswald Buddenhagen <o...@users.sf.net> * Makefile.am: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/compile new/isync-1.3.1/compile --- old/isync-1.3.0/compile 2017-10-01 10:46:50.000000000 +0200 +++ new/isync-1.3.1/compile 2019-05-28 15:49:12.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # Wrapper for compilers which do not understand '-c -o'. -scriptversion=2012-10-14.11; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1999-2014 Free Software Foundation, Inc. +# Copyright (C) 1999-2018 Free Software Foundation, Inc. # Written by Tom Tromey <tro...@cygnus.com>. # # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -255,7 +255,8 @@ echo "compile $scriptversion" exit $? ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac @@ -339,9 +340,9 @@ # Local Variables: # mode: shell-script # sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/configure.ac new/isync-1.3.1/configure.ac --- old/isync-1.3.0/configure.ac 2017-10-01 10:38:14.000000000 +0200 +++ new/isync-1.3.1/configure.ac 2019-05-28 15:44:13.000000000 +0200 @@ -1,4 +1,4 @@ -AC_INIT([isync], [1.3.0]) +AC_INIT([isync], [1.3.1]) AC_CONFIG_HEADERS([autodefs.h]) AM_INIT_AUTOMAKE @@ -11,6 +11,23 @@ CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" +AC_CHECK_PROG(PERL, perl, perl) +if test "x$PERL" = "x"; then + AC_MSG_ERROR([perl not found]) +fi + +need_perl=5.14 +AC_CACHE_CHECK([whether perl is recent enough], ob_cv_perl_ver, [ + if $PERL -e "use v$need_perl;" 2> /dev/null; then + ob_cv_perl_ver=yes + else + ob_cv_perl_ver=no + fi +]) +if test "x$ob_cv_perl_ver" = "xno"; then + AC_MSG_ERROR([perl is too old, need v$need_perl]) +fi + AC_CACHE_CHECK([whether strftime supports %z], ob_cv_strftime_z, [AC_TRY_RUN( [#include <time.h> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/isync.spec new/isync-1.3.1/isync.spec --- old/isync-1.3.0/isync.spec 2017-10-01 12:29:59.000000000 +0200 +++ new/isync-1.3.1/isync.spec 2019-05-28 15:49:49.000000000 +0200 @@ -1,10 +1,10 @@ Summary: Utility to synchronize IMAP mailboxes with local maildir folders Name: isync -Version: 1.3.0 +Version: 1.3.1 Release: 1 License: GPL Group: Applications/Internet -Source: isync-1.3.0.tar.gz +Source: isync-1.3.1.tar.gz URL: http://isync.sf.net/ Packager: Oswald Buddenhagen <o...@users.sf.net> BuildRoot: /var/tmp/%{name}-buildroot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/missing new/isync-1.3.1/missing --- old/isync-1.3.0/missing 2017-10-01 10:46:50.000000000 +0200 +++ new/isync-1.3.1/missing 2019-05-28 15:49:12.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2018-03-07.03; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2018 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -17,7 +17,7 @@ # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# along with this program. If not, see <https://www.gnu.org/licenses/>. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { @@ -207,9 +207,9 @@ exit $st # Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) +# eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" +# time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/config.c new/isync-1.3.1/src/config.c --- old/isync-1.3.0/src/config.c 2017-08-05 21:57:19.000000000 +0200 +++ new/isync-1.3.1/src/config.c 2017-10-15 16:53:27.000000000 +0200 @@ -355,6 +355,8 @@ if (store) { if (!store->max_size) store->max_size = INT_MAX; + if (!store->flat_delim) + store->flat_delim = ""; *storeapp = store; storeapp = &store->next; *storeapp = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/driver.c new/isync-1.3.1/src/driver.c --- old/isync-1.3.0/src/driver.c 2017-08-05 21:57:19.000000000 +0200 +++ new/isync-1.3.1/src/driver.c 2018-11-24 14:13:28.000000000 +0100 @@ -27,6 +27,15 @@ driver_t *drivers[N_DRIVERS] = { &maildir_driver, &imap_driver }; +int +count_generic_messages( message_t *msgs ) +{ + int count = 0; + for (; msgs; msgs = msgs->next) + count++; + return count; +} + void free_generic_messages( message_t *msgs ) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/driver.h new/isync-1.3.1/src/driver.h --- old/isync-1.3.0/src/driver.h 2017-08-05 20:02:13.000000000 +0200 +++ new/isync-1.3.1/src/driver.h 2018-11-24 14:13:28.000000000 +0100 @@ -259,6 +259,7 @@ int (*get_fail_state)( store_conf_t *conf ); }; +int count_generic_messages( message_t * ); void free_generic_messages( message_t * ); void parse_generic_store( store_conf_t *store, conffile_t *cfg ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/drv_imap.c new/isync-1.3.1/src/drv_imap.c --- old/isync-1.3.0/src/drv_imap.c 2017-10-01 10:42:35.000000000 +0200 +++ new/isync-1.3.1/src/drv_imap.c 2019-03-10 11:27:55.000000000 +0100 @@ -287,7 +287,7 @@ int bufl, litplus, iovcnt = 1; const char *buffmt; conn_iovec_t iov[3]; - char buf[1024]; + char buf[4096]; cmd->tag = ++ctx->nexttag; if (!cmd->param.data) { @@ -444,7 +444,7 @@ char *d, *ed; int maxlen; char c; - char buf[1024]; /* Minimal supported command buffer size per IMAP spec. */ + char buf[4096]; d = buf; ed = d + sizeof(buf); @@ -597,8 +597,9 @@ free( sts ); \ } -#define DONE_REFCOUNTED_STATE_ARGS(sts, ...) \ +#define DONE_REFCOUNTED_STATE_ARGS(sts, finalize, ...) \ if (!--sts->gen.ref_count) { \ + finalize \ sts->callback( sts->gen.ret_val, __VA_ARGS__, sts->callback_aux ); \ free( sts ); \ } @@ -948,7 +949,7 @@ struct tm datetime; memset( &datetime, 0, sizeof(datetime) ); - if (!(end = strptime( str, "%d-%b-%Y %H:%M:%S ", &datetime ))) + if (!(end = strptime( str, "%e-%b-%Y %H:%M:%S ", &datetime ))) return -1; if ((date = timegm( &datetime )) == -1) return -1; @@ -1102,7 +1103,6 @@ if (status & M_FLAGS) msgdata->flags = mask; } else { - /* XXX this will need sorting for out-of-order (multiple queries) */ cur = nfcalloc( sizeof(*cur) ); *ctx->msgapp = &cur->gen; ctx->msgapp = &cur->gen.next; @@ -2073,7 +2073,7 @@ int rc = sasl_client_step( ctx->sasl, NULL, 0, &interact, &out, &out_len ); if (process_sasl_step( ctx, rc, NULL, 0, interact, &out, &out_len ) < 0) warn( "Warning: SASL reported failure despite successful IMAP authentication. Ignoring...\n" ); - else if (out) + else if (out_len > 0) warn( "Warning: SASL wants more steps despite successful IMAP authentication. Ignoring...\n" ); } @@ -2174,7 +2174,7 @@ free( enc ); return; notsasl: - if (!ctx->sasl || sasl_listmech( ctx->sasl, NULL, "", "", "", &saslavail, NULL, NULL ) != SASL_OK) + if (!ctx->sasl || sasl_listmech( ctx->sasl, NULL, "", " ", "", &saslavail, NULL, NULL ) != SASL_OK) saslavail = "(none)"; /* EXTERNAL is always there anyway. */ if (!auth_login) { error( "IMAP error: selected SASL mechanism(s) not available;\n" @@ -2250,7 +2250,7 @@ ctx->state = SST_HALF; ctx->prefix = cfg->gen.path; - ctx->delimiter[0] = cfg->delimiter ? cfg->delimiter : 0; + ctx->delimiter[0] = cfg->delimiter; if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) { /* get NAMESPACE info */ if (!ctx->got_namespace) @@ -2388,7 +2388,7 @@ INIT_IMAP_CMD(imap_cmd_open_box_t, cmd, cmdp->callback, cmdp->callback_aux) cmd->gen.param.lastuid = 1; imap_exec( ctx, &cmd->gen, imap_open_box_p3, - "UID FETCH *:* (UID)" ); + "UID FETCH * (UID)" ); } static void @@ -2587,6 +2587,47 @@ } } +static int +imap_sort_msgs_comp( const void *a_, const void *b_ ) +{ + const message_t *a = *(const message_t * const *)a_; + const message_t *b = *(const message_t * const *)b_; + + if (a->uid < b->uid) + return -1; + if (a->uid > b->uid) + return 1; + return 0; +} + +static void +imap_sort_msgs( imap_store_t *ctx ) +{ + int count = count_generic_messages( ctx->msgs ); + if (count <= 1) + return; + + message_t **t = nfmalloc( sizeof(*t) * count ); + + message_t *m = ctx->msgs; + for (int i = 0; i < count; i++) { + t[i] = m; + m = m->next; + } + + qsort( t, count, sizeof(*t), imap_sort_msgs_comp ); + + ctx->msgs = t[0]; + + int j; + for (j = 0; j < count - 1; j++) + t[j]->next = t[j + 1]; + ctx->msgapp = &t[j]->next; + *ctx->msgapp = NULL; + + free( t ); +} + static void imap_submit_load_p2( imap_store_t *, imap_cmd_t *, int ); static void @@ -2615,7 +2656,10 @@ static void imap_submit_load_p3( imap_store_t *ctx, imap_load_box_state_t *sts ) { - DONE_REFCOUNTED_STATE_ARGS(sts, ctx->msgs, ctx->total_msgs, ctx->recent_msgs) + DONE_REFCOUNTED_STATE_ARGS(sts, { + if (sts->gen.ret_val == DRV_OK) + imap_sort_msgs( ctx ); + }, ctx->msgs, ctx->total_msgs, ctx->recent_msgs) } /******************* imap_fetch_msg *******************/ @@ -2922,7 +2966,7 @@ cmd->uid = cmdp->uid; cmd->gen.param.lastuid = 1; imap_exec( ctx, &cmd->gen, imap_find_new_msgs_p3, - "UID FETCH *:* (UID)" ); + "UID FETCH * (UID)" ); } static void @@ -3013,7 +3057,7 @@ static void imap_list_store_p3( imap_store_t *ctx, imap_list_store_state_t *sts ) { - DONE_REFCOUNTED_STATE_ARGS(sts, ctx->boxes) + DONE_REFCOUNTED_STATE_ARGS(sts, , ctx->boxes) } /******************* imap_cancel_cmds *******************/ @@ -3132,9 +3176,15 @@ server->pass = nfstrdup( cfg->val ); else if (!strcasecmp( "PassCmd", cfg->cmd )) server->pass_cmd = nfstrdup( cfg->val ); - else if (!strcasecmp( "Port", cfg->cmd )) - server->sconf.port = parse_int( cfg ); - else if (!strcasecmp( "Timeout", cfg->cmd )) + else if (!strcasecmp( "Port", cfg->cmd )) { + int port = parse_int( cfg ); + if ((unsigned)port > 0xffff) { + error( "%s:%d: Invalid port number\n", cfg->file, cfg->line ); + cfg->err = 1; + } else { + server->sconf.port = (ushort)port; + } + } else if (!strcasecmp( "Timeout", cfg->cmd )) server->sconf.timeout = parse_int( cfg ); else if (!strcasecmp( "PipelineDepth", cfg->cmd )) { if ((server->max_in_progress = parse_int( cfg )) < 1) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/drv_maildir.c new/isync-1.3.1/src/drv_maildir.c --- old/isync-1.3.0/src/drv_maildir.c 2017-10-01 10:41:29.000000000 +0200 +++ new/isync-1.3.1/src/drv_maildir.c 2018-07-01 13:24:59.000000000 +0200 @@ -1153,28 +1153,29 @@ goto retry; } int off, in_msgid = 0; - while ((want_tuid || want_msgid) && fgets( nbuf, sizeof(nbuf), f )) { - int bufl = strlen( nbuf ); - if (bufl && nbuf[bufl - 1] == '\n') + char lnbuf[1000]; // Says RFC2822 + while ((want_tuid || want_msgid) && fgets( lnbuf, sizeof(lnbuf), f )) { + int bufl = strlen( lnbuf ); + if (bufl && lnbuf[bufl - 1] == '\n') --bufl; - if (bufl && nbuf[bufl - 1] == '\r') + if (bufl && lnbuf[bufl - 1] == '\r') --bufl; if (!bufl) break; - if (want_tuid && starts_with( nbuf, bufl, "X-TUID: ", 8 )) { + if (want_tuid && starts_with( lnbuf, bufl, "X-TUID: ", 8 )) { if (bufl < 8 + TUIDL) { error( "Maildir error: malformed X-TUID header (UID %u)\n", uid ); continue; } - memcpy( entry->tuid, nbuf + 8, TUIDL ); + memcpy( entry->tuid, lnbuf + 8, TUIDL ); want_tuid = 0; in_msgid = 0; continue; } - if (want_msgid && starts_with_upper( nbuf, bufl, "MESSAGE-ID:", 11 )) { + if (want_msgid && starts_with_upper( lnbuf, bufl, "MESSAGE-ID:", 11 )) { off = 11; } else if (in_msgid) { - if (!isspace( nbuf[0] )) { + if (!isspace( lnbuf[0] )) { in_msgid = 0; continue; } @@ -1182,13 +1183,13 @@ } else { continue; } - while (off < bufl && isspace( nbuf[off] )) + while (off < bufl && isspace( lnbuf[off] )) off++; if (off == bufl) { in_msgid = 1; continue; } - entry->msgid = nfstrndup( nbuf + off, bufl - off ); + entry->msgid = nfstrndup( lnbuf + off, bufl - off ); want_msgid = 0; in_msgid = 0; } @@ -1569,7 +1570,7 @@ uint uid; char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX], fbuf[NUM_FLAGS + 3], base[128]; - bl = nfsnprintf( base, sizeof(base), "%ld.%d_%d.%s", (long)time( 0 ), Pid, ++MaildirCount, Hostname ); + bl = nfsnprintf( base, sizeof(base), "%lld.%d_%d.%s", (long long)time( 0 ), Pid, ++MaildirCount, Hostname ); if (!to_trash) { #ifdef USE_DB if (ctx->usedb) { @@ -1750,8 +1751,8 @@ for (;;) { nfsnprintf( buf, sizeof(buf), "%s/%s/%s", ctx->path, subdirs[gmsg->status & M_RECENT], msg->base ); s = strstr( msg->base, ((maildir_store_conf_t *)gctx->conf)->info_prefix ); - nfsnprintf( nbuf, sizeof(nbuf), "%s/%s/%ld.%d_%d.%s%s", ctx->trash, - subdirs[gmsg->status & M_RECENT], (long)time( 0 ), Pid, ++MaildirCount, Hostname, s ? s : "" ); + nfsnprintf( nbuf, sizeof(nbuf), "%s/%s/%lld.%d_%d.%s%s", ctx->trash, + subdirs[gmsg->status & M_RECENT], (long long)time( 0 ), Pid, ++MaildirCount, Hostname, s ? s : "" ); if (!rename( buf, nbuf )) break; if (!stat( buf, &st )) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/drv_proxy.c new/isync-1.3.1/src/drv_proxy.c --- old/isync-1.3.0/src/drv_proxy.c 2017-08-05 20:02:13.000000000 +0200 +++ new/isync-1.3.1/src/drv_proxy.c 2018-07-01 13:24:59.000000000 +0200 @@ -239,8 +239,8 @@ static char fbuf[as(Flags) + 1]; proxy_make_flags( cmd->data->flags, fbuf ); //# END -//# DEFINE fetch_msg_print_fmt_cb_args , flags=%s, date=%ld, size=%d -//# DEFINE fetch_msg_print_pass_cb_args , fbuf, cmd->data->date, cmd->data->len +//# DEFINE fetch_msg_print_fmt_cb_args , flags=%s, date=%lld, size=%d +//# DEFINE fetch_msg_print_pass_cb_args , fbuf, (long long)cmd->data->date, cmd->data->len //# DEFINE fetch_msg_print_cb_args if (sts == DRV_OK && (DFlags & DEBUG_DRV_ALL)) { printf( "%s=========\n", cmd->gen.ctx->label ); @@ -254,8 +254,8 @@ static char fbuf[as(Flags) + 1]; proxy_make_flags( data->flags, fbuf ); //# END -//# DEFINE store_msg_print_fmt_args , flags=%s, date=%ld, size=%d, to_trash=%s -//# DEFINE store_msg_print_pass_args , fbuf, data->date, data->len, to_trash ? "yes" : "no" +//# DEFINE store_msg_print_fmt_args , flags=%s, date=%lld, size=%d, to_trash=%s +//# DEFINE store_msg_print_pass_args , fbuf, (long long)data->date, data->len, to_trash ? "yes" : "no" //# DEFINE store_msg_print_args if (DFlags & DEBUG_DRV_ALL) { printf( "%s>>>>>>>>>\n", ctx->label ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/drv_proxy_gen.pl new/isync-1.3.1/src/drv_proxy_gen.pl --- old/isync-1.3.0/src/drv_proxy_gen.pl 2017-08-05 20:02:13.000000000 +0200 +++ new/isync-1.3.1/src/drv_proxy_gen.pl 2019-02-05 11:29:13.000000000 +0100 @@ -109,6 +109,7 @@ { $_ = shift; s/xint /\%\#x/g; + s/uint /\%u/g; s/int /\%d/g; s/const char \*/\%s/g; return $_; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/main.c new/isync-1.3.1/src/main.c --- old/isync-1.3.0/src/main.c 2017-10-01 10:41:29.000000000 +0200 +++ new/isync-1.3.1/src/main.c 2017-10-15 16:53:27.000000000 +0200 @@ -983,7 +983,7 @@ flags |= LIST_INBOX; } else if (c == '/') { /* Flattened sub-folders of INBOX actually end up in Path. */ - if (mvars->ctx[t]->conf->flat_delim) + if (mvars->ctx[t]->conf->flat_delim[0]) flags |= LIST_PATH; else flags |= LIST_INBOX; @@ -1027,7 +1027,7 @@ return; case DRV_OK: for (box = boxes; box; box = box->next) { - if (mvars->ctx[t]->conf->flat_delim) { + if (mvars->ctx[t]->conf->flat_delim[0]) { string_list_t *nbox; if (map_name( box->string, (char **)&nbox, offsetof(string_list_t, string), mvars->ctx[t]->conf->flat_delim, "/" ) < 0) { error( "Error: flattened mailbox name '%s' contains canonical hierarchy delimiter\n", box->string ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/socket.c new/isync-1.3.1/src/socket.c --- old/isync-1.3.0/src/socket.c 2017-10-01 10:42:35.000000000 +0200 +++ new/isync-1.3.1/src/socket.c 2018-09-08 18:37:09.000000000 +0200 @@ -40,7 +40,8 @@ # include <openssl/ssl.h> # include <openssl/err.h> # include <openssl/x509v3.h> -# if OPENSSL_VERSION_NUMBER < 0x10100000L +# if OPENSSL_VERSION_NUMBER < 0x10100000L \ + || (defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER >= 0x2070100fL) # define X509_OBJECT_get0_X509(o) ((o)->data.x509) # define X509_STORE_get0_objects(o) ((o)->objs) # endif @@ -270,6 +271,8 @@ init_wakeup( &conn->ssl_fake, ssl_fake_cb, conn ); conn->ssl = SSL_new( ((server_conf_t *)conn->conf)->SSLContext ); + if (ssl_return( "set server name", conn, SSL_set_tlsext_host_name( conn->ssl, conn->conf->host ) ) < 0) + return; SSL_set_fd( conn->ssl, conn->fd ); SSL_set_mode( conn->ssl, SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER ); socket_expect_read( conn, 1 ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/socket.h new/isync-1.3.1/src/socket.h --- old/isync-1.3.0/src/socket.h 2017-10-01 10:42:35.000000000 +0200 +++ new/isync-1.3.1/src/socket.h 2018-07-01 13:25:16.000000000 +0200 @@ -30,9 +30,7 @@ #endif #ifdef HAVE_LIBSSL -typedef struct ssl_st SSL; -typedef struct ssl_ctx_st SSL_CTX; -typedef struct stack_st _STACK; +# include <openssl/ssl.h> enum { SSLv3 = 2, @@ -45,7 +43,7 @@ typedef struct { char *tunnel; char *host; - int port; + ushort port; int timeout; #ifdef HAVE_LIBSSL char *cert_file; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/sync.c new/isync-1.3.1/src/sync.c --- old/isync-1.3.0/src/sync.c 2017-10-01 10:42:35.000000000 +0200 +++ new/isync-1.3.1/src/sync.c 2017-10-15 16:53:27.000000000 +0200 @@ -1014,7 +1014,7 @@ svars->orig_name[t] = (!names[t] || (ctx[t]->conf->map_inbox && !strcmp( ctx[t]->conf->map_inbox, names[t] ))) ? "INBOX" : names[t]; - if (!ctx[t]->conf->flat_delim) { + if (!ctx[t]->conf->flat_delim[0]) { svars->box_name[t] = nfstrdup( svars->orig_name[t] ); } else if (map_name( svars->orig_name[t], &svars->box_name[t], 0, "/", ctx[t]->conf->flat_delim ) < 0) { error( "Error: canonical mailbox name '%s' contains flattened hierarchy delimiter\n", svars->orig_name[t] ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/isync-1.3.0/src/util.c new/isync-1.3.1/src/util.c --- old/isync-1.3.0/src/util.c 2017-08-05 21:57:19.000000000 +0200 +++ new/isync-1.3.1/src/util.c 2017-10-15 16:55:23.000000000 +0200 @@ -479,19 +479,20 @@ char *p; int i, l, ll, num, inl, outl; + assert( arg ); l = strlen( arg ); - if (!in) { + assert( in ); + inl = strlen( in ); + if (!inl) { copy: *result = nfmalloc( reserve + l + 1 ); memcpy( *result + reserve, arg, l + 1 ); return 0; } - inl = strlen( in ); - if (out) { - outl = strlen( out ); - if (inl == outl && !memcmp( in, out, inl )) - goto copy; - } + assert( out ); + outl = strlen( out ); + if (equals( in, inl, out, outl )) + goto copy; for (num = 0, i = 0; i < l; ) { for (ll = 0; ll < inl; ll++) if (arg[i + ll] != in[ll]) @@ -500,7 +501,7 @@ i += inl; continue; fout: - if (out) { + if (outl) { for (ll = 0; ll < outl; ll++) if (arg[i + ll] != out[ll]) goto fnexti; @@ -511,7 +512,7 @@ } if (!num) goto copy; - if (!out) + if (!outl) return -2; *result = nfmalloc( reserve + l + num * (outl - inl) + 1 ); p = *result + reserve; @@ -519,15 +520,7 @@ for (ll = 0; ll < inl; ll++) if (arg[i + ll] != in[ll]) goto rnexti; -#ifdef __GNUC__ -# pragma GCC diagnostic push -/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42145 */ -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif memcpy( p, out, outl ); -#ifdef __GNUC__ -# pragma GCC diagnostic pop -#endif p += outl; i += inl; continue;