From 93fb3c29c6f7c581feb2ea201721e38ace2a5af9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 23 Nov 2019 13:30:12 +0100 Subject: [PATCH 01/14] fix UIDNEXT error message --- src/drv_imap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index a4959fb..989b86e 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -1173,7 +1173,7 @@ parse_response_code( imap_store_t *ctx, imap_cmd_t *cmd, char *s ) if (!(arg = next_arg( &s )) || (ctx->uidnext = strtoul( arg, &earg, 10 ), *earg)) { - error( "IMAP error: malformed NEXTUID status\n" ); + error( "IMAP error: malformed UIDNEXT status\n" ); return RESP_CANCEL; } } else if (!strcmp( "CAPABILITY", arg )) { From 48038fede11a3b6e45e1b709ac6204ebf4120a9a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 1 Jul 2020 18:25:45 +0200 Subject: [PATCH 02/14] mention --remove in --help output amends d9a983a. --- src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.c b/src/main.c index eadd81f..9dbb116 100644 --- a/src/main.c +++ b/src/main.c @@ -77,7 +77,8 @@ PACKAGE " " VERSION " - mailbox synchronizer\n" " -N, --renew propagate previously not propagated new messages\n" " -L, --pull propagate from master to slave\n" " -H, --push propagate from slave to master\n" -" -C, --create create mailboxes if nonexistent\n" +" -C, --create propagate creations of mailboxes\n" +" -R, --remove propagate deletions of mailboxes\n" " -X, --expunge expunge deleted messages\n" " -c, --config CONFIG read an alternate config file (default: ~/." EXE "rc)\n" " -D, --debug debugging modes (see manual)\n" @@ -88,7 +89,8 @@ PACKAGE " " VERSION " - mailbox synchronizer\n" "\nIf neither --pull nor --push are specified, both are active.\n" "If neither --new, --delete, --flags nor --renew are specified, all are active.\n" "Direction and operation can be concatenated like --pull-new, etc.\n" -"--create and --expunge can be suffixed with -master/-slave. Read the man page.\n" +"--create, --remove, and --expunge can be suffixed with -master/-slave.\n" +"See the man page for details.\n" "\nSupported mailbox formats are: IMAP4rev1, Maildir\n" "\nCompile time options:\n" #ifdef HAVE_LIBSSL From 281a87ed8926fc38194b86c78b1a1e4659f2d73e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Nov 2019 16:30:44 +0100 Subject: [PATCH 03/14] update build requirements in particular, mention perl-related things, which might not be immediately obvious. --- README | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README b/README index abb873d..28484bd 100644 --- a/README +++ b/README @@ -55,11 +55,18 @@ isync executable still exists; it is a compatibility wrapper around mbsync. * Requirements + perl v5.14+ Berkeley DB 4.1+ (optional) OpenSSL for TLS/SSL support (optional) Cyrus SASL (optional) zlib (optional) + The build from git also requires: + + GNU autotools (autoconf & automake) + perl module Date::Parse (libtimedate-perl on Debian, perl-TimeDate on + Fedora and Suse) + * Installation ./autogen.sh (only when building from git) From a2fe8c155a625b8242bd36870bc1e0c88b5f37bd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Feb 2020 12:10:07 +0100 Subject: [PATCH 04/14] re-generate ChangeLog only if it's newer than the git index otherwise, we'd re-generate it during 'install' as well. note that this does not work with new-style git worktrees, where .git is only a file - but there the log generation itself already doesn't work anyway. --- Makefile.am | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 557742f..245299b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -47,7 +47,10 @@ LOG_PL = \ print $$log."\n"; \ } -$(srcdir)/ChangeLog: log +$(srcdir)/.git/index: +$(srcdir)/ChangeLog: $(srcdir)/.git/index + $(MAKE) log + log: @test -z "$(srcdir)" || cd $(srcdir) && \ ( ! test -d .git || \ From 7d9d3e15f5e8e3a82998dd74287b0021c1900aaa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 18 Nov 2019 18:57:38 +0100 Subject: [PATCH 05/14] improve documentation of the server certificate related options --- src/mbsync.1 | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/mbsync.1 b/src/mbsync.1 index 883fc4f..e4906b0 100644 --- a/src/mbsync.1 +++ b/src/mbsync.1 @@ -371,18 +371,26 @@ Use old versions only when the server has problems with newer ones. .. .TP \fBSystemCertificates\fR \fByes\fR|\fBno\fR -Whether the system's default root cerificate store should be loaded. +Whether the system's default CA (certificate authority) certificate +store should be used to verify certificate trust chains. Disable this +if you want to trust only hand-picked certificates. (Default: \fByes\fR) .. .TP \fBCertificateFile\fR \fIpath\fR File containing additional X.509 certificates used to verify server -identities. Directly matched peer certificates are always trusted, -regardless of validity. -.br -Note that the system's default certificate store is always used -(unless \fBSystemCertificates\fR is disabled) -and should not be specified here. +identities. +These certificates are always trusted, regardless of validity. +.br +The certificates from this file are matched only against the received +server certificate itself; CA certificates are \fBnot\fR supported here. +Do \fBnot\fR specify the system's CA certificate store here; see +\fBSystemCertificates\fR instead. +.br +The contents for this file may be obtained using the +\fBmbsync-get-cert\fR tool; make sure to verify the fingerprints of the +certificates before trusting them, or transfer them securely from the +server's network (if it is trusted). .. .TP \fBClientCertificate\fR \fIpath\fR From a33e44758b74d59eaefbcead2d192e1d25539343 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 27 Nov 2019 17:55:33 +0100 Subject: [PATCH 06/14] fix roff abuse in man pages ".." is not valid. use "." instead, as recommended by groff_man(7). this also necessitated adjusting the markup of the license blurbs. --- src/compat/isync.1 | 101 +++++++++++++------------- src/mbsync.1 | 171 ++++++++++++++++++++++----------------------- 2 files changed, 135 insertions(+), 137 deletions(-) diff --git a/src/compat/isync.1 b/src/compat/isync.1 index aad06aa..034d1e0 100644 --- a/src/compat/isync.1 +++ b/src/compat/isync.1 @@ -1,30 +1,29 @@ -.ig -\" isync - mbsync wrapper: IMAP4 to Maildir mailbox synchronizer -\" Copyright (C) 2000-2002 Michael R. Elkins -\" Copyright (C) 2002-2004 Oswald Buddenhagen -\" -\" This program is free software; you can redistribute it and/or modify -\" it under the terms of the GNU General Public License as published by -\" the Free Software Foundation; either version 2 of the License, or -\" (at your option) any later version. -\" -\" This program is distributed in the hope that it will be useful, -\" but WITHOUT ANY WARRANTY; without even the implied warranty of -\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -\" 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 . -\" -.. +.\" isync - mbsync wrapper: IMAP4 to Maildir mailbox synchronizer +.\" Copyright (C) 2000-2002 Michael R. Elkins +.\" Copyright (C) 2002-2004 Oswald Buddenhagen +.\" +.\" This program is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 2 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" 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 . +.\" +. .TH isync 1 "2010 Feb 7" -.. +. .SH NAME isync - synchronize IMAP4 and Maildir mailboxes -.. +. .SH SYNOPSIS \fBisync\fR [\fIoptions\fR ...] {\fImailbox\fR ...|\fI-a\fR|\fI-l\fR} -.. +. .SH DESCRIPTION \fBisync\fR is a command line application which synchronizes local Maildir mailboxes with remote IMAP4 mailboxes, suitable for use in @@ -40,7 +39,7 @@ want to use \fBmdconvert\fR to convert the mailboxes to the more efficient .br \fBisync\fR is deprecated. Please use the \fB-w\fR option to permanently migrate the configuration and start using \fBmbsync\fR directly. -.. +. .SH OPTIONS .TP \fB-c\fR, \fB--config\fR \fIfile\fR @@ -136,7 +135,7 @@ of "isync" with "mbsync", or appending ".mbsync" if "isync" was not found. .TP \fB-W\fR, \fB--writeto\fR \fIfile\fR Like \fB-w\fR, but use the specified name for the new config file. -.. +. .SH CONFIGURATION \fBisync\fR by default reads \fI~/.isyncrc\fR to load configuration data. Each non-empty line of the configuration file that does not start with a @@ -146,7 +145,7 @@ The following commands are understood: \fBMailbox\fR \fIpath\fR Defines a local Maildir mailbox. All configuration commands following this line, up until the next \fIMailbox\fR command, apply to this mailbox only. -.. +. .TP \fBHost\fR [\fBimaps:\fR]\fIname\fR Defines the DNS name or IP address of the IMAP server. If the hostname is @@ -155,57 +154,57 @@ to port 993 (though you can change this by placing a \fBPort\fR command \fBafter\fR the \fBHost\fR command). Note that modern servers support SSL on the default port 143. \fBisync\fR will always attempt to use SSL if available. -.. +. .TP \fBPort\fR \fIport\fR Defines the TCP port number of the IMAP server (Default: 143 for imap, 993 for imaps) -.. +. .TP \fBBox\fR \fImailbox\fR Defines the name of the remote IMAP mailbox associated with the local Maildir mailbox (Default: INBOX) -.. +. .TP \fBUser\fR \fIusername\fR Defines the login name on the IMAP server (Default: current user) -.. +. .TP \fBPass\fR \fIpassword\fR Defines the password for \fIusername\fR on the IMAP server. Note that this option is \fBNOT\fR required. If no password is specified in the configuration file, \fBisync\fR will prompt you for it. -.. +. .TP \fBAlias\fR \fIstring\fR Defines an alias for the mailbox which can be used as a shortcut on the command line. -.. +. .TP \fBCopyDeletedTo\fR \fImailbox\fR Specifies the remote IMAP mailbox to copy deleted messages to prior to expunging (Default: none). -.. +. .TP \fBDelete\fR \fIyes\fR|\fIno\fR Specifies whether message deletions are propagated. (Default: no). \fBNOTE:\fR The \fI-d\fR command line option overrides this setting when set to \fIno\fR. -.. +. .TP \fBExpunge\fR \fIyes\fR|\fIno\fR Specifies whether deleted messages are expunged. (Default: no). \fBNOTE:\fR The \fI-e\fR command line option overrides this setting when set to \fIno\fR. -.. +. .TP \fBMailDir\fR \fIdirectory\fR Specifies the location of your local mailboxes if a relative path is specified in a \fIMailbox\fR command (Default: \fI~\fR). \fBNOTE:\fR This directive is allowed only in the \fIglobal\fR section (see below). -.. +. .TP \fBFolder\fR \fIdirectory\fR/ Specifies the location of your IMAP mailboxes @@ -214,7 +213,7 @@ specified in \fIBox\fR commands (Default: \fI""\fR). a slash) to this specification. \fBNOTE 2:\fR This directive is allowed only in the \fIglobal\fR section (see below). -.. +. .TP \fBMaxMessages\fR \fIcount\fR Sets the number of messages \fBisync\fR should keep in the local copy of a @@ -227,14 +226,14 @@ Messages that are flagged (marked as important) and unread messages will not be automatically deleted. If \fIcount\fR is 0, the maximum number of messages is \fBunlimited\fR. (Default: 0) -.. +. .TP \fBMaxSize\fR \fIbytes\fR Messages larger than that many bytes will not be transferred over the wire. This is useful for weeding out messages with large attachments. If \fIbytes\fR is 0, the maximum file size is \fBunlimited\fR. (Default: 0) -.. +. .TP \fBTunnel\fR \fIcommand\fR Specify a command to run to establish a connection rather than opening a TCP @@ -246,17 +245,17 @@ Selects whether the server's first "personal" NAMESPACE should be prefixed to mailbox names. Disabling this makes sense for some broken IMAP servers. This option is meaningless if a \fIFolder\fR was specified. (Default: \fIyes\fR) -.. +. .TP \fBRequireCRAM\fR \fIyes\fR|\fIno\fR If set to \fIyes\fR, \fBisync\fR will abort the connection if no CRAM-MD5 authentication is possible. (Default: \fIno\fR) -.. +. .TP \fBRequireSSL\fR \fIyes\fR|\fIno\fR \fBisync\fR will abort the connection if a TLS/SSL session cannot be established with the IMAP server. (Default: \fIyes\fR) -.. +. .TP \fBCertificateFile\fR \fIpath\fR File containing additional X.509 certificates used to verify server @@ -265,22 +264,22 @@ regardless of validity. .br Note that the system's default certificate store is always used and should not be specified here. -.. +. .TP \fBUseSSLv2\fR \fIyes\fR|\fIno\fR Should \fBisync\fR use SSLv2 for communication with the IMAP server over SSL? (Default: \fIno\fR) -.. +. .TP \fBUseSSLv3\fR \fIyes\fR|\fIno\fR Should \fBisync\fR use SSLv3 for communication with the IMAP server over SSL? (Default: \fIyes\fR if the imaps port is used, otherwise \fIno\fR) -.. +. .TP \fBUseTLSv1\fR \fIyes\fR|\fIno\fR Should \fBisync\fR use TLSv1.x for communication with the IMAP server over SSL? (Default: \fIyes\fR) -.. +. .TP \fBOneToOne\fR \fBisync\fR will ignore any \fIMailbox\fR specifications and instead pick up @@ -288,14 +287,14 @@ all mailboxes from the local \fIMailDir\fR and remote \fIFolder\fR and map them 1:1 onto each other according to their names. \fBNOTE:\fR This directive is allowed only in the \fIglobal\fR section (see below). -.. +. .TP \fBInbox\fR \fImailbox\fR Exception to the OneToOne mapping: the special IMAP mailbox \fIINBOX\fR is mapped to the local \fImailbox\fR (relative to the \fIMailDir\fR). \fBNOTE:\fR This directive is only meaningful in the \fIglobal\fR section (see below). -.. +. .P Configuration commands that appear prior to the first \fBMailbox\fR command are considered to be \fIglobal\fR @@ -305,24 +304,24 @@ login name for several IMAP servers, you can put a \fBUser\fR command before the first \fBMailbox\fR command, and then leave out the \fBUser\fR command in the sections for each mailbox. \fBisync\fR will then use the global value by default. -.. +. .SH FILES .TP .B ~/.isyncrc Default configuration file -.. +. .SH BUGS The configuration file takes precedence over command line options. .br Use -c /dev/null to work around. .P See the \fBINHERENT PROBLEMS\fR section in the \fBmbsync\fR man page, too. -.. +. .SH SEE ALSO mbsync(1), mdconvert(1), mutt(1), maildir(5) .P Up to date information on \fBisync\fR can be found at http://isync.sf.net/ -.. +. .SH AUTHORS Originally written by Michael R. Elkins, currently maintained by Oswald Buddenhagen. diff --git a/src/mbsync.1 b/src/mbsync.1 index e4906b0..6830508 100644 --- a/src/mbsync.1 +++ b/src/mbsync.1 @@ -1,33 +1,32 @@ -.ig -\" mbsync - mailbox synchronizer -\" Copyright (C) 2000-2002 Michael R. Elkins -\" Copyright (C) 2002-2004,2011-2015 Oswald Buddenhagen -\" Copyright (C) 2004 Theodore Y. Ts'o -\" -\" This program is free software; you can redistribute it and/or modify -\" it under the terms of the GNU General Public License as published by -\" the Free Software Foundation; either version 2 of the License, or -\" (at your option) any later version. -\" -\" This program is distributed in the hope that it will be useful, -\" but WITHOUT ANY WARRANTY; without even the implied warranty of -\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -\" 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 . -\" -\" As a special exception, mbsync may be linked with the OpenSSL library, -\" despite that library's more restrictive license. -.. +.\" mbsync - mailbox synchronizer +.\" Copyright (C) 2000-2002 Michael R. Elkins +.\" Copyright (C) 2002-2004,2011-2015 Oswald Buddenhagen +.\" Copyright (C) 2004 Theodore Y. Ts'o +.\" +.\" This program is free software; you can redistribute it and/or modify +.\" it under the terms of the GNU General Public License as published by +.\" the Free Software Foundation; either version 2 of the License, or +.\" (at your option) any later version. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" 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 . +.\" +.\" As a special exception, mbsync may be linked with the OpenSSL library, +.\" despite that library's more restrictive license. +. .TH mbsync 1 "2015 Mar 22" -.. +. .SH NAME mbsync - synchronize IMAP4 and Maildir mailboxes -.. +. .SH SYNOPSIS \fBmbsync\fR [\fIoptions\fR ...] {{\fIchannel\fR[\fB:\fIbox\fR[{\fB,\fR|\fB\\n\fR}...]]|\fIgroup\fR} ...|\fB-a\fR} -.. +. .SH DESCRIPTION \fBmbsync\fR is a command line application which synchronizes mailboxes; currently Maildir and IMAP4 mailboxes are supported. @@ -43,7 +42,7 @@ these files are protected against concurrent \fBmbsync\fR processes. Mailboxes can be safely modified while \fBmbsync\fR operates (see \fBINHERENT PROBLEMS\fR below for a minor exception). Multiple replicas of each mailbox can be maintained. -.. +. .SH OPTIONS .TP \fB-c\fR, \fB--config\fR \fIfile\fR @@ -110,7 +109,7 @@ Without category specification, all categories except net-all are enabled. Suppress progress counters (this is implicit if stdout is no TTY, or any debugging categories are enabled) and notices. If specified twice, suppress warning messages as well. -.. +. .SH CONFIGURATION The configuration file is mandatory; \fBmbsync\fR will not run without it. Lines starting with a hash mark (\fB#\fR) are comments and are ignored entirely. @@ -141,7 +140,7 @@ even combinations thereof. .br Mailbox names, OTOH, always use canonical path separators, which are Unix-like forward slashes. -.. +. .SS All Stores These options can be used in all supported Store types. .br @@ -150,7 +149,7 @@ and not necessarily a remote server. .br The special mailbox \fBINBOX\fR exists in every Store; its physical location in the file system is Store type specific. -.. +. .TP \fBPath\fR \fIpath\fR The location of the Store in the (server's) file system. @@ -161,7 +160,7 @@ in the Channels section. Note that you \fBmust\fR append a slash if you want to specify an entire directory. (Default: none) -.. +. .TP \fBMaxSize\fR \fIsize\fR[\fBk\fR|\fBm\fR][\fBb\fR] Messages larger than that will not be propagated into this Store. @@ -170,7 +169,7 @@ This is useful for weeding out messages with large attachments. MeBytes instead of bytes. \fBB\fR is accepted but superfluous. If \fIsize\fR is 0, the maximum message size is \fBunlimited\fR. (Default: \fI0\fR) -.. +. .TP \fBMapInbox\fR \fImailbox\fR Create a virtual mailbox (relative to \fBPath\fR) which aliases @@ -178,7 +177,7 @@ the \fBINBOX\fR. Makes sense in conjunction with \fBPatterns\fR in the Channels section, though with a Maildir slave, you probably want to place \fBInbox\fR under \fBPath\fR instead. This virtual mailbox does not support subfolders. -.. +. .TP \fBFlatten\fR \fIdelim\fR Flatten the hierarchy within this Store by substituting the canonical @@ -190,27 +189,27 @@ A common choice for the delimiter is \fB.\fR. .br Note that flattened sub-folders of the \fBINBOX\fR always end up under \fBPath\fR, including the "INBOX\fIdelim\fR" prefix. -.. +. .TP \fBTrash\fR \fImailbox\fR Specifies a mailbox (relative to \fBPath\fR) to copy deleted messages to prior to expunging. See \fBRECOMMENDATIONS\fR and \fBINHERENT PROBLEMS\fR below. (Default: none) -.. +. .TP \fBTrashNewOnly\fR \fByes\fR|\fBno\fR When trashing, copy only not yet propagated messages. This makes sense if the remote Store has a \fBTrash\fR as well (with \fBTrashNewOnly\fR \fBno\fR). (Default: \fBno\fR) -.. +. .TP \fBTrashRemoteNew\fR \fByes\fR|\fBno\fR When expunging the remote Store, copy not yet propagated messages to this Store's \fBTrash\fR. When using this, the remote Store does not need an own \fBTrash\fR at all, yet all messages are archived. (Default: \fBno\fR) -.. +. .SS Maildir Stores The reference point for relative \fBPath\fRs is the current working directory. .P @@ -238,11 +237,11 @@ message deletion and a new message, resulting in unnecessary traffic. \fBMutt\fR is known to work fine with both schemes. .br Use \fBmdconvert\fR to convert mailboxes from one scheme to the other. -.. +. .TP \fBMaildirStore\fR \fIname\fR Define the Maildir Store \fIname\fR, opening a section for its parameters. -.. +. .TP \fBAltMap\fR \fByes\fR|\fBno\fR Use the \fBalternative\fR UID storage scheme for mailboxes in this Store. @@ -250,20 +249,20 @@ This does not affect mailboxes that do already have a UID storage scheme; use \fBmdconvert\fR to change it. See \fBRECOMMENDATIONS\fR below. (Default: \fBno\fR) -.. +. .TP \fBInbox\fR \fIpath\fR The location of the \fBINBOX\fR. This is \fInot\fR relative to \fBPath\fR, but it is allowed to place the \fBINBOX\fR inside the \fBPath\fR. (Default: \fI~/Maildir\fR) -.. +. .TP \fBInfoDelimiter\fR \fIdelim\fR The character used to delimit the info field from a message's basename. The Maildir standard defines this to be the colon, but this is incompatible with DOS/Windows file systems. (Default: the value of \fBFieldDelimiter\fR) -.. +. .TP \fBSubFolders\fR \fBVerbatim\fR|\fBMaildir++\fR|\fBLegacy\fR The on-disk folder naming style used for hierarchical mailboxes. @@ -284,12 +283,12 @@ Note that attempts to set \fBPath\fR are rejected in this mode. (this is \fBmbsync\fR's historical style) .br (Default: unset; will error out when sub-folders are encountered) -.. +. .SS IMAP4 Accounts .TP \fBIMAPAccount\fR \fIname\fR Define the IMAP4 Account \fIname\fR, opening a section for its parameters. -.. +. .TP \fBHost\fR \fIhost\fR Specify the DNS name or IP address of the IMAP server. @@ -297,31 +296,31 @@ Specify the DNS name or IP address of the IMAP server. If \fBTunnel\fR is used, this setting is needed only if \fBSSLType\fR is not \fBNone\fR and \fBCertificateFile\fR is not used, in which case the host name is used for certificate subject verification. -.. +. .TP \fBPort\fR \fIport\fR Specify the TCP port number of the IMAP server. (Default: 143 for IMAP, 993 for IMAPS) .br If \fBTunnel\fR is used, this setting is ignored. -.. +. .TP \fBTimeout\fR \fItimeout\fR Specify the connect and data timeout for the IMAP server in seconds. Zero means unlimited. (Default: \fI20\fR) -.. +. .TP \fBUser\fR \fIusername\fR Specify the login name on the IMAP server. -.. +. .TP \fBPass\fR \fIpassword\fR Specify the password for \fIusername\fR on the IMAP server. Note that this option is \fInot\fR required. If neither a password nor a password command is specified in the configuration file, \fBmbsync\fR will prompt you for a password. -.. +. .TP \fBPassCmd\fR [\fB+\fR]\fIcommand\fR Specify a shell command to obtain a password rather than specifying a @@ -331,13 +330,13 @@ optional. Prepend \fB+\fR to the command to indicate that it produces TTY output (e.g., a decryption password prompt); failure to do so will merely produce messier output. -.. +. .TP \fBTunnel\fR \fIcommand\fR Specify a command to run to establish a connection rather than opening a TCP socket. This allows you to run an IMAP session over an SSH tunnel, for example. -.. +. .TP \fBAuthMechs\fR \fItype\fR ... The list of acceptable authentication mechanisms. @@ -348,7 +347,7 @@ enough for the current \fBSSLType\fR setting. The actually used mechanism is the most secure choice from the intersection of this list, the list supplied by the server, and the installed SASL modules. (Default: \fB*\fR) -.. +. .TP \fBSSLType\fR {\fBNone\fR|\fBSTARTTLS\fR|\fBIMAPS\fR} Select the connection security/encryption method: @@ -362,20 +361,20 @@ so it is the default (unless a tunnel is used). .br \fBIMAPS\fR - security is established by starting SSL/TLS negotiation right after connecting the secure IMAP port 993. -.. +. .TP \fBSSLVersions\fR [\fBSSLv3\fR] [\fBTLSv1\fR] [\fBTLSv1.1\fR] [\fBTLSv1.2\fR] Select the acceptable SSL/TLS versions. Use old versions only when the server has problems with newer ones. (Default: [\fBTLSv1\fR] [\fBTLSv1.1\fR] [\fBTLSv1.2\fR]). -.. +. .TP \fBSystemCertificates\fR \fByes\fR|\fBno\fR Whether the system's default CA (certificate authority) certificate store should be used to verify certificate trust chains. Disable this if you want to trust only hand-picked certificates. (Default: \fByes\fR) -.. +. .TP \fBCertificateFile\fR \fIpath\fR File containing additional X.509 certificates used to verify server @@ -391,7 +390,7 @@ The contents for this file may be obtained using the \fBmbsync-get-cert\fR tool; make sure to verify the fingerprints of the certificates before trusting them, or transfer them securely from the server's network (if it is trusted). -.. +. .TP \fBClientCertificate\fR \fIpath\fR File containing a client certificate to send to the server. @@ -399,11 +398,11 @@ File containing a client certificate to send to the server. .br Note that client certificate verification is usually not required, so it is unlikely that you need this option. -.. +. .TP \fBClientKey\fR \fIpath\fR File containing the private key corresponding to \fBClientCertificate\fR. -.. +. .TP \fBPipelineDepth\fR \fIdepth\fR Maximum number of IMAP commands which can be simultaneously in flight. @@ -412,14 +411,14 @@ This is mostly a debugging option, but may also be used to limit average bandwidth consumption (GMail may require this if you have a very fast connection), or to spare flaky servers like M$ Exchange. (Default: \fIunlimited\fR) -.. +. .TP \fBDisableExtension\fR[\fBs\fR] \fIextension\fR ... Disable the use of specific IMAP extensions. This can be used to work around bugs in servers (and possibly \fBmbsync\fR itself). (Default: empty) -.. +. .SS IMAP Stores The reference point for relative \fBPath\fRs is whatever the server likes it to be; probably the user's $HOME or $HOME/Mail on that server. The location @@ -427,21 +426,21 @@ of \fBINBOX\fR is up to the server as well and is usually irrelevant. .TP \fBIMAPStore\fR \fIname\fR Define the IMAP4 Store \fIname\fR, opening a section for its parameters. -.. +. .TP \fBAccount\fR \fIaccount\fR Specify which IMAP4 Account to use. Instead of defining an Account and referencing it here, it is also possible to specify all the Account options directly in the Store's section - this makes sense if an Account is used for one Store only anyway. -.. +. .TP \fBUseNamespace\fR \fByes\fR|\fBno\fR Selects whether the server's first "personal" NAMESPACE should be prefixed to mailbox names. Disabling this makes sense for some broken IMAP servers. This option is meaningless if a \fBPath\fR was specified. (Default: \fByes\fR) -.. +. .TP \fBPathDelimiter\fR \fIdelim\fR Specify the server's hierarchy delimiter. @@ -449,12 +448,12 @@ Specify the server's hierarchy delimiter. .br Do \fInot\fR abuse this to re-interpret the hierarchy. Use \fBFlatten\fR instead. -.. +. .SS Channels .TP \fBChannel\fR \fIname\fR Define the Channel \fIname\fR, opening a section for its parameters. -.. +. .TP {\fBMaster\fR|\fBSlave\fR} \fB:\fIstore\fB:\fR[\fImailbox\fR] Specify the Master resp. Slave Store to be connected by this Channel. @@ -462,7 +461,7 @@ If \fBPatterns\fR are specified, \fImailbox\fR is interpreted as a prefix which is not matched against the patterns, and which is not affected by mailbox list overrides. Otherwise, if \fImailbox\fR is omitted, \fBINBOX\fR is assumed. -.. +. .TP \fBPattern\fR[\fBs\fR] [\fB!\fR]\fIpattern\fR ... Instead of synchronizing only one mailbox pair, synchronize all mailboxes @@ -480,13 +479,13 @@ The mailbox list selected by \fBPatterns\fR can be overridden by a mailbox list in a channel reference (a \fBGroup\fR specification or the command line). .br Example: "\fBPatterns\fR\ \fI%\ !Trash\fR" -.. +. .TP \fBMaxSize\fR \fIsize\fR[\fBk\fR|\fBm\fR][\fBb\fR] Analogous to the homonymous option in the Stores section, but applies equally to Master and Slave. Note that this actually modifies the Stores, so take care not to provide conflicting settings if you use the Stores in multiple Channels. -.. +. .TP \fBMaxMessages\fR \fIcount\fR Sets the maximum number of messages to keep in each Slave mailbox. @@ -498,7 +497,7 @@ Messages that are flagged (marked as important) and (by default) unread messages will not be automatically deleted. If \fIcount\fR is 0, the maximum number of messages is \fBunlimited\fR (Default: \fI0\fR). -.. +. .TP \fBExpireUnread\fR \fByes\fR|\fBno\fR Selects whether unread messages should be affected by \fBMaxMessages\fR. @@ -508,7 +507,7 @@ However, if your archive contains large amounts of unread messages by design, treating them as important would practically defeat \fBMaxMessages\fR. In this case you need to enable this option. (Default: \fBno\fR). -.. +. .TP \fBSync\fR {\fBNone\fR|[\fBPull\fR] [\fBPush\fR] [\fBNew\fR] [\fBReNew\fR] [\fBDelete\fR] [\fBFlags\fR]|\fBAll\fR} Select the synchronization operation(s) to perform: @@ -563,14 +562,14 @@ from the Slave to the Master. Note that it is not allowed to assert a cell in two ways, e.g. "\fBSync\fR\ \fBPullNew\fR\ \fBPull\fR" and "\fBSync\fR\ \fBPullNew\fR\ \fBDelete\fR\ \fBPush\fR" induce error messages. -.. +. .TP \fBCreate\fR {\fBNone\fR|\fBMaster\fR|\fBSlave\fR|\fBBoth\fR} Automatically create missing mailboxes [on the Master/Slave]. Otherwise print an error message and skip that mailbox pair if a mailbox and the corresponding sync state does not exist. (Global default: \fBNone\fR) -.. +. .TP \fBRemove\fR {\fBNone\fR|\fBMaster\fR|\fBSlave\fR|\fBBoth\fR} Propagate mailbox deletions [to the Master/Slave]. @@ -583,13 +582,13 @@ mark them as deleted. This ensures compatibility with \fBSyncState *\fR. Note that for safety, non-empty mailboxes are never deleted. .br (Global default: \fBNone\fR) -.. +. .TP \fBExpunge\fR {\fBNone\fR|\fBMaster\fR|\fBSlave\fR|\fBBoth\fR} Permanently remove all messages [on the Master/Slave] marked for deletion. See \fBRECOMMENDATIONS\fR below. (Global default: \fBNone\fR) -.. +. .TP \fBCopyArrivalDate\fR {\fByes\fR|\fBno\fR} Selects whether their arrival time should be propagated together with @@ -599,14 +598,14 @@ sorting intact. Note that IMAP does not guarantee that the time stamp (termed \fBinternal date\fR) is actually the arrival time, but it is usually close enough. (Default: \fBno\fR) -.. +. .P \fBSync\fR, \fBCreate\fR, \fBRemove\fR, \fBExpunge\fR, \fBMaxMessages\fR, and \fBCopyArrivalDate\fR can be used before any section for a global effect. The global settings are overridden by Channel-specific options, which in turn are overridden by command line switches. -.. +. .TP \fBSyncState\fR {\fB*\fR|\fIpath\fR} Set the location of this Channel's synchronization state files. @@ -623,7 +622,7 @@ the appended string is made up according to the pattern (see also \fBFieldDelimiter\fR below). .br (Global default: \fI~/.mbsync/\fR). -.. +. .SS Groups .TP \fBGroup\fR \fIname\fR [\fIchannel\fR[\fB:\fIbox\fR[\fB,\fR...]]] ... @@ -637,12 +636,12 @@ If you supply one or more \fIbox\fRes to a \fIchannel\fR, they will be used instead of what is specified in the Channel's Patterns. The same can be done on the command line, except that there newlines can be used as mailbox name separators as well. -.. +. .TP \fBChannel\fR[\fBs\fR] \fIchannel\fR[\fB:\fIbox\fR[\fB,\fR...]] ... Add the specified channels to the group. This option can be specified multiple times within a Group. -.. +. .SS Global Options .TP \fBFSync\fR \fByes\fR|\fBno\fR @@ -655,7 +654,7 @@ Enabling it is a wise choice for file systems mounted with data=writeback, in particular modern systems like ext4, btrfs and xfs. The performance impact on older file systems may be disproportionate. (Default: \fByes\fR) -.. +. .TP \fBFieldDelimiter\fR \fIdelim\fR The character to use to delimit fields in the string appended to a global @@ -665,7 +664,7 @@ DOS/Windows file systems. This option is meaningless for \fBSyncState\fR if the latter is \fB*\fR, obviously. However, it also determines the default of \fBInfoDelimiter\fR. (Global default: \fI;\fR on Windows, \fI:\fR everywhere else) -.. +. .TP \fBBufferLimit\fR \fIsize\fR[\fBk\fR|\fBm\fR][\fBb\fR] The per-Channel, per-direction instantaneous memory usage above which @@ -673,7 +672,7 @@ The per-Channel, per-direction instantaneous memory usage above which absolute limit, as even a single message can consume more memory than this. (Default: \fI10M\fR) -.. +. .SH CONSOLE OUTPUT If \fBmbsync\fR's output is connected to a console, it will print progress counters by default. The output will look like this: @@ -688,7 +687,7 @@ The message counts represent added messages, messages with updated flags, and trashed messages, respectively. No attempt is made to calculate the totals in advance, so they grow over time as more information is gathered. -.. +. .SH RECOMMENDATIONS Make sure your IMAP server does not auto-expunge deleted messages - it is slow, and semantically somewhat questionable. Specifically, Gmail needs to @@ -727,7 +726,7 @@ Mutt always does that, while mu4e needs to be configured to do it: .in +4 (setq mu4e-change-filenames-when-moving t) .in -4 -.. +. .SH INHERENT PROBLEMS Changes done after \fBmbsync\fR has retrieved the message list will not be synchronised until the next time \fBmbsync\fR is invoked. @@ -738,7 +737,7 @@ lost if they are marked as deleted after the message list was retrieved but before the mailbox is expunged. There is no risk as long as the IMAP mailbox is accessed by only one client (including \fBmbsync\fR) at a time. -.. +. .SH FILES .TP .B ~/.mbsyncrc @@ -746,7 +745,7 @@ Default configuration file .TP .B ~/.mbsync/ Directory containing synchronization state files -.. +. .SH SEE ALSO mdconvert(1), isync(1), mutt(1), maildir(5) .P @@ -754,7 +753,7 @@ Up to date information on \fBmbsync\fR can be found at http://isync.sf.net/ .P SASL mechanisms are listed at http://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml -.. +. .SH AUTHORS Originally written by Michael R. Elkins, rewritten and currently maintained by Oswald Buddenhagen, From bee4fc54e7a3cf6e1965efeaa068ca8db4ba976f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 22 Nov 2019 21:00:18 +0100 Subject: [PATCH 07/14] fix overflows in uint comparisons --- src/drv_maildir.c | 4 ++-- src/util.c | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/drv_maildir.c b/src/drv_maildir.c index 958dde8..8818d2e 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -840,8 +840,8 @@ maildir_compare( const void *l, const void *r ) char *ldot, *rdot, *ldot2, *rdot2, *lseq, *rseq; int ret, llen, rlen; - if ((ret = lm->uid - rm->uid)) - return ret; + if (lm->uid != rm->uid) // Can't subtract, the result might not fit into signed int. + return lm->uid > rm->uid ? 1 : -1; /* No UID, so sort by arrival date. We should not do this, but we rely on the suggested unique file name scheme - we have no choice. */ diff --git a/src/util.c b/src/util.c index 8c56a28..2a96389 100644 --- a/src/util.c +++ b/src/util.c @@ -534,7 +534,10 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha static int compare_uints( const void *l, const void *r ) { - return *(uint *)l - *(uint *)r; + uint li = *(uint *)l, ri = *(uint *)r; + if (li != ri) // Can't subtract, the result might not fit into signed int. + return li > ri ? 1 : -1; + return 0; } void From 121448ceb9f9df03d88672917fe04506f783c76c Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 3 Dec 2019 13:00:19 +0100 Subject: [PATCH 08/14] make -DC work with yama ptrace protection --- src/main.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main.c b/src/main.c index 9dbb116..d301e6f 100644 --- a/src/main.c +++ b/src/main.c @@ -30,6 +30,9 @@ #include #include #include +#ifdef __linux__ +# include +#endif int DFlags; int JLimit; @@ -144,17 +147,34 @@ crashHandler( int n ) dup2( 0, 1 ); dup2( 0, 2 ); error( "*** " EXE " caught signal %d. Starting debugger ...\n", n ); +#ifdef PR_SET_PTRACER + int pip[2]; + if (pipe( pip ) < 0) { + perror( "pipe()" ); + exit( 3 ); + } +#endif switch ((dpid = fork())) { case -1: perror( "fork()" ); break; case 0: +#ifdef PR_SET_PTRACER + close( pip[1] ); + read( pip[0], pbuf, 1 ); + close( pip[0] ); +#endif sprintf( pbuf, "%d", Pid ); sprintf( pabuf, "/proc/%d/exe", Pid ); execlp( "gdb", "gdb", pabuf, pbuf, (char *)0 ); perror( "execlp()" ); _exit( 1 ); default: +#ifdef PR_SET_PTRACER + prctl( PR_SET_PTRACER, (ulong)dpid ); + close( pip[1] ); + close( pip[0] ); +#endif waitpid( dpid, 0, 0 ); break; } From dfa8c16f27559c1e010bde36ad7a3d488531f83f Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 16 Nov 2019 17:14:32 +0100 Subject: [PATCH 09/14] don't timeout while uploading big messages we did already set up the timeout when starting to send commands, but so far we did not reset it when succeeding to send out data. rectify that. REFFAIL: 87sgy92we3.fsf@jnanam.net --- src/socket.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/socket.c b/src/socket.c index 950c956..dbd781c 100644 --- a/src/socket.c +++ b/src/socket.c @@ -680,8 +680,6 @@ do_read( conn_t *sock, char *buf, int len ) int n; assert( sock->fd >= 0 ); - if (pending_wakeup( &sock->fd_timeout )) - conf_wakeup( &sock->fd_timeout, sock->conf->timeout ); #ifdef HAVE_LIBSSL if (sock->ssl) { if ((n = ssl_return( "read from", sock, SSL_read( sock->ssl, buf, len ) )) <= 0) @@ -1055,6 +1053,9 @@ socket_fd_cb( int events, void *aux ) if (events & POLLOUT) conf_notifier( &conn->notify, POLLIN, 0 ); + if (pending_wakeup( &conn->fd_timeout )) + conf_wakeup( &conn->fd_timeout, conn->conf->timeout ); + #ifdef HAVE_LIBSSL if (conn->state == SCK_STARTTLS) { start_tls_p2( conn ); From 94022a6752ac61842bac77957364b288787be607 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sat, 23 Nov 2019 13:51:20 +0100 Subject: [PATCH 10/14] catch server's failure to FETCH * the query is untypical enough to have caused problems with davmail (when we still used *:*) and mailo.com (until it got fixed), so better check that the result (not) returned by the server makes sense. --- src/drv_imap.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/drv_imap.c b/src/drv_imap.c index 989b86e..dd0215f 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -2404,9 +2404,15 @@ imap_open_box_p3( imap_store_t *ctx, imap_cmd_t *gcmd, int response ) { imap_cmd_open_box_t *cmdp = (imap_cmd_open_box_t *)gcmd; - // This will happen if the box is empty. - if (!ctx->uidnext) + if (!ctx->uidnext) { + if (ctx->total_msgs) { + error( "IMAP error: querying server for highest UID failed\n" ); + imap_open_box_p4( ctx, cmdp, RESP_NO ); + return; + } + // This is ok, the box is simply empty. ctx->uidnext = 1; + } imap_open_box_p4( ctx, cmdp, response ); } @@ -2983,10 +2989,16 @@ imap_find_new_msgs_p3( imap_store_t *ctx, imap_cmd_t *gcmd, int response ) imap_cmd_find_new_t *cmdp = (imap_cmd_find_new_t *)gcmd; imap_cmd_find_new_t *cmd; - if (response != RESP_OK || ctx->uidnext <= cmdp->uid) { + if (response != RESP_OK) { imap_find_new_msgs_p4( ctx, gcmd, response ); return; } + if (!ctx->uidnext) { + // We are assuming that the new messages were not in fact instantly deleted. + error( "IMAP error: re-querying server for highest UID failed\n" ); + imap_find_new_msgs_p4( ctx, gcmd, RESP_NO ); + return; + } INIT_IMAP_CMD(imap_cmd_find_new_t, cmd, cmdp->callback, cmdp->callback_aux) cmd->out_msgs = cmdp->out_msgs; imap_exec( (imap_store_t *)ctx, &cmd->gen, imap_find_new_msgs_p4, From 04fc586e75ec3429e9f6d3b8a55d570e4aca658e Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Mon, 9 Sep 2019 18:47:32 +0200 Subject: [PATCH 11/14] handle case-insensitivity of IMAP's INBOX this is relevant only when listing an IMAP Store's contents, as that's the only place where we aren't imposing the spelling ourselves. we need to be careful not to treat our own canonical (prefix-stripped and always slash-delimited) box names like that; codify that in comments. this reveals that commit 6f2160f1 may be deemed to have been incorrect - the TODO item was ambiguous, and could quite possibly have meant this fix. unsurprisingly, 380ccdd4 re-introduced it with more explicit wording. --- TODO | 2 -- src/drv_imap.c | 38 ++++++++++++++++++++++++++++---------- src/drv_maildir.c | 5 +++++ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/TODO b/TODO index b074e22..f8c6d73 100644 --- a/TODO +++ b/TODO @@ -37,8 +37,6 @@ Patterns. function being missing so far - this is needed for move detection, which would work only within one Channel -normalize INBOX capitalization received from IMAP, to avoid anomalies. - kill the concept of an INBOX, it is a relic from single-channel operation. if somebody needs it, he can have two stores with different Paths. the path can name a single (in-)box (curr. broken with maildir). an empty box name diff --git a/src/drv_imap.c b/src/drv_imap.c index dd0215f..4ea86d6 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -1232,8 +1232,20 @@ parse_list_rsp_p1( imap_store_t *ctx, list_t *list, char *cmd ATTR_UNUSED ) return parse_list( ctx, cmd, parse_list_rsp_p2 ); } +// Use this to check whether a full path refers to the actual IMAP INBOX. static int is_inbox( imap_store_t *ctx, const char *arg, int argl ) +{ + if (!starts_with_upper( arg, argl, "INBOX", 5 )) + return 0; + if (arg[5] && arg[5] != ctx->delimiter[0]) + return 0; + return 1; +} + +// Use this to check whether a path fragment collides with the canonical INBOX. +static int +is_INBOX( imap_store_t *ctx, const char *arg, int argl ) { if (!starts_with( arg, argl, "INBOX", 5 )) return 0; @@ -1256,16 +1268,22 @@ parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char *cmd ATTR_UNUSED ) } arg = list->val; argl = list->len; - if ((l = strlen( ctx->prefix ))) { - if (starts_with( arg, argl, ctx->prefix, l )) { - arg += l; - argl -= l; - if (is_inbox( ctx, arg, argl )) { - if (!arg[5]) - warn( "IMAP warning: ignoring INBOX in %s\n", ctx->prefix ); - goto skip; - } - } else if (!is_inbox( ctx, arg, argl )) { + if (is_inbox( ctx, arg, argl )) { + // The server might be weird and have a non-uppercase INBOX. It + // may legitimately do so, but we need the canonical spelling. + memcpy( arg, "INBOX", 5 ); + } else if ((l = strlen( ctx->prefix ))) { + if (!starts_with( arg, argl, ctx->prefix, l )) + goto skip; + arg += l; + argl -= l; + // A folder named "INBOX" would be indistinguishable from the + // actual INBOX after prefix stripping, so drop it. This applies + // only to the fully uppercased spelling, as our canonical box + // names are case-sensitive (unlike IMAP's INBOX). + if (is_INBOX( ctx, arg, argl )) { + if (!arg[5]) // No need to complain about subfolders as well. + warn( "IMAP warning: ignoring INBOX in %s\n", ctx->prefix ); goto skip; } } diff --git a/src/drv_maildir.c b/src/drv_maildir.c index 8818d2e..e1622d3 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -352,6 +352,7 @@ maildir_list_maildirpp( maildir_store_t *ctx, int flags, const char *inbox ) } else { if (!(flags & (LIST_PATH | LIST_PATH_MAYBE))) continue; + // Explained in maildir_list_recurse(). if (starts_with( ent, -1, "INBOX", 5 ) && (!ent[5] || ent[5] == '.')) { if (!warned) { warned = 1; @@ -437,6 +438,10 @@ maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags, continue; } } + // A folder named "INBOX" would be indistinguishable from the + // actual INBOX after prefix stripping, so drop it. This applies + // only to the fully uppercased spelling, as our canonical box + // names are case-sensitive (unlike IMAP's INBOX). if (!nameLen && equals( ent, -1, "INBOX", 5 )) { path[pathLen] = 0; warn( "Maildir warning: ignoring INBOX in %s\n", path ); From aff0c88a38ddeba1926b9512f1cfeceff46387d4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 24 Nov 2019 10:54:52 +0100 Subject: [PATCH 12/14] fix printf length arguments on lp64 found by coverity. --- src/compat/config.c | 2 +- src/compat/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compat/config.c b/src/compat/config.c index 2377961..08d2017 100644 --- a/src/compat/config.c +++ b/src/compat/config.c @@ -259,7 +259,7 @@ write_imap_server( FILE *fp, config_t *cfg ) if (!p) hl = nfsnprintf( buf, sizeof(buf), "%s", cfg->host ); else { - hl = nfsnprintf( buf, sizeof(buf), "%.*s", p - cfg->host, cfg->host ); + hl = nfsnprintf( buf, sizeof(buf), "%.*s", (int)(p - cfg->host), cfg->host ); p2 = strrchr( buf, '.' ); if (p2) hl = sprintf( buf, "%s", p2 + 1 ); diff --git a/src/compat/main.c b/src/compat/main.c index 17b4037..f83ed74 100644 --- a/src/compat/main.c +++ b/src/compat/main.c @@ -376,7 +376,7 @@ main( int argc, char **argv ) if (!p) nfsnprintf( path2, sizeof(path2), "%s.mbsync", config ); else - nfsnprintf( path2, sizeof(path2), "%.*smb%s", p - config, config, p + 1 ); + nfsnprintf( path2, sizeof(path2), "%.*smb%s", (int)(p - config), config, p + 1 ); outconfig = path2; } if ((fd = creat( outconfig, 0666 )) < 0) { From 96afe8d0c26871472e7132066b93ef4246ae89af Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Sun, 29 Dec 2019 12:59:40 +0100 Subject: [PATCH 13/14] fix propagation of flagged oversized messages ... when not syncing flags and the target is not being expunged, as in that case flags were not queried in time. --- src/sync.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sync.c b/src/sync.c index 7397db2..7d3fe79 100644 --- a/src/sync.c +++ b/src/sync.c @@ -1252,9 +1252,9 @@ box_opened2( sync_vars_t *svars, int t ) opts[1-t] |= OPEN_FLAGS; if (chan->stores[t]->max_size != INT_MAX) { if (chan->ops[t] & OP_RENEW) - opts[1-t] |= OPEN_OLD_SIZE; + opts[1-t] |= OPEN_FLAGS|OPEN_OLD_SIZE; if (chan->ops[t] & OP_NEW) - opts[1-t] |= OPEN_NEW_SIZE; + opts[1-t] |= OPEN_FLAGS|OPEN_NEW_SIZE; } } if (chan->ops[t] & OP_EXPUNGE) { From 80deabf520b2cfab629f36dacd6515491cc73737 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 8 Jul 2020 11:42:47 +0200 Subject: [PATCH 14/14] bump version --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 66ce71a..ca3ee33 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([isync], [1.3.1]) +AC_INIT([isync], [1.3.2]) AC_CONFIG_HEADERS([autodefs.h]) AM_INIT_AUTOMAKE