David Levine [Sun, 25 Aug 2019 12:49:53 +0000 (08:49 -0400)]
Removed unnecessary warning about missing semicolon.
The warning was for Content-Type and Content-Disposition, and was
incorrect. Thanks to Tom for providing output with it. Also
removed multiple trailing newlines from warning output, thanks to
Ralph for tracking those down.
Ken Hornstein [Sun, 28 Jul 2019 01:22:12 +0000 (21:22 -0400)]
Reorder configure options to be before variables
Reorder the configure options generated by build_nmh so they
will be before the variables, otherwise they end up IN things like
CFLAGS. Fixes bug #56680.
Ken Hornstein [Mon, 15 Jul 2019 18:25:53 +0000 (14:25 -0400)]
Fix handling of fullname
Make it that if a Local-Mailbox profile entry was NOT specified
that the fullname would be generated BEFORE the local mailbox was
generated, so the user's name ended up in the email address properly.
David Levine [Sun, 14 Jul 2019 13:29:21 +0000 (09:29 -0400)]
show and mhl now decode more addresses in header fields.
Added decoding of To:, Cc:, Resent-To:, Resent-Cc:, and
Resent-From: addresses to mhl.format and mhl.headers. Thanks to
Conrad Hughes for suggesting it for the first two components and
to Ralph for suggesting it for the Resent- components.
Ken Hornstein [Mon, 8 Jul 2019 13:59:15 +0000 (09:59 -0400)]
Create new mh-format function %(ordinal)
Implement a new mh-format function %(ordinal). This will output
the appropriate ordinal prefix (st, nd, rd, st) based on the value
of the "num" register.
Ken Hornstein [Mon, 24 Jun 2019 16:42:05 +0000 (12:42 -0400)]
Print port number in the connection error message
If a connection to a host fails, print the port number in the brief error
message. This will hopefully eliminate problems when nmh is using a default
port number that users are not expecting.
Ken Hornstein [Fri, 17 May 2019 18:27:28 +0000 (14:27 -0400)]
Remove final traces of TMA support
TMA (the TTI Trusted Mail Agent) was an early implementation of
encrypted mail and is long gone. There were a few vestigial bits
of this support left in nmh, and this is finally removing them.
This includes the check for the "Encrypted" header field in various
scan formats and some code to return the code SCNENC from scan()
function where it would have special handling by programs like inc(1).
Ken Hornstein [Mon, 13 May 2019 00:07:56 +0000 (20:07 -0400)]
Cleanup MIME header handling in mhbuild
Per discussion on nmh-workers, cleanup the handling of MIME headers
in mhbuild. The following logic should now apply.
If mhbuild is run with -auto AND a MIME-Version header is detected, then
exit silently with no error (and leave the draft untouched). Otherwise,
if a MIME-Version header or ANY Content-* header is found, exit with an
error. Note that this means if mhbuild is run with -auto then an error
will be returned if any Content-* headers are seen.
Previously, mhbuild would silently eat any Content-Type headers seen
in an existing draft; this behavior was brought forward from MH 6 and
no one could explain the reason for this behavior. This behavior has
been removed.
Ken Hornstein [Thu, 2 May 2019 17:26:56 +0000 (13:26 -0400)]
Improve SASL snoop output
Generate more information in the netsec layer when -snoop is enabled.
Specifically, enumerate the supported SASL mechanisms by the client and
server and explain which layer is using encryption.
Ken Hornstein [Wed, 24 Apr 2019 17:05:30 +0000 (13:05 -0400)]
Remove MIME content caching code
Remove all of the MIME content caching code. Besides being of dubious
value and having a number of 'interesting' security implications,
it apparently only would cache content if you ran it using mhn
(the necessary entry point was not copied over when mhn was split
apart) and it would only work on the top-level MIME content of a
message.
Ken Hornstein [Tue, 23 Apr 2019 01:42:14 +0000 (21:42 -0400)]
Set the close-on-exec flag for sockets
Since we no longer use closefds(), start cleaning up stray descriptors.
Start by making sure that any network sockets we create have the
close-on-exec flag set on them.
Ken Hornstein [Tue, 23 Apr 2019 00:36:14 +0000 (20:36 -0400)]
Garbage collect closefds()
Remove the closefds() function; it was used sporadically and was
causing problems on High Sierra. In the future look at opening
more descriptors with FD_CLOEXEC.
Ken Hornstein [Fri, 22 Mar 2019 15:59:04 +0000 (11:59 -0400)]
Add support for %(trimr) format function
Add support for a %(trimr) format function, which behaves exactly
like %(trim) but also returns a string. Turns out this is literally
a one-line change that does not require a new format instruction.
David Levine [Sat, 10 Nov 2018 17:35:31 +0000 (12:35 -0500)]
Added -attendee switch to mhical(1).
This allows the user to select which of their attendee addresses they are
responding about, when they have more than one in the invitation.
Added corresponding -a switch to calaccept, etc., functions in replaliases.
Updated mhical to retain DESCRIPTION lines. Gmail puts a link to the event
DESCRIPTION line along with a message to no edit that section, though it
seems to accept responses if the DESCRIPTION line was removed.
Incremented mhical version number to 0.5.
David Levine [Thu, 1 Nov 2018 23:44:32 +0000 (19:44 -0400)]
Increased sizes of a couple of buffers.
gcc 8 noticed that snprintf could have overrun them. It might be
better to reduce the sizes of buffers used for display names, etc.
Or ever better, use dynamically sized buffers.
Ralph Corderoy [Sun, 1 Jul 2018 08:43:05 +0000 (09:43 +0100)]
mhlsbr.c: Use variable for strncpy(3)'s size, not sizeof.
Silences gcc 8.1.1's warning that the size of the source was being used,
not the destination. The destination has just been allocated to be the
size of the source so no overflow can occur. Move existing variable
that later holds the buffer size to before the allocation and strncpy so
it can be used for those too.
Ralph Corderoy [Sun, 1 Jul 2018 08:32:28 +0000 (09:32 +0100)]
rcvtty.c: Use struct utmpx's ut_line[], not a copy.
Silences gcc 8.1.1's warning that strncpy(3)'s length is the sizeof of
the source, not the destination, by removing the strncpy and passing the
source to alert() where it's only read, not written.
David Levine [Tue, 20 Feb 2018 02:30:17 +0000 (21:30 -0500)]
Fixed mhshow/test-charset to work on all tested platforms.
Restores the functionality of commit f81046da6. Also, skips the
last two tests if iconv isn't enabled. And removes the test
files if the last test, without iconv_elides_question_marks, behaves
as expected. Finally, some comments have been updated.
Ken Hornstein [Mon, 12 Feb 2018 21:01:08 +0000 (16:01 -0500)]
Avoid free() in format engine for now.
This free() call messes up the buffer handling in scansbr.c:scan();
for now we're going to live with the leak and fix this properly when
we normalize the format engine's memory handling.
Ralph Corderoy [Sun, 11 Feb 2018 13:02:24 +0000 (13:02 +0000)]
cpstripped(): Replace malloc()s with statics based on MB_LEN_MAX.
MB_CUR_MAX from stdlib.h isn't a compile-time constant so can't be used
for the size of a couple of static char arrays so malloc() was used at
run time, with the tiny claims never being freed. valgrind(1) noticed
and David suggested MB_LEN_MAX from limits.h instead; that header's
contents are suitable for #if expressions and thus compile-time
constants.
Ken Hornstein [Sat, 10 Feb 2018 04:15:32 +0000 (23:15 -0500)]
Clean up memory leaks by callers of scan().
Make sure we reuse the "scanl" argument to the scan() function, as that's
the signal to have scan() reuse it's buffers. Otherwise repeated calls
to scan will leak a TON of memory. Reported by Ralph Corderoy.
David Levine [Fri, 9 Feb 2018 00:43:56 +0000 (19:43 -0500)]
Compile the header format for each message.
Per Ken's suggestion, compile_header() and compile_marker() are now
called for each message. That's done with reset_comptable disabled.
So, per Ralph's suggestion, fmt_free(NULL, 1) is called after all
messages are shown to free up memory held by the component table.
Ralph Corderoy [Sat, 3 Feb 2018 10:49:40 +0000 (10:49 +0000)]
test-charset: Fix test when HAVE_ICONV is false.
When the Content-Type's charset parameter's encoding is `invalid', it
makes no difference whether HAVE_ICONV is defined or not as the
parameter's value can't be decoded.
Ralph Corderoy [Wed, 24 Jan 2018 00:27:01 +0000 (00:27 +0000)]
%(divide): Avoid SIGFPE on integer divide of INT_MIN by -1.
Dividing by zero isn't the only cause of SIGFPE.
fmttest -raw -format '%(num -2147483648) %(divide -1)' foo
Also, add FIXME comment suggesting the user should be told of overflow
rather than silently using zero as the result.
Ralph Corderoy [Wed, 24 Jan 2018 00:12:59 +0000 (00:12 +0000)]
Use trim_suffix_c() to remove optional trailing character.
I'm unsure if one of the cases can know the string's length is long
enough to read the char before the NUL. Using trim_suffix_c()
simplifies and removes the possibility.
Ralph Corderoy [Wed, 24 Jan 2018 13:49:06 +0000 (13:49 +0000)]
mhfixmsg.man: Replace UTF-8 `§' with `\(sc' troff escape.
man page source is ASCII. GNU groff's troff's source is ISO 8859-1.
The `§' in UTF-8 looks like `§' in ISO 8859-1. If those two bytes make
it to a UTF-8 terminal then it appears as `§', but target something
else, e.g. PDF, and the flaw shows.
Also adjust test-manpages to grep for bytes other than HT, and SPACE to
tilde, in the built man pages. A test of the source could be also be
done for the Makefile's `all' target, but this one should remain to spot
the build process breaking things, e.g. non-ASCII in $prefix.
Ralph Corderoy [Tue, 23 Jan 2018 16:37:01 +0000 (16:37 +0000)]
fmt_scan(): Avoid undefined behaviour from overlapping strncpy(3).
M. Levinson pointed out in private email that pcc(1) tickles a bug that
causes undefined behaviour due to part of `buffer[]', accessed by `str',
being strncpy(3) back to its start. Fix by using memmove(3) to slide
`str' back to `buffer's beginning whenever it may have wandered off.
Fixes e8635a8a that added `%(unquote)', but using `%(trim)' twice was
also faulty in the same way and pre-dates git.
Ralph Corderoy [Tue, 23 Jan 2018 09:18:34 +0000 (09:18 +0000)]
mhshow: Avoid SEGV when user's command has two or fewer words.
After argsplit() returned a NULL-terminated vector, the existing NULL
was overwritten with another and the vector index then incremented.
This made the test for whether vec[2] was available out by one resulting
in NULL being used and printed.
This plucking of the third word is a faulty assumption as argsplit()
doesn't always return ["sh", "-c", ...], but add a new test script for
it to avoid regression and so that the script can be expanded with more
related tests.
Debian's packager, Alexander Zanger, reported test/oauth/test-* problems
due to environment variables for the system's network proxies. David
Levine suggested the unsetting of them. The tests only make HTTP
connections so just the variables affecting those are unset.