Commit Graph

239 Commits

Author SHA1 Message Date
christos 08face766e Fix a (very old) file leak. From Anon Ymous 2007-12-17 22:06:00 +00:00
perry 8b0f9554ff convert __attribute__s to applicable cdefs.h macros 2007-12-15 19:44:37 +00:00
christos 428c7a1f82 From Anon Ymous:
- Fix a file handle leak.
- Use Fopen(), Fdopen(), and Fclose() consistently so the signal
  handler close files.
2007-12-14 16:55:20 +00:00
christos 7c16cc9e3b From Anon Ymous
- Fix a stupid typo: sizeof(sizeof(a)) isn't very useful.
- Use emalloc(3) and erealloc(3) instead of malloc(3) and realloc(3),
  resp.
2007-11-14 22:06:04 +00:00
christos fef32d862e From Anon Ymous: Make this compile without MIME_SUPPORT. 2007-10-30 16:08:11 +00:00
christos e988ecba95 bump date 2007-10-30 02:29:22 +00:00
christos 349d978117 From Anon Ymous:
- Add a "forward" command as requested by garbled@.
  From the manpage:

  forward
	  Takes a list of messages and prompts for an address (or
	  addresses) to forward each message to.  If no message list is
	  specified, the current message is used.  The mail editor is run
	  for each message allowing the user to enter a message that will
	  precede the forward message.  The message is sent as a multi-
	  part/mixed MIME encoded message.

- Add the ability to match messages that do (or do not) contain a
  header field.  E.g., the command "f ! /Subject:" will display the
  list of messages that are missing a "Subject" field.

- Teach savemail() to prefix fake headlines so the mbox doesn't get
  broken.

- Fixed a couple of "bugs" in the attachment editing routine.
2007-10-30 02:28:30 +00:00
christos 2283d346cb From Anon Ymous:
knf changes:
- s/sizeof x/sizeof(x)/.
- remove unnecessary malloc typecasts.
- whitespace nits.
2007-10-29 23:20:37 +00:00
christos 4556f89a2d 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.)
2007-10-27 15:14:50 +00:00
christos d727506fb5 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.
2007-10-23 14:58:43 +00:00
christos 3e94d8f384 Handle 2 digit years, from Anon Ymous 2007-10-19 15:59:55 +00:00
christos 790ed387b2 Use warnx(3) not warn(3); timegm(3) does not set errno. Use the
unconverted time if the date is invalid. (from Anon Ymous)
2007-10-04 17:05:01 +00:00
christos ecde76d5ff Support obsolete zone info in date field. (See obs_zone of RFC 2822,
sec 4.3.) from Anon Ymous
2007-09-12 13:09:46 +00:00
dogcow fc68757006 A prophylactic patch: change offsetof -> blkoffsetof 2007-08-22 03:42:06 +00:00
christos 9b2b49a478 off by one fix from Anon Ymous 2007-07-07 18:04:17 +00:00
christos 68a6fb4652 protect against null. 2007-07-07 17:53:13 +00:00
christos c9033e1918 Don't expand % escapes in headers. 2007-07-06 20:14:33 +00:00
christos c5d61cf88b call setprogname(); from anon ymous. 2007-06-13 19:39:54 +00:00
christos 41101b58c8 Add RCSID's to help files and centralize the function to cat the help files. 2007-06-05 17:50:22 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
christos bccb1cb6c7 bump version, from Anon Ymous 2007-02-15 17:18:15 +00:00
christos 12d4fbef5e don't overwrite variables on the stack. From Anon Ymous. 2007-01-22 19:07:13 +00:00
christos 8d9a441486 Appease wizd, from Anon Ymous. 2007-01-05 03:52:35 +00:00
christos d834d54792 From Anon Ymous:
1) Don't miss the pipe command when grabbing the command name.
2) Convert some key constants to defines.
2007-01-03 00:39:16 +00:00
christos 07a95a1d4c 1) Fix a really stupid table termination error in mime_decode.c.
2) When doing attachments set the "name=" parameter of the
Content-Type field, in addition to the (already) set "filename="
parameter of the Content-Disposition field.  Some utilities (e.g.,
metamail) use this parameter for the filename even though (I believe)
the "filename=" parameter of the Content-Disposition field is
preferred by the standard (I can't find this explicitly except for
"application/octet-stream" types - see RFC1521 sec 7.4.1 and RFC2046
sec 4.5.1).  My impression is that the "name=" parameter of the
Content-Types field is really intended for use when retrieving a file
not in the message, e.g., "message/external-body" Content-Types, and
not for the filename.
(Thanks to wiz@ for noticing this in his spam logs.)

3) Be more careful when determining the Content-Type of 1-byte
attachments.  libmagic(3) isn't helpful on such small files.
2007-01-03 00:24:36 +00:00
christos 8d5de8f839 From Anon Ymous:
1) Remove a stray "SRCS+=" line from the Makefile.
2) Document the "nospec" option of "regex-search".
3) Fix some typos and formatting in the manpage.
2007-01-02 03:09:13 +00:00
christos b01c8fbc21 From Anon Ymous
1) Add support for message selection based on the message body.  The
pattern matching is done on the MIME decoded body as would be seen by
the print command.

2) Don't hook editline when doing headers only: that mode is never
interactive and it messes up piping if output is redirected to a
command that expects tty input, such as 'more'.
2006-12-25 18:43:29 +00:00
wiz 201b173539 Consistently use Ev for PAGER. 2006-12-23 09:26:10 +00:00
wiz 6056ee8d62 Use Nm instead of Xr to ourselves. 2006-12-23 09:08:46 +00:00
wiz bf6c34fe61 Use Sx for section cross-references. 2006-12-23 08:42:59 +00:00
wiz a6ce50109e Remove trailing whitespace. 2006-12-23 08:40:11 +00:00
christos 581e519fb5 From Anon Ymous:
1) When detaching, don't try to close things we shouldn't (after
   doing the header).  Specifically, mip->mi_head_end was not
   getting set correctly in mime_sendmessage().

2) Change paging to be closer to its old behavior: next, dt, and dp
   should only page if the crt variable is set; and don't automatically
   page most other commands - the user can always pipe them into more.
2006-12-15 20:26:03 +00:00
christos eea42e044a Fix timezone and date parsing. From Anon Ymous. 2006-12-10 06:06:47 +00:00
christos 8d6767f0e6 When "autoprint" and "crt" were set, the pager was getting bypassed.
Thanks to Patrick Klos for reporting the problem. (from Anon Ymous)
2006-12-06 17:55:00 +00:00
christos 6e70cbd24e From Anon Ymous:
Partially restore the "crt" variable: if set, the [pP]rint and [tT]ype
commands invoke the PAGER making them identical to the [pP]age and
[mM]more commands.  Its value is now ignored.  If anyone really
objects, I will do my best to restore the old behavior, but it really
doesn't fit very well into the current paging architecture.
2006-12-06 16:26:24 +00:00
christos 67e2fbb036 fix a core-dump and do some more error checking via asserts. From Anon Ymous 2006-12-05 03:47:41 +00:00
christos 1194ba0741 Document the new threading etc. features. From Anon Ymous. 2006-12-03 18:09:09 +00:00
christos 75df0a7821 block a few more signals, from anon 2006-11-29 01:29:46 +00:00
christos c77cd73835 don't block sigterm otherwise a forked process that sends a sigterm to itself
never exits (gv), from anon
2006-11-29 01:25:28 +00:00
christos 3a9442af4c pointers should be either casted to intptr_t or even better not casted... 2006-11-28 20:29:25 +00:00
christos f20e38f662 pass lint. 2006-11-28 18:46:04 +00:00
christos f309875081 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!!!!
2006-11-28 18:45:32 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
christos 3bf60b1367 From Anon Ymous:
The problem is that mime_decode_close() closes all files registered
after mip->mi_pipe_end and this is getting set in mime_sendmessage()
after a fflush().

When you print a large number of messages fflush() blocks and prevents
mip->mi_pipe_end from getting set before the SIGPIPE comes in and
jumps to the close block that calls mime_decode_close().  As a result,
mime_decode_close() was closing all the registered files including
obuf (mi_pipe_end was NULL).
2006-11-01 16:42:27 +00:00
christos eb238f14b4 new file from Anon Ymous 2006-10-31 22:37:19 +00:00
christos f1830357a3 new files from Anon Ymous. 2006-10-31 22:36:37 +00:00
wiz c00bfebf76 Various fixes. Bump date for previous. 2006-10-31 22:10:41 +00:00
christos 798fbc606d 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.
2006-10-31 20:07:32 +00:00
wiz 7b2e399484 Some cleanups from the person without a name. 2006-10-26 15:26:37 +00:00
wiz 04f37109b9 New sentence, new line.
Use .Pp instead of .sp. Whitespace cleanup. Bump date for previous.
2006-10-26 11:05:29 +00:00