Kevin McCarthy [Sun, 26 Mar 2017 19:27:15 +0000 (12:27 -0700)]
Fix mutt_refresh() pausing during macro events.
Changeset a07e8215a0ef split input buffering into two pools.
Unfortunately, the mutt_refresh() was not changed to check the correct
buffer count, resulting in unnecessary refreshes during macros.
The SSL interactive certificate prompts set OPTIGNOREMACROEVENTS and
then put up a confirmation menu. Perhaps we've just been lucky, but
it seems we should refresh the screen in those cases if we're in the
middle of a macro. Add a check for this option in mutt_refresh() too.
Richard Russon [Wed, 22 Mar 2017 16:44:02 +0000 (16:44 +0000)]
merge: Tidy the code - Part 2
* build: force OPS to be rebuild after a reconfigure
* build: fix minor code warnings / style
* tidy: be specific about void functions
* build: expand a few more alloc macros
* tidy: add argument names to function prototypes
* build: drop local copy of regex code
* tidy: indent the docbook manual
* tidy: rearrange code to avoid forward declarations
* tidy: limit the scope of some functions
* build: give the compress functions a unique name
* tidy: use snake_case for function names
* build: add missing newlines to mutt_debug
Richard Russon [Thu, 16 Mar 2017 02:35:05 +0000 (02:35 +0000)]
build: give the compress functions a unique name
The compressed mailbox functions are passed as pointers to mutt.
Their names, e.g. "open_mailbox" are OK for compilation, but they are
ambiguous when debugging.
Richard Russon [Wed, 15 Mar 2017 18:39:10 +0000 (18:39 +0000)]
build: force OPS to be rebuild after a reconfigure
A common problem is getting build errors after running ./configure for
the second time, e.g.
./configure [FEW OPTIONS]; make
./configure [MANY OPTIONS]; make
This commit forces keymap_defs.h to be rebuilt after a configure.
Richard Russon [Tue, 21 Mar 2017 16:12:39 +0000 (16:12 +0000)]
merge: upstream fixes (mutt/default)
* Add SNI support for OpenSSL. (see #3923)
* Add SNI support for GnuTLS. (closes #3923)
* Add shortcuts for IMAP and POP mailboxes in the file browser
* Change OpenSSL to use SHA-256 for cert comparison. (closes #3924)
* Fix conststrings type mismatches. (closes #3926)
* Pass envlist to filter children too. (closes #3922)
* Fix mutt_envlist_set() for the case that envlist is null. (see #3922)
* Fix setenv overwriting to not truncate the envlist. (see #3922)
Kevin McCarthy [Mon, 20 Mar 2017 17:16:03 +0000 (10:16 -0700)]
Fix setenv overwriting to not truncate the envlist. (see #3922)
The refactor in 2b9c40f13e13 exposed a bug I hadn't noticed. The
match loop performed a FREE() on the slot. Then, below, it was
checking if (*envp) to see whether it was overwriting or creating a
new slot. However, FREE() nulls out *envp. This would end up
truncating the envlist just after the set slot!
Move the free down, using a mutt_str_replace(), when overwriting the
slot.
Kevin McCarthy [Sat, 18 Mar 2017 20:38:20 +0000 (13:38 -0700)]
Fix conststrings type mismatches. (closes #3926)
The generation programs for conststrings.c: txt2c.c and txt2c.sh,
specified the resultant types as "unsigned char[]" while version.c
declared them as "const char[]".
txt2.c generates 0xXX hex codes for each individual character, thus
the "unsigned" definition. With link-time optimization, some versions
of gcc notice the mismatch and emit a warning.
Change the declarations to match the definitions and cast to char[]
when they are used.
Add shortcuts for IMAP and POP mailboxes in the file browser
Mailbox list may not be properly displayed in a standard 80-column
terminal window if the $folder variable contains a long URL. In such
a case only left part of each entry name can be visible with the default
value of $folder_format. What's worse, this visible part may not be
enough to distinguish between the entries.
Thus in this case mutt_pretty_mailbox() will be just as useful as for
local mailboxes.
Kevin McCarthy [Thu, 9 Mar 2017 21:00:10 +0000 (13:00 -0800)]
Add SNI support for OpenSSL. (see #3923)
The original patch for this is by Phil Pennock at:
https://people.spodhuis.org/phil.pennock/software/mutt-patches/
I have removed the OpenSSL version check and defined(OPENSSL_NO_TLSEXT)
check because:
* SSL_set_tlsext_host_name() was added in 0.9.8f [11 Oct 2007]
* OpenSSL 1.1 no longer has the OPENSSL_NO_TLSEXT compilation option
* https://rt.openssl.org/Ticket/Display.html?id=2788&user=guest&pass=guest
shows that the no-tlsext compilation option has been broken for some time.
* Going forward, I'd like to minimize and start removing cruft required
to support ancient/insecure versions of libraries.
Richard Russon [Fri, 17 Mar 2017 00:01:33 +0000 (00:01 +0000)]
merge: Tidy the code - Part 1
* drop control characters from the source
* drop vim modelines
* delete trailing whitespace
* mark all local functions as static
* delete unused functions
* replace FOREVER with while (true)
* drop #if HAVE_CONFIG_H
* use #ifdef for potentially missing symbols
* remove #if 0 code blocks
* drop commented out source
* IMAP auth functions are stored by pointer cannot be static
On a hostname mismatch, saving the certificate is pointless because
mutt will ask the user no matter if the certificate is saved or not.
The only invocation allowing "accept always" is guarded by a call to
check_certificate_digest(), which means the check_certificate_file()
check is redundant. Therefore remove that check and add a comment
noting why.
Thanks to Matthias Andree for the original version of this patch.
Kevin McCarthy [Thu, 9 Mar 2017 18:56:21 +0000 (10:56 -0800)]
Prevent skipped certs from showing a second time. (see #3916)
OpenSSL sometimes passes a skipped certificate to
ssl_verify_callback() a second time, with preverify_ok=1. From
OpenSSL's viewpoint there is nothing wrong with this, but mutt will
end up showing the certificate in the interactive prompt again.
Cache the last cert and position, and compare with the latest when
skip_mode and preverify_ok are both set.
Kevin McCarthy [Wed, 8 Mar 2017 02:26:06 +0000 (18:26 -0800)]
Move the OpenSSL partial chain support check inside configure.ac. (see #3916)
Instead of directly checking whether X509_V_FLAG_PARTIAL_CHAIN is
defined everywhere, do it once inside configure. This will allow
better support in the future if the test needs to change.
Matthias Andree [Wed, 8 Mar 2017 02:26:04 +0000 (18:26 -0800)]
Add $ssl_verify_partial_chains option for OpenSSL. (closes #3916)
The reworked OpenSSL certificate validation took away a "feature" of
the previous implementation: the ability to reject a node in the chain
and yet continue to the next node.
If this new option is set to 'yes', enables OpenSSL's
X509_V_FLAG_PARTIAL_CHAIN flag to reinstate the functionality and permit
to use a non-root certificate as the trust anchor.
This option is only available if OpenSSL offers the
X509_V_FLAG_PARTIAL_CHAIN macro, which should be the case as of 1.0.2b
or later.
Code written by Kevin McCarthy and Matthias Andree.
Richard Russon [Sat, 11 Mar 2017 19:11:12 +0000 (19:11 +0000)]
merge: add lua scripting
* lua: add basic working example
* Adding basic Lua scripting basics to mutt
* Refactor of the regex parsing code into its own function
* Added new headers mutt_commands.h and mutt_options.h
* Added -B option for batch mode. exiting before any mail sending feature
* Lua API for Mutt's config and commandline
Guyzmo [Sun, 15 Jan 2017 02:29:23 +0000 (03:29 +0100)]
Lua API for Mutt's config and commandline
* adds the following to Mutt's API:
* `:lua` to execute a line of Lua
* `:lua-source` to load and run a Lua source file
* exposes the following Mutt API in Lua:
* `mutt.message()` To write a message on Mutt's command line
* `mutt.error()` To write an error message on Mutt's command line
* `mutt.enter()` run an arbitrary Mutt command, like with `:enter-command`
* `mutt.get()` get a variable from Mutt
* `mutt.set()` sets a variable from Mutt (with type enforcement)
* `mutt.call()` calls a command available in mutt, with arguments
* `mutt.command.*` exposes all the commands from within Mutt
* For some technical details:
* proper error handling of the Lua interpreter
* exposed mutt_option_set and mutt_option_get from init
Guyzmo [Sat, 14 Jan 2017 12:31:58 +0000 (13:31 +0100)]
Adding basic Lua scripting basics to mutt
* adding two commands:
- lua: to parse a line of lua code
- lua-source: to load and parse a lua file
* binding two mutt functions in lua:
- mutt_message and
- mutt_error
Richard Russon [Sat, 11 Mar 2017 18:46:00 +0000 (18:46 +0000)]
fix: Garbage in chdir prompt due to unescaped string
I upgraded one of my stable systems to stretch and noticed that when
changing the directory with 'c', there was some garbage at the end of
the string in the prompt. I've not noticed that before on my main
amd64 system, but this stable system is i386, so different alignment
and word size that can affect this kind of thing.
I tracked it down to an unescaped string handling.
Damien Riegel [Sat, 18 Feb 2017 19:19:58 +0000 (14:19 -0500)]
mx: don't make MUTT_NNTP and MUTT_COMPRESSED conditional
Other symbols like MUTT_IMAP and MUTT_POP don't depend on their
respective configuration flags to be defined, keep the same logic for
MUTT_NNTP and MUTT_COMPRESSED. That makes it easier to remove some
ifdef.
Damien Riegel [Sat, 18 Feb 2017 18:41:19 +0000 (13:41 -0500)]
mx: remove `#ifdef USE_COMPRESSED` in mx_fastclose_mailbox
Some code to cleanup compressed mailbox on close depends on an #ifdef
block in mx_fastclose_mailbox, but this mailbox specific code should be
implemented in the mx_ops' close function.
This commit moves the call to `mutt_free_compress_info` in the mailbox
close function, allowing us to mark it static and to remove the ifdef.
Richard Russon [Mon, 6 Mar 2017 12:45:01 +0000 (12:45 +0000)]
merge: upstream fixes (mutt/default)
* Clear out extraneous errors before SSL_connect() (see #3916)
* SSL: Fix memory leak in subject alternative name code. (closes #3920)
* Increase ACCOUNT.pass field size. (closes #3921)
Kevin McCarthy [Sun, 5 Mar 2017 23:24:45 +0000 (15:24 -0800)]
Increase ACCOUNT.pass field size. (closes #3921)
#3921 reported his password token used for Google XOAUTH2 is size 129.
The ACCOUNT structure currently uses a size 128 buffer. Who knew a
password field would ever be bigger than that?
Since the ACCOUNT structure has no allocation/dellocation routines,
the easiest fix is to increase the size. Bump the size up to 256.
Kevin McCarthy [Sun, 5 Mar 2017 23:24:45 +0000 (15:24 -0800)]
Increase ACCOUNT.pass field size. (closes #3921)
#3921 reported his password token used for Google XOAUTH2 is size 129.
The ACCOUNT structure currently uses a size 128 buffer. Who knew a
password field would ever be bigger than that?
Since the ACCOUNT structure has no allocation/dellocation routines,
the easiest fix is to increase the size. Bump the size up to 256.