Kevin McCarthy [Sat, 24 Mar 2018 22:10:13 +0000 (15:10 -0700)]
Increase account.user/login size to 128.
Like the pass field in commit 52949004, the existing size was
insufficient for the reporter of issue #18. For now, just bump up the
size, but I'll move up looking into making these dynamically sized.
Kevin McCarthy [Fri, 23 Mar 2018 03:23:46 +0000 (20:23 -0700)]
Remove dead code in pgp.c
pgp_extract_keys_from_messages() has been subsumed by
crypt_extract_keys_from_messages(). The function had incorrect
multi-bit flag comparisons, but since it's dead code, remove it
instead.
Kevin McCarthy [Fri, 23 Mar 2018 03:04:46 +0000 (20:04 -0700)]
Fix comparison of flags with multiple bits set.
PGPENCRYPT, PGPKEY, SMIMEENCRYPT, and SMIMEOPAQUE are all combination
flags, with multiple bits set. In a few places these flags were
bitwise-and'ed incorrectly: expecting a non-zero result to indicate
all the bits in the flag were set. Change those to explicitly compare
the result against the original flag.
Kevin McCarthy [Thu, 22 Mar 2018 16:32:31 +0000 (09:32 -0700)]
Fix s/mime non-detached signature handling.
This fix is based on stbuehler's patch from
https://dev.gnupg.org/T2919.
Recent versions of gpgme seem to terminate the connection for a
protocol error. stbuehler's analysis is that this is actually a
gpgme bug, but recreating the context works around the problem.
Kevin McCarthy [Sun, 11 Mar 2018 19:48:46 +0000 (12:48 -0700)]
Add $abort_noattach and $abort_noattach_regexp options.
$abort_noattach_regexp is matched against the body of a message. If
so, the $abort_noattach quadoption is used to prompt whether to abort
sending.
Thanks to Antonio Radici for bringing the original version of the
patch to our attention, which he pulled from
https://github.com/tlvince/pkgbuild/blob/master/mutt-kiss/mutt-attach.patch
This version was rewritten to use a regexp, to fix a few issues, and
to better fit in with Mutt styles and conventions.
Kevin McCarthy [Thu, 22 Feb 2018 02:25:37 +0000 (18:25 -0800)]
Fix is_from() year parsing to abort on year overflow.
Unlike mutt_parse_date(), is_from() was not checking for overflow, and
could end up passing a negative year to mutt_mktime().
It should perhaps be changed to use mutt_atoi(), which does better
range checking, but that requires mutt_atoi() being changed to allow
trailing characters and its callers return value checks being
updated. I'll put that on the todo list.
Kevin McCarthy [Thu, 22 Feb 2018 02:18:53 +0000 (18:18 -0800)]
Cap parsed years at 9999 when converting to time_t.
Large year values, even those less than INT_MAX, apparently can cause
gmtime() and localtime() to return NULL. Mutt needs larger changes
checking and handling those errors, but this will prevent the
immediately triggerable issue.
Kevin McCarthy [Sun, 4 Feb 2018 02:08:28 +0000 (18:08 -0800)]
Add history-search function, bound to ctrl-r.
Create a very basic "search history" functionality in the line editor.
It uses the current input, and searches backward through history. If
there is one match, it immediately uses that otherwise it pops up a
simple menu of matches.
Kevin McCarthy [Thu, 1 Feb 2018 19:10:01 +0000 (11:10 -0800)]
Add stub flea and muttbug scripts back.
It was rightfully pointed out that the removal was too abrupt. These
programs have been around for a long time, and many internet searches
still say to use them for reporting bugs.
Add stub versions which inform to use the gitlab url instead.
Kevin McCarthy [Mon, 22 Jan 2018 03:41:47 +0000 (19:41 -0800)]
Remove useless assignments in add_to_list functions.
The code was probably pulled from some of the header processing
functions, which were in a loop. In those versions, "last" pointed to
a collection of new entries appended, but in these two functions,
updating last just obfuscates the code.
Olaf Hering [Tue, 16 Jan 2018 08:40:06 +0000 (09:40 +0100)]
Split Copyright and Thanks in help output.
The Copyright string is changing often, and its content is obvious.
It does not need translation. The remaining string can be translated.
This change avoids a stale translation once one of the years change.
Olaf Hering [Tue, 3 Dec 2013 15:42:39 +0000 (16:42 +0100)]
examine_directory: set directory/symlink size to zero
The size of a directory or symlink in the folder browser is not meaningful.
For directories it means just how many blocks were allocated to hold all
entries. It does not mean that the entries are still present in the directory.
For symlinks its the size of the target.
Set both to zero to simplify the folder browser output.
Kevin McCarthy [Thu, 11 Jan 2018 21:24:30 +0000 (13:24 -0800)]
Create pgp and s/mime default and sign_as key vars. (see #3983)
The $postpone_encrypt and $(pgp/smime)_self_encrypt configuration
variables have created a somewhat messier situation for users. Many
of them now have to specify their keys across multiple configuration
variables.
(Trac) Ticket #3983 had a reasonable request: "if my encrypt and
signing keys are the same, why can't I just specify my key once in my
.muttrc?"
The problem currently is that $smime_default_key and $pgp_sign_as are
both used to specify signing keys, and are set by the "sign (a)s"
security menu choice. So we can't store encryption keys there because
some users have separate sign-only capability keys.
Create $pgp_default_key to store the default encryption key. Change
signing to use $pgp_default_key, unless overridden by $pgp_sign_as.
The pgp "sign (a)s" will continue setting $pgp_sign_as.
Create $smime_sign_as. Change signing to use $smime_default_key
unless overridden by $smime_sign_as. Change s/mime "sign (a)s" menu
to set $smime_sign_as instead.
Change $postpone_encrypt and $(pgp/smime)_self_encrypt to use
$(pgp/smime)_default_key by default.
Mark $(pgp/smime)_self_encrypt_as deprecated. They are now aliases
for the $(pgp/smime)_default_key config vars.
Change $(pgp/smime)_self_encrypt default to set.
The intent is that most users now need only set
$(pgp/smime)_default_key. If they have a sign-only key, or have
separate signing and encryption keys, they can put that in
$(pgp/smime)_sign_as. This also enables to default self_encrypt on
and solve a very common request.
Thanks to Michele Marcionelli and Vincent Lefèvre for gently pushing
me towards a solution.
Fabian Groffen [Sun, 7 Jan 2018 12:06:56 +0000 (13:06 +0100)]
cmd_handle_fatal: make error message a bit more descriptive
When there are multiple IMAP connections available, "Mailbox closed"
doesn't give a hint as to which one. Use account info to identify which
mailbox was closed.
Kevin McCarthy [Sat, 6 Jan 2018 23:55:17 +0000 (15:55 -0800)]
Change imap literal counts to parse and store unsigned ints.
IMAP literals are of type number. Change imap_get_literal_count() to
use mutt_atoui() instead of atoi(). Change the return type variables
used to store the count to type unsigned int.
It's doubtful this was a real issue, but as long as we're cleaning up
incorrect atoi() usage, we should fix this too.
Kevin McCarthy [Sat, 6 Jan 2018 04:39:50 +0000 (20:39 -0800)]
Fix improper signed int conversion of IMAP uid and msn values.
Several places in the imap code, when parsing "number" and "nz-number"
values from the IMAP data, use atoi() and strtol(). This is
incorrect, and can result in failures when a uid value happens to be
larger than 2^31.
Create a helper function, mutt_atoui() and use that instead. One
place was using strtol() and relying on the endptr parameter, and so
was changed to use strtoul() instead.
Thanks to Paul Saunders for the bug report and original patch, which
this commit is based on.
Kevin McCarthy [Sun, 31 Dec 2017 03:10:16 +0000 (19:10 -0800)]
Disable message security if the backend is not available.
Gitlab issue #3 exposed an awkward corner case: if mutt is configured
without PGP or S/MIME, and with GPGME, but $crypt_use_gpgme is unset.
In this case, no backend will be available, but WithCrypto will be set
with both APPLICATION_PGP and APPLICATION_SMIME bits.
That will allow various config vars to enable encryption or signing,
even though there will be no backend available to perform them. The
message security flag might then be set, but when the user hits send,
will end up back at the compose menu due to the error.
The pgp or smime menu might not even be available to clear the
security setting!
Add a check in send.c before the compose menu is invoked, and give a
warning message for the menu ops inside the compose menu.
I believe this should prevent the issue. However this is a corner
case combined with user misconfiguration, so I don't believe is worth
a large effort to completely eradicate.
Kevin McCarthy [Mon, 18 Dec 2017 20:55:20 +0000 (12:55 -0800)]
Determine latest tag using git describe.
Commit 8648db83 relies on `sort -V` which is unavailable on some
platforms. Instead just use `git describe` with --abbrev=0 to only
output the tag. We still manually compute the distance to avoid the
problem mentioned in that commit.
Additionally, add Vincent's fix from commit 3b142cea to the stable
branch.
Adam Borowski [Sun, 17 Dec 2017 12:36:21 +0000 (13:36 +0100)]
manually touch atime when reading a mbox file
The only common use of atime left is local mail agents leaving a mark on
mbox file after the mail has been read. And, since POSIX-2008, it is
possible to use futimens() to alter atime even on filesystems mounted with
noatime.
There's no extra cost for doing this on when atime updates are enabled:
the inode will be dirty already.
Commit c1bcf4ba exposed a bug in the s/mime encryption code. It was
errorneously calling unlink on the list of generated cert files to
use.
Prior to that commit, the list had an initial space, which apparently
made the unlink fail. After that commit, encrypting to a single
certificate would end up deleting the certificate.
Remove the calls to unlink the cert file. Add some missing cleanup if
the call to openssl fails.