Commit Graph

1319 Commits

Author SHA1 Message Date
Oswald Buddenhagen
d7dc906077 *** socket debug 2024-08-01 11:49:53 +02:00
Oswald Buddenhagen
22ba78fa78 *** shrink buffer 2024-08-01 11:49:51 +02:00
Oswald Buddenhagen
f467b57a95 generalize GPL exception
we have explicit approval from:
- Anton Khirnov <anton@khirnov.net>
- Jeremy Katz <katzj@fedoraproject.org>
- Jesse Weaver <pianohacker@gmail.com>
- Marc Hoersken <info@marc-hoersken.de>
- Michael J Gruber <michael@grubix.eu>
- Noa Resare <noa@resare.com> (formerly Daniel)
- Oliver Runge <oliver.runge@gmail.com>
- Patrick Steinhardt <ps@pks.im>
- Theodore Ts'o <tytso@mit.edu>

notably missing approval from:
- Michael Elkins <me@sigpipe.org>

further missing approval from:
- Eivind Eklund <eivind@FreeBSD.org>
- Georgy Kibardin <georgy@kibardin.name>
- Jack Stone <jwjstone@fastmail.fm>
- Jan Synacek <jsynacek@redhat.com>

still, because
- isync already contains an exception for OpenSSL,
- every contributor implicitly agreed to that exception, and
- that exception exists specifically because of the advertising clause
  in OpenSSL < v3's license,
i'm assuming that the MIA contributors are actually fine with the
proposed change.
2024-07-31 21:30:42 +02:00
Oswald Buddenhagen
7bca6967a7 update some email addresses
noa's and jeremy's new address are confirmed.
michael e.'s address is kinda confirmed, except that it's silent.
2024-07-31 21:30:34 +02:00
Husain Alshehhi
5f81162f5e add tag files to .gitignore
The auto-generated makefile targets CTAGS, GTAGS and TAGS generate files
locally that should not be checked-in into the source code. This change
adds these files to the .gitignore file. The list of files match those
in distclean-tags target.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
ee832951e2 revamp automatic enumeration of power-of-two enumerators
i found a neat trick to do it with the C pre-processor after all.
this makes the enum definitions themselves arguably somewhat less
legible, but on the upside the build system becomes simpler, and IDEs
can build/update their code models without having to (re-)build the
project first.

somewhat as a side effect, this gives bit enums proper names, so we
don't need to refer to them by cryptic prefixes anymore.

amends 6a78e2c5f.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
31c504d432 remove redundant argument from BIT_FORMATTER_PROTO()
it doesn't need to know the enum prefix.

amends 17db5de0c & 950ebe833.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
43271d8fad eliminate commit_cmds driver callback
no driver implements it, and this isn't likely to change any time soon.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
8b8313997c Revert "actually implement imap_commit_cmds()"
the CHECK command doesn't do what i thought; the formulation in the
specs was ambiguous - it really checks for new mail, rather than
committing, and each operation is supposed to be atomic. inefficient,
but safe. IMAP4rev2 eliminates the command altogether, subsuming its
function under NOOP.

consequently, the commit callback doesn't make sense for imap.
in principle, we could use it to coalesce multiple STOREs to counter the
inefficiency, but that won't happen any time soon, and the
implementation would look rather differently anyway.

as a "side effect", this fixes an assertion failure in imap_close_box()
when all flag sets failed (e.g., b/c the box was read-only), as their
callbacks would be short-cut in front of the completion of the CHECK
command, which was not sequenced before the close_box() call.

This reverts commit cfaa4848dd.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
84194a7a9f don't try to create already existing boxes
if the SELECT command fails even though the box was LISTed, then the
error cause is obviously not that box is absent, and so we should not
attempt to CREATE it.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
ceb0fa9803 don't try to qsort() NULL array
while this actually works due to the array size being zero, it's
undefined behavior which makes gcc eliminate a subsequent null check in
the calling function.
2024-07-31 21:23:58 +02:00
Oswald Buddenhagen
12e30ce560 cap readsz at buffer size
otherwise we may get negative comparison sizes, which the unsigned
arithmetic we use cannot represent. this would prevent buffer content
downshifting, resulting in prepare_read() erroring out.

amends 859b7dd.

REFMAIL: 87h740x2xe.fsf@wavexx.thregr.org
REFMAIL: ec0f6f2a-0151-46ad-865a-a6f77ad8e204@app.fastmail.com
REFMAIL: 87edk45p9o.fsf@b3l.xyz
REFMAIL: CYAWIDDGRHT7.2CH3R3D6Z3F97@ferdinandy.com
2024-07-31 18:38:15 +02:00
Oswald Buddenhagen
e70c300f74 permit leading whitespace in INTERNALDATE strings
the BNF specifies "(SP DIGIT) / 2DIGIT" for the date-day-fixed symbol,
but "*SP 1*DIGIT" matches that closely enough for parsing purposes.

REFMAIL: CYYDEEVZ8CCT.2M1T7XKT45HH8@jonas.vautherin.ch
2024-02-07 11:40:04 +01:00
Oswald Buddenhagen
65cd4429bb document defaults of referenced XDG env vars
so users don't have to google the spec.
2022-07-09 08:28:45 +02:00
Oswald Buddenhagen
8648d7a479 remove duplicate contributor entry
anton khirnov is already in the main section, no need to have him in the
honorary section as well.

on a completely unrelated note, for posterity: andreas grapentin's
mention is due to commit cf13630a, where i forgot to credit him for the
initial version of the patch.
2022-07-05 11:40:54 +02:00
Oswald Buddenhagen
ec50c55c36 make DNS lookup asynchronous
true asynchronicity is actually fairly useless, as it's unlikely that
both Stores in a Channel use IMAP, and both host resolutions take
particularly long - the main objective is imposing the Timeout setting.
however, we can't just use setjmp()+alarm(), as longjmp()ing out of
getaddrinfo() is undefined, as it may for example free() just at the
wrong time. so we go for the real thing.

this implementation just fork()s out a process which uses getaddrinfo()
(or gethostbyname()) per lookup. this isn't particularly scalable, but
as we don't expect a lot of lookups, it seems adequate.
2022-07-04 18:28:30 +02:00
Oswald Buddenhagen
ced20ad0d9 fix Tunnel leaving behind zombies
this generally went unnoticed, as the tunnel usually terminates right
before we exit anyway. however, if multiple Channels are synced, it may
become visible.

this is a "shotgun" implementation, where the main loop just reaps all
unclaimed children.
arguably, it would be cleaner if each socket actually tracked its own
process, but getting synchronous kills+waits right is tricky, so we
continue to pretend that there is no process as far as the socket layer
is concerned.

poll()/select() are not restartable, so they need EINTR handling now
that SIGCHLD is actually delivered.
2022-07-04 18:28:30 +02:00
Oswald Buddenhagen
b841374827 fix broken Tunnel potentially causing SIGPIPE
we need to ignore the signal, so the regular error handling can kick in.
2022-07-04 18:28:30 +02:00
Oswald Buddenhagen
b9a4746b54 don't refresh progress counters pointlessly
the mainloop-based refresh timer keeps spinning even if there is no
update. overload stats_steps to signal whether a refresh is needed.

amends 8fbc4323.
2022-07-04 18:28:30 +02:00
Oswald Buddenhagen
460bfbb8ac abort channel sync when a store is fubar
this got lost in d5a5da947.

this also simplifies a nested condition, where the logic has previously
been, but isn't applicable any more.

REFMAIL: 87fsjloz05.fsf@wavexx.thregr.org
2022-07-01 15:13:10 +02:00
Oswald Buddenhagen
92faccc639 improve wording of --ext-exit docu 2022-07-01 14:57:39 +02:00
Oswald Buddenhagen
f6ccf9c4f5 fix lineup of --ext-exit in help output 2022-07-01 14:57:39 +02:00
Oswald Buddenhagen
16ecde504d try to make AUTHORS reflect reality
make a complete list of contributors who hold copyright (and those who
don't).

the case of ted is particularly interesting - he recently disclaimed
significant contributions, but it turns out that this isn't true:
the rewrite in 130664b6 incorporated significant portions of his async
IMAP patch for debian.

speaking of debian, i deleted ted's and nicolas' mention as debian
maintainers, as debian/ is basically just a (poorly maintained) mirror,
and has an own copyright file.
2022-06-26 12:21:58 +02:00
Oswald Buddenhagen
c9e57161cc autotest: add missing next in cmptrash()
this doesn't really matter, as the branches are mutually exclusive
anyway, but still.

amends 01329bdf.
2022-06-20 17:33:03 +02:00
Oswald Buddenhagen
a87d6ddaca bump version 2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
21c8529383 update TODO
remove items:
- the "Unidentified socket error" should be gone since 7ba7be111
- imap_commit_cmds() is implemented since cfaa4848d
- we will never use MULTIAPPEND and FETCH BODY with multiple messages,
  as that would significantly complicate matters for no tangible benefit

... and add some new thoughts.

the idea to use strings of colons for quoting patterns doesn't work, as
colons in "regular" patterns could not be quoted.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
7619705428 whitespace fixes
consistently surround '|' with spaces.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
090ba0caa3 drop unused 'flags' parameter of maildir_list_{recurse,inbox,path}()
amends 416ced25.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
46584e5358 add support for Maildir Paths with suffixes
that is, Path not ending with a slash.

pedantically, this is a bugfix, as the manual already suggested that
this is possible (and at least one user got the hint, though he was
disappointed).

the IMAP driver already supports this.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
3bfc3c5063 forbid nesting maildir Path under Inbox again
it was never documented, and i can't really think of a case where
someone would actually want it, as the MUA side of things would be just
weird. additionally, the case of Path being Inbox+'/' did not work
anyway. will reconsider and fix the latter case if someone complains.

reverts 98bd2b11.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
acd6b4b0b8 simplify/fix recursive maildir listing
there is no need to call maildir_list_{path,inbox}() from
maildir_list_recurse(), as maildir_list_store() will do that anyway -
if it's actually requested, that is. this means that this removes the
implicit listing when Inbox is nested into Path, or vice versa. this is
actually correct, as the Patterns matching would throw away the non-
requested boxes anyway.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
32d500ed15 simplify maildir recursion limitation
the isDir argument is effectively already a depth counter, so we don't
need a separate one for that.

amends 79797826.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
52c063fd45 add support for UTF-7 mailbox names
this finally makes us compliant with IMAP4rev1. how fitting that the
meanwhile released IMAP4rev2 demoted UTF-7 to legacy status ...

based on a patch by Georgy Kibardin <georgy@kibardin.name>.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
efab63fb8e enable UTF-8 on servers with RFC6855 support
note that this is a somewhat sloppy implementation, as it simply
assumes that the local system uses UTF-8 - that seems reasonable
nowadays.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
9169ee8fd8 assume Tunnel to be secure more consistently
follows up on 27458133.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
8ba4192b23 autotest conversion of even more malformed messages
this follows up on 87065c12.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
bfcc2d7d19 default to CRLF output in copy_msg_convert()
if we have nothing to go on, assume canonical line endings.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
6dc9312dbc recognize options even if the build does not support them
there were several cases of confused users who failed to notice that
they built without OpenSSL and wondered what is wrong with their
config.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
faec30abf4 rename SSLType => TLSType
for consistency with TLSVersions.
the variable names are unchanged to avoid churn.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
a7f1b86475 disable TLS 1.0 & 1.1 by default
these were not reasonable defaults any more.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
e3056b26e9 supersede SSLVersions option with TLSVersions
the new one isn't an exhaustive set anymore, but a delta to the default
(or previous setting). this has the advantage that new versions aren't
automatically disabled anymore as soon as mbsync learns about them if
the user has a setting they fail to adjust.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
7e0e14a686 prune legacy SSL options
they have been deprecated since v1.2.
2022-06-19 16:12:55 +02:00
Oswald Buddenhagen
f7458a96d3 handle copying/trashing failures more carefully
report them as errors (not warnings), let them cause a non-zero exit
code, and in the case of trashing, prevent the subsequent expunge. the
exception are messages that just disappeared below our feet.
2022-06-19 16:12:52 +02:00
Oswald Buddenhagen
4c14123144 postpone check for cancellation in some driver callbacks
the purpose of these checks is preventing triggering more driver calls,
while immediate followups to already completed calls should be still
made.

note that some of the checks are strictly speaking redundant, as
chaining into a next phase will return immediately anyway when the
other side isn't ready yet. but we keep them for clarity.
2022-06-19 16:12:08 +02:00
Oswald Buddenhagen
f29dbb18f1 dissolve SVARS_CHECK_CANCEL_RET
it was small and used only twice, so didn't really pull its weight.
2022-06-19 16:12:08 +02:00
Oswald Buddenhagen
ffb290084a stop abusing SYNC_* for what really should be COPY_* 2022-06-19 16:12:08 +02:00
Oswald Buddenhagen
9e0efd409a prefer DECL_INIT_SVARS over DECL_SVARS+INIT_SVARS
... as a result of relying on C99+.
2022-06-19 16:12:08 +02:00
Oswald Buddenhagen
6bfffa177a make more use of SVARS_CHECK_RET{,_VARS} macro 2022-06-19 16:12:08 +02:00
Oswald Buddenhagen
4d75c45507 add --ext-exit option
this is only a partial solution for reporting changes, but it's
adequate if the goal is merely triggering a bulk action, like
re-indexing the local store.

inspired by patches posted by Yuri D'Elia <wavexx@thregr.org>.
2022-06-19 16:12:06 +02:00
Oswald Buddenhagen
edc901b7af include expunges in progress counters 2022-06-19 16:11:43 +02:00