Kevin McCarthy [Thu, 29 Nov 2018 20:36:08 +0000 (12:36 -0800)]
Add SENDER to default list of IMAP headers
This header is matched by the ~e and ~L patterns. Those patterns
should work without the user having to know to add Sender to the list
of $imap_headers. This was probably just an oversight.
Kevin McCarthy [Tue, 27 Nov 2018 21:55:04 +0000 (13:55 -0800)]
Fix QRESYNC crash after a large number of VANISHED messages
When handling QRESYNC vanished, imap_expunge_mailbox() was called to
empty out the messages. Various counters, including vcount are
updated by the mx_update_tables() after the expunge.
These counters need to be reset, because mx_update_context() will do
so once again at the end of reading new headers. This can cause an
out of bounds access in v2r.
Kevin McCarthy [Mon, 26 Nov 2018 03:48:49 +0000 (19:48 -0800)]
Prevent trying to match a failing color body regex repeatedly
Emails with really long lines (e.g. spam), can suffer performance if a
complicated regex is matched to no effect over and over. If the regex
failed at the beginning, it won't match at the end of another's regex
match range, so turn it off.
Jenya Sovetkin [Fri, 7 Dec 2018 17:54:04 +0000 (18:54 +0100)]
reset notmuch Mailbox->size on opening
previous behaviour: size was not reset. This resulted in mailbox size to
accumulate on each mailbox reopening, hence displaying incorrect mailbox
size information in the status bar.
new behaviour: size is reset to zero.
steps to replicate previous behaviour: open neomutt with vfolder. Press
space to refresh vfolder (open from sidebar) several times. Mailbox size
in the status bar accumulates.
Pietro Cerutti [Thu, 6 Dec 2018 11:55:43 +0000 (11:55 +0000)]
merge: upstream GPGME improvements
* Require GPGME version 1.2.0 and drop useless HAVE macros.
* Always use the gpgme_new wrapper in crypt-gpgme.
* Try to avoid creation of temp. directory for key import.
* Improve the console output for extract-keys and speed up import.
The latter commit also introduced a bug in the import code which
listed all keys in the keyring to a temporary file and copied that one
to stdout. The former commit avoided the output to stdout.
The fix here is to use pgp_gpgme_extract_keys only for extracting
information about the key and don't re-use the same code for importing
keys. We now import the keys directly in pgp_gpgme_invoke_import and
we print the fingerprint and status flags for all imported keys. That
information available from GPGME for ages (0.3.1 from 2003).
The user id is unfortunately not printed; that would require a lookup
of the newly imported key. Can be done with another patch.
Werner Koch [Mon, 3 Dec 2018 07:41:55 +0000 (08:41 +0100)]
Try to avoid creation of temp. directory for key import.
Since gpgme 1.9.0 it is possible to list keys directly from a file
without importing it into gpg' own keyring. This patch implements
this in a backward compatible way.
Unfortunately we need to check for a suitable gpgme version at build
time and also for a suitable gpg version at runtime. This is
implemented by a version check which requires to call or include code
taken from libgpg-error (aka gpgrt). However this library is anyway a
dependency of gpgme and thus does not pose any extra burden.
The functions parse_version_number, parse_version_string, and
cmp_version_strings are taken from libgpg-error's repo at 2018-11-20.
Libgpg-error is distributed under the LGPL-2.1-or-later.
Werner Koch [Mon, 3 Dec 2018 07:41:54 +0000 (08:41 +0100)]
Always use the gpgme_new wrapper in crypt-gpgme.
The wrapper is much more convenient and there is no need to sometimes
use gpgme_new directly. The perceived advantage on not bailing out in
an out-of-core condition is not realistic because other small amounts
of memory are allocated all over mutt anyway and thus function will
terminate the process as well.
This patch also changes the minimum version of gpgme to 1.4.0. This
is so that we can always pass NULL to functions like gpgme_release.
Further 1.4.0 has new functions which we may soon like to use.
Werner Koch [Mon, 3 Dec 2018 07:41:53 +0000 (08:41 +0100)]
Require GPGME version 1.2.0 and drop useless HAVE macros.
GPGME 1.2.0 was released nearly 10 years ago and thus we can really
demand this version. For various reasons it would be advisable to
require a decent version but that is a different thing and needs to be
done in a separate patch.
HAVE_GPGME_OP_EXPORT_KEYS and HAVE_GPGME_PKA_TRUST are not anymore
needed because they are supported by that GPGME version.
Pietro Cerutti [Fri, 30 Nov 2018 13:04:48 +0000 (13:04 +0000)]
Add the "attach_save_dir" config variable
This specifies the location where attachments are saved. The default is
the current working directory.
- Suggest a directory even if the attachment doesn't have a name
- Do not clear the prompt buffer when modifying a suggested filename
- Default to "./" if attach_save_dir is empty or unset
Austin Ray [Wed, 14 Nov 2018 02:12:09 +0000 (21:12 -0500)]
notmuch: check for long run during db free
`nm_db_release(...)` should protect against freeing a long run database.
Prior to this commit, it was up to the programmer to ensure that a long
run database was not released.
The commit moves the check into `nm_db_release(...)` and removes the
checks elsewhere to reduce unnecessary, repeated checks.
Austin Ray [Sat, 10 Nov 2018 04:24:49 +0000 (23:24 -0500)]
notmuch: use guard-clauses pre-condition check
Several functions used an if statement with the body of the function
inside the if block. Instead, negate the if statement and return early.
This makes it easier to keep track of invariants.
Austin Ray [Tue, 27 Nov 2018 03:07:38 +0000 (22:07 -0500)]
notmuch: don't overwrite nm_default_uri
In commit 1040935, I accidentally removed a check for using `Folder` as
the `db_filename` if `db_filename` is null. My change made it so that it
always overwrote the value.
Richard Russon [Mon, 26 Nov 2018 18:29:31 +0000 (18:29 +0000)]
merge: upstream changes
* Add mutt_buffer_mktemp() transition function
* Add mutt_buffer_adv_mktemp() transition function
* Always print mutt_buffer_pool_free() size debug output
* add Buffer fixup functions
* Remove conversion of nbsp to space
* Ensure a resized empty buffer is null-terminated
* Fix memleaks of saslconn on error paths
* Fix memory leak on error in eat_regexp() and eat_date()
* Document send-hooks are not executed for resumed messages
* Fix a few memory leaks for idna conversion
* Allow relative date hour/min/sec offsets
* Add some brief documentation on OAUTH support
* Update $index_format cross-references in manual
* Add L10N comments to several unclear messages
* Switch color chunk matching to use bsearch
Kevin McCarthy [Mon, 19 Nov 2018 03:13:20 +0000 (19:13 -0800)]
Switch color chunk matching to use bsearch
Emails with extremely long lines, combined with a large number of
color matches, can cause a performance hit so severe that mutt appears
to have hung.
Switching out to using a binary search speeds things up noticably.
The for loops being replaced were a bit strange. resolve_types()
ensures there are no overlaps, and that they are ordered. A match is
defined by (first <= cnt < last). I can't see any reason for the
strange comparison of (cnt > last) follow by (cnt != last). Perhaps
at one time it made sense.
Peter Wu [Tue, 23 Oct 2018 10:29:26 +0000 (12:29 +0200)]
Fix memleaks of saslconn on error paths
If mutt_sasl_client_new returns an error, the callers would ignore the
allocated saslconn resource from sasl_client_new. Be sure to release
these with sasl_dispose as documented in sasl.h. Likewise, let callers
(POP/IMAP) dispose the resource on their error paths. SMTP was already
taken care of. Found with LeakSanitizer in IMAP.
Kevin McCarthy [Wed, 17 Oct 2018 00:35:54 +0000 (17:35 -0700)]
Ensure a resized empty buffer is null-terminated
The new buffer code is using the pool, which ensures its buffers are
null-terminated.
However, if a "new" buffer from another part of the code were passed
to one of the temporary interfaces that resizes the buffer, it's
possible a non-terminated string might end up being passed through.
It's reasonable to expect mutt_b2s() for a "new" buffer should be the
same as after it is resized larger. So ensure the resulting buf->data
is properly terminated to avoid surprises.
Kevin McCarthy [Tue, 16 Oct 2018 23:04:57 +0000 (16:04 -0700)]
Remove conversion of nbsp to space
Keep the behavior of it not line-breaking, but don't change it to a
space character when displaying. This is so copy-paste from the pager
will preserve the nbsp, which is semantically important in some
locales.