debian/0000755000000000000000000000000012224235616007171 5ustar debian/EXT/0000755000000000000000000000000012224232175007626 5ustar debian/EXT/ChangeLog0000644000000000000000000010547112224232175011410 0ustar 2013-07-18 07:11 jmc * mail.1: document the :c selectors; from Sunil Nimmagadda 2013-04-29 00:28 okan * lex.c, names.c, popen.c: use FD_CLOEXEC instead of 1; from David Hill ok otto 2012-11-14 13:22 gsoares * cmd2.c: use F_OK macro instead of 0 in access() when checking by file existence. make the code easier to read. no functional change. OK millert@ 2011-04-06 11:36 miod * cmd1.c, cmd2.c, cmd3.c, collect.c, lex.c: Avoid using NULL in non-pointer contexts: use 0 for integer values and '\0' for chars. 2010-11-07 08:05 jmc * mail.1: more EXIT STATUS bits; from Daniel Dickman 2010-01-10 10:53 jmc * mail.1: remove references to docs we no longer install; 2010-01-04 17:50 deraadt * Makefile: Stop installing many of the incredibly dated and un-authoritative share/doc files. If any information found in these documents is worthwhile and you miss it, please make the time to work it into the manual pages (which people actually do read). ok guenther 2009-10-27 23:59 deraadt * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, edit.c, fio.c, getname.c, head.c, lex.c, list.c, main.c, names.c, popen.c, quit.c, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c: rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms 2009-09-05 10:49 tobias * cmd3.c: Fixed typo in comment. ok millert 2009-07-29 18:15 martynas * mail.1, USD.doc/mail9.nr, misc/mail.tildehelp: - ~<, ~_ are undocumented aliases of ~r, ~: - missing documentation for ~. - use compact list, and .Pp. so that aliases could be listed - reformat to fit aliases in tilde help with help & ok jmc@, sobrado@, millert@ 2009-07-28 16:05 martynas * cmd2.c, cmdtab.c, collect.c, extern.h: remove core / tilde C. it's useless, doesn't work, never has been documented, ^\ should be used instead. ok millert@ 2009-07-23 20:06 martynas * cmd3.c: elide a little bit later, the final list, after From has been appended. properly removes if there's a dup in from & to. ok millert@ 2009-04-23 19:12 deraadt * misc/mail.help: document the "more" command in the help page; ok millert 2009-02-10 19:27 jmc * mail.1: mark these utilities as being largely posix compliant or, in the case of nm, as not being posix compliant; 2008-11-03 20:07 jmc * USD.doc/mail9.nr, misc/mail.tildehelp: ...and then sync tildehelp and mail9.nr; 2008-11-03 18:50 jmc * mail.1, misc/mail.tildehelp: update the tilde escapes for both these files, and try and keep them in a similar format/order; 2008-11-03 18:20 jmc * USD.doc/: mail4.nr, mail5.nr, mail9.nr: poor USD docs, we always forget you! ...document ~x 2008-11-03 15:42 martynas * collect.c, mail.1: add ~x; which is quite handy sometimes. per posix man page tweak&ok jmc@. ok millert@ 2008-10-09 06:48 jmc * main.c: - add -d to usage - sync -f arg name with man page synopsis 2008-10-08 21:05 martynas * mail.1: document -d. ok millert@ 2008-08-05 17:15 sobrado * misc/mail.help: fix description of the mail(1) "p" command; from Aaron W. Hsu. ok martynas@ 2008-08-03 14:30 martynas * cmdtab.c: make U (abbreviation of unread) work as man page says ok millert@, jmc@. sure theo 2008-07-16 15:14 martynas * send.c: 'no subject' check is never triggered. check if it's actually empty ok millert@ 2008-07-16 15:11 martynas * mail.1, main.c, send.c: add -E flag and 'skipempty' option to skip sending messages with empty bodies. useful for sending mails from crontabs. from rivo nurges , with missing 'skipempty' documentation and usage update from me ok millert@ 2008-07-16 14:56 martynas * mail.1: man page tweaks: - for argument of -f flag, name -> file - document TMPDIR, better description from millert@ ok millert@ 2008-07-16 14:53 martynas * aux.c, cmd3.c, collect.c, head.c, send.c: - use strncmp/strncasecmp instead of comparing by character - simplify istrlcpy, no need to check for isupper - line[0] is redundant, because strcasecmp will take care of it ok millert@ 2008-07-16 14:49 martynas * edit.c, fio.c: - err with the pathbuf, if we know it - use tmpdir instead of /tmp ok millert@ 2008-07-15 19:23 martynas * aux.c, extern.h, list.c: - chraise can be replaced with toupper; no need to check for islower - remove quite some code, use strcasestr instead of reimplementing it each time - use strncasecmp, instead of comparing through each character "looks fine" millert@ 2008-07-15 19:13 martynas * cmd1.c: set cp to the value of PAGER, so that type1 doesn't try to use it uninitialized (page=1), or use wrong previously-set value of crt (page=0). ok millert@ 2007-10-17 20:02 deraadt * edit.c: - Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) by temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray 2007-10-05 14:39 chl * fio.c: check if it's really a newline before removing it with the help of ray@ "Looks OK" millert@ 2007-09-10 14:29 tobias * collect.c, edit.c, fio.c, quit.c: Proper use of fseek/fseeko macros. OK joris@, otto@ 2007-08-31 23:14 ray * edit.c: Copy editit() from sendbug, synchronizing editor calling code. OK otto, millert, beck, mbalmer, deraadt. 2007-08-06 19:16 sobrado * mail.1, main.c: the ellipsis is not an optional argument; while here, sync the usage and synopsis of commands lots of good ideas by jmc@ ok jmc@ 2007-06-19 05:47 ray * vars.c: Grammar-o. OK jmc 2007-05-31 19:20 jmc * mail.1: convert to new .Dd format; 2007-05-25 21:27 krw * fio.c: "interupt" -> "interrupt" in various comments. Mostly from Diego Casati. 2007-04-03 18:01 martynas * cmd1.c: make it work with height 4 (division by zero) ok millert@ 2007-03-20 21:01 millert * send.c: Set umask to 077 when saving messages in the outbox (not enabled by default). From veenhuizen at users dot sourceforge dot net 2007-02-26 13:38 jmc * mail.1: more small fixes from Igor Sobrado, tweaked by myself; 2007-02-26 13:17 jmc * mail.1: some small fixes from Igor Sobrado; 2007-02-25 20:26 jmc * mail.1: remove bad comma; from Igor Sobrado 2006-11-16 00:16 ray * fio.c: Fix undefined behavior (var = --var). From Alexey Dobriyan . OK moritz@ and jaredy@. 2006-10-10 21:38 cloder * edit.c: fgets(3) returns NULL on error, not 0. No functional change, but it makes the code easier to read. OK deraadt 2006-05-02 05:28 hugh * extern.h: Nuke a couple orphaned prototypes. quoth deraadt: no problem 2006-04-02 00:51 deraadt * fio.c: use SEEK_* for lseek() 2006-03-04 16:18 miod * USD.doc/mail6.nr: the the 2006-02-01 19:01 otto * quit.c: double semicolon; from Daniel Matic in PR 4929 2006-01-06 18:53 millert * extern.h: Adapt things to use __type_t instead of _BSD_TYPE_T_ Add new sys/_types.h header Include machine/_types.h or sys/_types.h where applicable 2005-07-11 14:08 millert * list.c, tty.c: Fix off-by-one bug in readtty() and don't assume BUFSIZ == 1024. Based on a patch from Ulf Harnhammar. 2004-12-07 22:30 jmc * mail.1: remove unsupported paths; from okan demirmen; 2004-09-15 22:21 deraadt * aux.c, cmd2.c, cmdtab.c, extern.h, list.c: avoid aliasing against libc symbols 2004-09-15 22:21 deraadt * popen.c: unused variable 2004-06-04 00:07 jmc * mail.1: sync w/ usd docs; ok millert@ 2004-06-04 00:04 jmc * USD.doc/: mail0.nr, mail1.nr, mail2.nr, mail3.nr, mail4.nr, mail5.nr, mail6.nr, mail8.nr, mail9.nr: update mail docs w/ reality; help and ok millert@ 2004-05-10 15:25 deraadt * edit.c, fio.c, lex.c: delint; millert ok 2004-05-10 12:10 millert * cmd2.c, cmdtab.c, extern.h, lex.c: Get rid of the ancient "clobber" command. It was really only for debugging purposes. Noticed and OK by deraadt@ 2004-04-30 06:52 jmc * mail.1: missing full stop; 2004-04-19 10:17 jmc * mail.1, main.c: - sort SYNOPSIS - remove a load of unnecessary quoting and some groff cruft - sort options list - add usd doc to SEE ALSO - sync usage() 2004-02-01 15:19 jmc * USD.doc/Makefile: add paper.txt target; 2004-01-03 20:26 millert * cmdtab.c: Silence a gcc warning: "initialization from incompatible pointer type" The problem is that while ANSI C allows initialization of unions, the initializer must be valid for the first member of the union. Therefore, add a cast to quiet the compiler. Noticed and Ok pvalchev@ 2004-01-03 20:06 millert * collect.c: Fix format type mismatch (int vs. ssize_t). 2003-12-03 20:59 millert * cmd1.c: Change how the line output from the 'h' command is formatted. Previously if you had an ungodly number of messages the line could wrap the screen. We now format the line in a buffer and then only print as many characters as will fit instead of printing the parts piecemeal. 2003-10-24 20:32 avsm * cmd2.c, collect.c, lex.c: dont compare int to NULL, millert@ ok 2003-10-13 00:46 tedu * lex.c, list.c: better realloc. ok deraadt jose 2003-09-04 22:14 jmc * mail.1: put escapes in the right place; (i.e. stuff I got wrong the first time, or missed) this includes some .Cd's with missing quotes and .Nm abuse in man4; 2003-09-04 14:09 jmc * mail.1: escape in the wrong place; 2003-07-14 09:27 jmc * mail.1: remove some old groff macros; 2003-07-07 21:36 deraadt * fio.c: protos 2003-06-28 14:25 jmc * mail.1: use .Bk/.Ek to align the options in SYNOPSIS; 2003-06-25 15:13 millert * def.h: Remove unused c_func0; noticed by deraadt@ 2003-06-10 09:12 jmc * mail.1: - section reorder - COMPATIBILITY merge - macro cleanup - kill whitespace at EOL - new sentence, new line ssh pages ok markus@ 2003-06-03 02:56 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c, USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr: Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo. 2003-05-15 02:47 pjanzen * cmd1.c, def.h, send.c: Use vis() on any remotely created input before displaying it on a screen. deraadt@ ok 2003-04-09 09:49 jmc * misc/mail.help: syetem -> system; from Marko Cehaja closes PR 3187 2003-01-03 19:17 millert * mail.1: DEL hasn't sent SIGINTR in a looooong time. 2002-11-14 02:57 deraadt * mail.1: use $ or # before commands in examples 2002-10-07 22:45 vincent * getname.c: tyop ok deraadt@ 2002-08-12 00:42 aaron * cmd3.c, vars.c: Swap args to calloc(3) so they are in the correct order; art@ ok. 2002-06-14 21:35 todd * head.c: spelling; from Brian Poole 2002-06-12 06:07 mpech * popen.c: a real pid_t cleanup. espie@ ok for make/, deraadt@ one extra eye, millert@ ok 2002-04-13 19:09 millert * collect.c: Errata #23: mail(1) will process tilde escapes even in non-interactive mode. This can lead to a local root compromise. Don't do tilde escapes unless we are in interactive mode. Now the behavior matches the man page... 2002-04-11 23:33 miod * collect.c: Errata #23: mail(1) will process tilde escapes even in non-interactive mode. This can lead to a local root compromise. Fix (millert): Don't do tilde escapes unless we are in interactive mode. Now the behavior matches the man page... 2002-04-08 20:27 millert * collect.c: Don't do tilde escapes unless we are in interactive mode. Now the behavior matches the man page... 2002-03-14 06:51 mpech * fio.c: Remove \n from err/errx/warn/warnx(). millert@ ok 2002-02-16 21:27 millert * def.h: Part one of userland __P removal. Done with a simple regexp with some minor hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically. 2002-01-24 23:01 millert * temp.c: Fix `necesary' typos; Alexander Yurchenko Alas many of these were introduced by yours truly as necessary just doesn't look right to me for some reason ;-) 2002-01-24 20:33 mickey * mail.1: fix the history refs 2001-12-18 16:55 millert * fio.c: We need to adjust where "dot" points when we realloc(message). Problem found by Mike Heffner of the FreeBSD project. 2001-11-28 01:26 millert * extern.h, send.c: Catch SIGINT in sendmessage() so user can interupt a long message that is being output. Make statusput() return an int and return -1 if ferror() 2001-11-28 01:04 millert * tty.c: Fix typo; SIGTTIN where SIGINT meant and rename a variable for clarity. 2001-11-23 00:03 millert * popen.c: Revert change to Popen() to only wrap command in a shell if it contains meta characters since people may expect their aliases to work. Instead, just remove the "kill(lock_pid, SIGTERM);" since lockspool now does the right thing when the pipe is closed. 2001-11-21 20:41 millert * cmd1.c, cmd2.c, cmd3.c, lex.c, list.c, names.c, popen.c, tty.c, vars.c: o kill strcpy() o check return values of malloc and friends o use strdup() when sensible 2001-11-21 18:43 millert * names.c: fix arg reversal that was introduced during ANSIfication 2001-11-21 15:28 millert * main.c: Fix extern decl of version missed in previous commit. 2001-11-21 15:26 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, list.c, main.c, names.c, popen.c, quit.c, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c: o ANSIfy o Style nits o Use const to silent stupid -Wall warnings o strnc{py,at} -> strlc{py,at} o Use strpbrk() instead of homegrown anyof() o Use NULL instead of #defines with 0 cast to a pointer This still could use a proper audit 2001-11-20 23:19 millert * popen.c: In private version of popen(), only wrap a command to be run in a shell if it contains meta chars. Sneaky hack to work around a ksh bug. 2001-11-20 20:50 millert * aux.c, cmd1.c, cmd3.c, collect.c, def.h, edit.c, extern.h, fio.c, glob.h, lex.c, main.c, quit.c, tty.c: Major signal overhaul. We no longer longjmp all over the place. Instead, routines responsible to gathering user input (or in some cases outputting data) catch the signals and set flags as needed. Because of this some handlers are install without the SA_RESTART flag so syscalls are not restarted and we can check the flag. All signal handlers are now safe. This should make the flow of control a bit more grokable but the code is still ugly. 2001-11-17 19:10 deraadt * lex.c: properly bail out of incfile(); millert ok 2001-11-16 17:10 millert * cmd1.c, extern.h: Instead of using a longjmp to catch SIGPIPE, just set to SIG_IGN and check the return value on writes for error. Save and restore terminal modes when piping to a command so we end up with a known good state if the command terminates uncleanly. 2001-10-11 20:59 millert * main.c: missing arg to errx 2001-10-04 04:23 pvalchev * pathnames.h: Fix path to /bin/ls; ok millert 2001-09-16 16:12 millert * aux.c: Optimize space-eating loop since we've already checked that the first char is a space. Patch from sacrificial-spam-address@horizon.com 2001-09-16 15:27 millert * aux.c: 1) In skin(), only add a space after a comma if there is actually a space in the input buffer. This prevents a rare buffer overflow on very long header lines where one or more entries has a comment in it but the entries have no space after the comma *and* the amount of extra space needed to add a space after each comma is greater than the length of the comments that will be removed. This is debian bug #108677 2) In skin(), use a temporary variable in the realloc() and don't die if realloc() fails since its only purpose is to shrink the buffer, not expand it (and thus is not fatal). 2001-09-07 01:19 millert * main.c: Sanity check length of -u argument to avoid truncation later on. 2001-09-04 23:16 millert * popen.c: Fix bogus use of snprintf return value. Since we know the max length of a username we can use that as part of the buffer size. 2001-06-23 23:04 millert * cmd1.c, collect.c, lex.c, tty.c: Remove evil #ifdef __GNUC__ garbage to avoid longjmp clobbering and use volatile instead. 2001-01-19 04:11 millert * cmd3.c, edit.c, head.c, popen.c: More fixes from Don Beusee: - edit and other interactive commands have no stdin (making the command completely broken). - messages with "From " line having date format with -0800 type of timezone are not recognized correctly. 2001-01-16 05:36 millert * aux.c, cmd1.c, cmd3.c, cmdtab.c, collect.c, def.h, extern.h, fio.c, lex.c, list.c, names.c, pathnames.h, popen.c, quit.c, send.c, vars.c, version.c: Changes from Don Beusee: o escape From line with a leading '>' when needed o only print To: address and Subject lines if actually present o new variable 'allnet' to treat user@foo and user@bar as the same "user" o folders command now takes an optional argument like ls. o new "pipe" (|) command to pipe the message through an arbitrary command o make header display format the same as SunOS 4.1.3 /usr/ucb/mail o tilde commands work regardless of interactive mode. o fix "read: Interrupted system call" error by retrying if EINTR o expanded help file Changes by me: o read the help file via the PAGER as it is now more than 24 lines long 2001-01-16 04:04 millert * misc/: mail.help, mail.tildehelp: Changes from Don Beusee: o escape From line with a leading '>' when needed o only print To: address and Subject lines if actually present o new variable 'allnet' to treat user@foo and user@bar as the same "user" o folders command now takes an optional argument like ls. o new "pipe" (|) command to pipe the message through an arbitrary command o make header display format the same as SunOS 4.1.3 /usr/ucb/mail o tilde commands work regardless of interactive mode. o fix "read: Interrupted system call" error by retrying if EINTR o expanded help file Changes by me: o read the help file via the PAGER as it is now more than 24 lines long 2000-11-09 17:52 aaron * mail.1: Change all option list specifications to ".Bl -tag -width Ds". Most man pages just needed their -width parameter tweaked to "Ds", which provides a nice width of 6 constant characters. For consistency more than anything. 2000-10-06 21:16 jason * cmd1.c, cmd3.c, collect.c, names.c, popen.c, aux.c, edit.c, lex.c, main.c, quit.c, send.c: Pull in patch from current (even more to come): Fix (millert): warnx?/errx? paranoia (use "%s" not a bare string unless it is a constant). These are not security holes but it is worth fixing them anyway both for robustness and so folks looking for examples in the tree are not misled into doing something potentially dangerous. Furthermore, it is a bad idea to assume that pathnames will not include '%' in them and that error routines don't return strings with '%' in them (especially in light of the possibility of locales). 2000-08-23 21:24 mickey * extern.h, names.c, send.c: repair sendmail options handling 2000-08-02 04:10 millert * cmd3.c, fio.c, temp.c: $HOME paranoia: never use getenv("HOME") w/o checking for NULL and non-zero 2000-07-06 06:24 deraadt * lex.c: printf with % for the prompt 2000-06-30 16:00 millert * cmd3.c, names.c, collect.c, aux.c, cmd1.c, edit.c, popen.c, quit.c, send.c, lex.c, main.c: warnx?/errx? paranoia (use "%s" not a bare string unless it is a constant). These are not security holes but it is worth fixing them anyway both for robustness and so folks looking for examples in the tree are not misled into doing something potentially dangerous. Furthermore, it is a bad idea to assume that pathnames will not include '%' in them and that error routines don't return strings with '%' in them (especially in light of the possibility of locales). 2000-06-26 23:18 hugh * mail.1: fix pasto; noted by art 2000-06-11 21:03 millert * mail.1: newaliases(1) -> newaliases(8) 2000-05-15 06:55 deraadt * mail.1: /etc/mail/aliases 2000-04-26 15:47 millert * cmd1.c, cmd2.c, collect.c, extern.h, quit.c, send.c: Change the name of mail's send() function to sendmessages() to avoid shadowing the libc send(2); gadams@avernus.com 2000-04-25 16:42 millert * aux.c, cmd1.c, cmd3.c, extern.h, lex.c: When incorporating new messages, clear the "new" count before the inc so the count of new messages is useful afterwards. This makes mail behave more like the SunOS version in this respect. 2000-04-12 21:47 aaron * mail.1: Trailing whitespace begone! 2000-03-24 21:41 aaron * mail.1: Correct the HISTORY section to note that this command appeared in Version 5 of AT&T UNIX, not Version 6. Verified by strings(1)'ing a .dsk file (PDP-11 executable) containing the v5 sources, obtainable at gatekeeper.dec.com in the directory /pub/DEC/sim/software. Idea from NetBSD PR/4790. 2000-03-23 19:32 millert * names.c: When calling sendmail, use "--" to indicate end of command line arguments. This prevents someone from sneaking arbitrary args to sendmail via the Reply-To: or From: lines. 2000-03-10 19:07 aaron * mail.1: Various cleanups and standardization. 2000-03-04 20:02 aaron * mail.1: Try to standardize the options list introduction; it should read "The options are as follows:", except in special cases. 1999-10-16 20:47 aaron * mail.1: Formatting fixes. 1999-06-05 01:21 aaron * mail.1: - remove trailing white space - remove arguments from .Os macros - remove arguments from .Nm macros, where appropriate - some more Dq/Sq/Ql insanity - still lots to do in the usr.bin tree... :/ 1999-05-12 13:26 aaron * mail.1: grammar police: do not hyphenate compound words that act as adjectives if the first word ends in -ly i.e., fully-qualified, newly-created, globally-visible, etc. are wrong 1998-11-19 23:23 aaron * mail.1: significant cleanup; also s/INTRODUCTION/DESCRIPTION/, in particular for man -h 1998-11-11 23:01 aaron * mail.1: remove redundant .Pp macros 1998-09-27 21:20 millert * mail.1: mail -u foo is not really the same as mail -f /var/mail/foo 1998-09-27 21:16 millert * glob.h, main.c, popen.c: Use new username option to lockspool for 'mail -u'. 1998-09-26 19:55 aaron * mail.1: usr.bin/ man page fixes, f-m. 1998-09-13 03:50 aaron * mail.1: typos 1998-09-12 22:55 todd * misc/mail.help: document reality. 1998-09-10 16:47 millert * mail.1: .Xr lockspool 1 1998-09-10 16:18 millert * popen.c, quit.c: Fix comments 1998-09-10 16:06 millert * popen.c: If a child has not been waited on via the SIGCHLD handler, wait for it ourselves instead of playing games with sigsuspend. This may fix PR 588. 1998-09-10 16:04 millert * mail.1: make mail.1 nroff'able again 1998-09-08 15:24 millert * popen.c: repair order of signal blocking that got changed in conversion to POSIX signals 1998-09-08 14:59 millert * lex.c: Fix comments in .mailrc where there is no space after the hash (#). Noted by pjanzen@foatdi.harvard.edu 1998-09-07 16:44 aaron * mail.1: More man page fixes. Particularly fix uses of it's/its, affect/effect, then/than and such. Other miscellaneous problems fixed across these source files. 1998-09-06 22:23 aaron * mail.1: More man page fixes. Spelling, grammar, some typos. Lots of double-word occurrences squashed as well. 1998-09-01 16:38 deraadt * mail.1: more man page fixes; aaron@ug.cs.dal.ca 1998-08-15 23:17 millert * pathnames.h, popen.c: use lockspool for locking, not 'mail.local -H' 1998-07-16 06:05 millert * mail.1: mention MAIL environment variable 1998-06-25 07:29 deraadt * mail.1: and mailx too.. 1998-06-12 18:07 millert * collect.c, lex.c, popen.c: back out some signal changes that can cause mail to hang when quitting due to SIGCHLD blockage 1998-06-12 17:51 millert * v7.local.c, fio.c, quit.c, popen.c: Don't call truncate() directly; have rm() do it if we get EPERM on unlink() In popen.c, findchild() may return NULL so catch that case. 1998-06-12 17:15 millert * v7.local.c: Properly delete messages that the user has deleted in his/her spool. I fudged up the logic when I replaced an unlink with a truncate. 1998-06-11 06:20 deraadt * fio.c: Don't segfault just because a line starts with NUL; ross 1998-05-11 04:15 millert * cmd1.c: fix scrolling and 'z' command; matt debergalis 1998-05-04 05:37 millert * collect.c, lex.c, popen.c, v7.local.c: Never remove a mail spool, as we may not have proper prics, just truncate. Also block signals in a few critical areas 1998-04-25 00:41 deraadt * mail.1: doc startup behaviour; koshy@india.hp.com 1998-04-25 00:19 deraadt * mail.1: fix usage; ru@ucb.crimea.ua 1998-03-24 05:40 deraadt * mail.1: prettty 1998-02-15 21:20 niklas * popen.c: Remove one case of malloc call from sighandler 1997-11-14 00:23 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, edit.c, extern.h, fio.c, head.c, lex.c, list.c, mail.1, main.c, names.c, popen.c, quit.c, send.c, strings.c, temp.c, tty.c, vars.c: NetBSD changes (mostly comsmetic): replace panic() with calls to err()/errx() use S_IS* instead of doing by hand with S_IF*. Use TIMESPEC_TO_TIMEVAL() and gettimeofday instead of time(2) Use _POSIX_VDISABLE, not 0 Kill register 1997-11-13 03:30 millert * tty.c: Add back EXTPROC code now that tty_pty.c has the lite2 fix. 1997-11-04 08:34 deraadt * mail.1: unbalanced parenthesis around command abbreviation in mail.1; h-nokubi@nmit.tmg.nec.co.jp 1997-09-21 11:49 deraadt * Makefile: $OpenBSD$ 1997-09-04 20:44 millert * fio.c: Deal with pairs in mailboxes so we can work with eudora mail spools mounted from DOS/Windoze. From Matt Thomas . 1997-08-31 14:32 millert * cmd2.c, fio.c, popen.c: Kill union wait. 1997-08-05 04:00 deraadt * popen.c: pull errno.h in 1997-08-04 19:25 deraadt * popen.c: save errno in sigchld handlers 1997-08-04 17:30 millert * aux.c, list.c: Fix a problem in skin() that was introduced with the buffer oflow fix. Could end up realloc'ing the wrong thing. 1997-07-31 17:55 millert * tty.c: Remove TIOCEXT added in lite2 merge for now. Causes problems when mail(1) is used over a telnet session. 1997-07-31 02:48 millert * names.c: Another static buffer bytes the dust. 1997-07-31 02:36 millert * aux.c, list.c: Document an assumption and kill a static buffer. 1997-07-30 07:19 millert * aux.c, cmd2.c, cmd3.c, collect.c, extern.h, lex.c: Make istrcpy() take a size (not length) field, now called istrncpy(). Change some strcpy() -> strncpy() out of paranoia. 1997-07-30 06:32 millert * cmd1.c, cmd3.c, collect.c, extern.h, lex.c, main.c, tty.c, v7.local.c: Fix one possible oflow (not exploitable) and do a wee bit of KNF. Much more remains to be done. 1997-07-28 15:20 millert * aux.c, fio.c: Dynamically allocate space for addr header strings instead of using BUFSIZ. We know that the end size will be <= to the start size so it is simple to preallocate enough space. Fixes NetBSD PR#3028 1997-07-28 10:01 deraadt * Makefile: install mail.rc at distribution time; bug found by explorer@flame.org 1997-07-25 21:05 mickey * aux.c: #if __STDC__ --> #ifdef __STDC__ 1997-07-24 17:27 millert * cmd1.c, collect.c, edit.c, extern.h, fio.c, lex.c, names.c, quit.c, send.c, temp.c: tempnam(3) goes bye bye. 1997-07-24 16:23 millert * extern.h, fio.c, lex.c, quit.c, temp.c: Replace 3 tempnam()'s with mkstemp. The two left look tricky. 1997-07-22 19:13 millert * lex.c: incfile() needs to lock the mail spool so it doesn't get partial messages. Noticed by Theo. 1997-07-22 19:09 deraadt * dotlock.c: locking is done differently now 1997-07-22 18:54 millert * cmd1.c, collect.c, extern.h, send.c, tty.c: grabh() now returns SIGINT if it was interrupted (previously always returned 0 and the return val was always ignored). Add gethfromtty() to get a header (using grabh) from the tty and quit on two ^C's. Use gethfromtty() when getting Subject, Cc, and Bcc headers so we can quit nicely. Closes PR #291. Don't use longs where it doesn't make sense. 1997-07-22 18:26 millert * collect.c: Only require 2 ^C's at Subject: prompt to quit as it is supposed to. Also in Subject: prompt, when we get that first ^C re-prompt for the Subject: like SunOS does so the user knows what is going on. 1997-07-22 06:46 millert * lex.c: Release signals when we get an error condition in incfile(). 1997-07-18 18:12 millert * glob.h: Change jmp_buf to sigjmp_buf that I missed in the last sweep. 1997-07-14 16:09 millert * popen.c: Don't call it a mask when it is a sigset_t (cosmetic changes only). 1997-07-14 15:56 millert * collect.c, main.c, popen.c, send.c, tty.c: Convert remaining sigsetmask() -> sigprocmask() (POSIX style) in collect.c and fix up some signal botches elsewhere. 1997-07-14 00:24 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, def.h, edit.c, fio.c, getname.c, head.c, lex.c, list.c, main.c, names.c, popen.c, quit.c, send.c, strings.c, temp.c, tty.c, v7.local.c: NOSTR -> NULL Use sigsetjmp/siglongjmp instead of sigjmp/longjmp for portability. 1997-07-13 23:53 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, collect.c, dotlock.c, edit.c, fio.c, lex.c, main.c, names.c, popen.c, quit.c, send.c, strings.c, tty.c, vars.c: bcopy() -> memcpy() and fix some casts. 1997-07-13 23:35 millert * USD.doc/: Makefile, mail2.nr, mail4.nr, mail5.nr, mail6.nr, mail8.nr, mail9.nr: Update from 44.BSD-lite2 1997-07-13 21:21 millert * aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, dotlock.c, edit.c, extern.h, fio.c, getname.c, head.c, lex.c, list.c, mail.1, main.c, names.c, popen.c, quit.c, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c: Merge in NetBSD and 4.4BSD-lite2 changes as well as some of my own. - handle long lines safely (from NetBSD) - use puts/fputs and putchar/putc when it makes sense - use err/errx and warn/warnx when it makes sense - make return() and sizeof() style consisten - some more buffer safety 1997-06-18 23:52 deraadt * version.c: crank version number, we have made a few changes... 1997-06-16 20:57 millert * v7.local.c: Use buflen, not sizeof(buf) as buf is a pointer. 1997-06-02 17:00 dm * v7.local.c: buflen != sizeof (char *) 1997-05-30 08:51 deraadt * aux.c, cmd1.c, cmd3.c, extern.h, fio.c, lex.c, list.c, popen.c, v7.local.c: overflows abound 1997-04-27 20:56 millert * Makefile: COPY -> INSTALL_COPY and STRIP -> INSTALL_STRIP This fixes namespace problems where STRIP is sometimes used as the name of the strip(1) to use and other times used as the flag to send install(1) when stripping (or not). COPY doesn't have this problem (yet) but was poorly named. 1997-04-13 20:32 deraadt * collect.c: single ^C on a pipe 1997-04-13 20:22 deraadt * collect.c: do not (continue) on a stdin pipe 1997-04-10 15:33 deraadt * collect.c: how is this for fast bug fixing response! revert to sigblock() since the sigprocmask() code was not equivelant. report from grr@shandakor.tharsis.com, PR#154 1997-03-29 03:01 millert * Makefile, cmd1.c, cmd3.c, def.h, extern.h, fio.c, pathnames.h, popen.c, quit.c, temp.c: Use ``mail.local -H'' to do dot locking so we can have mode 755 mail spool, change an occurrence of tempnam() to mkstemp(), change some longs and shorts to ints. Mail is now usable again. 1997-02-03 00:25 deraadt * def.h: use a long line counter, netbsd pr#3083, rhialto@polder.ubc.kun.nl 1997-01-17 07:12 millert * aux.c, fio.c, lex.c, list.c, names.c: r?index -> strr?chr 1997-01-15 23:42 millert * main.c: getopt(3) returns -1 when out of args, not EOF, whee! 1997-01-13 20:36 deraadt * mail.1: doc "more" command; jdc@orthanc.ncl.ac.uk 1996-12-08 14:32 downsj * Makefile: install -> ${INSTALL}, -c -> ${COPY} 1996-10-28 00:42 millert * temp.c: Ignore $HOME if > MAXPATHLEN 1996-10-26 05:11 millert * mail.1, v7.local.c: honor $LOGNAME 1996-09-16 02:26 deraadt * main.c, temp.c: _PATH_TMP -> _PATH_TMPFILE; avoid /tmp//fooXXXX where possible too 1996-06-26 21:22 dm * popen.c: Accept NULL nset in prepare child (as run_editor will try to use one). 1996-06-11 12:53 deraadt * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, dotlock.c, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c, USD.doc/Makefile, USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr: from christos; - Fix PR/105: Implement dot locking protocol and check return value of flock. - Fix PR/2247: Don't call unknown users "ubluit". Issue an error message. - Fix/add prototypes. - Fix warnings. - Use POSIX signal mask calls. 1996-03-27 19:32 niklas * Makefile, cmd1.c, cmdtab.c, extern.h, lex.c: From NetBSD: merge of 960317 1995-10-18 08:45 deraadt * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c, USD.doc/Makefile, USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr, misc/mail.help, misc/mail.rc, misc/mail.tildehelp: Initial revision 1995-10-18 08:45 deraadt * Makefile, aux.c, cmd1.c, cmd2.c, cmd3.c, cmdtab.c, collect.c, def.h, edit.c, extern.h, fio.c, getname.c, glob.h, head.c, lex.c, list.c, mail.1, main.c, names.c, pathnames.h, popen.c, quit.c, rcv.h, send.c, strings.c, temp.c, tty.c, v7.local.c, vars.c, version.c, USD.doc/Makefile, USD.doc/mail0.nr, USD.doc/mail1.nr, USD.doc/mail2.nr, USD.doc/mail3.nr, USD.doc/mail4.nr, USD.doc/mail5.nr, USD.doc/mail6.nr, USD.doc/mail7.nr, USD.doc/mail8.nr, USD.doc/mail9.nr, USD.doc/maila.nr, misc/mail.help, misc/mail.rc, misc/mail.tildehelp: initial import of NetBSD tree debian/EXT/README0000644000000000000000000000030712224232175010506 0ustar This directory contain ChangeLog generated from upstream CVS repository with the help of `cvs2cl --no-wrap --gmt -S' command. -- Robert Luberda Sun, 06 Nov 2011 21:43:13 +0100 debian/bsd-mailx.README.Debian0000644000000000000000000001262212224232175013111 0ustar bsd-mailx for DEBIAN ---------------------- The history of this package is quite complicated. The changelog includes a summary with the different maintainers. At the beginning of Debian, I think this package was based on a BSD 5.5 mail version from FreeBSD. There has been a lot on work on the package shipped with Debian 0.93R6, which was based a BSD 8.1 mail version from BSD4.4Lite. The extensions includes support for dotfile locking, setgid support, POP support, signal handling hacks. here is a README originally found: + README for Berkely mailx version 8.1 with POP extension + + This is "mailx", a simple program for sending and receiving email. + + This is based on mailx version 8.1 (as distributed with BSD 4.4lite). + + It has been extended to support the post-office protocol (POP). Run + "mail -p" and it will retrive your email from a POP server rather than + from your local mail queue. See the manual page for more details. + + The POP support was written by Jonathan I. Kamens for version mailx 5.5 + (as distributed with BSD 4.3.) + + The POP support was integrated into version 8.1 by Salvatore Valente + for no particular reason. (It would have been simpler for me to + simply use Jonathan's 5.5 source tree. There are no major differences + between the two versions.) + + Have a nice day. + -Salvatore Valente. + 5/12/94 + + + PORTING + + Before attempting to compile this for _any_ system, you should do two + things: + + Edit CFLAGS in Makefile. + Edit pathnames.h. + + These sources are _extremely_ BSDish. I have successfully built this + for Linux, BSD 4.3, NetBSD, Ultrix, Aix, and SunOS. I have never + successfully gotten it to build for Solaris or any System 5ish system. + If you want to try, here are some issues you will face: + + It uses BSD signal() semantics. Use sigaction(). + It uses BSD longjmp() semantics. Use siglongjmp(). + It uses BSD sgtty. Use termios. + It uses BSD signal mask functions. Use posix sigmask functions. + + There will probably be other hurdles too. Good luck. With Debian1.1 a switch was done to a version base on a BSD5.5 mail program, because of signal handling problems (which I think were due to bad compilation options). So no more POP support. Some patches from Ken Whang included, the corresponding README was: + mailx-5.5-kw 5/30/95 + + + WHAT'S IN THIS PATCH + + There are a bunch of little features, common in System V and SunOS + versions of mailx, that are missing from the NetBSD-based version + distributed with Linux. This patch attempts to fill in some of what's + missing. + + Changes from debian mailx-5.5 include: + + 5/4/95: + + -- interpret prompt variable + -- interpret ~a and ~A tilde escapes + -- updated tildehelp list + -- changed mail.rc to ignore nothing (just my personal preference) + -- accept From lines with times of the form hh:mm (formerly took only hh:mm:ss) + + 5/7/95: + + -- Save (S) command saves to mailbox named after author + -- take startup commands from file named by environment variable MAILRC + + 5/30/95: + + -- -H switch for header summary only + + Still to be done: + + -- pipe ~p output through PAGER (see type1 in cmd1.c for an example) + -- save (s) by default to MBOX (instead of "No file specified.") + -- ~q should save to dead.letter, ~x is not known + -- update man page + -- allnet and showto ("showto" shows recipient instead of sender if sender + is current user) + + Possibly difficult: + + -- interpret editheaders variable as in SunOS version + + Bugs: + + -- ~a,~A tilde escapes leave an extra trailing blank on each line + -- to conform to original style, I should really be using char *cp + instead of new variables sig and prompt to be looking up variables + -- -H switch implementation is kind of gross. grep for "hdronly" in + source files; much room for improvement! + + + HOW TO INSTALL + + Apply Sal Valente's debian patch first, so: + + tar xvfz mailx-5.5.tar.gz + cd mailx-5.5 + zcat ../mailx-5.5.debian.diff.gz | patch -p1 + zcat ../mailx-5.5-kw.diff.gz | patch -p1 + make + + Or you may wish to just uncompress the diff file and pick and choose + the changes that you like. + + + AUTHOR + + Ken Whang This version has no provision for the debian mail policy (permission on /var/mail+dotfile locking), so Loic Prylli finally recreate a package based on the OpenBSD mail with the minimum number of patches to make it suited for debian (see changelog). There is no more POP support, nor the added functionality from Ken Whang, but all these patches are archived, so mail if you want them to be incorporated. Loic Prylli , Mon, 23 Dec 1996 00:13:13 +0100 Sat Apr 4 14:05:38 CEST 1998: After a security patch to fix tmp races, a number of things broke. Here is what I have tried to fix them: The rationale is to have all file openings go through safe_open: File opened in mode "w", "w+", are created with O_EXCL mode, (should coincide with temporary files or new files) Files with "a" "a+" et "r+" mode do not require the O_EXCL files. "a+" et "r+" do not creat the file. Still to do: check creat calls debian/bsd-mailx.dirs0000644000000000000000000000006312224232175011730 0ustar etc usr/bin usr/share/bsd-mailx usr/share/man/man1 debian/bsd-mailx.postinst0000644000000000000000000000166512224232175012663 0ustar #!/bin/sh # vim:ts=2:et # $Id: bsd-mailx.postinst,v 1.3 2008-01-08 22:01:43 robert Exp $ set -e update_alt() { program="$1" priority="$2" bindir=/usr/bin mandir=/usr/share/man/man1 if [ ! -e "$bindir/mailx" ] || ! update-alternatives --display "mailx" | grep -q "${bindir}/${program}$" ; then update-alternatives --install "$bindir/mailx" mailx "$bindir/$program" "$priority" \ --slave "$bindir/mail" mail "$bindir/$program" \ --slave "$bindir/Mail" Mail "$bindir/$program" \ --slave "$mandir/mailx.1.gz" mailx.1.gz "$mandir/$program.1.gz" \ --slave "$mandir/mail.1.gz" mail.1.gz "$mandir/$program.1.gz" \ --slave "$mandir/Mail.1.gz" Mail.1.gz "$mandir/$program.1.gz" fi } if [ "$1" = "configure" ]; then update_alt bsd-mailx 50 fi #DEBHELPER# debian/bsd-mailx.prerm0000644000000000000000000000031112224232175012110 0ustar #!/bin/sh # vim:ts=2:et # $Id: bsd-mailx.prerm,v 1.2 2007-12-01 12:06:49 robert Exp $ set -e if [ "$1" = "remove" ]; then update-alternatives --remove "mailx" "/usr/bin/bsd-mailx" fi #DEBHELPER# debian/changelog0000644000000000000000000005347612224232175011057 0ustar bsd-mailx (8.1.2-0.20131005cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * Remove 23-Treat-new-line-only-messages-as-empty-ones.patch, introduced in 1:8.1.2-0.20071017cvs-1 so that bsd-mailx will behave like other mailx implementations and will not treat messages containing a single new line only as an empty ones (LP: #607099, reopens #355545). * Extend description of this package to mention the fact that bsd-mailx lacks many features that may be found in other packages like heirloom-mailx or mailutils (closes: #508303). * Add 26-Fix-confusing-error.patch to make a message given when -b is used without -t less confusing (closes: #327809). * Fix 00-Makefile.patch not to override CC and pass CPPFLAGS while compiling. * debian/rules: + apply patch from Ubuntu to respect DEB_HOST_GNU_TYPE when selecting CC for cross-compiling; + do not try to run make clean on unpatched Makefile. * Bump Standards-Version to 3.9.4 (no changes). -- Robert Luberda Sun, 06 Oct 2013 11:58:42 +0200 bsd-mailx (8.1.2-0.20111106cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * Drop the additional source files from EXT directory, use libbsd-dev instead. Move EXT to debian. * 00-Makefile: don't override CFLAGS set in environment. * Switch to dpkg-source 3.0 (quilt) format. * Use debhelper v9 and tiny debian/rules file. * debian/control: + Build-Depends on libbsd-dev; + Standards-Version: 3.9.2; + use Breaks instead of versioned Conflicts; + add Vcs fields; + reformat the dependencies fields with `wrap-and-sort' command. * Include full text of BSD licence in copyright (lintian). -- Robert Luberda Sun, 20 Nov 2011 23:37:22 +0100 bsd-mailx (8.1.2-0.20100314cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * Follow upstream and stop installing the outdated documentation (closes: #455708); also remove doc-base file. * debian/control: + depend on default-mta instead of exim4 (closes: #555495); + add ${misc:Depends} dependency (lintian); + Standards-Version: 3.8.4 (no changes). -- Robert Luberda Sun, 14 Mar 2010 13:22:18 +0100 bsd-mailx (8.1.2-0.20090911cvs-2) unstable; urgency=medium * Fix a bogus "can't send mail: sendmail process failed" errors appearing rarely on systems under heavy loads (closes: #550116). Many thanks to Ivan Zahariev for his investigation and patch. -- Robert Luberda Sat, 10 Oct 2009 11:21:11 +0200 bsd-mailx (8.1.2-0.20090911cvs-1) unstable; urgency=low * New upstream release from OpenBSD repository. * Fix grammar in description (closes: #515781). * Drop mailx transitional package. * Bump debhelper compat mode to 7. * Standards-Version: 3.8.3 -- Robert Luberda Fri, 11 Sep 2009 18:14:22 +0200 bsd-mailx (8.1.2-0.20081101cvs-2) unstable; urgency=low * Upload to unstable. -- Robert Luberda Sun, 09 Nov 2008 09:00:25 +0100 bsd-mailx (8.1.2-0.20081101cvs-1) experimental; urgency=low * New upstream release. * Lower priority of mailx package to extra. * Standards-Version: 3.8.0 (no changes). * Remove duplicated `it' from description (lintian). -- Robert Luberda Sat, 01 Nov 2008 12:40:12 +0100 bsd-mailx (8.1.2-0.20071201cvs-3) unstable; urgency=low * Lower priority of mailx package to optional (see #477124). * copyright: Add a copyright notice (lintian). * Build depend on debhelper >= 6 (lintian). * Change doc-base section to Network/Communication (lintian). -- Robert Luberda Sat, 26 Apr 2008 09:52:18 +0200 bsd-mailx (8.1.2-0.20071201cvs-2) unstable; urgency=medium * Add conflict with old mailx packages (closes: #459621). * Standards-Version: 3.7.3 (no changes). * Fix invalid regexp in postinst. -- Robert Luberda Tue, 08 Jan 2008 23:01:18 +0100 bsd-mailx (8.1.2-0.20071201cvs-1) unstable; urgency=low * New upstream version. * Rename package to bsd-mailx, and create dummy mailx package for smooth upgrades. * Manage /usr/bin/mailx with update-alternatives to allow other packages like mailutils or nail to be installed together with bsd-mailx. * Remove outdated preinst script. -- Robert Luberda Sat, 01 Dec 2007 12:54:13 +0100 mailx (1:8.1.2-0.20071017cvs-2) unstable; urgency=low * collect.c: Ooops, for debugging I commented out the line responsible for removing temporary, and forgot to uncomment it... -- Robert Luberda Fri, 19 Oct 2007 23:10:11 +0200 mailx (1:8.1.2-0.20071017cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * send.c: treat messages which contain only a new line sign as empty messages (closes: #355545). * Fix ` debian-rules-ignores-make-clean-error' lintian warning. * Bump debhelper compat mode to v6. -- Robert Luberda Thu, 18 Oct 2007 23:35:53 +0200 mailx (1:8.1.2-0.20070424cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * Standards-Version: 3.7.2. * Lower package priority to standard to match the override file. * main.c: Replace with spaces any embeded newline passed in arguments for '-s' and '-a' options (closes: #419840). * mail.1: Fix a typo (closes: #411420). -- Robert Luberda Thu, 03 May 2007 12:09:36 +0200 mailx (1:8.1.2-0.20050715cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository: + fixed segfault in list.c (closes: #313306). * Standard-Version: 3.6.2 (no changes). -- Robert Luberda Fri, 15 Jul 2005 00:28:33 +0200 mailx (1:8.1.2-0.20040524cvs-4) unstable; urgency=low * Fix documentation of sendmail options in the man page and in the mailx's usage output (closes: #285259). -- Robert Luberda Sat, 18 Dec 2004 13:58:28 +0100 mailx (1:8.1.2-0.20040524cvs-3) unstable; urgency=medium * fio.c: Fix segfault on wildcard expansion introduced in previous upload. Thanks to Yuri D'Elia for noticing this (see bug#148389). -- Robert Luberda Sat, 13 Nov 2004 22:23:14 +0100 mailx (1:8.1.2-0.20040524cvs-2) unstable; urgency=medium * Bugfix release (closes: #278748): + fio.c: Use wordexpr() instead of calling /bin/echo not to allow executing external commands while expanding shell variables and wildcards. + names.c: isfileaddr function return false if '@', '!' or '%' i characters occur anywhere (e.g not only before the slash) in the recipient name. -- Robert Luberda Wed, 3 Nov 2004 20:46:39 +0100 mailx (1:8.1.2-0.20040524cvs-1) unstable; urgency=low * New upstream version from OpenBSD CVS repository. * debian/control: add exim4 alternative to mail-transport-agent dependency (closes: #248498). * USD.doc/mail*.nr: changed references from /usr/lib/Mail.rc to /etc/mail.rc. * USD.doc/Makefile, debian/rules: generate and install manual.txt (like in the upstream version). * Removed lintian override file, it's no longer needed. * Add lintian source overrides for `cvsignore-file-in-source' and `source-contains-CVS-dir'. -- Robert Luberda Mon, 24 May 2004 23:03:47 +0200 mailx (1:8.1.2-0.20031014cvs-2) unstable; urgency=medium * edit.c: if the external editor (called by ~e or ~v commands) fails for some reason, don't delete the temporary file if it has been modified. This partly fixes bug#148037. * popen.c: print exit code of failed commands. * quit.c: change message saying that mailbox was "removed" to "truncated" (closes: #196682); mailx does not remove mailboxes, see the entry for 1:8.1.2-0.20020316cvs-2 in this changelog for the reason. -- Robert Luberda Wed, 31 Mar 2004 23:42:19 +0200 mailx (1:8.1.2-0.20031014cvs-1) unstable; urgency=low * New upstream version from OpenBSD. * Fix problem with building on Hurd (closes: #213929). * mail.1: removed reference to non-existent lockspool man page. * Standards-Version: 3.6.1 (no changes). -- Robert Luberda Tue, 14 Oct 2003 20:48:51 +0200 mailx (1:8.1.2-0.20030521cvs-1) unstable; urgency=low * New upstream version from OpenBSD. * Added EXT/vis.[ch] files, needed for compiling this version. * Minor fix in Makefile (closes: #181022). * debian/control: Remove ending dot from synopsis line (lintian). * Standards-Version: 3.5.10 (no changes). -- Robert Luberda Thu, 22 May 2003 21:12:21 +0200 mailx (1:8.1.2-0.20020411cvs-5) unstable; urgency=low * cmd1.c: Check if return value of screensize() > 0 (closes: #170784). * Support DEB_BUILD_OPTIONS=noopt instead of debug. * Build with debhelper v4. * Standards-Version: 3.5.8. -- Robert Luberda Sat, 7 Dec 2002 11:42:34 +0100 mailx (1:8.1.2-0.20020411cvs-4) unstable; urgency=low * send.c: Always wait for a sendmail process, check its exit code and if non-zero, print a warning message to user and save original message to ~/dead.letter (closes: #145379). * popen.c: Make wait_child() return an exit code of the child. * mail.1: s/^\.ne li$/.ne/g to fix groff warnings. -- Robert Luberda Sat, 24 Aug 2002 22:15:23 +0200 mailx (1:8.1.2-0.20020411cvs-3) unstable; urgency=low * aux.c: in function alter() do initialize tv_usec part of the timeval structure used to set modification time on the mailbox file (closes: #152038). Thanks to John Girash for help. -- Robert Luberda Thu, 11 Jul 2002 05:21:34 +0200 mailx (1:8.1.2-0.20020411cvs-2) unstable; urgency=low * collect.c: return from grabh() if stdin is not a terminal. This fixes the `-I' option (closes: #149005). -- Robert Luberda Tue, 18 Jun 2002 22:55:27 +0200 mailx (1:8.1.2-0.20020411cvs-1) unstable; urgency=high * New upstream CVS snapshot, with only one change, which fixes potential security problem: + collect.c: Don't do tilde escapes unless we are in interactive mode. Now the behavior matches the man page... * Many thanks to Michal Pajak for pointing out the problem. -- Robert Luberda Thu, 11 Apr 2002 19:07:59 +0200 mailx (1:8.1.2-0.20020316cvs-3) unstable; urgency=low * fio.c: fixed previous patch (closes: #140527,#140485). -- Robert Luberda Tue, 2 Apr 2002 07:14:58 +0200 mailx (1:8.1.2-0.20020316cvs-2) unstable; urgency=low * fio.c: Don't delete mailbox file, always truncate it, because liblockfile fails to remove the lock file if mailbox doesn't exist (closes: #111537). -- Robert Luberda Wed, 27 Mar 2002 09:20:08 +0100 mailx (1:8.1.2-0.20020316cvs-1) unstable; urgency=low * Applied patches from Arnaud Giersch which fix outstanding problems: + closes: #37104: Bug in all mailx* (tested: <=mailx_8.1.1-10). + closes: #71759: mailx concatenates messages. MANY THANKS FOR YOUR HELP, Arnaud! * New upstream version from OpenBSD CVS repository: + closes: #34752: mail causes segmentation fault when pushing Ctrl+C. * This version uses strlcpy&strlcat functions, appropriate files were included in Debian patch. * Added upstream changelog file, generated by hand from CVS logs using `cvs2cl --no-wrap -S'. * Makefile: added -p option to install (preserve timestamps of installed files). -- Robert Luberda Tue, 26 Mar 2002 05:47:53 +0100 mailx (1:8.1.2-0.20010922cvs-3) unstable; urgency=low * debian/copyright: text of BSD license can be found in common-licences, so do not include it here... -- Robert Luberda Fri, 4 Jan 2002 08:13:30 +0100 mailx (1:8.1.2-0.20010922cvs-2) unstable; urgency=low * debian/copyright: removed 3th paragraph from the text of BSD license as suggested by Branden Robinson (closes: #123828). * Upgraded standards version to 3.5.6 (no changes needed). -- Robert Luberda Sat, 22 Dec 2001 21:56:31 +0100 mailx (1:8.1.2-0.20010922cvs-1) unstable; urgency=low * New version from OpenBSD cvs repository: + aux.c: In skin(), only add a space after a comma if there is actually a space in the input buffer. This prevents a rare buffer overflow on very long header lines... (closes: #108677). See #108677 for more info. + aux.c: In skin() don't die if realloc() fails since its only purpose is to shrink the buffer, not expand it. * No other changes was made, so I think this version should go to woody as well. -- Robert Luberda Sun, 23 Sep 2001 21:42:22 +0200 mailx (1:8.1.2-0.20010705cvs-2) unstable; urgency=low * Removed exim from exim|mail-transport-agent dependency (closes: #106122). * Added a lintian override file for virtual-package-without-real-package- dependency warning. * Fix spelling in description of the package (closes: #106449). -- Robert Luberda Wed, 8 Aug 2001 23:31:21 +0200 mailx (1:8.1.2-0.20010705cvs-1) unstable; urgency=low * New version from OpenBSD cvs. * Updated copyright and README.Debian files. * Removed IOSAFE patch - it wasn't used. * REPLYTO can be set in ~/.mailrc too. -- Robert Luberda Thu, 12 Jul 2001 18:58:01 +0200 mailx (1:8.1.2-0.20010319cvs-4) unstable; urgency=low * Applied patch from Tormod Volden , which adds "showname" option to mailx (closes: #96867). * v7.local.c: Removed /var/spool/mail hack added by Paul in 1:8.1.1-10.1.1 * quit.c: Use lockf instead if flock. * quit.c: Add missing newline in `Saved ...' message. * Added doc-base support. * Added versioned dependency on base-files, as suggested in upgrading- checklist for Debian Policy 3.5.4. * Standards-Version: 3.5.5 -- Robert Luberda Tue, 12 Jun 2001 23:43:10 +0200 mailx (1:8.1.2-0.20010319cvs-3) unstable; urgency=low * Applied some patches from FreeBSD: + Add Relpy-To header if REPLYTO environment variable is set. + Add In-Reply-To header for replies (closes: #23115). * When saving messages to mbox, print its real filename (closes: #68920). Thanks to Tollef Fog Heen for patch. * /etc/mail.rc: Add Delivered-To to list of ignored headers. -- Robert Luberda Wed, 4 Apr 2001 00:20:57 +0200 mailx (1:8.1.2-0.20010319cvs-2) unstable; urgency=low * Don't ask about (B)Cc: header twice (closes: #90822). -- Robert Luberda Fri, 23 Mar 2001 23:47:43 +0100 mailx (1:8.1.2-0.20010319cvs-1) unstable; urgency=medium * New maintainer (closes: #90146). * New upstream version from OpenBSD CVS repository. * Security fix: don't install mailx binary setgid mail. Now the liblockfile library is used for mailbox locking. * cmd3.c: Initialize head variable with NULLs. This should fix problem with garbage text when replying (closes: #84166). * Add conflicts with older suidmanager. * Helpfiles moved to /usr/share/mailx. * Added support for DEB_BUILD_OPTIONS=debug,nostrip. * Updated Standards-Version: 3.5.2 * Switch to debhelper v3. * Updated Build-Depends field. * Closing bugs fixed in NMUs (closes: #23901, #64238, #68725, #68745). -- Robert Luberda Thu, 22 Mar 2001 08:05:56 +0100 mailx (1:8.1.1-10.3) unstable; urgency=low * debian/rules: added install dependancy to binary-arch (Closes: Bug#83361). -- Edward Betts Sun, 28 Jan 2001 14:40:05 -0700 mailx (1:8.1.1-10.2) unstable; urgency=low * debian/control: Standards-Version updated. * debian/control: Build-Depends added. * debian/control: Depends line fixed (Closes: Bug#41909). * debian/rules: rewritten, still uses debhelper. * Makefile: man pages moved to /usr/share/man (Closes: Bug#80758). * applied patch from Martin Schulze (Closes: Bug#23356, Bug#13756). * applied patch from Ulf Jaenicke-Roessler (Closes: Bug#26757, Bug#40424). * misc/mail.help, USD.doc/mail[1568].nr: changed references from /usr/spool/mail to /var/mail (Closes: Bug#41910). * send.c: Comment out bcc code (Closes: Bug#75232). * pathnames.h: Change default shell from /bin/csh to /bin/sh. * pathnames.h: Change default pager from /bin/more to /usr/bin/pager (Closes: Bug#41228). * pathnames.h: Change default editor from /bin/ex to /usr/bin/editor (Closes: Bug#66385). * debian/rules: stop using dh_suidregister -- Edward Betts Sun, 14 Jan 2001 12:36:16 -0700 mailx (1:8.1.1-10.1.3) frozen unstable; urgency=high * Fix the security fix: only accept a couple environment variables instead of blindly using them all -- Wichert Akkerman Tue, 8 Aug 2000 11:42:02 -0700 mailx (1:8.1.1-10.1.2) frozen unstable; urgency=high * Another security problem: refuse to get the interactive variable from the environment by explicitly setting it in the hashtable. -- Wichert Akkerman Mon, 7 Aug 2000 12:36:10 -0700 mailx (1:8.1.1-10.1.1) frozen unstable; urgency=high * NMU to fix RC bug. Now accepts both /var/mail and /var/spool/mail as allowed places for setgid file manipulation. fixes:#64238 -- Paul Slootman Thu, 8 Jun 2000 19:51:14 +0200 mailx (1:8.1.1-10.1) stable frozen unstable; urgency=high * Security fix for a GID=mail shell. -- Daniel Jacobowitz Sun, 4 Jun 2000 22:45:19 -0700 mailx (1:8.1.1-10) frozen unstable; urgency=high * correct major security flaw, patch from Alvaro Martinez Echevarria , bug#23880, bug#23901 * other potential buffer overflow, patch from Juan-Mariano de Goyeneche , bug #22937 -- Loic Prylli Sun, 28 Jun 1998 20:15:18 -0400 mailx (1:8.1.1-9) frozen unstable; urgency=high * recompile without the signal handling workarounds (lo that eliminate critical bugs where message parts can be lost (#20798) and (#20558) -- Loic Prylli Thu, 9 Apr 1998 02:11:26 +0200 mailx (1:8.1.1-8) frozen unstable; urgency=high * previous patch broke most file accesses, corrected safe_open (#20634) * try to check every access to Fopen, change "a" into "w" for new files, to suit behaviour of safe_open. -- Loic Prylli Sat, 4 Apr 1998 22:01:19 +0200 mailx (1:8.1.1-7) frozen; urgency=medium * security fix for tmp races patch from Martin Schulze (#20059) -- Loic Prylli Mon, 23 Mar 1998 22:52:35 +0100 mailx (1:8.1.1-6) unstable; urgency=low * convert to debhelper * changelog now compressed (bug#15431) * removed .orig and .rej from source (bug#18409) -- Loic Prylli Sat, 14 Feb 1998 14:34:22 +0100 mailx (1:8.1.1-5) unstable; urgency=low * apply David Brown patch so mailx choose the right window size (#12197) * correct Depends: in control file. -- Loic Prylli Sat, 15 Nov 1997 00:30:38 +0100 mailx (1:8.1.1-4) unstable; urgency=high * mailx was sending empty message, ignoring user input add clearerr when EAGAIN occur in "IOSAFE" code (#14263) -- Loic Prylli Tue, 11 Nov 1997 20:22:35 +0100 mailx (1:8.1.1-3.1) unstable; urgency=low * Non-maintainer release. * Libc6 compile. (#11705) * Install missing symlink to manpage. (#7274) -- Martin Mitchell Wed, 29 Oct 1997 04:34:39 +1100 mailx (1:8.1.1-3) unstable; urgency=low * add dpkg --assert-working-epoch in preinst bug#6850 * add writing of pid in mailbox locking file * fix:mailx was not removing temporary lock files -- Loic Prylli Sat, 1 Feb 1997 11:44:04 +0100 mailx (1:8.1.1-2) unstable; urgency=low * correct bug #2733 (occur when no space left) dans quit.c * detection of From_ lines with tring to match the date bug#2010 * corrected garble output bug #2284 -- Loic Prylli Sat, 28 Dec 1996 15:02:22 +0100 mailx (1:8.1.1-1) unstable; urgency=medium * recreate completely starting from OpenBSD mail version (we loose a lot of extension but we have a working program now) * OpenBSD base version is the last one in december 96 * rechange the numbering of version, so epoch 1+8.1 is from 4.4BSD, the last upstream digit is to change each time we update to a new openbsd version. * fix the problem of longjmp inside signals inside stdio calls * reincorporate a patch to be dot file locking+setgid safe * some fix in signal handling -- Loic Prylli Mon, 23 Dec 1996 01:57:44 +0100 Mon Apr 29 17:21:42 1996 Sven Rudolph * releasing 8.5.5-1 * added symlink /usr/bin/Mail -> /usr/bin/mailx Thu Apr 25 23:55:36 1996 Sven Rudolph * set version number to 8.5.5 because it has to superseed 8.1 * switched back to mailx-5.5-kw (see mailx-5.5-kw.diff.README) * no POP support mailx 8.1 Debian 5 - 10/19/95 Sven Rudolph * uses now BSD signal emulation (/usr/include/bsd/signal.h) * added virtual package names in Depends: and Provides fields (Bug#1460) * added Section: field * created symlink for mailx manpage (Bug#1114) mailx 8.1 Debian 4 - 5/20/95 Carl Streeter * Added diffs from Delman Lee : Hi! I got mailx-8.1-3 from the Linux Debian distribution, and have added a "hold-pop" option to hold messages on the POP server after retrieving them. (Also fixed a minor bug with mailx thinking that there is mail even if the POP mailbox is empty. Code around stat() below.) mailx 8.1 Debian 3 - 4/18/95 Carl Streeter * Fixed control file to depend on smail|sendmail. Updated to latest guidelines debian/compat0000644000000000000000000000000212224232175010364 0ustar 9 debian/control0000644000000000000000000000274512224232175010601 0ustar Source: bsd-mailx Section: mail Priority: standard Maintainer: Robert Luberda Standards-Version: 3.9.4 Build-Depends: debhelper (>= 9), groff, libbsd-dev (>= 0.3), liblockfile-dev (>= 1.05) Vcs-Git: git://anonscm.debian.org/users/robert/bsd-mailx.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=users/robert/bsd-mailx.git Package: bsd-mailx Architecture: any Depends: base-files (>= 2.2.0), default-mta | mail-transport-agent, ${misc:Depends}, ${shlibs:Depends} Provides: mail-reader, mailx Breaks: mailutils (<< 1:1.1+dfsg1-4), mailx (<< 1:20071201) Replaces: mailx (<< 1:20071201) Description: simple mail user agent bsd-mailx is the traditional simple command-line-mode mail user agent. Even if you don't use it, it may be required by other programs. . The /usr/bin/mail command provided by this package is a very simple one, and does not include many features that can be found in more advanced mail user agents. . For example bsd-mailx DOES NOT support: - MIME (i.e. no attachments, no UTF-8 or other charsets support); - SMTP protocol (/usr/sbin/sendmail interface only is used); - POP3/IMAP (bsd-mailx reads local mailboxes only); - maildir format (traditional mbox only format is supported). . If the above features are needed, please consider installing another package providing similar /usr/bin/mail interface: - heirloom-mailx package, - or mailutils package. debian/copyright0000644000000000000000000000374712224232175011134 0ustar This package was debianized by Loic Prylli on Mon, 23 Dec 1996 00:13:13 +0100. The package is currently maintained by Robert Luberda It is now based on OpenBSD in directory src/usr.bin/mail on a lot of major ftp sites. See the README.Debian (and changelog.Debian) for the complicated history of the Debian package. Copyright (c) 1980, 1993 The Regents of the University of California. This software is licensed under the BSD License. The complete text of the license is included below: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. debian/patches/0000755000000000000000000000000012224232175010615 5ustar debian/patches/00-Makefiles.patch0000644000000000000000000000453412224232175013761 0ustar From: Loic Prylli Date: Mon, 29 Jun 1998 20:15:00 -0400 Subject: 00 Makefiles. Fix makefiles to make it possible to compile mailx on non-BSD systems. --- Makefile | 33 ++++++++++++++++++++++++++++++--- USD.doc/Makefile | 14 +++++++++----- 2 files changed, 39 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 7bbb530..3c74690 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,22 @@ # $OpenBSD: Makefile,v 1.9 2010/01/04 17:50:39 deraadt Exp $ PROG= mail +CC ?= gcc + +CFLAGS += -D_BSD_SOURCE -DDEBIAN -g -Wall + SRCS= version.c aux.c cmd1.c cmd2.c cmd3.c cmdtab.c collect.c \ edit.c fio.c getname.c head.c v7.local.c lex.c list.c main.c names.c \ popen.c quit.c send.c strings.c temp.c tty.c vars.c + +OBJS=$(SRCS:%.c=%.o) +LIBS=-llockfile -lbsd + SFILES= mail.help mail.tildehelp EFILES= mail.rc -LINKS= ${BINDIR}/mail ${BINDIR}/Mail ${BINDIR}/mail ${BINDIR}/mailx -MLINKS= mail.1 Mail.1 mail.1 mailx.1 +MFILES= mail.1 + +all: $(PROG) beforeinstall: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \ @@ -17,4 +26,22 @@ distribution: cd ${.CURDIR}/misc; ${INSTALL} ${INSTALL_COPY} -o root -g wheel \ -m 644 ${EFILES} ${DESTDIR}/etc -.include + +$(PROG): $(OBJS) + $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + +.y.c: + bison $< + mv -f $*.tab.c $@ + +clean: + rm -f $(PROG) $(OBJS) *~ core + +install: + install -p -c -m 755 $(PROG) $(DESTDIR)/usr/bin/bsd-mailx + install -p -c -m 644 $(MFILES) $(DESTDIR)/usr/share/man/man1/bsd-mailx.1 + cd misc && install -p -c -m 644 $(EFILES) $(DESTDIR)/etc/ + cd misc && install -p -c -m 644 $(SFILES) $(DESTDIR)/usr/share/bsd-mailx/ diff --git a/USD.doc/Makefile b/USD.doc/Makefile index fc82a17..a59ecb0 100644 --- a/USD.doc/Makefile +++ b/USD.doc/Makefile @@ -5,11 +5,15 @@ DIR= usd/07.mail SRCS= mail0.nr mail1.nr mail2.nr mail3.nr mail4.nr mail5.nr mail6.nr \ mail7.nr mail8.nr mail9.nr maila.nr MACROS= -me +TBL=tbl -paper.ps: ${SRCS} - ${TBL} ${SRCS} | ${ROFF} > ${.TARGET} +all: manual.ps manual.txt -paper.txt: ${SRCS} - ${TBL} ${SRCS} | ${ROFF} -Tascii > ${.TARGET} +manual.ps: ${SRCS} + ${TBL} ${SRCS} | groff ${MACROS} -Tps > $@ -.include +manual.txt: ${SRCS} + ${TBL} ${SRCS} | groff ${MACROS} -Tascii > $@ + +clean : + -rm -f manual.ps manual.txt debian/patches/01-Fix-includes.patch0000644000000000000000000000300012224232175014377 0ustar From: Robert Luberda Date: Sun, 6 Nov 2011 23:03:12 +0100 Subject: 01 Fix includes. --- def.h | 4 +++- edit.c | 6 ++++++ list.c | 3 +++ names.c | 1 + send.c | 1 + 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/def.h b/def.h index 322be15..3772892 100644 --- a/def.h +++ b/def.h @@ -52,9 +52,11 @@ #include #include #include +#include #include #include -#include +#include +#include #include "pathnames.h" #define APPEND /* New mail goes to end of mailbox */ diff --git a/edit.c b/edit.c index cf14a37..d7a4732 100644 --- a/edit.c +++ b/edit.c @@ -30,6 +30,12 @@ * SUCH DAMAGE. */ +#ifdef DEBIAN +/* needed for asprintf */ +#define _GNU_SOURCE +#include +#endif + #include #include diff --git a/list.c b/list.c index cfdb17e..8240dfa 100644 --- a/list.c +++ b/list.c @@ -30,6 +30,9 @@ * SUCH DAMAGE. */ +#define _GNU_SOURCE // for strcasestr +#include // for strcasestr + #include "rcv.h" #include #include "extern.h" diff --git a/names.c b/names.c index 7c0e9e0..0ce42c7 100644 --- a/names.c +++ b/names.c @@ -38,6 +38,7 @@ #include "rcv.h" #include +#include #include "extern.h" /* diff --git a/send.c b/send.c index 6f0dc51..1adb4fd 100644 --- a/send.c +++ b/send.c @@ -30,6 +30,7 @@ * SUCH DAMAGE. */ +#include #include "rcv.h" #include "extern.h" debian/patches/02-Base-fixes-1.patch0000644000000000000000000001321712224232175014205 0ustar From: Loic Prylli Date: Mon, 29 Jun 1998 20:15:00 -0400 Subject: 02 Base fixes 1. Fixes from Debian patch 1:8.1.1-10 --- USD.doc/mail1.nr | 2 +- USD.doc/mail5.nr | 2 +- collect.c | 2 ++ head.c | 3 +++ mail.1 | 6 +++--- main.c | 2 +- misc/mail.rc | 4 ++-- names.c | 3 ++- pathnames.h | 39 +++++++++++++++++++++++++++++++++++---- 9 files changed, 50 insertions(+), 13 deletions(-) diff --git a/USD.doc/mail1.nr b/USD.doc/mail1.nr index 1d21d52..414fc2b 100644 --- a/USD.doc/mail1.nr +++ b/USD.doc/mail1.nr @@ -90,7 +90,7 @@ When you log in, the system notifies you if there are any messages waiting in your system mailbox. If you are a .i csh user, you will be notified when new mail arrives if you inform -the shell of the location of your mailbox. On OpenBSD, +the shell of the location of your mailbox. On Debian, your system mailbox is located in the directory /var/mail in a file with your login name. If your login name is .q sam, diff --git a/USD.doc/mail5.nr b/USD.doc/mail5.nr index aecaf61..3e352af 100644 --- a/USD.doc/mail5.nr +++ b/USD.doc/mail5.nr @@ -489,7 +489,7 @@ commands. .. The .. .b local .. command is usually not used be general users since it is designed for -.. local configuration; it is usually found in the file /usr/lib/Mail.rc. +.. local configuration; it is usually found in the file /etc/mail.rc. .ip "\fBmail\fP\ \ " Send mail to one or more people. If you have the .i ask diff --git a/collect.c b/collect.c index 204dc36..44f1605 100644 --- a/collect.c +++ b/collect.c @@ -402,6 +402,8 @@ exwrite(char *name, FILE *fp, int f) fputs("File exists\n", stderr); return(-1); } + /* FIXME: Fopen with "w" will currently prevent writing to an existig file + (/dev/null), for now I am not sure this would even marginally useful to allow */ if ((of = Fopen(name, "w")) == NULL) { warn(NULL); return(-1); diff --git a/head.c b/head.c index 97fefc2..3366fbd 100644 --- a/head.c +++ b/head.c @@ -60,10 +60,13 @@ ishead(char *linebuf) fail(linebuf, "No from or date field"); return(0); } + /* be very tolerant about the date */ +#ifndef DEBIAN if (!isdate(hl.l_date)) { fail(linebuf, "Date field not legal date"); return(0); } +#endif /* * I guess we got it! */ diff --git a/mail.1 b/mail.1 index cf920da..c2ba788 100644 --- a/mail.1 +++ b/mail.1 @@ -288,7 +288,7 @@ The current list of such aliases can be displayed with the command in .Nm mail . System wide distribution lists can be created by editing -.Pa /etc/mail/aliases +.Pa /etc/aliases , (see .Xr aliases 5 and @@ -1142,7 +1142,7 @@ If the environment variable is set, its value is used as the path to the user's mail spool. .Sh FILES -.Bl -tag -width /usr/share/misc/mail.*help -compact +.Bl -tag -width /usr/share/bsd\-mailx/mail.*help -compact .It Pa /var/mail/* post office (unless overridden by the .Ev MAIL @@ -1155,7 +1155,7 @@ file giving initial mail commands; can be overridden by setting the environment variable .It Pa /tmp/R* temporary files -.It Pa /usr/share/misc/mail.*help +.It Pa /usr/share/bsd\-mailx/mail.*help help files .It Pa /etc/mail.rc system initialization file diff --git a/main.c b/main.c index 16e0c80..24562e4 100644 --- a/main.c +++ b/main.c @@ -261,7 +261,7 @@ setscreensize(void) if (ioctl(1, TIOCGWINSZ, (char *) &ws) < 0) ws.ws_col = ws.ws_row = 0; if (tcgetattr(1, &tbuf) < 0) - ospeed = 9600; + ospeed = B9600; else ospeed = cfgetospeed(&tbuf); if (ospeed < B1200) diff --git a/misc/mail.rc b/misc/mail.rc index 95717f3..3fcc98d 100644 --- a/misc/mail.rc +++ b/misc/mail.rc @@ -1,2 +1,2 @@ -set append dot save asksub -ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via +set ask askcc append dot save crt +ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via Delivered-To diff --git a/names.c b/names.c index 0ce42c7..a062f5e 100644 --- a/names.c +++ b/names.c @@ -235,8 +235,9 @@ outof(struct name *names, FILE *fo, struct header *hp) (void)snprintf(tempname, sizeof(tempname), "%s/mail.ReXXXXXXXXXX", tmpdir); + /* hopefully we always create the file, so I change the "a" to "w" the line below */ if ((fd = mkstemp(tempname)) == -1 || - (fout = Fdopen(fd, "a")) == NULL) { + (fout = Fdopen(fd, "w")) == NULL) { warn("%s", tempname); senderr++; goto cant; diff --git a/pathnames.h b/pathnames.h index f1f5100..aa639d2 100644 --- a/pathnames.h +++ b/pathnames.h @@ -36,14 +36,45 @@ #include /* executables */ +#ifndef _PATH_SHELL +#define _PATH_SHELL "/bin/sh" +#endif +#ifndef _PATH_PAGER +#define _PATH_PAGER "/usr/bin/pager" +#endif +#ifndef _PATH_EX +#define _PATH_EX "/usr/bin/editor" +#endif +#ifndef _PATH_VI +#define _PATH_VI "/usr/bin/vi" +#endif +#ifndef _PATH_SENDMAIL +#define _PATH_SENDMAIL "/usr/sbin/sendmail" +#endif + +/* directories */ +#ifndef _PATH_TMP +#define _PATH_TMP "/tmp/" +#endif + +/* executables */ +#ifndef _PATH_LS +#define _PATH_LS "/bin/ls" +#endif + +#ifndef DEBIAN #define _PATH_EX "/usr/bin/ex" #define _PATH_MORE "/usr/bin/more" -#define _PATH_LS "/bin/ls" #define _PATH_LOCKSPOOL "/usr/libexec/lockspool" +#endif -/* directories & files */ +/* mail runtime files */ +#ifndef _PATH_MAILDIR #define _PATH_MAILDIR "/var/mail" -#define _PATH_HELP "/usr/share/misc/mail.help" -#define _PATH_TILDE "/usr/share/misc/mail.tildehelp" +#endif + +/* directories & files */ +#define _PATH_HELP "/usr/share/bsd-mailx/mail.help" +#define _PATH_TILDE "/usr/share/bsd-mailx/mail.tildehelp" #define _PATH_MASTER_RC "/etc/mail.rc" #define _PATH_LOCTMP "/tmp/local.XXXXXXXXXX" debian/patches/03-Base-fixes-2.patch0000644000000000000000000001250612224232175014207 0ustar From: Edward Betts Date: Sun, 28 Jan 2001 14:40:00 -0700 Subject: 03 Base fixes 2. Fixes from Debian patch 1:8.1.1-10.3 --- cmd1.c | 2 ++ def.h | 9 +++++++++ extern.h | 2 +- mail.1 | 21 +++++++++++---------- main.c | 23 ++++++++++++++++++----- send.c | 2 ++ vars.c | 9 +++++++-- 7 files changed, 50 insertions(+), 18 deletions(-) diff --git a/cmd1.c b/cmd1.c index bcc29f6..84186c5 100644 --- a/cmd1.c +++ b/cmd1.c @@ -340,6 +340,8 @@ type1(int *msgvec, char *cmd, int doign, int page) char *cp; FILE *obuf; + cp = NULL; + obuf = stdout; restoreterm = 0; diff --git a/def.h b/def.h index 3772892..af2ecce 100644 --- a/def.h +++ b/def.h @@ -72,6 +72,10 @@ #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */ +#ifndef NOFILE +#define NOFILE 256 +#endif + struct message { short m_flag; /* flags, see below */ int m_offset; /* offset in block of message */ @@ -264,4 +268,9 @@ struct ignoretab { (void)ftruncate(fileno(stream), (off_t)ftell(stream)); \ } while(0) + + +#ifndef UID_MAX +#define UID_MAX -1 +#endif #endif /* MAIL_DEF_H */ diff --git a/extern.h b/extern.h index 5255f65..714f48c 100644 --- a/extern.h +++ b/extern.h @@ -234,7 +234,7 @@ int spool_unlock(void); void spreserve(void); void sreset(void); pid_t start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...); -pid_t start_commandv(char *, sigset_t *, int, int, __va_list); +pid_t start_commandv(char *, sigset_t *, int, int, va_list); int statusput(struct message *, FILE *, char *); void stop(int); int stouch(void *); diff --git a/mail.1 b/mail.1 index c2ba788..94f22de 100644 --- a/mail.1 +++ b/mail.1 @@ -41,11 +41,12 @@ .Nm mail .Bk -words .Op Fl dEIinv -.Op Fl b Ar list .Op Fl c Ar list +.Op Fl b Ar list +.Op Fl c Ar cc-addr .Op Fl s Ar subject .Ar to-addr ... -.Op Fl Ar sendmail-options ... +.Op Fl - Ar sendmail-options ... .Ek .Nm mail .Op Fl dEIiNnv @@ -63,14 +64,14 @@ with lines replaced by messages. .Pp The options are as follows: .Bl -tag -width Ds -.It Fl b Ar list +.It Fl b Ar bcc-addr Send blind carbon copies to -.Ar list . -.It Fl c Ar list +.Ar bcc-addr . +.It Fl c Ar cc-addr Send carbon copies to -.Ar list +list of users. -.Ar list +.Ar cc-addr should be a comma separated list of names. .It Fl d Causes @@ -1164,7 +1165,7 @@ system initialization file .Ex -std mail .Sh SEE ALSO .Xr fmt 1 , -.Xr lockspool 1 , +.Xr newaliases 1 , .Xr vacation 1 , .Xr aliases 5 , .Xr mailaddr 7 , @@ -1195,9 +1196,9 @@ Most are not useful to the general user. .Pp Usually, -.Nm mail +.Nm Mail and .Nm mailx are just links to -.Nm Mail , +.Nm mail , which can be confusing. diff --git a/main.c b/main.c index 24562e4..e7f04bd 100644 --- a/main.c +++ b/main.c @@ -35,7 +35,7 @@ #include #include "extern.h" -__dead void usage(void); +static void usage(void); int main(int, char **); /* @@ -55,6 +55,17 @@ main(int argc, char **argv) char *rc; extern const char version[]; + /* + * drop any sgid/suid privileges + */ + if (setgid (getgid()) < 0) { + err(1, "setgid"); + } + + if (setuid (getuid()) < 0) { + err(1, "setuid"); + } + /* * Set up a reasonable environment. * Figure out whether we are being run interactively, @@ -94,8 +105,10 @@ main(int argc, char **argv) /* * Next argument is person to pretend to be. */ +#ifndef DEBIAN if (strlen(optarg) >= MAXLOGNAME) errx(1, "username `%s' too long", optarg); +#endif unsetenv("MAIL"); myname = optarg; uflag = 1; @@ -278,15 +291,15 @@ setscreensize(void) screenwidth = 80; } -__dead void +static void usage(void) { - fprintf(stderr, "usage: %s [-dEIinv] [-b list] [-c list] " + fprintf(stderr, "usage: %s [-dEIinv] [-b bcc-addr] [-c cc-addr] " "[-s subject] to-addr ...\n", __progname); - fprintf(stderr, " %*s [-sendmail-options ...]\n", + fprintf(stderr, " %*s [-- sendmail-options ...]\n", (int)strlen(__progname), ""); - fprintf(stderr, " %s [-dEIiNnv] -f [file]\n", __progname); + fprintf(stderr, " %s [-dEIiNnv] -f [name]\n", __progname); fprintf(stderr, " %s [-dEIiNnv] [-u user]\n", __progname); exit(1); } diff --git a/send.c b/send.c index 1adb4fd..961d734 100644 --- a/send.c +++ b/send.c @@ -505,8 +505,10 @@ puthead(struct header *hp, FILE *fo, int w) fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++; if (hp->h_cc != NULL && w & GCC) fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++; +/* Should not put bcc into mails (Closes: Bug#75232) if (hp->h_bcc != NULL && w & GBCC) fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++; +*/ if (gotcha && w & GNL) (void)putc('\n', fo); return(0); diff --git a/vars.c b/vars.c index 7f2fe5d..5ded8cf 100644 --- a/vars.c +++ b/vars.c @@ -100,19 +100,24 @@ char * value(char *name) { struct var *vp; +#ifndef DEBIAN char *env; +#endif if ((vp = lookup(name)) != NULL) return(vp->v_value); +#ifndef DEBIAN /* do not trust environment */ + else if ((env = getenv(name))) return(env); +#endif /* not set, see if we can provide a default */ else if (strcmp(name, "SHELL") == 0) - return(_PATH_CSHELL); + return(_PATH_SHELL); else if (strcmp(name, "LISTER") == 0) return(_PATH_LS); else if (strcmp(name, "PAGER") == 0) - return(_PATH_MORE); + return(_PATH_PAGER); else return(NULL); } debian/patches/04-Add-custom-header.patch0000644000000000000000000001137212224232175015311 0ustar From: Martin Schulze Date: Tue, 9 Jun 1998 22:42:19 +0200 Subject: 04 Add custom header. Provide a possibility to add custom header fields such as "X-Loop: This service" or "X-Generated: via cron" (Closes: Bug#23356, Bug#13756). --- def.h | 1 + extern.h | 2 +- mail.1 | 8 +++++++- main.c | 24 +++++++++++++++++++++--- send.c | 6 +++++- 5 files changed, 35 insertions(+), 6 deletions(-) diff --git a/def.h b/def.h index af2ecce..1905d00 100644 --- a/def.h +++ b/def.h @@ -179,6 +179,7 @@ struct headline { struct header { struct name *h_to; /* Dynamic "To:" string */ char *h_subject; /* Subject string */ + char *h_header; /* Additional header string */ struct name *h_cc; /* Carbon copies string */ struct name *h_bcc; /* Blind carbon copies */ struct name *h_smopts; /* Sendmail options */ diff --git a/extern.h b/extern.h index 714f48c..febe362 100644 --- a/extern.h +++ b/extern.h @@ -164,7 +164,7 @@ void load(char *); struct var * lookup(char *); int mail (struct name *, struct name *, struct name *, struct name *, - char *); + char *, char *); void mail1(struct header *, int); void makemessage(FILE *, int); void mark(int); diff --git a/mail.1 b/mail.1 index 94f22de..e7cef0a 100644 --- a/mail.1 +++ b/mail.1 @@ -41,6 +41,7 @@ .Nm mail .Bk -words .Op Fl dEIinv +.Op Fl a Ar header .Op Fl c Ar list .Op Fl b Ar list .Op Fl c Ar cc-addr @@ -64,6 +65,11 @@ with lines replaced by messages. .Pp The options are as follows: .Bl -tag -width Ds +.It Fl a +Specify additional header fields on the command line such as "X-Loop: +foo@bar" etc. You have to use quotes if the string contains spaces. +This argument may be specified more than once, the headers will then +be concatenated. .It Fl b Ar bcc-addr Send blind carbon copies to .Ar bcc-addr . @@ -1180,7 +1186,7 @@ utility is compliant with the specification. .Pp The flags -.Op Fl bcdEIv +.Op Fl abcdeEIv are extensions to that specification. .Sh HISTORY A diff --git a/main.c b/main.c index e7f04bd..db333c4 100644 --- a/main.c +++ b/main.c @@ -50,6 +50,7 @@ main(int argc, char **argv) int i; struct name *to, *cc, *bcc, *smopts; char *subject; + char *header = NULL; char *ef; char nosrc = 0; char *rc; @@ -89,7 +90,7 @@ main(int argc, char **argv) bcc = NULL; smopts = NULL; subject = NULL; - while ((i = getopt(argc, argv, "EINT:b:c:dfins:u:v")) != -1) { + while ((i = getopt(argc, argv, "EINT:a:b:c:defins:u:v")) != -1) { switch (i) { case 'T': /* @@ -130,6 +131,22 @@ main(int argc, char **argv) */ subject = optarg; break; + + case 'a': + /* + * Give additional header fields for sending from + * non terminal + */ + if (header == NULL) { + if ((header = (char *)malloc(strlen(optarg)+1)) != NULL) + strcpy(header, optarg); + } else { + if ((header = (char *)realloc(header, strlen(optarg)+strlen(header)+2)) != NULL) { + strcat(header, "\n"); + strcat(header, optarg); + } + } + break; case 'f': /* * User is specifying file to "edit" with Mail, @@ -181,6 +198,7 @@ main(int argc, char **argv) */ bcc = cat(bcc, nalloc(optarg, GBCC)); break; + case 'e': case 'E': /* * Don't send messages with an empty body. @@ -227,7 +245,7 @@ main(int argc, char **argv) rc = "~/.mailrc"; load(expand(rc)); if (!rcvmode) { - mail(to, cc, bcc, smopts, subject); + mail(to, cc, bcc, smopts, subject, header); /* * why wait? */ @@ -295,7 +313,7 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-dEIinv] [-b bcc-addr] [-c cc-addr] " + fprintf(stderr, "usage: %s [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] " "[-s subject] to-addr ...\n", __progname); fprintf(stderr, " %*s [-- sendmail-options ...]\n", (int)strlen(__progname), ""); diff --git a/send.c b/send.c index 961d734..f577cb3 100644 --- a/send.c +++ b/send.c @@ -279,12 +279,13 @@ statusput(struct message *mp, FILE *obuf, char *prefix) */ int mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, - char *subject) + char *subject, char *header) { struct header head; head.h_to = to; head.h_subject = subject; + head.h_header = header; head.h_cc = cc; head.h_bcc = bcc; head.h_smopts = smopts; @@ -305,6 +306,7 @@ sendmail(void *v) head.h_to = extract(str, GTO); head.h_subject = NULL; + head.h_header = NULL; head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; @@ -509,6 +511,8 @@ puthead(struct header *hp, FILE *fo, int w) if (hp->h_bcc != NULL && w & GBCC) fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++; */ + if (hp->h_header != NULL && w) + fprintf(fo, "%s\n", hp->h_header), gotcha++; if (gotcha && w & GNL) (void)putc('\n', fo); return(0); debian/patches/05-Mailx-fixes.patch0000644000000000000000000000754512224232175014261 0ustar From: Wichert Akkerman Date: Tue, 8 Aug 2000 11:42:00 -0700 Subject: 05 Mailx fixes. mailx (1:8.1.1-10.1.3) frozen unstable; urgency=high * More security fixes * Don't allow to set interactive in mailrc (or interactively) * Modify the variable-handling code to grok NULL values -- Wichert Akkerman Mon, 7 Aug 2000 17:22:57 -0700 mailx (1:8.1.1-10.1.2) frozen unstable; urgency=high * Another security problem: refuse to get the interactive variable from the environment by explicitly setting it in the hashtable. -- Wichert Akkerman Mon, 7 Aug 2000 12:36:10 -0700 --- extern.h | 2 +- mail.1 | 9 ++++++++- main.c | 20 ++++++++++++++++++++ names.c | 10 ++++++---- vars.c | 5 +++-- 5 files changed, 38 insertions(+), 8 deletions(-) diff --git a/extern.h b/extern.h index febe362..c3e5199 100644 --- a/extern.h +++ b/extern.h @@ -75,7 +75,7 @@ char *snarf(char *, int *); char *username(void); char *value(char *); char *vcopy(char *); -char *yankword(char *, char *); +char *yankword(char *, char *, int); int Fclose(FILE *); int More(void *); int Pclose(FILE *); diff --git a/mail.1 b/mail.1 index e7cef0a..0ad08a6 100644 --- a/mail.1 +++ b/mail.1 @@ -1138,10 +1138,17 @@ command; normally, the first five lines are printed. utilizes the .Ev HOME , .Ev LOGNAME , +.Ev USER , +.Ev SHELL , +.Ev DEAD , +.Ev PAGER , +.Ev LISTER , +.Ev EDITOR , +.Ev VISUAL .Ev MAIL , .Ev MAILRC , and -.Ev USER +.Ev MBOX environment variables. .Pp If the diff --git a/main.c b/main.c index db333c4..e070d89 100644 --- a/main.c +++ b/main.c @@ -52,6 +52,7 @@ main(int argc, char **argv) char *subject; char *header = NULL; char *ef; + char* cmd; char nosrc = 0; char *rc; extern const char version[]; @@ -76,6 +77,25 @@ main(int argc, char **argv) (void)signal(SIGPIPE, SIG_IGN); if (isatty(0)) assign("interactive", ""); + + /* + * Grab some stuff from the environment we might use + */ + + if ((cmd = getenv("PAGER"))) + assign("PAGER", cmd); + if ((cmd = getenv("LISTER"))) + assign("LISTER", cmd); + if ((cmd = getenv("SHELL"))) + assign("SHELL", cmd); + if ((cmd = getenv("EDITOR"))) + assign("EDITOR", cmd); + if ((cmd = getenv("VISUAL"))) + assign("VISUAL", cmd); + if ((cmd = getenv("MBOX"))) + assign("MBOX", cmd); + if ((cmd = getenv("DEAD"))) + assign("DEAD", cmd); image = -1; /* * Now, determine how we are being used. diff --git a/names.c b/names.c index a062f5e..f2e61fe 100644 --- a/names.c +++ b/names.c @@ -94,7 +94,7 @@ extract(char *line, int ntype) top = NULL; np = NULL; cp = line; - while ((cp = yankword(cp, nbuf)) != NULL) { + while ((cp = yankword(cp, nbuf, BUFSIZ)) != NULL) { t = nalloc(nbuf, ntype); if (top == NULL) top = t; @@ -155,9 +155,10 @@ detract(struct name *np, int ntype) * Throw away things between ()'s, and take anything between <>. */ char * -yankword(char *ap, char *wbuf) +yankword(char *ap, char *wbuf, int maxsize) { char *cp, *cp2; + int used = 0; cp = ap; for (;;) { @@ -184,10 +185,11 @@ yankword(char *ap, char *wbuf) break; } if (*cp == '<') - for (cp2 = wbuf; *cp && (*cp2++ = *cp++) != '>';) + /* Pre-increment "used" so we leave room for the trailing zero */ + for (cp2 = wbuf; *cp && (++used < maxsize) && (*cp2++ = *cp++) != '>';) ; else - for (cp2 = wbuf; *cp && !strchr(" \t,(", *cp); *cp2++ = *cp++) + for (cp2 = wbuf; *cp && (++used < maxsize) && !strchr(" \t,(", *cp); *cp2++ = *cp++) ; *cp2 = '\0'; return(cp); diff --git a/vars.c b/vars.c index 5ded8cf..59e015b 100644 --- a/vars.c +++ b/vars.c @@ -70,8 +70,7 @@ assign(char *name, char *value) void vfree(char *cp) { - - if (*cp) + if (cp && *cp) (void)free(cp); } @@ -84,6 +83,8 @@ vcopy(char *str) { char *new; + if (str == NULL) + return NULL; if (*str == '\0') return(""); if ((new = strdup(str)) == NULL) debian/patches/06-Use-lockf-instead-of-flock.patch0000644000000000000000000000107012224232175017032 0ustar From: Robert Luberda Date: Tue, 5 Jun 2001 23:08:00 +0200 Subject: 06 Use lockf instead of flock. quit.c: Use lockf instead if flock. --- quit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/quit.c b/quit.c index 7320df9..1d8b5b1 100644 --- a/quit.c +++ b/quit.c @@ -96,7 +96,7 @@ quit(void) fbuf = Fopen(mailname, "r+"); if (fbuf == NULL) goto newmail; - if (flock(fileno(fbuf), LOCK_EX) == -1) { + if (lockf(fileno(fbuf), F_LOCK, 0) == -1) { warn("Unable to lock mailbox"); (void)Fclose(fbuf); return(-1); debian/patches/07-Initialize-head-struct.patch0000644000000000000000000000277012224232175016412 0ustar From: Robert Luberda Date: Wed, 21 Mar 2001 23:07:00 +0100 Subject: 07 Initialize head struct. Initialize head struct and other fixes. --- cmd2.c | 2 +- cmd3.c | 2 ++ collect.c | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd2.c b/cmd2.c index 3a47287..3c7ad91 100644 --- a/cmd2.c +++ b/cmd2.c @@ -171,7 +171,7 @@ save1(char *str, int mark, char *cmd, struct ignoretab *ignore) else disp = "[New file]"; if ((obuf = Fopen(file, "a")) == NULL) { - warn(NULL); + warn("fopen"); return(1); } for (ip = msgvec; *ip && ip-msgvec < msgCount; ip++) { diff --git a/cmd3.c b/cmd3.c index 905144b..066161c 100644 --- a/cmd3.c +++ b/cmd3.c @@ -195,6 +195,7 @@ _respond(msgvec) struct name *np; struct header head; + memset(&head, 0, sizeof(head)); if (msgvec[1] != 0) { puts("Sorry, can't reply to multiple messages at once"); return(1); @@ -603,6 +604,7 @@ _Respond(int *msgvec) struct message *mp; int *ap; char *cp; + memset(&head, 0, sizeof(head)); head.h_to = NULL; for (ap = msgvec; *ap != 0; ap++) { diff --git a/collect.c b/collect.c index 44f1605..3f63597 100644 --- a/collect.c +++ b/collect.c @@ -405,7 +405,7 @@ exwrite(char *name, FILE *fp, int f) /* FIXME: Fopen with "w" will currently prevent writing to an existig file (/dev/null), for now I am not sure this would even marginally useful to allow */ if ((of = Fopen(name, "w")) == NULL) { - warn(NULL); + warn("fopen"); return(-1); } lc = 0; debian/patches/08-Use-liblockfile-library.patch0000644000000000000000000000400612224232175016536 0ustar From: Robert Luberda Date: Wed, 21 Mar 2001 01:05:00 +0100 Subject: 08 Use liblockfile library. Security fix: don't install mailx binary setgid mail. Now the liblockfile library is used for mailbox locking. --- popen.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/popen.c b/popen.c index 5a1cd56..dfd66cd 100644 --- a/popen.c +++ b/popen.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "extern.h" #define READ 0 @@ -421,6 +422,7 @@ free_child(pid_t pid) static int handle_spool_locks(int action) { +#ifndef DEBIAN static FILE *lockfp = NULL; if (action == 0) { @@ -460,6 +462,68 @@ handle_spool_locks(int action) } return(1); +#else + int retval; + char lockpath[PATHSIZE]; + + snprintf(lockpath, PATHSIZE - 1, "%s.lock", mailname); + lockpath[PATHSIZE - 1] = '\0'; + + if (action == 0) { + /* Clear the lock */ + retval = lockfile_remove(lockpath); + if (retval == 0) + return(1); + else + warn("Cannot remove lockfile %s", lockpath); + + } else if (action == 1) { + + retval = lockfile_create(lockpath, 3, 0); + switch (retval) { + case L_SUCCESS: + return(1); + + case L_NAMELEN: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Recipient name too long." + ); + break; + + case L_TMPLOCK: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Error creating temporary lockfile" + ); + break; + + case L_TMPWRITE: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Failed to write pid into tmp lockfile." + ); + break; + + case L_MAXTRYS: + warnx( "Cannot create lockfile %s: %s", + lockpath, + "Failed after max tries." + ); + break; + + case L_ERROR: + default: + warn( "Cannot create lockfile %s", + lockpath + ); + break; + + } + } + + return(0); +#endif } int debian/patches/09-Saved-mbox-message.patch0000644000000000000000000000122012224232175015506 0ustar From: Tollef Fog Heen Date: Sun, 1 Apr 2001 22:31:13 +0200 Subject: 09 Saved mbox message. Debian Bug#68920: Save message says mbox even when $MBOX is set --- quit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/quit.c b/quit.c index 1d8b5b1..44bc21d 100644 --- a/quit.c +++ b/quit.c @@ -287,9 +287,9 @@ quit(void) } (void)Fclose(obuf); if (mcount == 1) - puts("Saved 1 message in mbox"); + printf("Saved 1 message in %s\n", mbox); else - printf("Saved %d messages in mbox\n", mcount); + printf("Saved %d messages in %s\n", mcount, mbox); /* * Now we are ready to copy back preserved files to debian/patches/10-Reply-To-header.patch0000644000000000000000000001727712224232175014773 0ustar From: Robert Luberda Date: Mon, 2 Apr 2001 00:24:00 +0200 Subject: 10 Reply-To header. Applied some patches from FreeBSD: + Add Relpy-To header if REPLYTO environment variable is set. + Add In-Reply-To header for replies (closes: #23115). --- cmd3.c | 9 +++++++++ collect.c | 11 ++++++++++- def.h | 12 ++++++++---- extern.h | 2 +- mail.1 | 13 ++++++++++--- main.c | 8 ++++++-- names.c | 3 ++- send.c | 13 +++++++++++-- 8 files changed, 57 insertions(+), 14 deletions(-) diff --git a/cmd3.c b/cmd3.c index 066161c..20a61c4 100644 --- a/cmd3.c +++ b/cmd3.c @@ -242,6 +242,9 @@ _respond(msgvec) head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; + head.h_replyto = getenv("REPLYTO"); + head.h_inreplyto = skin(hfield("message-id", mp)); + mail1(&head, 1); return(0); } @@ -604,8 +607,10 @@ _Respond(int *msgvec) struct message *mp; int *ap; char *cp; + char *mid; memset(&head, 0, sizeof(head)); + mid = NULL; head.h_to = NULL; for (ap = msgvec; *ap != 0; ap++) { mp = &message[*ap - 1]; @@ -614,6 +619,7 @@ _Respond(int *msgvec) if ((cp = skin(hfield("from", mp))) == NULL) cp = skin(nameof(mp, 2)); head.h_to = cat(head.h_to, extract(cp, GTO)); + mid = skin(hfield("message-id", mp)); } if (head.h_to == NULL) return(0); @@ -624,6 +630,9 @@ _Respond(int *msgvec) head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; + head.h_replyto = getenv("REPLYTO"); + head.h_inreplyto = mid; + mail1(&head, 1); return(0); } diff --git a/collect.c b/collect.c index 3f63597..e3c5460 100644 --- a/collect.c +++ b/collect.c @@ -218,13 +218,22 @@ cont: break; case 's': /* - * Set the Subject list. + * Set the Subject line. */ cp = &linebuf[2]; while (isspace(*cp)) cp++; hp->h_subject = savestr(cp); break; + case 'R': + /* + * Set the Reply-To line. + */ + cp = &linebuf[2]; + while (isspace(*cp)) + cp++; + hp->h_replyto = savestr(cp); + break; case 'c': /* * Add to the CC list. diff --git a/def.h b/def.h index 1905d00..0d1413a 100644 --- a/def.h +++ b/def.h @@ -165,12 +165,14 @@ struct headline { #define GSUBJECT 2 /* Likewise, Subject: line */ #define GCC 4 /* And the Cc: line */ #define GBCC 8 /* And also the Bcc: line */ -#define GMASK (GTO|GSUBJECT|GCC|GBCC) +#define GREPLYTO 0x10 /* And the Reply-To: line */ +#define GINREPLYTO 0x20 /* The In-Reply-To: line */ +#define GMASK (GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO) /* Mask of places from whence */ -#define GNL 16 /* Print blank line after */ -#define GDEL 32 /* Entity removed from list */ -#define GCOMMA 64 /* detract puts in commas */ +#define GNL 0x40 /* Print blank line after */ +#define GDEL 0x80 /* Entity removed from list */ +#define GCOMMA 0x100 /* detract puts in commas */ /* * Structure used to pass about the current @@ -182,6 +184,8 @@ struct header { char *h_header; /* Additional header string */ struct name *h_cc; /* Carbon copies string */ struct name *h_bcc; /* Blind carbon copies */ + char *h_replyto; /* Reply address */ + char *h_inreplyto; /* Reference */ struct name *h_smopts; /* Sendmail options */ }; diff --git a/extern.h b/extern.h index c3e5199..c888a9e 100644 --- a/extern.h +++ b/extern.h @@ -164,7 +164,7 @@ void load(char *); struct var * lookup(char *); int mail (struct name *, struct name *, struct name *, struct name *, - char *, char *); + char *, char *, char *); void mail1(struct header *, int); void makemessage(FILE *, int); void mark(int); diff --git a/mail.1 b/mail.1 index 0ad08a6..32fc10f 100644 --- a/mail.1 +++ b/mail.1 @@ -42,8 +42,7 @@ .Bk -words .Op Fl dEIinv .Op Fl a Ar header -.Op Fl c Ar list -.Op Fl b Ar list +.Op Fl b Ar bcc-addr .Op Fl c Ar cc-addr .Op Fl s Ar subject .Ar to-addr ... @@ -802,6 +801,10 @@ Abort the message being sent, copying the message to in your home directory if .Ic save is set. +.It Ic ~R Ns Ar string +Use +.Ar string +as the Reply-To field. .Pp .It Ic ~r Ns Ar filename .It Ic ~< Ns Ar filename @@ -1068,6 +1071,9 @@ variable is set. The default paginator .Xr more 1 is used if this option is not defined. +.It Ev REPLYTO +If set, will be used to initialize the Reply-To field for outgoing +messages. .It Ev SHELL Pathname of the shell to use in the .Ic !\& @@ -1144,7 +1150,8 @@ utilizes the .Ev PAGER , .Ev LISTER , .Ev EDITOR , -.Ev VISUAL +.Ev VISUAL , +.Ev REPLYTO , .Ev MAIL , .Ev MAILRC , and diff --git a/main.c b/main.c index e070d89..0d02b67 100644 --- a/main.c +++ b/main.c @@ -50,7 +50,8 @@ main(int argc, char **argv) int i; struct name *to, *cc, *bcc, *smopts; char *subject; - char *header = NULL; + char *replyto; + char *header; char *ef; char* cmd; char nosrc = 0; @@ -110,6 +111,8 @@ main(int argc, char **argv) bcc = NULL; smopts = NULL; subject = NULL; + header = NULL; + replyto = NULL; while ((i = getopt(argc, argv, "EINT:a:b:c:defins:u:v")) != -1) { switch (i) { case 'T': @@ -257,6 +260,7 @@ main(int argc, char **argv) spreserve(); if (!nosrc) load(_PATH_MASTER_RC); + replyto = getenv("REPLYTO"); /* * Expand returns a savestr, but load only uses the file name * for fopen, so it's safe to do this. @@ -265,7 +269,7 @@ main(int argc, char **argv) rc = "~/.mailrc"; load(expand(rc)); if (!rcvmode) { - mail(to, cc, bcc, smopts, subject, header); + mail(to, cc, bcc, smopts, subject, header, replyto); /* * why wait? */ diff --git a/names.c b/names.c index f2e61fe..5de6f01 100644 --- a/names.c +++ b/names.c @@ -254,7 +254,8 @@ outof(struct name *names, FILE *fo, struct header *hp) } (void)fcntl(image, F_SETFD, FD_CLOEXEC); fprintf(fout, "From %s %s", myname, date); - puthead(hp, fout, GTO|GSUBJECT|GCC|GNL); + puthead(hp, fout, + GTO|GSUBJECT|GCC|GREPLYTO|GINREPLYTO|GNL); while ((c = getc(fo)) != EOF) (void)putc(c, fout); rewind(fo); diff --git a/send.c b/send.c index f577cb3..969a682 100644 --- a/send.c +++ b/send.c @@ -279,7 +279,7 @@ statusput(struct message *mp, FILE *obuf, char *prefix) */ int mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, - char *subject, char *header) + char *subject, char *header, char *replyto) { struct header head; @@ -288,6 +288,8 @@ mail(struct name *to, struct name *cc, struct name *bcc, struct name *smopts, head.h_header = header; head.h_cc = cc; head.h_bcc = bcc; + head.h_replyto = replyto; + head.h_inreplyto = NULL; head.h_smopts = smopts; mail1(&head, 0); return(0); @@ -309,6 +311,8 @@ sendmail(void *v) head.h_header = NULL; head.h_cc = NULL; head.h_bcc = NULL; + head.h_replyto = getenv("REPLYTO"); + head.h_inreplyto = NULL; head.h_smopts = NULL; mail1(&head, 0); return(0); @@ -466,7 +470,8 @@ infix(struct header *hp, FILE *fi) return(fi); } (void)rm(tempname); - (void)puthead(hp, nfo, GTO|GSUBJECT|GCC|GBCC|GNL|GCOMMA); + (void)puthead(hp, nfo, + GTO|GSUBJECT|GCC|GBCC|GREPLYTO|GINREPLYTO|GNL|GCOMMA); c = getc(fi); while (c != EOF) { (void)putc(c, nfo); @@ -513,6 +518,10 @@ puthead(struct header *hp, FILE *fo, int w) */ if (hp->h_header != NULL && w) fprintf(fo, "%s\n", hp->h_header), gotcha++; + if (hp->h_replyto != NULL && w & GREPLYTO) + fprintf(fo, "Reply-To: %s\n", hp->h_replyto), gotcha++; + if (hp->h_inreplyto != NULL && w & GINREPLYTO) + fprintf(fo, "In-Reply-To: <%s>\n", hp->h_inreplyto), gotcha++; if (gotcha && w & GNL) (void)putc('\n', fo); return(0); debian/patches/11-Showname-option.patch0000644000000000000000000000736112224232175015153 0ustar From: Tormod Volden Date: Sun, 6 May 2001 20:23:48 +0200 Subject: 11 Showname option Debian Bug#96867: Dear mailx maintainer, I have written a patch that mimics the SunOS mailx "showname" option, that is, in the mail header listing the senders full name is shown instead of the e-mail address. I had to make the "skin" function aware of the reptype variable, and thus give a reptype value for each call of skin. Ugly but it seems to work. --- aux.c | 9 +++++++-- cmd1.c | 2 +- cmd3.c | 18 +++++++++--------- extern.h | 2 +- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/aux.c b/aux.c index c401def..b96afb3 100644 --- a/aux.c +++ b/aux.c @@ -367,7 +367,7 @@ nameof(struct message *mp, int reptype) { char *cp, *cp2; - cp = skin(name1(mp, reptype)); + cp = skin(name1(mp, reptype), reptype); if (reptype != 0 || charcount(cp, '!') < 2) return(cp); cp2 = strrchr(cp, '!'); @@ -410,7 +410,7 @@ skip_comment(char *cp) * of "host-phrase." */ char * -skin(char *name) +skin(char *name, int reptype) { char *nbuf, *bufend, *cp, *cp2; int c, gotlt, lastsp; @@ -464,6 +464,11 @@ skin(char *name) break; case '<': + /* in case of showname it is time to return */ + if (reptype == 0 && value("showname") != NULL) { + *cp2 = 0; + return(savestr(nbuf)); + } cp2 = bufend; gotlt++; lastsp = 0; diff --git a/cmd1.c b/cmd1.c index 84186c5..1c7f748 100644 --- a/cmd1.c +++ b/cmd1.c @@ -214,7 +214,7 @@ printhead(int mesg) dispc = 'M'; parse(headline, &hl, pbuf); from = nameof(mp, 0); - to = skin(hfield("to", mp)); + to = skin(hfield("to", mp), 0); np = extract(from, GTO); np = delname(np, myname); if (altnames) diff --git a/cmd3.c b/cmd3.c index 20a61c4..db16208 100644 --- a/cmd3.c +++ b/cmd3.c @@ -203,11 +203,11 @@ _respond(msgvec) mp = &message[msgvec[0] - 1]; touch(mp); dot = mp; - if ((rcv = skin(hfield("from", mp))) == NULL) - rcv = skin(nameof(mp, 1)); - if ((replyto = skin(hfield("reply-to", mp))) != NULL) + if ((rcv = skin(hfield("from", mp), 1)) == NULL) + rcv = skin(nameof(mp, 1), 1); + if ((replyto = skin(hfield("reply-to", mp), 1)) != NULL) np = extract(replyto, GTO); - else if ((cp = skin(hfield("to", mp))) != NULL) + else if ((cp = skin(hfield("to", mp), 1)) != NULL) np = extract(cp, GTO); else np = NULL; @@ -231,7 +231,7 @@ _respond(msgvec) if ((head.h_subject = hfield("subject", mp)) == NULL) head.h_subject = hfield("subj", mp); head.h_subject = reedit(head.h_subject); - if (replyto == NULL && (cp = skin(hfield("cc", mp))) != NULL) { + if (replyto == NULL && (cp = skin(hfield("cc", mp), 2)) != NULL) { np = elide(extract(cp, GCC)); np = delname(np, myname); if (altnames != 0) @@ -243,7 +243,7 @@ _respond(msgvec) head.h_bcc = NULL; head.h_smopts = NULL; head.h_replyto = getenv("REPLYTO"); - head.h_inreplyto = skin(hfield("message-id", mp)); + head.h_inreplyto = skin(hfield("message-id", mp), 1); mail1(&head, 1); return(0); @@ -616,10 +616,10 @@ _Respond(int *msgvec) mp = &message[*ap - 1]; touch(mp); dot = mp; - if ((cp = skin(hfield("from", mp))) == NULL) - cp = skin(nameof(mp, 2)); + if ((cp = skin(hfield("from", mp), 2)) == NULL) + cp = skin(nameof(mp, 2), 2); head.h_to = cat(head.h_to, extract(cp, GTO)); - mid = skin(hfield("message-id", mp)); + mid = skin(hfield("message-id", mp), 1); } if (head.h_to == NULL) return(0); diff --git a/extern.h b/extern.h index c888a9e..919747d 100644 --- a/extern.h +++ b/extern.h @@ -69,7 +69,7 @@ FILE *run_editor(FILE *, off_t, int, int); char *salloc(int); char *savestr(char *); FILE *setinput(struct message *); -char *skin(char *); +char *skin(char *, int); char *skip_comment(char *); char *snarf(char *, int *); char *username(void); debian/patches/12-REPLYTO-can-be-set-in-.mailrc-too.patch0000644000000000000000000000335712224232175017666 0ustar From: Robert Luberda Date: Thu, 12 Jul 2001 19:00:00 +0200 Subject: 12 REPLYTO can be set in .mailrc too. REPLYTO can be set in ~/.mailrc too. --- cmd3.c | 4 ++-- main.c | 4 +++- send.c | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/cmd3.c b/cmd3.c index db16208..abc247f 100644 --- a/cmd3.c +++ b/cmd3.c @@ -242,7 +242,7 @@ _respond(msgvec) head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; - head.h_replyto = getenv("REPLYTO"); + head.h_replyto = value("REPLYTO"); head.h_inreplyto = skin(hfield("message-id", mp), 1); mail1(&head, 1); @@ -630,7 +630,7 @@ _Respond(int *msgvec) head.h_cc = NULL; head.h_bcc = NULL; head.h_smopts = NULL; - head.h_replyto = getenv("REPLYTO"); + head.h_replyto = value("REPLYTO"); head.h_inreplyto = mid; mail1(&head, 1); diff --git a/main.c b/main.c index 0d02b67..82e709f 100644 --- a/main.c +++ b/main.c @@ -97,6 +97,8 @@ main(int argc, char **argv) assign("MBOX", cmd); if ((cmd = getenv("DEAD"))) assign("DEAD", cmd); + if ((cmd = getenv("REPLYTO"))) + assign("REPLYTO", cmd); image = -1; /* * Now, determine how we are being used. @@ -260,7 +262,7 @@ main(int argc, char **argv) spreserve(); if (!nosrc) load(_PATH_MASTER_RC); - replyto = getenv("REPLYTO"); + replyto = value("REPLYTO"); /* * Expand returns a savestr, but load only uses the file name * for fopen, so it's safe to do this. diff --git a/send.c b/send.c index 969a682..83dd737 100644 --- a/send.c +++ b/send.c @@ -311,7 +311,7 @@ sendmail(void *v) head.h_header = NULL; head.h_cc = NULL; head.h_bcc = NULL; - head.h_replyto = getenv("REPLYTO"); + head.h_replyto = value("REPLYTO"); head.h_inreplyto = NULL; head.h_smopts = NULL; mail1(&head, 0); debian/patches/13-Mailx-concatenates-messages.patch0000644000000000000000000000203212224232175017400 0ustar From: Arnaud Giersch Date: Mon, 11 Mar 2002 22:22:03 +0100 Subject: 13 Mailx concatenates messages. Debian Bug#71759 Check if there is still an empty line at the end of the edited message. If not, it adds one. --- edit.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/edit.c b/edit.c index d7a4732..73cc915 100644 --- a/edit.c +++ b/edit.c @@ -112,6 +112,24 @@ edit1(int *msgvec, int type) (void)ignoresig(SIGINT, &oact, &oset); fp = run_editor(setinput(mp), (off_t)mp->m_size, type, readonly); if (fp != NULL) { + int c1, c2; + + /* Check if the last empty line is still here. + * If no, add it. + * (closes Debian bug #71759) + */ + (void)fseek(fp, -2L, SEEK_END); + c2 = getc(fp); + c1 = getc(fp); + (void)fseek(fp, 0L, SEEK_END); + if (c1 != '\n') { + putc('\n', fp); + putc('\n', fp); + } else if (c2 != '\n') { + putc('\n', fp); + } + (void)fflush(fp); + (void)fseek(otf, 0L, SEEK_END); size = ftell(otf); mp->m_block = blockof(size); debian/patches/14-Truncate-mailbox-instead-of-deleting-it.patch0000644000000000000000000000230012224232175021523 0ustar From: Robert Luberda Date: Wed, 27 Mar 2002 00:20:00 +0100 Subject: 14 Truncate mailbox instead of deleting it. fio.c: Don't delete mailbox file, always truncate it, because liblockfile fails to remove the lock file if mailbox doesn't exist (closes: #111537). quit.c: change message saing that mailbox was "removed" to "truncated" (closes: #196682); --- fio.c | 8 ++++++++ quit.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/fio.c b/fio.c index 2de727c..34f8a46 100644 --- a/fio.c +++ b/fio.c @@ -321,6 +321,14 @@ rm(char *name) errno = EISDIR; return(-1); } +#ifdef DEBIAN + /* + * lockfile_remove can't remove a lockfile if a mailbox file + * doesn't exist, so we must not delete it (see Bug#111537). + */ + if (!strcmp (name, mailname)) + return(truncate(name, 0)); +#endif if (unlink(name) == -1) { if (errno == EPERM) return(truncate(name, (off_t)0)); diff --git a/quit.c b/quit.c index 44bc21d..82f87bd 100644 --- a/quit.c +++ b/quit.c @@ -496,7 +496,11 @@ edstop(void) (void)Fclose(obuf); if (gotcha) { (void)rm(mailname); +#ifdef DEBIAN + puts("truncated"); +#else puts("removed"); +#endif } else puts("complete"); fflush(stdout); debian/patches/15-No-space-left-in-tmp.patch0000644000000000000000000000607012224232175015663 0ustar From: Arnaud Giersch Date: Sun, 6 Nov 2011 23:59:06 +0100 Subject: 15 No space left in /tmp Debian Bug#37104 The problem reported here, i.e. a segmentation fault when reading mail is already corrected. The message "Message temporary file corrupted" is printed by a call to "errx" instead of "panic" as it was in mailx-8.1.1-10. *But* there is another problem[1]: mailx sends an empty mail when there is no space left in "/tmp". Here is a patch making mailx check if all is ok when writing new mail in temporary file. If not, it outputs an error message and no longer sends an empty mail. --- collect.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/collect.c b/collect.c index e3c5460..6da0913 100644 --- a/collect.c +++ b/collect.c @@ -151,8 +151,10 @@ cont: break; if (linebuf[0] != escape || value("interactive") == NULL || lastlong) { - if (putline(collf, linebuf, !longline) < 0) + if (putline(collf, linebuf, !longline) < 0) { + warn("%s", tempname); goto err; + } continue; } c = linebuf[1]; @@ -163,10 +165,12 @@ cont: * Otherwise, it's an error. */ if (c == escape) { - if (putline(collf, &linebuf[1], !longline) < 0) + if (putline(collf, &linebuf[1], !longline) < 0) { + warn("%s", tempname); goto err; - else + } else { break; + } } puts("Unknown tilde escape."); break; @@ -284,6 +288,7 @@ cont: lc++; if ((t = putline(collf, linebuf, rc != LINESIZE-1)) < 0) { + warn("%s", tempname); (void)Fclose(fbuf); goto err; } @@ -305,7 +310,10 @@ cont: } if ((cp = expand(cp)) == NULL) break; - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } exwrite(cp, collf, 1); break; case 'm': @@ -335,7 +343,10 @@ cont: * Print out the current state of the * message without altering anything. */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } puts("-------\nMessage contains:"); puthead(hp, stdout, GTO|GSUBJECT|GCC|GBCC|GNL); while ((t = getc(collf)) != EOF) @@ -346,7 +357,10 @@ cont: * Pipe message through command. * Collect output as new message. */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } mespipe(collf, &linebuf[2]); goto cont; case 'v': @@ -356,7 +370,10 @@ cont: * 'e' means to use EDITOR * 'v' means to use VISUAL */ - rewind(collf); + if (fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + goto err; + } mesedit(collf, c); goto cont; } @@ -384,8 +401,11 @@ err: collf = NULL; } out: - if (collf != NULL) - rewind(collf); + if (collf != NULL && fseek(collf, 0L, SEEK_SET)) { + warn("%s", tempname); + (void)Fclose(collf); + collf = NULL; + } noreset--; return(collf); } debian/patches/16-Stdin-not-a-tty.patch0000644000000000000000000000112712224232175014776 0ustar From: Robert Luberda Date: Tue, 18 Jun 2002 22:58:00 +0200 Subject: 16 Stdin not a tty. Return from grabh() if stdin is not a terminal. This fixes the `-I' option (closes: #149005). --- tty.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tty.c b/tty.c index 8adc37a..219f434 100644 --- a/tty.c +++ b/tty.c @@ -70,6 +70,10 @@ grabh(struct header *hp, int gflags) char *s; int error; + /* do nothing if not on tty, see Debian Bug #149005 */ + if (!isatty(0)) + return 0; + sigemptyset(&act.sa_mask); act.sa_flags = SA_RESTART; act.sa_handler = SIG_DFL; debian/patches/17-Intialize-tv_used.patch0000644000000000000000000000113412224232175015461 0ustar From: Robert Luberda Date: Thu, 11 Jul 2002 05:30:00 +0200 Subject: 17 Intialize tv_used aux.c: in function alter() do initialize tv_usec part of the timeval structure used to set modification time on the mailbox file (closes: #152038). Thanks to John Girash for help. --- aux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/aux.c b/aux.c index b96afb3..a89830b 100644 --- a/aux.c +++ b/aux.c @@ -338,6 +338,7 @@ alter(char *name) TIMESPEC_TO_TIMEVAL(&tv[1], &sb.st_mtimespec); #else tv[1].tv_sec = sb.st_mtime; + tv[1].tv_usec = 0; #endif (void)utimes(name, tv); } debian/patches/18-Wait-for-sendmail.patch0000644000000000000000000000375312224232175015356 0ustar From: Robert Luberda Date: Sat, 24 Aug 2002 22:18:00 +0200 Subject: 18 Wait for sendmail. * send.c: Always wait for a sendmail process, check its exit code and if non-zero, print a warning message to user and save original message to ~/dead.letter (closes: #145379). * popen.c: Make wait_child() return an exit code of the child. --- popen.c | 12 +++++++++--- send.c | 15 +++++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/popen.c b/popen.c index dfd66cd..691827e 100644 --- a/popen.c +++ b/popen.c @@ -291,8 +291,12 @@ prepare_child(sigset_t *nset, int infd, int outfd) int wait_command(pid_t pid) { - - if (wait_child(pid) < 0) { + int ret; + ret = wait_child(pid); + if (ret > 0) { + printf("Fatal error, process exited with code %d.\n", ret); + return(-1); + } else if (ret < 0) { puts("Fatal error in process."); return(-1); } @@ -388,7 +392,9 @@ wait_child(pid_t pid) if (cp != NULL) delchild(cp); sigprocmask(SIG_SETMASK, &oset, NULL); - if (rv == -1 || (WIFEXITED(wait_status) && WEXITSTATUS(wait_status))) + if (rv >= 0 && (WIFEXITED(wait_status))) + return (WEXITSTATUS(wait_status)); + else return(-1); else return(0); diff --git a/send.c b/send.c index 83dd737..4886c14 100644 --- a/send.c +++ b/send.c @@ -330,6 +330,7 @@ mail1(struct header *hp, int printheaders) char **namelist; struct name *to; FILE *mtf; + int w; /* * Collect user's mail from standard input. @@ -413,10 +414,24 @@ mail1(struct header *hp, int printheaders) warn("%s", cp); _exit(1); } +#ifndef DEBIAN if (value("verbose") != NULL) (void)wait_child(pid); else free_child(pid); +#else + /* + * Always wait for sendmail and check its error code. + * See: Bug#145379 + */ + if ((w = wait_child(pid))) { + fprintf(stderr, "Can't send mail: sendmail process failed"); + if (w > 0) + fprintf(stderr, " with error code %d", w); + fprintf(stderr, "\n"); + savedeadletter(mtf); + } +#endif out: (void)Fclose(mtf); } debian/patches/19-Fix-compilation-on-Hurd.patch0000644000000000000000000000134712224232175016446 0ustar From: Robert Luberda Date: Tue, 14 Oct 2003 20:50:00 +0200 Subject: 19 Fix compilation on Hurd. Fix problem with building on Hurd (closes: #213929). --- def.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/def.h b/def.h index 0d1413a..4aad744 100644 --- a/def.h +++ b/def.h @@ -63,7 +63,11 @@ #define ESCAPE '~' /* Default escape for sending */ #define NMLSIZE 1024 /* max names in a message list */ +#ifdef MAXPATHLEN #define PATHSIZE MAXPATHLEN /* Size of pathnames throughout */ +#else +#define PATHSIZE 4096 +#endif #define HSHSIZE 59 /* Hash size for aliases and vars */ #define LINESIZE BUFSIZ /* max readable line width */ #define STRINGSIZE ((unsigned) 128)/* Dynamic allocation units */ debian/patches/20-Don-t-delete-temporary-file.patch0000644000000000000000000000206512224232175017236 0ustar From: Robert Luberda Date: Wed, 31 Mar 2004 23:01:00 +0200 Subject: 20 Don't delete temporary file If the external editor (called by ~e or ~v commands) fails for some reason, don't delete the temporary file if it has been modified. This partly fixes bug#148071. --- edit.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/edit.c b/edit.c index 73cc915..d951139 100644 --- a/edit.c +++ b/edit.c @@ -216,7 +216,22 @@ run_editor(FILE *fp, off_t size, int type, int readonly) edit = _PATH_VI; } if (editit(edit, tempname) == -1) { - (void)rm(tempname); + /* + * Don't delete the file if user has changed it + * See Debian bug#148071 + * robert@debian.org, 2004.03.30 + */ + if ( !readonly && + !stat(tempname, &statb) && + (modtime != statb.st_mtime)) { + printf( + "Saved changed message in %s\n" + "Please note that this file is located in temporary\n" + "directory and may disappear without any notice\n", + tempname); + } else { + (void)rm(tempname); + } goto out; } /* debian/patches/21-Use-wordexpr-instead-of-echo.patch0000644000000000000000000000523612224232175017433 0ustar From: Robert Luberda Date: Wed, 3 Nov 2004 20:52:00 +0100 Subject: 21 Use wordexpr instead of echo. fio.c: Use wordexpr() instead of calling /bin/echo not to allow executing external commands while expanding shell variables and wildcards. --- fio.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ names.c | 5 +++-- 2 files changed, 53 insertions(+), 2 deletions(-) diff --git a/fio.c b/fio.c index 34f8a46..f8a76a1 100644 --- a/fio.c +++ b/fio.c @@ -39,6 +39,10 @@ #include #include "extern.h" +#ifdef DEBIAN +#include +#endif + /* * Mail -- a mail program * @@ -422,12 +426,16 @@ expand(char *name) { char xname[PATHSIZE]; char cmdbuf[PATHSIZE]; /* also used for file names */ +#ifdef DEBIAN + wordexp_t p; +#else pid_t pid; int l; char *cp, *shell; int pivec[2]; struct stat sbuf; extern int wait_status; +#endif /* * The order of evaluation is "%" and "#" expand into constants. @@ -463,6 +471,47 @@ expand(char *name) } if (strpbrk(name, "~{[*?$`'\"\\") == NULL) return(name); +#ifdef DEBIAN + { + *xname = '\0'; + memset(&p, 0, sizeof(p)); + switch (wordexp(name, &p, WRDE_NOCMD)) { + case 0: /* OK */ + if (p.we_wordc == 0) { + fprintf(stderr, "\"%s\": No match.\n", name); + } else if (p.we_wordc > 1) { + fprintf(stderr, "\"%s\": Ambiguous.\n", name); + } else if (strlen(p.we_wordv[0]) >= PATHSIZE) { + fprintf(stderr, "\"%s\": Expansion buffer overflow.\n", name); + } else { + strncpy(xname, p.we_wordv[0], PATHSIZE); + }; + break; + case WRDE_NOSPACE: + fprintf(stderr, "\"%s\": Out of memory.\n", name); + break; + case WRDE_BADVAL: + case WRDE_BADCHAR: + case WRDE_SYNTAX: + fprintf(stderr, "\"%s\": Syntax error.\n", name); + break; + case WRDE_CMDSUB: + fprintf(stderr, "\"%s\": Command execution not allowed.\n", name); + break; + default: + fprintf(stderr, "\"%s\": Unknown expansion error.\n", name); + break; + } + + wordfree(&p); + if (!*xname) + return (NULL); + else + return(savestr(xname)); + + } +#else + /* XXX - just use glob(3) and env expansion instead? */ if (pipe(pivec) < 0) { warn("pipe"); @@ -505,6 +554,7 @@ expand(char *name) return(NULL); } return(savestr(xname)); +#endif } /* diff --git a/names.c b/names.c index 5de6f01..51b7426 100644 --- a/names.c +++ b/names.c @@ -348,6 +348,7 @@ int isfileaddr(char *name) { char *cp; + int ret = 0; if (*name == '+') return(1); @@ -355,9 +356,9 @@ isfileaddr(char *name) if (*cp == '!' || *cp == '%' || *cp == '@') return(0); if (*cp == '/') - return(1); + ret=1; } - return(0); + return(ret); } /* debian/patches/22-Replace-newlines-with-spaces.patch0000644000000000000000000000201712224232175017501 0ustar From: Robert Luberda Date: Thu, 3 May 2007 12:30:00 +0200 Subject: 22 Replace newlines with spaces. main.c: Replace with spaces any embeded newline passed in arguments for '-s' and '-a' options (closes: #419840). --- main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.c b/main.c index 82e709f..0b73fdb 100644 --- a/main.c +++ b/main.c @@ -149,11 +149,16 @@ main(int argc, char **argv) case 'd': debug++; break; +#define REMOVE_NEWLINES(arg) { char *t; \ + for (t = (arg); *t; t++) \ + if (*t == '\n' || *t == '\r') *t = ' '; \ + } case 's': /* * Give a subject field for sending from * non terminal */ + REMOVE_NEWLINES(optarg); subject = optarg; break; @@ -162,6 +167,7 @@ main(int argc, char **argv) * Give additional header fields for sending from * non terminal */ + REMOVE_NEWLINES(optarg); if (header == NULL) { if ((header = (char *)malloc(strlen(optarg)+1)) != NULL) strcpy(header, optarg); debian/patches/24-False-cant-send-email-errors.patch0000644000000000000000000001034312224232175017365 0ustar From: Ivan Zahariev Date: Wed, 7 Oct 2009 20:50:11 +0300 Subject: 24 False cant send email errors. Debian Bug #550116: This bug is caused by the patch in "send.c" for the bug report #145379. Under certain circumstances, a race condition can occur if: 1. The parent fork()'s a process and exec()'s "sendmail" in "send.c". The child process is born. 2. The child starts, finishes quickly and exits. The parent has not called wait_child(pid) in "send.c" yet. 3. The parent immediately gets SIGCHLD because the child exited already. The sigchild() handler in "popen.c" reaps the child via waitpid() and exits directly because findchild(pid, 1) returned NULL. It returned NULL because the PID of the child process has not been added to the "child" structure list at all. 4. The execution of the parent process is resumed in "send.c", and it now calls wait_child(pid). The function wait_child(pid) returns "-1" because wait_child(pid) in "popen.c" calls waitpid(pid, ...) again for the same child PID, which the sigchild() handler already reaped. The second call to findchild(pid, 1) by wait_child(pid) in "popen.c" returns NULL too, because as already stated the PID of the child process has not been added to the "child" structure list. As a result, the false error message "Can't send mail: sendmail process failed" is given. This bug happens only rarely, usually when the system is under load and the parent process lags a bit after the child one. But it does happen. We send about 15 messages every hour on 36 servers each, and we get 10 false error messages on average for 24 hours (0.08% false error rate). --- extern.h | 1 + popen.c | 9 +++++++++ send.c | 30 ++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) diff --git a/extern.h b/extern.h index 919747d..c2642fe 100644 --- a/extern.h +++ b/extern.h @@ -126,6 +126,7 @@ void fixhead(struct header *, struct name *); void fmt(char *, struct name *, FILE *, int); int folders(void *); int forward(char *, FILE *, char *, int); +int add_child(pid_t); void free_child(pid_t); int from(void *); off_t fsize(FILE *); diff --git a/popen.c b/popen.c index 691827e..d0cb372 100644 --- a/popen.c +++ b/popen.c @@ -396,6 +396,15 @@ wait_child(pid_t pid) return (WEXITSTATUS(wait_status)); else return(-1); +} + +/* + * Mark that we will wait for this child via SIGCHLD, or waitpid() manually, and we want its exit status stored. + */ +int +add_child(pid_t pid) { + if (!findchild(pid, 0/* alloc if not present */)) + return(-1); // this should never happen else return(0); } diff --git a/send.c b/send.c index 4886c14..af242a1 100644 --- a/send.c +++ b/send.c @@ -331,6 +331,7 @@ mail1(struct header *hp, int printheaders) struct name *to; FILE *mtf; int w; + sigset_t parent_nset, parent_oset; /* * Collect user's mail from standard input. @@ -384,6 +385,15 @@ mail1(struct header *hp, int printheaders) } if ((cp = value("record")) != NULL) (void)savemail(expand(cp), mtf); + + /* + * Block the SIGCHLD signal temporarily, until we fork() a child and add its PID to the struct child "child" list. + * See: Bug#550116 + */ + sigemptyset(&parent_nset); + sigaddset(&parent_nset, SIGCHLD); + sigprocmask(SIG_BLOCK, &parent_nset, &parent_oset); + /* * Fork, set up the temporary mail file as standard * input for "mail", and exec with the user list we generated @@ -398,6 +408,12 @@ mail1(struct header *hp, int printheaders) if (pid == 0) { sigset_t nset; + /* + * Restore the original signal mask which we altered in the parent, just in case. + * See: Bug#550116 + */ + sigprocmask(SIG_SETMASK, &parent_oset, NULL); + sigemptyset(&nset); sigaddset(&nset, SIGHUP); sigaddset(&nset, SIGINT); @@ -414,6 +430,20 @@ mail1(struct header *hp, int printheaders) warn("%s", cp); _exit(1); } + + /* + * Add the PID to the struct child "child" list or else the sigchild() handler may reap the child + * before we manage to reap it in wait_child(). + * Then restore the original signal mask. + * See: Bug#550116 + */ + if (add_child(pid)) { + fprintf(stderr, "findchild() failed"); // this should never happen + } + sigprocmask(SIG_SETMASK, &parent_oset, NULL); + + + #ifndef DEBIAN if (value("verbose") != NULL) (void)wait_child(pid); debian/patches/25-Fix-confusing-error.patch0000644000000000000000000000141612224232175015732 0ustar From: Robert Luberda Date: Sun, 6 Oct 2013 10:30:36 +0200 Subject: 25 Fix confusing error Fix an error message shown when -s, -c, or -b is used without -t to be less confusing for users (closes: #327809). --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 0b73fdb..ebe98cc 100644 --- a/main.c +++ b/main.c @@ -249,7 +249,7 @@ main(int argc, char **argv) * Check for inconsistent arguments. */ if (to == NULL && (subject != NULL || cc != NULL || bcc != NULL)) - errx(1, "You must specify direct recipients with -s, -c, or -b"); + errx(1, "You must specify direct recipients with -t when -s, -c, or -b is used"); if (ef != NULL && to != NULL) errx(1, "Cannot give -f and people to send to"); /* debian/patches/series0000644000000000000000000000137312224232175012036 0ustar 00-Makefiles.patch 01-Fix-includes.patch 02-Base-fixes-1.patch 03-Base-fixes-2.patch 04-Add-custom-header.patch 05-Mailx-fixes.patch 06-Use-lockf-instead-of-flock.patch 07-Initialize-head-struct.patch 08-Use-liblockfile-library.patch 09-Saved-mbox-message.patch 10-Reply-To-header.patch 11-Showname-option.patch 12-REPLYTO-can-be-set-in-.mailrc-too.patch 13-Mailx-concatenates-messages.patch 14-Truncate-mailbox-instead-of-deleting-it.patch 15-No-space-left-in-tmp.patch 16-Stdin-not-a-tty.patch 17-Intialize-tv_used.patch 18-Wait-for-sendmail.patch 19-Fix-compilation-on-Hurd.patch 20-Don-t-delete-temporary-file.patch 21-Use-wordexpr-instead-of-echo.patch 22-Replace-newlines-with-spaces.patch 24-False-cant-send-email-errors.patch 25-Fix-confusing-error.patch debian/rules0000755000000000000000000000063712224232175010254 0ustar #!/usr/bin/make -f include /usr/share/dpkg/architecture.mk ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) export CC = $(DEB_HOST_GNU_TYPE)-gcc else export CC = gcc endif %: dh "$@" --parallel override_dh_auto_clean: # Don't try to run make clean on unpatched version of Makefile ! grep -q DEBIAN Makefile || dh_auto_clean override_dh_installchangelogs: dh_installchangelogs -a debian/EXT/ChangeLog debian/source.lintian-overrides0000644000000000000000000000006212224232175014044 0ustar bsd-mailx source: source-contains-cvs-control-dir debian/source/0000755000000000000000000000000012224232175010466 5ustar debian/source/format0000644000000000000000000000001412224232175011674 0ustar 3.0 (quilt) debian/source/options0000644000000000000000000000002712224232175012103 0ustar diff-ignore tar-ignore