Commit Graph

259 Commits

Author SHA1 Message Date
christos 1ed23800b4 Don't barf on malformed mime messages (missing mime version). From Anon Ymous 2009-08-28 14:26:50 +00:00
apb 3ac228d1b2 Declare "com" as volatile in execute(), to make it safe to use
across setjmp/longjmp.

Inspired by PR 41255 from Kurt Lidl, but this change makes "com" a
volatile pointer to const non-volatile data, whereas the PR made it a
non-volatile pointer to const volatile data.
2009-07-14 21:15:48 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
he ec30dc689c Do the -Wuninitialized workaround in a way which conforms to our
style guide, and remove a now unneeded LINTED comment.  From private
feedback.
2009-04-13 10:03:58 +00:00
he a389f78e47 Work around a problem with gcc -Wuninitialized seen for our sh3 targets. 2009-04-12 22:47:39 +00:00
christos 27b54bd918 - magic fix for short files
- knf
from Anon Ymous
2009-04-11 14:22:32 +00:00
christos ca13337dfe 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.
2009-04-10 13:08:24 +00:00
joerg 5d8c8ad0cf Fix quoting. 2009-03-23 17:02:06 +00:00
christos df68463076 fix warnings. 2009-03-11 01:10:05 +00:00
christos 71735a83f7 add missing , 2009-02-11 19:22:22 +00:00
christos 26114345a6 don't print warnings about can't find termcap entry. 2009-02-11 19:10:08 +00:00
lukem 1742612d3c sign-compare fix for amd64 2009-01-25 14:07:18 +00:00
lukem c172e3b989 fix -Wsign-compare issues 2009-01-18 01:29:57 +00:00
wiz be47919875 Spelling fixes. 2008-12-08 11:32:18 +00:00
christos c78e2d1227 PR/1880: Jim Barnard: Don't parse backslash escaped characters inside single
quoted strings.
2008-12-07 19:21:00 +00:00
christos c6f8f3a3b2 PR/1880: Jim Barnard: Pass backslash escaped characters unintepreted inside
single quoted strings. Document new behavior, and its relationship with POSIX.
2008-12-07 19:17:09 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
christos 17a5e23949 Make sure the current message (dot) is set correctly when changing the
display state, i.e., hidden/exposed tags or threads.  This fixes at
least two problems:

- If the current message is a duplicate that is deleted by the "deldups"
  command, then the dot was invalid making all messages appear to have
  been deleted.  It is now set to the surviving duplicate message.

- If the current message is tagged, the "hidetags" command would leave
  the dot invalid and the dislay would reset it at the top of the
  current screen.  It is now set the the first untagged (and
  not deleted) message after the previous (tagged) dot message.

From Anon Ymous
2008-04-27 22:26:50 +00:00
christos a2fe0ba0a1 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
2008-04-24 01:27:06 +00:00
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