Home | History | Annotate | Download | only in mail
History log of /src/usr.bin/mail/support.c
RevisionDateAuthorComments
 1.27  08-Sep-2023  shm Add check for space presence after comma in skin()

Check if comma is followed by space, otherwise it may lead to overflow in the
output buffer as space might be extra appended to the output buffer without
consuming anything from the input. This condition breaks the assumption that
length(input) >= length(output) while the code relies on it.
 1.26  08-Sep-2023  shm Fix writing outside of the nbuf buffer in skin()

Data provided to skin() can be longer than LINEBUF (if same header is provided
multiple times, hfield returns concatenated data).

Thanks to riastradh@ for the review and comments
 1.25  09-Nov-2017  christos Only open regular files.
 1.24  29-Apr-2012  christos set close on exec for all opened files.
 1.23  24-May-2011  joerg branches: 1.23.4;
Use proper format strings.
 1.22  10-Apr-2009  christos From Anon Ymous:

- Remove all longjmp(3) calls from signal handlers. Instead, we post
to an internal signal queue and check that periodically. All signal
related code is now in sig.c, except for the SIGCHLD handler which
remains in popen.c as it is intimately tied to routines there.

- Handle SIGPIPE in type1() regardless of mime support, or else the
handler in execute() will prevent our error code from being returned
resulting in 'sawcom' not being set on the first command as it should.
This only affected the initial behavior of the "next" command without
mime support.

- Add the 'T' flag to many commands in cmdtab.c that should not look
like the first command. E.g., start mail on a mailbox with multiple
messages, run "set foo", then "next", and watch the second message get
displayed rather than the first as is the case without the first "set"
command.

- Add file descriptor and file handle leak detection. Enabled by
DEBUG_FILE_LEAK. This will likely disappear in the future.

- Fix a long standing (since import in 1993) longjmp() bug in
edstop(): the jmpbuf was invalid when quit() is called at the end of
main.

- Fix a long standing bug (since import in 1993) in snarf() where it
didn't strip whitespace correctly if the line consisted only of
whitespace.

- Lint cleanup.

- New Feature: "Header" command. This allows miscellaneous header
fields to be added to the header, e.g., "X-Organization:" or
"Reply-To:" fields.

- New Feature: "page-also" variable. This allows the specification of
additional commands to page. It is more flexible than "crt".

- Document the "pager-off" variable: if set, it disables paging
entirely.
 1.21  24-Apr-2008  christos branches: 1.21.8;
Fix a header decode mistake that caused mime header lines decoded by
hfield() to be decoded as if they were "unstructured" regardless of
their type. This resulted from calling mime_decode_hfield() with the
body of the header line, i.e., the portion after the colon header
field name terminator, rather than the full header line.
From Anon Ymous
 1.20  27-Oct-2007  christos branches: 1.20.6;
From Anon Ymous:
- Add a "bounce" command as requested by garbled@.
From the manpage:

bounce Takes a list of messages and prompts for an address to bounce the
messages to. All the original header fields are preserved except
for the ``Delivered-To'', ``X-Original-To'' and ``Status''
fields. The new ``To'' field contains the bounce address(es)
plus any addresses in the old ``To'' field minus the user's local
address and any on the alternates list. (See the alternates com-
mand.)
 1.19  23-Oct-2007  christos From Anon Ymous:
- Introduce date_to_tm() and hl_date_to_tm() to parse the date and
headline date a bit more efficiently.
- If 'tm_isdst' is determined, let strftime(3) handle the '%Z' and
'%z' formats. Otherwise, output "-0000" and "???", respectively, to
help preserve with alignment; strftime(3) will output an empty
string in these case.
- Change fail() to use the '-d' flag (which sets the 'debug' variable)
rather than the "debug" _environment_ variable. This is more
consistent with other warnings.
- Don't use gcc C extensions, e.g., "case LOW ... HIGH:".
- Define is_WSP() in def.h to be an inline function that for checks
whitespace (WSP = ' ' or '\t'), as defined in RFC 2822. Use it
consistently in place of isblank().
- For consistency, rename skip_blank() to skip_WSP().
- Add inline skip_space() to complement skip_blank() (now skip_WSP).
- Check all ctype(3) calls for argument range issues.
- Whitespace and comment cleanup/changes.
 1.18  05-Jun-2007  christos branches: 1.18.4;
Add RCSID's to help files and centralize the function to cat the help files.
 1.17  28-Nov-2006  christos From Anon Ymous:

1) Statification of modules.

2) Implement the 'detach' and 'Detach' commands for extracting mime
parts from messages.

3) Teach mail to output "In-Reply-To" and "References" header fields
when replying so others can thread us.

4) Implement threading, sorting, and tagging, supported by the
following commands: 'flatten', 'reverse', 'sort', 'thread',
'unthread', 'down', 'tset', 'up', 'expose', 'hide', 'tag',
'untag', 'invtags', 'tagbelow', 'hidetags', 'showtags'.
See the manpage for details (when available - soon).

5) Implement a 'deldups' command to delete duplicate messages based on
their "Message-Id" field, e.g., in replies to a mailing list that
are also CCed to a subscriber. (This can also be accomplished with
the threading and tagging commands.)

6) Implement 'ifdef' and 'ifndef' commands, and make the conditionals
nestable (i.e., implement a conditional stack). The if/else/endif
commands existed before, but they were primitive and undocumented.
The 'if' command currently recognizes the "receiving", "sending",
and "headersonly" mode keywords.

7) Teach the message selecting routine to understand regular
expressions if "regex-search" is defined. Otherwise only case
insensitive substring matches are done (as in the past).

8) Teach the message selection routine to understand boolean
expressions. Improved "colon-modifier" support. See the manpage
for details (when available - soon).

9) Extend paging to all commands (where relevant).

10) Add shell like piping and redirection of (standard) output (if
"enable-piping" is defined). Extend completion to these contexts.

11) The manpage should follow soon!!!!
 1.16  31-Oct-2006  christos More fixes from Anon Ymous:


1) Removed the -B flag (it was stupid on my part) and added a short
description indicating how to accomplish the same thing under the
"Sending Mail" section of man mail(1).

2) Added a -H flag to dump the headers and exit. It takes optional
flags to restrict to old, new, read, unread, and deleted messages
(the later being kind of useless - it shares code with something
that already had it).

3) Restored the 'Save' command which somehow got mistakenly removed in
the last commit and add documentation for it! (My apologies to
its author.)

4) Added a 'mkread' command to mark messages as read (the inverse of
'unread'). Should we also have a 'mknew' command?

5) Added a 'smopts' command to keep a database of addresses and
sendmail options to be used when sending messages to those
addresses. See man mail(1) for a fuller description.

6) Added 'indentpreamble' and 'indentpostscript' variables whose
values are inserted before and after a quoted message (~m or ~M
escapes).
=20
7) Added string formatting abilities for the 'prompt', 'insertpreamble',
'insertpostscript', and header display strings. These strings
support all the strftime() format parameters as well as many more
specific to mail (see man mail(1)).

8) Fix the -a flag so that it only takes a single filename, unless
"mime-attach-list" is defined. This is more conventional and avoids
unexpected whitespace issues.
 1.15  21-Oct-2006  christos From our anonymous user:
- mime and character set handling
- command line editor and completion
- many code improvements
 1.14  19-Jul-2005  christos Pass lint completely.
 1.13  19-Jul-2005  christos WARNS=3
 1.12  30-Oct-2004  dsl Add (unsigned char) cast to ctype functions
 1.11  31-Oct-2003  ross Defensively rewrite a string moving loop.
Constify.
Check for an allocation error.
 1.10  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22365, verified by myself.
 1.9  05-Mar-2002  wiz Use warn() instead of perror().
 1.8  05-Mar-2002  wiz KNF: No space after casts.
 1.7  05-Mar-2002  wiz Replace a 0-cast with NULL.
 1.6  05-Mar-2002  wiz ANSIfy another function (overlooked that one...).
 1.5  05-Mar-2002  wiz Use strpbrk(3) instead of anyof().
 1.4  04-Mar-2002  wiz Don't use special null string pointer (NOSTR), just use NULL.
 1.3  02-Mar-2002  wiz Rename variables to avoid shadowing.
 1.2  02-Mar-2002  wiz ANSIfy, and minimal KNF.
 1.1  19-Oct-2001  tv Rename "aux.c" to "support.c" to avoid clash with invalid "aux" basename
on some Microsoft host OS's.
 1.18.4.1  06-Nov-2007  matt sync with HEAD
 1.20.6.1  18-May-2008  yamt sync with head.
 1.21.8.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.23.4.1  23-May-2012  yamt sync with head.

RSS XML Feed