*** KNOWNBUGS.OLD	Sun Nov  7 10:28:55 1993
--- KNOWNBUGS	Wed Jan 12 06:00:44 1994
***************
*** 1,7 ****
  
  
  	     K N O W N   B U G S   I N   S E N D M A I L
! 			     (for 8.6.3)
  
  
  The following are bugs or deficiencies in sendmail that I am aware of
--- 1,7 ----
  
  
  	     K N O W N   B U G S   I N   S E N D M A I L
! 			     (for 8.6.5)
  
  
  The following are bugs or deficiencies in sendmail that I am aware of
***************
*** 9,23 ****
  want to get the most up to date version of this from FTP.CS.Berkeley.EDU
  in /ucb/sendmail/KNOWNBUGS.
  
! * "SYSERR: openmailer(local): fd 1 not open" message
  
-   File descriptor 1 (standard output) should not be closed during normal
-   processing.  This is checked periodically, and sometimes this condition
-   is found and this message is produced.  Sendmail repairs the problem,
-   and the mail is still delivered, but I still don't know why it happens.
-   (There was a bug that was fixed in 8.6.beta.13 that might be related,
-   but I think this bug still exists.)
  
  * Null bytes are not handled properly.
  
    Sendmail should handle full binary data.  As it stands, it handles
--- 9,25 ----
  want to get the most up to date version of this from FTP.CS.Berkeley.EDU
  in /ucb/sendmail/KNOWNBUGS.
  
! This list is not guaranteed to be complete, especially for fixed bugs.
! Many bugs are reported and fixed without ever making it as far as this
! file.  See the file RELEASE_NOTES (in the root directory of the sendmail
! distribution) for more details.
  
  
+ +----------------------------------------------+
+ | THE FOLLOWING PROBLEMS ARE STILL OUTSTANDING |
+ +----------------------------------------------+
+ 
+ 
  * Null bytes are not handled properly.
  
    Sendmail should handle full binary data.  As it stands, it handles
***************
*** 26,37 ****
    restructuring of the code -- for example, almost no C library support
    could be used to handle strings.
  
- * Route-addrs missing angle brackets.
- 
-   There are cases where route-addrs do not get angle brackets around them,
-   such as in the "-r" flag on mailers or in the From_ line created when
-   mailing to files.
- 
  * Duplicate error messages.
  
    Sometimes identical, duplicate error messages can be generated.  As
--- 28,33 ----
***************
*** 56,59 ****
    this address.  It's not clear what the right behaviour is in this
    circumstance.
  
! (Version 8.9, last updated 10/31/93)
--- 52,171 ----
    this address.  It's not clear what the right behaviour is in this
    circumstance.
  
! * REDIRECT aliases don't work with `n' option.
! 
!   If you have option `n' set when you use newaliases and have
!   REDIRECT addresses in your aliases file, you'll get the error
!   messages during the newaliases instead of when email is sent to
!   the address in question.  The workaround is to turn off the `n'
!   option.
! 
! * MX records that point at non-existent hosts work strangly.
! 
!   Consider the DNS records:
! 
! 	hostH	MX	1 hostA
! 		MX	2 hostB
! 	hostA	A	128.32.8.9
! 
!   (note that there is no A record for hostB).  If hostA is down,
!   an attempt to send to hostH gives "host unknown" -- that is, it
!   reflects out the status on the last host it tries, which in this
!   case is hostB, which is unknown.  It probably ought to eliminate
!   hostB early in processing.
! 
! * NAME environment variables with commas break.
! 
!   If you define your NAME environment variable to have a comma
!   (e.g., ``Lastname, Firstname''), and you are using the $q definition
!   that uses ``name <address>'' format, sendmail treats the first and
!   last names as two addresses, thus producing a bogus From line.  You
!   can work around this by changing the $q definition to use
!   ``address (name)''.
! 
! * \231 considered harmful.
! 
!   Header addresses that have the \231 character (and possibly others
!   in the range \201 - \237) behave in odd and usually unexpected ways.
! 
! * DEC Alphas (OSF/1 1.3) sometimes time out on sending mail.
! 
!   I have one report that DEC Alphas acting as SMTP clients sometimes
!   will apparently not see the "250 OK" message in response to the
!   dot that indicates the end of the message.  This only happens if
!   the message is run from the queue -- if it gets through on first
!   try, everything is fine.  I have been unable to reproduce this
!   problem at Berkeley.
! 
! * accept() problem on SVR4.
! 
!   Apparently, the sendmail daemon loop (doing accept()s on the network)
!   can get into a wierd state on SVR4; it starts logging ``SYSERR:
!   getrequests: accept: Protocol Error''.  The workaround is to kill
!   and restart the sendmail daemon.  We don't have an SVR4 system at
!   Berkeley that carries more than token mail load, so I can't validate
!   this.  It is likely to be a glitch in the sockets emulation, since
!   "Protocol Error" is not possible error code with Berkeley TCP/IP.
! 
!   I've also had someone report the message ``sendmail: accept:
!   SIOCGPGRP failed errno 22'' on an SVR4 system.  This message is
!   not in the sendmail source code, so I assume it is also a bug
!   in the sockets emulation.  (Errno 22 is EINVAL "Invalid Argument"
!   on all the systems I have available, including Solaris 2.x.)
! 
! * Sending user deletion not done properly in :include: lists.
! 
!   If you don't have the "m" (me too) option set, then a person
!   sending to a list that contains themselves should not get a copy
!   of the message.  However, if that list points to a :include: file
!   that has one address per line, this will break, and the sender
!   will always get a copy of their own message, just as though the
!   "m" option were set.
! 
!   You can eliminate this by adding commas at the end of each line
!   of the :include: file.
! 
! 
! +-------------------------------------------+
! | THE FOLLOWING PROBLEMS ARE FIXED IN 8.6.5 |
! +-------------------------------------------+
! 
! * Route-addrs missing angle brackets.
! 
!   There are cases where route-addrs do not get angle brackets around them,
!   such as in the "-r" flag on mailers or in the From_ line created when
!   mailing to files.
! 
! * No "exposed users" in "nullrelay" configuration.
! 
!   The "nullrelay" configuration hides all addresses behind the mail
!   hub name.  Some sites might prefer to expose some names such as
!   root.  This information is always available in Received: lines.
! 
! * owner-* alias that uses :include: broken.
! 
!   If you have aliases set up as:
! 
! 	owner-listname:		:include:/some/file
! 
!   sendmail will break because it considers this a "sender address",
!   which is not permitted to use the :include: syntax.  The easiest
!   workaround is to change this to:
! 
! 	owner-listname:		:include:/some/file,
! 
!   (note the trailing comma); a somewhat cleaner solution is to use:
! 
! 	owner-listname:		listname-request
! 	listname-request:	:include:/some/file
! 
! * "SYSERR: openmailer(local): fd 1 not open" message
! 
!   File descriptor 1 (standard output) should not be closed during normal
!   processing.  This is checked periodically, and sometimes this condition
!   is found and this message is produced.  Sendmail repairs the problem,
!   and the mail is still delivered, but I still don't know why it happens.
!   (There was a bug that was fixed in 8.6.beta.13 that might be related,
!   but I think this bug still exists.)
! 
! (Version 8.15, last updated 1/12/94)
*** READ_ME.OLD	Thu Nov 25 07:55:57 1993
--- READ_ME	Tue Jan  4 07:52:09 1994
***************
*** 1,5 ****
  /*-
!  *	@(#)READ_ME	8.5 (Berkeley) 9/28/93
   */
  
  			SENDMAIL RELEASE 8
--- 1,5 ----
  /*-
!  *	@(#)READ_ME	8.8 (Berkeley) 1/4/94
   */
  
  			SENDMAIL RELEASE 8
***************
*** 41,46 ****
--- 41,83 ----
  macro set that is compatible with these macros.
  
  
+ +-----------------------+
+ | RELATED DOCUMENTATION |
+ +-----------------------+
+ 
+ There are other files you should read.  Rooted in this directory are:
+ 
+   CHANGES-R5-R8
+ 	Describes changes between Release 5 and Release 8 of sendmail.
+ 	There are some things that may behave somewhat differently.
+ 	For example, the rules governing when :include: files will
+ 	be read have been tightened up for security reasons.
+   FAQ
+ 	Answers to Frequently Asked Questions.
+   KNOWNBUGS
+ 	Known bugs in the current release.  I try to keep this up
+ 	to date -- get the latest version from FTP.CS.Berkeley.EDU
+ 	in /ucb/sendmail/KNOWNBUGS.
+   RELEASE_NOTES
+ 	A detailed description of the changes in each version.  This
+ 	is quite long, but informative.
+   src/READ_ME
+ 	Details on compiling and installing sendmail.
+   cf/README
+ 	Details on configuring sendmail.
+   doc/op/op.me
+ 	The sendmail Installation & Operations Guide.  Be warned: if
+ 	you are running this off on SunOS or some other system with an
+ 	old version of -me, you need to add the following macro to the
+ 	macros:
+ 
+ 		.de sm
+ 		\s-1\\$1\\s0\\$2
+ 		..
+ 
+ 	This sets a word in a smaller pointsize.
+ 
+ 
  +--------------+
  | RELATED RFCS |
  +--------------+
***************
*** 96,101 ****
--- 133,169 ----
  faster, and the interface is nicer to animals and plants.  You will
  also probably find that you have to add -I/where/you/put/db/include
  to the sendmail makefile to get db.h to work properly.
+ 
+ 
+ +-------------+
+ | USE WITH MH |
+ +-------------+
+ 
+ This version of sendmail notices and reports certain kinds of SMTP
+ protocol violations that were ignored by older versions.  If you
+ are running MH you may wish to install the patch in contrib/mh.patch
+ that will prevent these warning reports.  This patch also works
+ with the old version of sendmail, so it's safe to go ahead and
+ install it.
+ 
+ 
+ +-----------+
+ | MAKEFILES |
+ +-----------+
+ 
+ The Makefiles in this release use the new Berkeley "make" that is
+ available in BSD Net/2 and 4.4BSD.  If you are using this version
+ of make, you may notice one or two places where the Makefile includes
+ "../../Makefile.inc".  This file is not included with the sendmail
+ distribution because it's not part of sendmail.  However, it is,
+ in toto:
+ 
+ 	#	@(#)Makefile.inc	8.1 (Berkeley) 6/6/93
+ 
+ 	BINDIR?=	/usr/sbin
+ 
+ The other directories should all have Makefile.dist files that work
+ on the old make.  For more details, see src/READ_ME.
  
  
  +---------------------+
*** RELEASE_NOTES.OLD	Sun Nov  7 10:29:11 1993
--- RELEASE_NOTES	Thu Jan 13 06:45:11 1994
***************
*** 1,3 ****
--- 1,287 ----
+ 8.6.5/8.6.5	94/01/13
+ 	Security fix:  /.forward could be owned by anyone (the test
+ 		to allow root to own any file was backwards).  From
+ 		Bob Campbell at U.C. Berkeley.
+ 	Security fix: group ids were not completely set when programs
+ 		were invoked.  This caused programs to have group
+ 		permissions they should not have had (usually group
+ 		daemon instead of their own group).  In particular,
+ 		Perl scripts would refuse to run.
+ 	Security: check to make sure files that are written are not
+ 		symbolic links (at least under some circumstances).
+ 		Although this does not respond to a specific known
+ 		attack, it's just a good idea.  Suggested by
+ 		Christian Wettergren.
+ 	Security fix: if a user had an NFS mounted home directory on
+ 		a system with a restricted shell listed in their
+ 		/etc/passwd entry, they could still execute any
+ 		program by putting that in their .forward file.
+ 		This fix prevents that by insisting that their shell
+ 		appear in /etc/shells before allowing a .forward to
+ 		execute a program or write a file.  You can disable
+ 		this by putting "*" in /etc/shells.  It also won't
+ 		permit world-writable :include: files to reference
+ 		programs or files (there's no way to disable this).
+ 		These behaviours are only one level deep -- for
+ 		example, it is legal for a world-writable :include:
+ 		file to reference an alias that writes a file, on
+ 		the assumption that the alias file is well controlled.
+ 	Security fix: root was not treated suspiciously enough when
+ 		looking into subdirectories.  This would potentially
+ 		allow a cracker to examine files that were publically
+ 		readable but in a non-publically searchable directory.
+ 	Fix a problem that causes an error on QUIT on a cached
+ 		connection to create problems on the current job.
+ 		These are typically unrelated, so errors occur in
+ 		the wrong place.
+ 	Reset CurrentLA in sendall() -- this makes sendmail queue
+ 		runs more responsive to load average, and fixes a
+ 		problem that ignored the load average in locally
+ 		generated mail.  From Eric Wassenaar.
+ 	Fix possible core dump on aliases with null LHS.  From
+ 		John Orthoefer of BB&N.
+ 	Revert to using flock() whenever possible -- there are just
+ 		too many bugs in fcntl() locking, particularly over
+ 		NFS, that cause sendmail to fail in perverse ways.
+ 	Fix a bug that causes the connection cache to get confused
+ 		when sending error messages.  This resulted in
+ 		"unexpected close" messages.  It should fix itself
+ 		on the following queue run.  Problem noted by
+ 		Liudvikas Bukys of Rochester University.
+ 	Include $k in $=k as documented in the Install & Op Guide.
+ 		This seems odd, but it was documented....  From
+ 		Michael Corrigan of UCSD.
+ 	Fix problem that caused :include:s from alias files to be
+ 		forced to be owned by root instead of daemon
+ 		(actually DefUid).  From Tim Irvin.
+ 	Diagnose unrecognized I option values -- from Mortin Forssen
+ 		of the Chalmers University of Technology.
+ 	Make "error" mailer work consistently when there is no error
+ 		code associated with it -- previously it returned OK
+ 		even though there was a real problem.  Now it assumes
+ 		EX_UNAVAILABLE.
+ 	Fix bug that caused the last header line of messages that had
+ 		no body and which were terminated with EOF instead of
+ 		"." to be discarded.  Problem noted by Liudvikas Bukys.
+ 	Fix core dump on SMTP mail to programs that failed -- it tried
+ 		to go to a "next MX host" when none existed, causing
+ 		a core dump.  From der Mouse at McGill University.
+ 	Change IDENTPROTO from a defined/not defined to a 0/1 switch;
+ 		this makes it easier to turn it off (using
+ 		-DIDENTPROTO=0 in the Makefile).  From der Mouse.
+ 	Fix YP_MASTER_NAME store to use the unupdated result of
+ 		gethostname() (instead of myhostname(), which tries
+ 		to fully qualify the name) to be consistent with
+ 		SunOS.  If your hostname is unqualified, this fixes
+ 		transfers to slave servers.  Bug noted by Keith
+ 		McMillan of Ameritech Services, Inc.
+ 	Fix Ultrix problem: gethostbyname() can return a very large
+ 		(> 500) h_length field, which causes the sockaddr
+ 		to be trashed.  Use the size of the sockaddr instead.
+ 		Fix from Bob Manson of Ohio State.
+ 	Don't assume "-a." on host lookups if NAMED_BIND is not
+ 		defined -- this confuses gethostbyname on hosts
+ 		file lookups, which doesn't understand the trailing
+ 		dot convention.
+ 	Log SMTP server subprocesses that die with a signal instead
+ 		of from a clean exit.
+ 	If you don't have option "I" set, don't assume that a DNS
+ 		"host unknown" message is authoritative -- it
+ 		might still be found in /etc/hosts.
+ 	Fix a problem that would cause Deferred: messages to be sent
+ 		as the subject of an error message, even though the
+ 		actual cause of a message was more severe than that.
+ 		Problem noted by Chris Seabrook of OSSI.
+ 	Fix race condition in DBM alias file locking.  From Kyle
+ 		Jones of UUNET.
+ 	Limit delivery syslog line length to avoid bugs in some
+ 		versions of syslog(3).  This adds a new compile time
+ 		variable SYSLOG_BUFSIZE.  From Jay Plett of Princeton
+ 		University, which is in turn derived from IDA.
+ 	Fix quotes inside of comments in addresses -- previously
+ 		it insisted that they be balanced, but the 822 spec
+ 		says that they should be ignored.
+ 	Dump open file state to syslog upon receiving SIGUSR1 (for
+ 		debugging).  This also evaluates ruleset 89, if set
+ 		(with the null input), and logs the result.  This
+ 		should be used sparingly, since the rewrite process
+ 		is not reentrant.
+ 	Change -qI, -qR, and -qS flags to be case-insensitive as
+ 		documented in the Bat Book.
+ 	If the mailer returned EX_IOERR or EX_OSERR, sendmail did not
+ 		return an error message and did not requeue the message.
+ 		Fix based on code from Roland Dirlewanger of
+ 		Reseau Regional Aquarel, Bordeaux, France.
+ 	Fix a problem that caused a seg fault if you got a 421 error
+ 		code during some parts of connection initialization.
+ 		I've only seen this when talking to buggy mailers on
+ 		the other end, but it shouldn't give a seg fault in
+ 		any case.  From Amir Plivatsky.
+ 	Fix core dump caused by a ruleset call that returns null.
+ 		Fix from Bryan Costales of ICSI.
+ 	Full-Name: field was being ignored.  Fix from Motonori Nakamura
+ 		of Kyoto University.
+ 	Fix a possible problem with very long input lines in setproctitle.
+ 		From P{r Emanuelsson.
+ 	Avoid putting "This is a warning message" out on return receipts.
+ 		Suggested by Douglas Anderson.
+ 	Detect loops caused by recursive ruleset calls.  Suggested by
+ 		Bryan Costales.
+ 	Initialize non-alias maps during alias rebuilds -- they may be
+ 		needed for parsing.  Problem noted by Douglas Anderson.
+ 	Log sender address even if no message was collected in SMTP
+ 		(e.g., if all RCPTs failed).  Suggested by Motonori
+ 		Nakamura.
+ 	Don't reflect the owner-list contents into the envelope sender
+ 		address if the value contains ", :, /, or | (to avoid
+ 		illegal addresses appearing there).
+ 	Efficiency hack for toktype macro -- from Craig Partridge of
+ 		BB&N.
+ 	Clean up DNS error printing so that a host name is always
+ 		included.
+ 	Remember to set $i during queue runs.  Reported by Stephen
+ 		Campbell of Dartmouth University.
+ 	If ${HOSTALIASES} is set, use it during canonification so that
+ 		headers are properly mapped.  Reported by Anne Bennett
+ 		of Concordia University.
+ 	Avoid printing misleading error message if SMTP mailer (not
+ 		using [IPC]) should die on a core dump.
+ 	Avoid incorrect diagnosis of "file 1 closed" when it is caused
+ 		by the other end closing the connection.  From
+ 		Dave Morrison of Oracle.
+ 	Improve several of the error messages printed by "mailq"
+ 		to include a host name or other useful information.
+ 	Add preliminary NetInfo support for NeXT systems.  From Vince
+ 		DeMarco.
+ 	Fix a glitch that sometimes caused :include:s that pointed to
+ 		NFS filesystems that were down to give an "aliasing/
+ 		forwarding loop broken" message instead of queueing
+ 		the message for retry.  Noted by William C Fenner of
+ 		the NRL Connection Machine Facility.
+ 	Fix a problem that could cause a core dump if the input sequence
+ 		had (or somehow acquired) a \231 character.
+ 	Make sure that route-addrs always have <angle brackets> around
+ 		them in non-SMTP envelopes (SMTP envelopes already do
+ 		this properly).
+ 	Avoid wierd headers on unbalanced punctuation of the form:
+ 		``Joe User <user)'' -- this caused reference to the
+ 		null macro.  Fix from Rick McCarty of IO.COM.
+ 	Fix a problem that caused an alias "user: user@local.host" to
+ 		not have the QNOTREMOTE bit set; this caused configs
+ 		to act as if FEATURE(notsticky) was defined even when
+ 		it was not.  The effect of the problem was to make it
+ 		very hard to to set up satellite sites that had a few
+ 		local accounts, with everything else forwarded to a
+ 		corporate hub.  Reported by Detlef Drewanz of the
+ 		University of Rostock and Mark Frost of NCD.
+ 	Change queuing to not call rulesets 3, {1 or 2}, 4 on header
+ 		addresses.  This is more efficient (fewer name server
+ 		calls) and fixes certain unusual configurations, such
+ 		as those that have ruleset 4 do something that is
+ 		non-idempotent unless a mailer-specific ruleset did
+ 		something else.  Problem reported by Brian J. Coan
+ 		of the Institute for Global Communications.
+ 	Fix the "obsolete argument" routine in main to better understand
+ 		new arguments.  For example, if you used ``sendmail
+ 		-C config -v -q'' it would choke on the -q because
+ 		the -C would stop looking for old-format arguments.
+ 	Portability fixes for:
+ 		SCO UNIX from Murray Kucherawy.
+ 		SCO Open Server 3.2v4 from Philippe Brand.
+ 		System V Release 4 from Rick Ellis and others.
+ 		OSF/1 from Steve Campbell.
+ 		DG/UX from Ben Mesander of the USGS and Bryan Curnutt
+ 			of Stoner Associates.
+ 		Motorola SysV88 from Kevin Johnson of Motorola.
+ 		Solaris 2.3 from Casper H.S. Dik of the University
+ 			of Amsterdam and John Caruso of University
+ 			of Maryland.
+ 		FreeBSD from Ollivier Robert.
+ 		NetBSD from Adam Glass.
+ 		TitanOS from Kate Hedstrom of Rutgers University.
+ 		Irix from Bryan Curnutt.
+ 		Dynix from Jim Davis of the University of Arizona.
+ 		RISC/os.
+ 		Linux from John Kennedy of California State University
+ 			at Chico.
+ 		Solaris 2.x from Tony Boner of the U.S. Air Force.
+ 		NEXTSTEP 3.x from Vince DeMarco.
+ 		HP-UX from various people.  NOTA BENE:  the location
+ 			of the config file has moved to /usr/lib
+ 			to match the HP-UX version of sendmail.
+ 	CONFIG: Don't do any recipient rewriting on relay mailer;
+ 		since this is intended only for internal use, the
+ 		usual RFC 821/822/1123 rules can be relaxed.  The
+ 		main point of this is to avoid munging (ugh) UUCP
+ 		addresses when relaying internally.
+ 	CONFIG: fix typo in mailer/uucp.m4 that mutilates list:;
+ 		syntax addresses delivered via UUCP.  Solution
+ 		provided by Peter Wemm.
+ 	CONFIG: fix thumb-fumble in default UUCP relaying in ruleset
+ 		zero; it caused double @ signs in addresses.  From
+ 		Irving Reid of the University of Toronto.
+ 	CONFIG: Portability fixes for SCO Unix 3.2 with TCP/IP 1.2.1
+ 		from Markku Toijala of ICL Personal Systems Oy.
+ 	CONFIG: Add trailing "." on pseudo-domains for consistency;
+ 		this fixes a problem (noted by Al Whaley of Sunnyside)
+ 		that made it hard to recognize your own pseudodomain
+ 		names.
+ 	CONFIG: catch "@host" syntax errors (i.e., null local-parts)
+ 		rather than letting them get "local configuration
+ 		error"s.  Problem noted by John Gardiner Myers.
+ 	CONFIG: add uucp-uudom mailer variant, based on code posted
+ 		by Spider Boardman <spider@Orb.Nashua.NH.US>; this
+ 		has uucp-dom semantics but old UUCP syntax.  This
+ 		also permits "uucp-old" as an alias for "uucp" and
+ 		"uucp-new" as a synonym for "suucp" for consistency.
+ 	CONFIG: add POP mailer support (from Kimmo Suominen
+ 		<kim@grendel.lut.fi>).
+ 	CONFIG: drop CSNET_RELAY support -- CSNET is long gone.
+ 	CONFIG: fix bug caused with domain literal addresses (e.g.,
+ 		``[128.32.131.12]'') when FEATURE(allmasquerade)
+ 		was set; it would get an additional @masquerade.host
+ 		added to the address.  Problem noted by Peter Wan
+ 		of Georgia Tech.
+ 	CONFIG: make sure that the local UUCP name is in $=w.  From
+ 		Jim Murray of Stratus.
+ 	CONFIG: changes to UUCP rewriting to simulate IDA-style "V"
+ 		mailer flag.  Briefly, if you are sending to host
+ 		"foo", then it rewrites "foo!...!baz" to "...!baz",
+ 		"foo!baz" remains "foo!baz", and anything else has
+ 		the local name prepended.
+ 	CONFIG: portability fixes for HP-UX.
+ 	DOC: several minor problems fixed in the Install & Op Guide.
+ 	MAKEMAP: fix core dump problem on lines that are too long or
+ 		which lack newline.  From Mark Delany.
+ 	MAILSTATS: print sums of columns (total messages & kbytes
+ 		in and out of the system).  From Tom Ferrin of UC
+ 		San Francisco Computer Graphics Lab.
+ 	SIGNIFICANT USER- OR SYSAD-VISIBLE CHANGES:
+ 		On HP-UX, /etc/sendmail.cf has been moved to
+ 			/usr/lib/sendmail.cf to match HP sendmail.
+ 		Permissions have been tightened up on world-writable
+ 			:include: files and accounts that have shells
+ 			that are not listed in /etc/shells.  This may
+ 			cause some .forward files that have worked
+ 			before to start failing.
+ 		SIGUSR1 dumps some state to the log.
+ 	NEW FILES:
+ 		src/Makefile.DGUX
+ 		src/Makefile.Dynix
+ 		src/Makefile.FreeBSD
+ 		src/Makefile.Mach386
+ 		src/Makefile.NetBSD
+ 		src/Makefile.RISCos
+ 		src/Makefile.SCO
+ 		src/Makefile.SVR4
+ 		src/Makefile.Titan
+ 		cf/mailer/pop.m4
+ 		cf/ostype/bsdi1.0.m4
+ 		cf/ostype/dgux.m4
+ 		cf/ostype/dynix3.2.m4
+ 		cf/ostype/sco3.2.m4
+ 		makemap/Makefile.dist
+ 		praliases/Makefile.dist
+ 
  8.6.4/8.6.4	93/10/31
  	Repair core-dump problem (write to read-only memory segment)
  		if you fall back to the return-to-Postmaster case in
*** cf/README.OLD	Mon Nov  8 13:14:32 1993
--- cf/README	Wed Jan 12 06:19:02 1994
***************
*** 4,10 ****
  
  		Eric Allman <eric@CS.Berkeley.EDU>
  
! 		@(#)README	8.15 (Berkeley) 10/31/93
  
  
  This document describes the sendmail configuration files being used
--- 4,10 ----
  
  		Eric Allman <eric@CS.Berkeley.EDU>
  
! 		@(#)README	8.21 (Berkeley) 1/12/94
  
  
  This document describes the sendmail configuration files being used
***************
*** 31,40 ****
  This package requires a post-V7 version of m4; if you are running the
  4.2bsd, SysV.2, or 7th Edition version, I suggest finding a friend with
  a newer version.  You can m4-expand on their system, then run locally.
! SunOS's /usr/5bin/m4 or BSD-Net/2's m4 both work.  GNU m4 (which is a
! language unto itself) also works, but I don't intend to work so hard
! to keep this up in the future.  [Note to GNU folks:  the construct
! "define(`FOO')" should work without my having to add a null value.]
  
  IF YOU DON'T HAVE A BERKELEY MAKE, don't despair!  Just run
  "m4 foo.mc > foo.cf" -- that should be all you need.  There is also
--- 31,39 ----
  This package requires a post-V7 version of m4; if you are running the
  4.2bsd, SysV.2, or 7th Edition version, I suggest finding a friend with
  a newer version.  You can m4-expand on their system, then run locally.
! SunOS's /usr/5bin/m4 or BSD-Net/2's m4 both work.  GNU m4 version 1.1
! also works.  Unfortunately, I'm told that the M4 on BSDI 1.0 doesn't
! work -- you'll have to use a Net/2 or GNU version.
  
  IF YOU DON'T HAVE A BERKELEY MAKE, don't despair!  Just run
  "m4 foo.mc > foo.cf" -- that should be all you need.  There is also
***************
*** 52,58 ****
--- 51,64 ----
  configuration files can do; clever people can probably tweak them
  to great effect.  But it should get you started.
  
+ *******************************************************************
+ ***  BE SURE YOU CUSTOMIZE THESE FILES!  They have some		***
+ ***  Berkeley-specific assumptions built in, such as the name	***
+ ***  of our UUCP-relay.  You'll want to create your own domain	***
+ ***  description, and use that in place of domain/Berkeley.m4.	***
+ *******************************************************************
  
+ 
  +--------------------------+
  | INTRODUCTION AND EXAMPLE |
  +--------------------------+
***************
*** 186,193 ****
  		connected.
  BITNET_RELAY	The host that will forward BITNET-addressed email.
  		If not defined, the .BITNET pseudo-domain won't work.
- CSNET_RELAY	The host that will forward CSNET-addressed email.
- 		If not defined, the .CSNET pseudo-domain won't work.
  LOCAL_RELAY	The site that will handle unqualified names -- that
  		is, names with out an @domain extension.  If not set,
  		they are assumed to belong on this machine.  This
--- 192,197 ----
***************
*** 241,252 ****
  		is for when you know that the UUCP mailer at the other
  		end can handle multiple recipients in one transfer.
  		When you invoke this, sendmail looks for all names in
! 		the $=U class and sends them to the uucp mailer; all
! 		names in the $=Y class are sent to suucp.  Note that
  		this is a function of what version of rmail runs on
  		the receiving end, and hence may be out of your control.
! 		If smtp is defined, it also defines a "uucp-dom" mailer
! 		that uses domain-style rewriting.
  
  usenet		Usenet (network news) delivery.  If this is specified,
  		an extra rule is added to ruleset 0 that forwards all
--- 245,259 ----
  		is for when you know that the UUCP mailer at the other
  		end can handle multiple recipients in one transfer.
  		When you invoke this, sendmail looks for all names in
! 		the $=U class and sends them to the uucp-old mailer; all
! 		names in the $=Y class are sent to uucp-new; and all
! 		names in the $=Z class are sent to uucp-uudom.  Note that
  		this is a function of what version of rmail runs on
  		the receiving end, and hence may be out of your control.
! 		If smtp is defined, it also defines "uucp-dom" and
! 		"uucp-uudom" mailers that use domain-style rewriting.
! 		See the section below describing UUCP mailers in more
! 		detail.
  
  usenet		Usenet (network news) delivery.  If this is specified,
  		an extra rule is added to ruleset 0 that forwards all
***************
*** 258,264 ****
--- 265,273 ----
  		on Sam Leffler's FlexFAX software.  For more information,
  		see below.
  
+ pop		Post Office Protocol.
  
+ 
  +----------+
  | FEATURES |
  +----------+
***************
*** 433,438 ****
--- 442,533 ----
  least in the same company).
  
  
+ +--------------------+
+ | USING UUCP MAILERS |
+ +--------------------+
+ 
+ It's hard to get UUCP mailers right because of the extremely ad hoc
+ nature of UUCP addressing.  These config files are really designed
+ for domain-based addressing, even for UUCP sites.
+ 
+ There are four UUCP mailers available.  The choice of which one to
+ use is partly a matter of local preferences and what is running at
+ the other end of your UUCP connection.  Unlike good protocols that
+ define what will go over the wire, UUCP uses the policy that you
+ should do what is right for the other end; if they change, you have
+ to change.  This makes it hard to do the right thing, and discourages
+ people from updating their software.  In general, if you can avoid
+ UUCP, please do.
+ 
+ The major choice is whether to go for a domainized scheme or a
+ non-domainized scheme.  This depends entirely on what the other
+ end will recognize.  If at all possible, you should encourage the
+ other end to go to a domain-based system -- non-domainized addresses
+ don't work entirely properly.
+ 
+ The four mailers are:
+ 
+     uucp-old (obsolete name: "uucp")
+ 	This is the oldest, the worst (but the closest to UUCP) way of
+ 	sending messages accros UUCP connections.  It does bangify
+ 	everything and prepends $U (your UUCP name) to the sender's
+ 	address (which can already be a bang path itself).  It can
+ 	only send to one address at a time, so it spends a lot of
+ 	time copying duplicates of messages.  Avoid this if at all
+ 	possible.
+ 
+     uucp-new (obsolete name: "suucp")
+ 	The same as above, except that it assumes that in one rmail
+ 	command you can specify several recipients.  It still has a
+ 	lot of other problems.
+ 
+     uucp-dom
+ 	This UUCP mailer keeps everything as domain addresses.
+ 	Basically, it uses the SMTP mailer rewriting rules.
+ 
+ 	Unfortunately, a lot of UUCP mailer transport agents require
+ 	bangified addresses in the envelope, although you can use
+ 	domain-based addresses in the message header.  (The envelope
+ 	shows up as the From_ line on UNIX mail.)  So....
+ 
+     uucp-uudom
+ 	This is a cross between uucp-new (for the envelope addresses)
+ 	and uucp-dom (for the header addresses).  It bangifies the
+ 	envelope sender (From_ line in messages) without adding the
+ 	local hostname, unless there is no host name on the address
+ 	at all (e.g., "wolf") or the host component is a UUCP host name
+ 	instead of a domain name ("somehost!wolf" instead of
+ 	"some.dom.ain!wolf").
+ 
+ Examples:
+ 
+ We are on host grasp.insa-lyon.fr (UUCP host name "grasp").  The
+ following summarizes the sender rewriting for various mailers.
+ 
+ Mailer          sender		rewriting in the envelope
+ ------		------		-------------------------
+ uucp-{old,new}	wolf		grasp!wolf
+ uucp-dom	wolf		wolf@grasp.insa-lyon.fr
+ uucp-uudom	wolf		grasp.insa-lyon.fr!wolf
+ 
+ uucp-{old,new}	wolf@fr.net	grasp!fr.net!wolf
+ uucp-dom	wolf@fr.net	wolf@fr.net
+ uucp-uudom	wolf@fr.net	fr.net!wolf
+ 
+ uucp-{old,new}	somehost!wolf	grasp!somehost!wolf
+ uucp-dom	somehost!wolf	somehost!wolf@grasp.insa-lyon.fr
+ uucp-uudom	somehost!wolf	grasp.insa-lyon.fr!somehost!wolf
+ 
+ If you are using one of the domainized UUCP mailers, you really want
+ to convert all UUCP addresses to domain format -- otherwise, it will
+ do it for you (and probably not the way you expected).  For example,
+ if you have the address foo!bar!baz (and you are not sending to foo),
+ the heuristics will add the @uucp.relay.name or @local.host.name to
+ this address.  However, if you map foo to foo.host.name first, it
+ will not add the local hostname.  You can do this using the uucpdomain
+ feature.
+ 
+ 
  +-------------------+
  | TWEAKING RULESETS |
  +-------------------+
***************
*** 826,832 ****
--- 921,934 ----
  the option is only included to provide back-compatibility.  These are
  marked with "*".
  
+ Remember that these options are M4 variables, and hence may need to
+ be quoted.  In particular, arguments with commas will usually have to
+ be ``double quoted, like this phrase'' to avoid having the comma
+ confuse things.  This is common for alias file definitions and for
+ the read timeout.
+ 
  M4 Variable Name	Default		Mac/Opt	Description
+ ================	=======		=======	===========
  confMAILER_NAME		MAILER-DAEMON	Dn	The sender name used for
  						internally generated
  						outgoing messages.
***************
*** 846,853 ****
  						SMTP mail.
  confBLANK_SUB		.		OB	Blank (space) substitution
  						character.
! confCON_EXPENSIVE	False		Oc	Connect immediately to
! 						mailers marked expensive?
  confCHECKPOINT_INTERVAL	10		OC	Checkpoint queue files
  						every N recipients.
  confDELIVERY_MODE	background	Od	Default delivery mode.
--- 948,955 ----
  						SMTP mail.
  confBLANK_SUB		.		OB	Blank (space) substitution
  						character.
! confCON_EXPENSIVE	False		Oc	Avoid connecting immediately
! 						to mailers marked expensive?
  confCHECKPOINT_INTERVAL	10		OC	Checkpoint queue files
  						every N recipients.
  confDELIVERY_MODE	background	Od	Default delivery mode.
***************
*** 1019,1026 ****
  MAILERS
  
     0	local, prog	local and program mailers
!    1	smtp		SMTP channel
!    2	uucp		UNIX-to-UNIX Copy Program
     3	netnews		Network News delivery
     4	fax		Sam Leffler's FlexFAX software
  
--- 1121,1128 ----
  MAILERS
  
     0	local, prog	local and program mailers
!    1	[e]smtp, relay	SMTP channel
!    2	uucp-*		UNIX-to-UNIX Copy Program
     3	netnews		Network News delivery
     4	fax		Sam Leffler's FlexFAX software
  
***************
*** 1029,1035 ****
  
     A
     B	Bitnet Relay
!    C	CSNET Relay
     D	The local domain -- usually not needed
     E
     F	FAX Relay
--- 1131,1137 ----
  
     A
     B	Bitnet Relay
!    C
     D	The local domain -- usually not needed
     E
     F	FAX Relay
*** cf/cf/Makefile.OLD	Wed Dec  1 11:54:48 1993
--- cf/cf/Makefile	Wed Dec  1 11:55:31 1993
***************
*** 1,4 ****
! #	@(#)Makefile	8.4 (Berkeley) 10/15/93
  
  M4=	m4
  #M4=	/usr/src/usr.bin/m4/obj/m4
--- 1,4 ----
! #	@(#)Makefile	8.5 (Berkeley) 12/1/93
  
  M4=	m4
  #M4=	/usr/src/usr.bin/m4/obj/m4
***************
*** 15,20 ****
--- 15,21 ----
  
  ALL=	cs-hidden.cf cs-exposed.cf \
  	hpux-cs-exposed.cf hpux-cs-hidden.cf \
+ 	riscos-cs-exposed.cf \
  	sunos3.5-cs-exposed.cf sunos3.5-cs-hidden.cf \
  	sunos4.1-cs-exposed.cf sunos4.1-cs-hidden.cf \
  	ultrix4.1-cs-exposed.cf ultrix4.1-cs-hidden.cf \
*** cf/domain/Berkeley.m4.OLD	Tue Oct  5 13:28:20 1993
--- cf/domain/Berkeley.m4	Mon Dec 20 10:49:11 1993
***************
*** 33,42 ****
  # SUCH DAMAGE.
  #
  divert(0)
! VERSIONID(`@(#)Berkeley.m4	8.3 (Berkeley) 10/5/93')
  define(`UUCP_RELAY', `ucbvax.Berkeley.EDU')dnl
  define(`BITNET_RELAY', `jade.Berkeley.EDU')dnl
- define(`CSNET_RELAY', `Relay.CV.COM')dnl
  define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')dnl
  define(`confCW_FILE', `-o /etc/sendmail.cw')dnl
  FEATURE(redirect)dnl
--- 33,41 ----
  # SUCH DAMAGE.
  #
  divert(0)
! VERSIONID(`@(#)Berkeley.m4	8.4 (Berkeley) 12/20/93')
  define(`UUCP_RELAY', `ucbvax.Berkeley.EDU')dnl
  define(`BITNET_RELAY', `jade.Berkeley.EDU')dnl
  define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')dnl
  define(`confCW_FILE', `-o /etc/sendmail.cw')dnl
  FEATURE(redirect)dnl
*** cf/feature/bitdomain.m4.OLD	Tue Nov 30 08:58:24 1993
--- cf/feature/bitdomain.m4	Tue Nov 30 09:01:07 1993
***************
*** 34,40 ****
  #
  
  divert(0)
! VERSIONID(`@(#)bitdomain.m4	8.3 (Berkeley) 8/7/93')
  divert(-1)
  
  
--- 34,40 ----
  #
  
  divert(0)
! VERSIONID(`@(#)bitdomain.m4	8.4 (Berkeley) 11/30/93')
  divert(-1)
  
  
***************
*** 45,49 ****
  
  PUSHDIVERT(8)
  # handle BITNET mapping
! R$* < @ $+ .BITNET > $*		$: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3
  POPDIVERT
--- 45,49 ----
  
  PUSHDIVERT(8)
  # handle BITNET mapping
! R$* < @ $+ .BITNET. > $*	$: $1 < @ $(bitdomain $2 $: $2.BITNET. $) > $3
  POPDIVERT
*** cf/feature/redirect.m4.OLD	Mon Jun  7 10:10:46 1993
--- cf/feature/redirect.m4	Mon Dec 27 14:48:46 1993
***************
*** 34,46 ****
  #
  
  divert(0)
! VERSIONID(`@(#)redirect.m4	8.1 (Berkeley) 6/7/93')
  divert(-1)
  
  
  PUSHDIVERT(3)
  # addresses sent to foo@host.REDIRECT will give a 551 error code
! R$* < @ $+ .REDIRECT >	$# error $@ NOUSER $: "551 User not local; please try " <$1@$2>
  POPDIVERT
  
  PUSHDIVERT(6)
--- 34,46 ----
  #
  
  divert(0)
! VERSIONID(`@(#)redirect.m4	8.2 (Berkeley) 12/27/93')
  divert(-1)
  
  
  PUSHDIVERT(3)
  # addresses sent to foo@host.REDIRECT will give a 551 error code
! R$* < @ $+ .REDIRECT. >	$# error $@ NOUSER $: "551 User not local; please try " <$1@$2>
  POPDIVERT
  
  PUSHDIVERT(6)
*** cf/feature/uucpdomain.m4.OLD	Tue Nov 30 07:18:13 1993
--- cf/feature/uucpdomain.m4	Tue Nov 30 09:01:08 1993
***************
*** 34,40 ****
  #
  
  divert(0)
! VERSIONID(`@(#)uucpdomain.m4	8.3 (Berkeley) 8/7/93')
  divert(-1)
  
  
--- 34,40 ----
  #
  
  divert(0)
! VERSIONID(`@(#)uucpdomain.m4	8.4 (Berkeley) 11/30/93')
  divert(-1)
  
  
***************
*** 45,49 ****
  
  PUSHDIVERT(8)
  # handle UUCP mapping
! R$* < @ $+ .UUCP > $*		$: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3
  POPDIVERT
--- 45,49 ----
  
  PUSHDIVERT(8)
  # handle UUCP mapping
! R$* < @ $+ .UUCP. > $*		$: $1 < @ $(uudomain $2 $: $2.UUCP. $) > $3
  POPDIVERT
*** cf/m4/cf.m4.OLD	Sun Jul 18 10:58:54 1993
--- cf/m4/cf.m4	Fri Dec 24 06:34:40 1993
***************
*** 51,56 ****
--- 51,57 ----
  
  changecom()
  undefine(`format')
+ undefine(`hpux')
  ifdef(`pushdef', `',
  	`errprint(`You need a newer version of M4, at least as new as
  System V or GNU')
***************
*** 92,98 ****
  define(`SITECONFIG',
  `CONCAT(D, $3, $2)
  define(`_CLASS_$3_', `')dnl
! ifelse($3, U, Cw$2, `dnl')
  define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
  		CONCAT(CY, $'1`),
  		CONCAT(C, $3, $'1`))')
--- 93,99 ----
  define(`SITECONFIG',
  `CONCAT(D, $3, $2)
  define(`_CLASS_$3_', `')dnl
! ifelse($3, U, Cw$2 $2.UUCP, `dnl')
  define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
  		CONCAT(CY, $'1`),
  		CONCAT(C, $3, $'1`))')
***************
*** 145,148 ****
  define(`confTRY_NULL_MX_LIST', `False')
  
  divert(0)dnl
! VERSIONID(`@(#)cf.m4	8.2 (Berkeley) 7/18/93')
--- 146,149 ----
  define(`confTRY_NULL_MX_LIST', `False')
  
  divert(0)dnl
! VERSIONID(`@(#)cf.m4	8.4 (Berkeley) 12/24/93')
*** cf/m4/proto.m4.OLD	Tue Nov 23 09:55:51 1993
--- cf/m4/proto.m4	Thu Jan 13 06:40:24 1994
***************
*** 34,40 ****
  #
  divert(0)
  
! VERSIONID(`@(#)proto.m4	8.20 (Berkeley) 10/31/93')
  
  MAILER(local)dnl
  
--- 34,40 ----
  #
  divert(0)
  
! VERSIONID(`@(#)proto.m4	8.30 (Berkeley) 1/12/94')
  
  MAILER(local)dnl
  
***************
*** 93,104 ****
  CPBITNET
  
  ')dnl
- ifdef(`CSNET_RELAY',
- `# CSNET relay host
- DC`'CSNET_RELAY
- CPCSNET
- 
- ')dnl
  ifdef(`FAX_RELAY',
  `# FAX relay host
  DF`'FAX_RELAY
--- 93,98 ----
***************
*** 185,191 ****
  # substitution for space (blank) characters
  OB`'confBLANK_SUB
  
! # connect to "expensive" mailers on initial submission?
  Oc`'confCON_EXPENSIVE
  
  # checkpoint queue runs after every N successful deliveries
--- 179,185 ----
  # substitution for space (blank) characters
  OB`'confBLANK_SUB
  
! # avoid connecting to "expensive" mailers on initial submission?
  Oc`'confCON_EXPENSIVE
  
  # checkpoint queue runs after every N successful deliveries
***************
*** 420,425 ****
--- 414,422 ----
  R$+ < $+ @ $+ >		$1 $2 < @ $3 >			move gaze right
  R$+ < @ $+ >		$@ $>_SET_96_ $1 < @ $2 >		already canonical
  
+ # do some sanity checking
+ R$* < @ $* : $* > $*	$1 < @ $2 $3 > $4		nix colons in addrs
+ 
  ifdef(`_NO_UUCP_', `dnl',
  `# convert old-style addresses to a domain-based address
  R$- ! $+		$@ $>_SET_96_ $2 < @ $1 .UUCP >	resolve uucp names
***************
*** 458,488 ****
  ifdef(`_NO_UUCP_', `dnl',
  `ifdef(`UUCP_RELAY',
  `# pass UUCP addresses straight through
! R$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP > $3',
  `# if really UUCP, handle it immediately
  ifdef(`_CLASS_U_',
! `R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
  ifdef(`_CLASS_V_',
! `R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
  ifdef(`_CLASS_W_',
! `R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
  ifdef(`_CLASS_X_',
! `R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
  ifdef(`_CLASS_Y_',
! `R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP > $3', `dnl')
  
  # try UUCP traffic as a local address
! R$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP > $3
  ifdef(`_OLD_SENDMAIL_',
! `R$* < @ $+ . $+ . UUCP > $*		$@ $1 < @ $2 . $3 . > $4',
! `R$* < @ $+ . . UUCP > $*		$@ $1 < @ $2 . > $3')')
  ')
! ifdef(`_NO_CANONIFY_',
! `# make sure local host names appear canonical
! R$* < @ $=w > $*		$: $1 < @ $2 . > $3',
  `# pass to name server to make hostname canonical
  R$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
  
  undivert(8)dnl
  
  # if this is the local hostname, make sure we treat is as canonical
--- 455,488 ----
  ifdef(`_NO_UUCP_', `dnl',
  `ifdef(`UUCP_RELAY',
  `# pass UUCP addresses straight through
! R$* < @ $+ . UUCP > $*		$@ $1 < @ $2 . UUCP . > $3',
  `# if really UUCP, handle it immediately
  ifdef(`_CLASS_U_',
! `R$* < @ $=U . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
  ifdef(`_CLASS_V_',
! `R$* < @ $=V . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
  ifdef(`_CLASS_W_',
! `R$* < @ $=W . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
  ifdef(`_CLASS_X_',
! `R$* < @ $=X . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
  ifdef(`_CLASS_Y_',
! `R$* < @ $=Y . UUCP > $*	$@ $1 < @ $2 . UUCP . > $3', `dnl')
  
  # try UUCP traffic as a local address
! R$* < @ $+ . UUCP > $*		$: $1 < @ $[ $2 $] . UUCP . > $3
  ifdef(`_OLD_SENDMAIL_',
! `R$* < @ $+ . $+ . UUCP . > $*		$@ $1 < @ $2 . $3 . > $4',
! `R$* < @ $+ . . UUCP . > $*		$@ $1 < @ $2 . > $3')')
  ')
! ifdef(`_NO_CANONIFY_', `dnl',
  `# pass to name server to make hostname canonical
  R$* < @ $* $~P > $*		$: $1 < @ $[ $2 $3 $] > $4')
  
+ # local host aliases and pseudo-domains are always canonical
+ R$* < @ $=w > $*		$: $1 < @ $2 . > $3
+ R$* < @ $* $=P > $*		$: $1 < @ $2 $3 . > $4
+ R$* < @ $* . . > $*		$1 < @ $2 . > $3
+ 
  undivert(8)dnl
  
  # if this is the local hostname, make sure we treat is as canonical
***************
*** 534,539 ****
--- 534,540 ----
  
  R<@>			$#_LOCAL_ $: <>			special case error msgs
  R$*:;<@>		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
+ R<@ $+>			$#error $@ USAGE $: "user address required"
  
  ifdef(`_MAILER_smtp_',
  `# handle numeric address spec
***************
*** 540,546 ****
  ifdef(`_NO_CANONIFY_', `dnl',
  `R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr')
  R$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
! R$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 @ [$2] $3	still numeric: send',
  	`dnl')
  
  # now delete the local info -- note $=O to find characters that cause forwarding
--- 541,547 ----
  ifdef(`_NO_CANONIFY_', `dnl',
  `R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	numeric internet addr')
  R$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
! R$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
  	`dnl')
  
  # now delete the local info -- note $=O to find characters that cause forwarding
***************
*** 564,570 ****
  ifdef(`_LOCAL_NOT_STICKY_',
  `R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
  R$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
! `R$+ < @ $=w . >		$: $1 < @ $2 @ $H >		first try hub
  ifdef(`_OLD_SENDMAIL_',
  `R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
  R$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
--- 565,571 ----
  ifdef(`_LOCAL_NOT_STICKY_',
  `R$=L < @ $=w . >		$#_LOCAL_ $: @ $1			special local names
  R$+ < @ $=w . >		$#_LOCAL_ $: $1			dispose directly',
! `R$+ < @ $=w . >		$: $1 < @ $2 . @ $H >		first try hub
  ifdef(`_OLD_SENDMAIL_',
  `R$+ < $+ @ $-:$+ >	$# $3 $@ $4 $: $1 < $2 >	yep ....
  R$+ < $+ @ $+ >		$#relay $@ $3 $: $1 < $2 >	yep ....
***************
*** 576,614 ****
  ifdef(`_NO_UUCP_', `dnl',
  `# resolve remotely connected UUCP links (if any)
  ifdef(`_CLASS_V_',
! `R$* < @ $=V . UUCP > $*		$: $>_SET_95_ < $V > $1 <@$2.UUCP> $3',
  	`dnl')
  ifdef(`_CLASS_W_',
! `R$* < @ $=W . UUCP > $*		$: $>_SET_95_ < $W > $1 <@$2.UUCP> $3',
  	`dnl')
  ifdef(`_CLASS_X_',
! `R$* < @ $=X . UUCP > $*		$: $>_SET_95_ < $X > $1 <@$2.UUCP> $3',
  	`dnl')')
  
  # resolve fake top level domains by forwarding to other hosts
  ifdef(`BITNET_RELAY',
! `R$*<@$+.BITNET>$*	$: $>_SET_95_ < $B > $1 <@$2.BITNET> $3	user@host.BITNET',
  	`dnl')
! ifdef(`CSNET_RELAY',
! `R$*<@$+.CSNET>$*	$: $>_SET_95_ < $C > $1 <@$2.CSNET> $3	user@host.CSNET',
  	`dnl')
  ifdef(`_MAILER_fax_',
! `R$+ < @ $+ .FAX >	$#fax $@ $2 $: $1		user@host.FAX',
  `ifdef(`FAX_RELAY',
! `R$*<@$+.FAX>$*		$: $>_SET_95_ < $F > $1 <@$2.FAX> $3	user@host.FAX',
  	`dnl')')
  
  ifdef(`UUCP_RELAY',
  `# forward non-local UUCP traffic to our UUCP relay
! R$*<@$*.UUCP>$*		$: $>_SET_95_ < $Y > $1 @ <$2.UUCP> $3	uucp mail',
  `ifdef(`_MAILER_uucp_',
  `# forward other UUCP traffic straight to UUCP
! R< @ $+ .UUCP > : $+	$#uucp $@ $1 $: $2		@host.UUCP:...
! R$+ < @ $+ .UUCP >	$#uucp $@ $2 $: $1		user@host.UUCP',
  	`dnl')')
  ifdef(`_MAILER_usenet_', `
  # addresses sent to net.group.USENET will get forwarded to a newsgroup
! R$+ . USENET		$#usenet $: $1',
  	`dnl')
  
  ifdef(`_LOCAL_RULES_',
--- 577,614 ----
  ifdef(`_NO_UUCP_', `dnl',
  `# resolve remotely connected UUCP links (if any)
  ifdef(`_CLASS_V_',
! `R$* < @ $=V . UUCP . > $*		$: $>_SET_95_ < $V > $1 <@$2.UUCP.> $3',
  	`dnl')
  ifdef(`_CLASS_W_',
! `R$* < @ $=W . UUCP . > $*		$: $>_SET_95_ < $W > $1 <@$2.UUCP.> $3',
  	`dnl')
  ifdef(`_CLASS_X_',
! `R$* < @ $=X . UUCP . > $*		$: $>_SET_95_ < $X > $1 <@$2.UUCP.> $3',
  	`dnl')')
  
  # resolve fake top level domains by forwarding to other hosts
  ifdef(`BITNET_RELAY',
! `R$*<@$+.BITNET.>$*	$: $>_SET_95_ < $B > $1 <@$2.BITNET.> $3	user@host.BITNET',
  	`dnl')
! ifdef(`_MAILER_pop_',
! `R$+ < @ POP. >		$#pop $: $1			user@POP',
  	`dnl')
  ifdef(`_MAILER_fax_',
! `R$+ < @ $+ .FAX. >	$#fax $@ $2 $: $1		user@host.FAX',
  `ifdef(`FAX_RELAY',
! `R$*<@$+.FAX.>$*		$: $>_SET_95_ < $F > $1 <@$2.FAX.> $3	user@host.FAX',
  	`dnl')')
  
  ifdef(`UUCP_RELAY',
  `# forward non-local UUCP traffic to our UUCP relay
! R$*<@$*.UUCP.>$*		$: $>_SET_95_ < $Y > $1 <@$2.UUCP.> $3	uucp mail',
  `ifdef(`_MAILER_uucp_',
  `# forward other UUCP traffic straight to UUCP
! R$* < @ $+ .UUCP. > $*		$#uucp $@ $2 $: $1 < @ $2 .UUCP. > $3	user@host.UUCP',
  	`dnl')')
  ifdef(`_MAILER_usenet_', `
  # addresses sent to net.group.USENET will get forwarded to a newsgroup
! R$+ . USENET.		$#usenet $: $1',
  	`dnl')
  
  ifdef(`_LOCAL_RULES_',
*** cf/m4/version.m4.OLD	Tue Nov 30 08:59:13 1993
--- cf/m4/version.m4	Thu Jan 13 06:42:08 1994
***************
*** 32,39 ****
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! VERSIONID(`@(#)version.m4	8.6.1.4 (Berkeley) 10/31/93')
  #
  divert(0)
  # Configuration version number
! DZ8.6.4
--- 32,39 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! VERSIONID(`@(#)version.m4	8.6.1.5 (Berkeley) 1/13/94')
  #
  divert(0)
  # Configuration version number
! DZ8.6.5
*** cf/mailer/pop.m4.OLD	Tue Dec 14 14:29:44 1993
--- cf/mailer/pop.m4	Wed Dec 15 06:36:42 1993
***************
*** 0 ****
--- 1,54 ----
+ PUSHDIVERT(-1)
+ #
+ # Copyright (c) 1983 Eric P. Allman
+ # Copyright (c) 1988, 1993
+ #	The Regents of the University of California.  All rights reserved.
+ #
+ # 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. All advertising materials mentioning features or use of this software
+ #    must display the following acknowledgement:
+ #	This product includes software developed by the University of
+ #	California, Berkeley and its contributors.
+ # 4. 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.
+ #
+ 
+ ifdef(`POP_MAILER_PATH',, `define(`POP_MAILER_PATH', /usr/lib/mh/spop)')
+ ifdef(`POP_MAILER_FLAGS',, `define(`POP_MAILER_FLAGS', `eu')')
+ ifdef(`POP_MAILER_ARGS',, `define(`POP_MAILER_ARGS', `pop $u')')
+ 
+ POPDIVERT
+ 
+ LOCAL_CONFIG
+ # POP mailer is a pseudo-domain
+ CPPOP
+ POPDIVERT
+ 
+ ####################################
+ ###   POP Mailer specification   ###
+ ####################################
+ 
+ VERSIONID(`@(#)pop.m4	8.1 (Berkeley) 12/15/93')
+ 
+ Mpop,		P=POP_MAILER_PATH, F=CONCAT(`lsDFM', POP_MAILER_FLAGS), S=10, R=20/40,
+ 		A=POP_MAILER_ARGS
*** cf/mailer/smtp.m4.OLD	Wed Nov 10 07:02:30 1993
--- cf/mailer/smtp.m4	Mon Dec 27 14:49:22 1993
***************
*** 40,52 ****
  ###   SMTP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)smtp.m4	8.7 (Berkeley) 10/31/93')
  
  Msmtp,		P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  Mesmtp,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
! Mrelay,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=51, E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
  
  #
--- 40,52 ----
  ###   SMTP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)smtp.m4	8.13 (Berkeley) 12/27/93')
  
  Msmtp,		P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
  Mesmtp,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=990, ')A=IPC $h
! Mrelay,		P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=61, E=\r\n,
  		ifdef(`_OLD_SENDMAIL_',, `L=2040, ')A=IPC $h
  
  #
***************
*** 55,66 ****
  S11
  R$+			$: $>51 $1			sender/recipient common
  R$* :; <@>		$@ $1 :;			list:; special case
  
- # handle unqualified names
- R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
- R$*			$@ $>61 $1
  
- 
  #
  #  header recipient rewriting if not masquerading recipients
  #
--- 55,63 ----
  S11
  R$+			$: $>51 $1			sender/recipient common
  R$* :; <@>		$@ $1 :;			list:; special case
+ R$*			$@ $>61 $1			qualify unqual'ed names
  
  
  #
  #  header recipient rewriting if not masquerading recipients
  #
***************
*** 87,100 ****
  R$=E < @ $=w . >	$@ $1 < @ $2 >			exposed user as is
  R$* < @ $=w . >		$: $1 < @ $M >			masquerade as domain
  R$* < @ >		$: $1 < @ $j >			in case $M undefined
  
- # handle unqualified names
- R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
- R$*			$@ $>61 $1
  
- 
  #
! #  common rewriting for all SMTP addresses
  #
  S51
  
--- 84,94 ----
  R$=E < @ $=w . >	$@ $1 < @ $2 >			exposed user as is
  R$* < @ $=w . >		$: $1 < @ $M >			masquerade as domain
  R$* < @ >		$: $1 < @ $j >			in case $M undefined
+ R$*			$@ $>61 $1			qualify unqual'ed names
  
  
  #
! #  convert pseudo-domain addresses to real domain addresses
  #
  S51
  
***************
*** 103,124 ****
  
  # output fake domains as user%fake@relay
  ifdef(`BITNET_RELAY',
! `R$+ <@ $+ . BITNET >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
  R$+.BITNET <@ $+:$+ >	$: $1 .BITNET < @ $3 >		strip mailer: part',
  	`dnl')
! ifdef(`CSNET_RELAY',
! `R$+ <@ $+ . CSNET >	$: $1 % $2 .CSNET < @ $C >	user@host.CSNET
! R$+.CSNET <@ $+:$+ >	$: $1 .CSNET < @ $3 >		strip mailer: part',
! 	`dnl')
! ifdef(`_NO_UUCP_', `dnl',
! `R$+ <@ $+ . UUCP >	$: $2 ! $1 < @ $j >		user@host.UUCP')
  
  
  #
  #  common sender and masquerading recipient rewriting
  #
  S61
  
  R$=E			$@ $1 < @ $j>			show exposed names
  R$+			$: $1 < @ $M >			user w/o host
  R$+ <@>			$: $1 < @ $j >			in case $M undefined
--- 97,125 ----
  
  # output fake domains as user%fake@relay
  ifdef(`BITNET_RELAY',
! `R$+ <@ $+ .BITNET. >	$: $1 % $2 .BITNET < @ $B >	user@host.BITNET
  R$+.BITNET <@ $+:$+ >	$: $1 .BITNET < @ $3 >		strip mailer: part',
  	`dnl')
! ifdef(`_NO_UUCP_', `dnl', `
! # do UUCP heuristics; note that these are shared with UUCP mailers
! R$+ < @ $+ .UUCP. >	$: < $2 ! > $1			convert to UUCP form
! R$+ < @ $* > $*		$@ $1 < @ $2 > $3		not UUCP form
  
+ # leave these in .UUCP form to avoid further tampering
+ R< $&h ! > $- ! $+	$@ $2 < @ $1 .UUCP. >
+ R< $&h ! > $-.$+ ! $+	$@ $3 < @ $1.$2 >
+ R< $&h ! > $+		$@ $1 < @ $&h .UUCP. >
+ R< $+ ! > $+		$: $1 ! $2 < @ $Y >
+ R$+ < @ >		$: $1 < @ $j >			in case $Y undefined
+ R$+ < @ $+ : $+ >	$: $1 < @ $3 >			strip mailer: part')
  
+ 
  #
  #  common sender and masquerading recipient rewriting
  #
  S61
  
+ R$* < @ $* > $*		$@ $1 < @ $2 > $3		already qualified
  R$=E			$@ $1 < @ $j>			show exposed names
  R$+			$: $1 < @ $M >			user w/o host
  R$+ <@>			$: $1 < @ $j >			in case $M undefined
*** cf/mailer/uucp.m4.OLD	Thu Nov 11 06:21:23 1993
--- cf/mailer/uucp.m4	Mon Jan 10 08:01:11 1994
***************
*** 42,60 ****
  ###   UUCP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)uucp.m4	8.6 (Berkeley) 10/31/93')
  
! # old UUCP mailer
  Muucp,		P=UUCP_MAILER_PATH, F=CONCAT(DFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS
  
! # smart UUCP mailer (handles multiple addresses)
  Msuucp,		P=UUCP_MAILER_PATH, F=CONCAT(mDFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS
  
  ifdef(`_MAILER_smtp_',
  `# domain-ized UUCP mailer
  Muucp-dom,	P=UUCP_MAILER_PATH, F=CONCAT(mDFMhu, UUCP_MAILER_FLAGS), S=52/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS')
  
  
--- 42,73 ----
  ###   UUCP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)uucp.m4	8.13 (Berkeley) 1/10/94')
  
! #
! #  There are innumerable variations on the UUCP mailer.  It really
! #  is rather absurd.
! #
! 
! # old UUCP mailer (two names)
  Muucp,		P=UUCP_MAILER_PATH, F=CONCAT(DFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS
+ Muucp-old,	P=UUCP_MAILER_PATH, F=CONCAT(DFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
+ 		A=UUCP_MAILER_ARGS
  
! # smart UUCP mailer (handles multiple addresses) (two names)
  Msuucp,		P=UUCP_MAILER_PATH, F=CONCAT(mDFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS
+ Muucp-new,	P=UUCP_MAILER_PATH, F=CONCAT(mDFMhuU, UUCP_MAILER_FLAGS), S=12, R=22, M=UUCP_MAX_SIZE,
+ 		A=UUCP_MAILER_ARGS
  
  ifdef(`_MAILER_smtp_',
  `# domain-ized UUCP mailer
  Muucp-dom,	P=UUCP_MAILER_PATH, F=CONCAT(mDFMhu, UUCP_MAILER_FLAGS), S=52/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), M=UUCP_MAX_SIZE,
+ 		A=UUCP_MAILER_ARGS
+ 
+ # domain-ized UUCP mailer with UUCP-style sender envelope
+ Muucp-uudom,	P=UUCP_MAILER_PATH, F=CONCAT(mDFMhu, UUCP_MAILER_FLAGS), S=72/31, R=ifdef(`_ALL_MASQUERADE_', `11/31', `21'), M=UUCP_MAX_SIZE,
  		A=UUCP_MAILER_ARGS')
  
  
***************
*** 70,79 ****
  R$* :; <@>			$@ $1 :;
  
  R$* < @ $* . >			$1 < @ $2 >		strip trailing dots
! R$* < @ $j >			$1			strip local name
  R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
  R$* < @ $+ >			$2 ! $1			convert to UUCP format
  R$+				$: $U ! $1		prepend our name
  
  #
  #  envelope and header recipient rewriting
--- 83,97 ----
  R$* :; <@>			$@ $1 :;
  
  R$* < @ $* . >			$1 < @ $2 >		strip trailing dots
! R$* < @ $=w >			$1			strip local name
! R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
! R<@ $+ > : $+			$1 ! $2			convert to UUCP format
  R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
  R$* < @ $+ >			$2 ! $1			convert to UUCP format
+ R$&h ! $+ ! $+			$@ $1 ! $2		$h!...!user => ...!user
+ R$&h ! $+			$@ $&h ! $1		$h!user => $h!user
  R$+				$: $U ! $1		prepend our name
+ R! $+				$: $k ! $1		in case $U undefined
  
  #
  #  envelope and header recipient rewriting
***************
*** 81,95 ****
  S22
  
  # don't touch list:; syntax
! R$* :; <@>			$@ $1 ;:
  
  R$* < @ $* . >			$1 < @ $2 >		strip trailing dots
  R$* < @ $j >			$1			strip local name
  R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
  R$* < @ $+ >			$2 ! $1			convert to UUCP format
  
  
! #
  #  envelope sender rewriting for uucp-dom mailer
  #
  S52
--- 99,120 ----
  S22
  
  # don't touch list:; syntax
! R$* :; <@>			$@ $1 :;
  
  R$* < @ $* . >			$1 < @ $2 >		strip trailing dots
  R$* < @ $j >			$1			strip local name
+ R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
+ R<@ $+ > : $+			$1 ! $2			convert to UUCP format
  R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
  R$* < @ $+ >			$2 ! $1			convert to UUCP format
+ R$&h ! $+ ! $+			$@ $1 ! $2		$h!...!user => ...!user
+ R$&h ! $+			$@ $&h ! $1		$h!user => $h!user
+ R$+				$: $U ! $1		prepend our name
+ R! $+				$: $k ! $1		in case $U undefined
  
  
! ifdef(`_MAILER_smtp_',
! `#
  #  envelope sender rewriting for uucp-dom mailer
  #
  S52
***************
*** 100,112 ****
  # pass everything to standard SMTP mailer rewriting
  R$*				$@ $>11 $1
  
  
  PUSHDIVERT(4)
  # resolve locally connected UUCP links
! R< @ $=Z . UUCP > : $+		$#uucp-dom $@ $1 $: $2	@host.UUCP: ...
! R$+ < @ $=Z . UUCP >		$#uucp-dom $@ $2 $: $1	user@host.UUCP
! R< @ $=Y . UUCP > : $+		$#suucp $@ $1 $: $2	@host.UUCP: ...
! R$+ < @ $=Y . UUCP >		$#suucp $@ $2 $: $1	user@host.UUCP
! R< @ $=U . UUCP > : $+		$#uucp $@ $1 $: $2	@host.UUCP: ...
! R$+ < @ $=U . UUCP >		$#uucp $@ $2 $: $1	user@host.UUCP
  POPDIVERT
--- 125,157 ----
  # pass everything to standard SMTP mailer rewriting
  R$*				$@ $>11 $1
  
+ #
+ #  envelope sender rewriting for uucp-uudom mailer
+ #
+ S72
  
+ # handle error address as a special case
+ R<@>				$n			errors to mailer-daemon
+ 
+ # do not qualify list:; syntax
+ R$* :; <@>			$@ $1 :;
+ 
+ R$* < @ $* . >			$1 < @ $2 >		strip trailing dots
+ R$* < @ $=w >			$1			strip local name
+ R<@ $- . UUCP > : $+		$1 ! $2			convert to UUCP format
+ R<@ $+ > : $+			$1 ! $2			convert to UUCP format
+ R$* < @ $- . UUCP >		$2 ! $1			convert to UUCP format
+ R$* < @ $+ >			$@ $2 ! $1		convert to UUCP format
+ 
+ R$&h ! $+ ! $+			$@ $1 ! $2		$h!...!user => ...!user
+ R$&h ! $+			$@ $&h ! $1		$h!user => $h!user
+ R$+				$: $M ! $1		prepend masquerade name
+ R! $+				$: $j ! $1		in case $M undefined')
+ 
+ 
  PUSHDIVERT(4)
  # resolve locally connected UUCP links
! R$* < @ $=Z . UUCP. > $*	$#uucp-uudom $@ $1 $: $1 < @ $2 .UUCP. > $3	@host.UUCP: ...
! R$* < @ $=Y . UUCP. > $*	$#uucp-new $@ $2 $: $1 < @ $2 .UUCP. > $3
! R$* < @ $=U . UUCP. > $*	$#uucp-old $@ $2 $: $1 < @ $2 .UUCP. > $3
  POPDIVERT
*** cf/ostype/bsdi1.0.m4.OLD	Sat Dec 11 13:05:45 1993
--- cf/ostype/bsdi1.0.m4	Sat Dec 11 13:05:41 1993
***************
*** 0 ****
--- 1,38 ----
+ divert(-1)
+ #
+ # Copyright (c) 1983 Eric P. Allman
+ # Copyright (c) 1988, 1993
+ #	The Regents of the University of California.  All rights reserved.
+ #
+ # 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. All advertising materials mentioning features or use of this software
+ #    must display the following acknowledgement:
+ #	This product includes software developed by the University of
+ #	California, Berkeley and its contributors.
+ # 4. 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.
+ #
+ 
+ divert(0)
+ VERSIONID(`@(#)bsdi1.0.m4	8.1 (Berkeley) 12/11/93')dnl
+ OSTYPE(bsd4.4)
*** cf/ostype/dgux.m4.OLD	Sat Nov 27 09:28:04 1993
--- cf/ostype/dgux.m4	Sat Nov 27 09:25:45 1993
***************
*** 0 ****
--- 1,39 ----
+ divert(-1)
+ #
+ # Copyright (c) 1983 Eric P. Allman
+ # Copyright (c) 1988, 1993
+ #	The Regents of the University of California.  All rights reserved.
+ #
+ # 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. All advertising materials mentioning features or use of this software
+ #    must display the following acknowledgement:
+ #	This product includes software developed by the University of
+ #	California, Berkeley and its contributors.
+ # 4. 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.
+ #
+ 
+ divert(0)
+ VERSIONID(`@(#)dgux.m4	8.1 (Berkeley) 11/27/93')
+ define(`LOCAL_MAILER_FLAGS', m)dnl
+ define(`confTIME_ZONE', `USE_TZ')dnl
*** cf/ostype/dynix3.2.m4.OLD	Sat Nov 27 14:28:30 1993
--- cf/ostype/dynix3.2.m4	Sat Nov 27 14:28:24 1993
***************
*** 0 ****
--- 1,39 ----
+ divert(-1)
+ #
+ # Copyright (c) 1983 Eric P. Allman
+ # Copyright (c) 1988, 1993
+ #	The Regents of the University of California.  All rights reserved.
+ #
+ # 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. All advertising materials mentioning features or use of this software
+ #    must display the following acknowledgement:
+ #	This product includes software developed by the University of
+ #	California, Berkeley and its contributors.
+ # 4. 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.
+ #
+ 
+ divert(0)
+ VERSIONID(`@(#)dynix3.2.m4	8.1 (Berkeley) 11/27/93')
+ define(`ALIAS_FILE', /usr/lib/aliases)dnl
+ define(`QUEUE_DIR', /usr/spool/mqueue)dnl
*** cf/ostype/hpux.m4.OLD	Tue Aug 24 20:31:55 1993
--- cf/ostype/hpux.m4	Sun Jan  9 09:50:51 1994
***************
*** 34,43 ****
  #
  
  divert(0)
! VERSIONID(`@(#)hpux.m4	8.4 (Berkeley) 8/24/93')
  
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
  define(`ALIAS_FILE', /usr/lib/aliases)dnl
  define(`STATUS_FILE', /usr/lib/sendmail.st)dnl
  define(`LOCAL_MAILER_FLAGS', `m')dnl
  define(`confTIME_ZONE', `USE_TZ')dnl
--- 34,44 ----
  #
  
  divert(0)
! VERSIONID(`@(#)hpux.m4	8.5 (Berkeley) 1/9/94')
  
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
  define(`ALIAS_FILE', /usr/lib/aliases)dnl
  define(`STATUS_FILE', /usr/lib/sendmail.st)dnl
  define(`LOCAL_MAILER_FLAGS', `m')dnl
+ define(`UUCP_MAILER_ARGS', `uux - -r -a$f -gC $h!rmail ($u)')dnl
  define(`confTIME_ZONE', `USE_TZ')dnl
*** cf/ostype/irix.m4.OLD	Sat Nov 27 09:28:44 1993
--- cf/ostype/irix.m4	Sat Nov 27 09:29:26 1993
***************
*** 34,38 ****
  #
  
  divert(0)
! VERSIONID(`@(#)irix.m4	8.2 (Berkeley) 8/8/93')
  define(`LOCAL_MAILER_FLAGS', Ehmu)dnl
--- 34,41 ----
  #
  
  divert(0)
! VERSIONID(`@(#)irix.m4	8.3 (Berkeley) 11/27/93')
  define(`LOCAL_MAILER_FLAGS', Ehmu)dnl
+ define(`QUEUE_DIR', /usr/spool/mqueue)dnl
+ define(`ALIAS_FILE', /usr/lib/aliases)dnl
+ define(`STATUS_FILE', /usr/lib/sendmail.st)dnl
*** cf/ostype/nextstep.m4.OLD	Wed Nov 10 17:07:58 1993
--- cf/ostype/nextstep.m4	Tue Nov 30 09:01:49 1993
***************
*** 34,42 ****
  #
  
  divert(0)
! VERSIONID(`@(#)nextstep.m4	8.3 (Berkeley) 8/13/93')
  define(`ALIAS_FILE', /etc/sendmail/aliases)dnl
  define(`HELP_FILE', /usr/lib/sendmail.hf)dnl
  define(`STATUS_FILE', /etc/sendmail/sendmail.st)dnl
  define(`UUCP_MAILER_PATH', /usr/bin/uux)dnl
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
--- 34,44 ----
  #
  
  divert(0)
! VERSIONID(`@(#)nextstep.m4	8.4 (Berkeley) 11/30/93')
  define(`ALIAS_FILE', /etc/sendmail/aliases)dnl
  define(`HELP_FILE', /usr/lib/sendmail.hf)dnl
  define(`STATUS_FILE', /etc/sendmail/sendmail.st)dnl
  define(`UUCP_MAILER_PATH', /usr/bin/uux)dnl
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
+ define(`LOCAL_MAILER_FLAGS', `rmnP')dnl
+ define(`LOCAL_SHELL_FLAGS', `euP')dnl
*** cf/ostype/riscos4.5.m4.OLD	Wed Dec  1 07:54:37 1993
--- cf/ostype/riscos4.5.m4	Wed Dec  1 08:44:17 1993
***************
*** 34,37 ****
  #
  
  divert(0)
! VERSIONID(`@(#)riscos4.5.m4	8.1 (Berkeley) 6/7/93')
--- 34,42 ----
  #
  
  divert(0)
! VERSIONID(`@(#)riscos4.5.m4	8.2 (Berkeley) 12/1/93')
! 
! define(`LOCAL_MAILER_ARGS', `rmail -d $u')dnl
! define(`ALIAS_FILE', `/usr/lib/aliases')dnl
! define(`QUEUE_DIR', `/usr/spool/mqueue')dnl
! define(`HELP_FILE', `/usr/lib/sendmail.hf')dnl
*** cf/ostype/sco3.2.m4.OLD	Sat Nov 27 10:29:19 1993
--- cf/ostype/sco3.2.m4	Sat Nov 27 10:29:10 1993
***************
*** 0 ****
--- 1,45 ----
+ divert(-1)
+ #
+ # Copyright (c) 1983 Eric P. Allman
+ # Copyright (c) 1988, 1993
+ #	The Regents of the University of California.  All rights reserved.
+ #
+ # 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. All advertising materials mentioning features or use of this software
+ #    must display the following acknowledgement:
+ #	This product includes software developed by the University of
+ #	California, Berkeley and its contributors.
+ # 4. 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.
+ #
+ 
+ divert(0)
+ VERSIONID(`@(#)sco32.m4	8.1 (Berkeley) 11/27/93')
+ define(`ALIAS_FILE', /usr/lib/mail/aliases)dnl
+ define(`QUEUE_DIR', /usr/spool/mqueue)dnl
+ define(`STATUS_FILE', /usr/lib/sendmail.st)dnl
+ define(`UUCP_MAILER_PATH', /usr/bin/uux)dnl
+ define(`LOCAL_MAILER_PATH', /usr/bin/lmail)dnl
+ define(`LOCAL_MAILER_FLAGS', PuhCE)dnl
+ define(`LOCAL_MAILER_ARGS', `lmail $u')dnl
+ define(`LOCAL_SHELL_FLAGS', Peu)dnl
*** doc/op/op.me.OLD	Fri Nov 12 09:44:20 1993
--- doc/op/op.me	Wed Jan 12 06:52:00 1994
***************
*** 30,36 ****
  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  .\" SUCH DAMAGE.
  .\"
! .\"	@(#)op.me	8.26 (Berkeley) 10/14/93
  .\"
  .\" eqn op.me | pic | troff -me
  .eh 'SMM:08-%''Sendmail Installation and Operation Guide'
--- 30,36 ----
  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  .\" SUCH DAMAGE.
  .\"
! .\"	@(#)op.me	8.32 (Berkeley) 1/12/94
  .\"
  .\" eqn op.me | pic | troff -me
  .eh 'SMM:08-%''Sendmail Installation and Operation Guide'
***************
*** 69,75 ****
  Mammoth Project
  eric@CS.Berkeley.EDU
  .sp
! Version 8.26
  .sp
  For Sendmail Version 8.6
  .)l
--- 69,75 ----
  Mammoth Project
  eric@CS.Berkeley.EDU
  .sp
! Version 8.32
  .sp
  For Sendmail Version 8.6
  .)l
***************
*** 185,191 ****
  on 4.4BSD.
  .pp
  If you are loading this off the tape,
! continue with the next session.
  If you have a running binary already on your system,
  you should probably skip to section 1.2.
  .sh 2 "Compiling Sendmail"
--- 185,191 ----
  on 4.4BSD.
  .pp
  If you are loading this off the tape,
! continue with the next section.
  If you have a running binary already on your system,
  you should probably skip to section 1.2.
  .sh 2 "Compiling Sendmail"
***************
*** 576,590 ****
  of this document.
  .sh 3 "/usr/\*(SB/newaliases"
  .pp
! If you are running delivermail,
! it is critical that the
  .i newaliases
! command be replaced.
! This can just be a link to
  .i sendmail :
  .(b
  rm \-f /usr/\*(SB/newaliases
! ln /usr/\*(SD/sendmail /usr/\*(SB/newaliases
  .)b
  This can be installed in whatever search path you prefer
  for your system.
--- 576,588 ----
  of this document.
  .sh 3 "/usr/\*(SB/newaliases"
  .pp
! The
  .i newaliases
! command should just be a link to
  .i sendmail :
  .(b
  rm \-f /usr/\*(SB/newaliases
! ln \-s /usr/\*(SD/sendmail /usr/\*(SB/newaliases
  .)b
  This can be installed in whatever search path you prefer
  for your system.
***************
*** 808,813 ****
--- 806,816 ----
  The system log is supported by the
  .i syslogd \|(8)
  program.
+ All messages from
+ .i sendmail
+ are logged under the
+ .sm LOG_MAIL
+ facility.
  .sh 3 "Format"
  .pp
  Each line in the system log
***************
*** 994,999 ****
--- 997,1012 ----
  .q mail.aliases
  in
  .q my.nis.domain .
+ Warning: if you build your own
+ .sm NIS -based
+ alias files,
+ be sure to provide the
+ .b \-l
+ flag to
+ .i makedbm (8)
+ to map upper case letters in the keys to lower case;
+ otherwise, aliases with upper case letters in their names
+ won't match incoming addresses.
  .pp
  Additional flags can be added after the colon
  exactly like a
***************
*** 1074,1084 ****
  .q a
  option is required in the configuration
  for this action to occur.
! This should normally be specified
! unless you are running
! .i delivermail
! in parallel with
! .i sendmail.
  .)f
  .sh 3 "List owners"
  .pp
--- 1087,1093 ----
  .q a
  option is required in the configuration
  for this action to occur.
! This should normally be specified.
  .)f
  .sh 3 "List owners"
  .pp
***************
*** 1438,1443 ****
--- 1447,1464 ----
  .i sendmail ,
  including the incoming SMTP traffic,
  will be logged in this file.
+ .sh 2 "Dumping State"
+ .pp
+ You can ask
+ .i sendmail
+ to log a dump of the open files
+ and the connection cache
+ by sending it a
+ .sm SIGUSR1
+ signal.
+ The results are logged at
+ .sm LOG_DEBUG
+ priority.
  .sh 1 "TUNING"
  .pp
  There are a number of configuration parameters
***************
*** 2381,2387 ****
  .b $)
  syntax is a more general form of lookup;
  it uses a named map instead of an implicit map.
! If no lookup is found, the indicted
  .i default
  is inserted;
  if no default is specified and no lookup matches,
--- 2402,2408 ----
  .b $)
  syntax is a more general form of lookup;
  it uses a named map instead of an implicit map.
! If no lookup is found, the indicated
  .i default
  is inserted;
  if no default is specified and no lookup matches,
***************
*** 2444,2455 ****
  may be a colon-separated list of hosts
  that are searched in order for the first working address
  (exactly like MX records).
  .pp
  A RHS may also be preceded by a
  .b $@
  or a
  .b $:
! to control evaluation.
  A
  .b $@
  prefix causes the ruleset to return with the remainder of the RHS
--- 2465,2485 ----
  may be a colon-separated list of hosts
  that are searched in order for the first working address
  (exactly like MX records).
+ The
+ .i user
+ is later rewritten by the mailer-specific envelope rewriting set
+ and assigned to the
+ .b $u
+ macro.
  .pp
+ Normally, a ruleset that matches is retried,
+ that is,
+ the ruleset loops until it fails.
  A RHS may also be preceded by a
  .b $@
  or a
  .b $:
! to change this behavior.
  A
  .b $@
  prefix causes the ruleset to return with the remainder of the RHS
***************
*** 2794,2800 ****
  Defaults to
  .q MAILER-DAEMON .
  .ip $o\(dg
! .b "The set of "operators" in addresses."
  A list of characters
  which will be considered tokens
  and which will separate tokens
--- 2824,2830 ----
  Defaults to
  .q MAILER-DAEMON .
  .ip $o\(dg
! .b "The set of \*(lqoperators\*(rq in addresses."
  A list of characters
  which will be considered tokens
  and which will separate tokens
***************
*** 3109,3114 ****
--- 3139,3165 ----
  is set to be the same as
  .b $k ,
  that is, the UUCP node name.
+ .pp
+ The class
+ .b $=m
+ is set to the set of domains by which this host is known,
+ initially just
+ .b $m .
+ .pp
+ .i Sendmail
+ can be compiled to allow a
+ .i scanf (3)
+ string on the
+ .b F
+ line.
+ This lets you do simplistic parsing of text files.
+ For example, to read all the user names in your system
+ .i /etc/passwd
+ file into a class, use
+ .(b
+ FL/etc/passwd %[^:]
+ .)b
+ which reads every line up to the first colon.
  .sh 3 "M \*- define mailer"
  .pp
  Programs and interfaces to mailers
***************
*** 3698,3704 ****
  .ip k\fIN\fP
  The maximum number of open connections that will be cached at a time.
  The default is one.
! This delays closing the the current connection until
  either this invocation of
  .i sendmail
  needs to connect to another host
--- 3749,3755 ----
  .ip k\fIN\fP
  The maximum number of open connections that will be cached at a time.
  The default is one.
! This delays closing the current connection until
  either this invocation of
  .i sendmail
  needs to connect to another host
***************
*** 3794,3799 ****
--- 3845,3851 ----
  restrictmailq	Restrict mailq command
  restrictqrun	Restrict \-q command line flag
  goaway	Disallow essentially all SMTP status queries
+ authwarnings	Put X-Authentication-Warning: headers in messages
  .)b
  The
  .q goaway
***************
*** 3807,3812 ****
--- 3859,3867 ----
  If queue runs are restricted,
  only root and the owner of the queue directory
  can run the queue.
+ Authentication Warnings add warnings about various conditions
+ that may indicate attempts to spoof the mail system,
+ such as using an non-standard queue directory.
  .ip P\fIpostmaster\fP
  If set,
  copies of error messages will be sent to the named
***************
*** 3893,3899 ****
  even if you are going to attempt immediate delivery.
  .i Sendmail
  always instantiates the queue file
! before returning control the the client
  under any circumstances.
  .ip S\fIfile\fP
  Log statistics in the named
--- 3948,3954 ----
  even if you are going to attempt immediate delivery.
  .i Sendmail
  always instantiates the queue file
! before returning control the client
  under any circumstances.
  .ip S\fIfile\fP
  Log statistics in the named
***************
*** 4165,4170 ****
--- 4220,4240 ----
  change the default definition of
  .b $w
  to be just the first component of the hostname.
+ .pp
+ The
+ .b V
+ line may have an optional
+ .b / \c
+ .i vendor
+ to indicate that this configuration file uses modifications
+ specific to a particular vendor\**.
+ .(f
+ \**And of course, vendors are encouraged to add themselves
+ to the list of recognized vendors by editing the routine
+ .i setvendor
+ in
+ .i conf.c .
+ .)f
  .sh 3 "K \*- key file declaration"
  .pp
  Special maps can be defined using the line:
***************
*** 4265,4271 ****
  and the third requires that
  .i sendmail
  be compiled with NIS support.
! All four accept as arguments the some optional flags
  and a filename
  (or a mapname for NIS;
  the filename is the root of the database path,
--- 4335,4341 ----
  and the third requires that
  .i sendmail
  be compiled with NIS support.
! All four accept as arguments the same optional flags
  and a filename
  (or a mapname for NIS;
  the filename is the root of the database path,
***************
*** 4616,4622 ****
  know exactly where each network connection is,
  possibly including the names of each host on that network.
  As long as the site remains small
! and the the configuration remains relatively static,
  the update problem will probably not be too great.
  .sh 4 "Single host"
  .pp
--- 4686,4692 ----
  know exactly where each network connection is,
  possibly including the names of each host on that network.
  As long as the site remains small
! and the configuration remains relatively static,
  the update problem will probably not be too great.
  .sh 4 "Single host"
  .pp
***************
*** 4944,4951 ****
  .i "if and only if"
  the
  .q C
! flag is defined in the mailer corresponding to
! .q eric@vangogh.CS.Berkeley.EDU.
  .pp
  Other flags are described
  in Appendix C.
--- 5014,5023 ----
  .i "if and only if"
  the
  .q C
! flag is defined in the mailer resolved to
! by running
! .q eric@vangogh.CS.Berkeley.EDU
! through rulesets 3 and 0.
  .pp
  Other flags are described
  in Appendix C.
***************
*** 4998,5004 ****
  may be used.
  .pp
  Finally,
! an argv template is given as the E field.
  It may have embedded spaces.
  If there is no argv with a
  .b $u
--- 5070,5076 ----
  may be used.
  .pp
  Finally,
! an argv template is given as the A field.
  It may have embedded spaces.
  If there is no argv with a
  .b $u
***************
*** 5175,5181 ****
  .q maildrop
  is found for the user,
  but no corresponding
! .q maildrop
  record exists,
  the record
  .q :default:mailname
--- 5247,5253 ----
  .q maildrop
  is found for the user,
  but no corresponding
! .q mailname
  record exists,
  the record
  .q :default:mailname
***************
*** 5310,5316 ****
  The load average type.
  Details are described below.
  .lp
! The are four built-in ways of computing the load average.
  .i Sendmail
  tries to auto-configure them based on imperfect guesses;
  you can select one using the
--- 5382,5388 ----
  The load average type.
  Details are described below.
  .lp
! The are several built-in ways of computing the load average.
  .i Sendmail
  tries to auto-configure them based on imperfect guesses;
  you can select one using the
***************
*** 5332,5337 ****
--- 5404,5411 ----
  .ip LA_FLOAT
  The kernel stores the load average in the kernel as an array of
  double precision floats.
+ .ip LA_MACH
+ Use MACH-style load averages.
  .ip LA_SUBR
  Call the
  .i getloadavg
***************
*** 6009,6015 ****
  However, for compatibility with RFC 822,
  you can set option `7' to get seven bit stripping.
  .pp
! Individual mailers can still produce seven bit out put using the
  `7' mailer flag.
  .sh 2 "User Database"
  .pp
--- 6083,6089 ----
  However, for compatibility with RFC 822,
  you can set option `7' to get seven bit stripping.
  .pp
! Individual mailers can still produce seven bit output using the
  `7' mailer flag.
  .sh 2 "User Database"
  .pp
***************
*** 6517,6525 ****
  This produces a lot of data very quickly and should be used sparingly.
  .pp
  There are a number of options that may be specified as
! primitive flags
! (provided for compatibility with
! .i delivermail ).
  These are the e, i, m, and v options.
  Also,
  the f option
--- 6591,6597 ----
  This produces a lot of data very quickly and should be used sparingly.
  .pp
  There are a number of options that may be specified as
! primitive flags.
  These are the e, i, m, and v options.
  Also,
  the f option
***************
*** 6803,6809 ****
  .\"Eric Allman
  .\"Britton-Lee, Inc.
  .\".sp
! .\"Version 8.26
  .\".ce 0
  .bp 2
  .rs
--- 6875,6881 ----
  .\"Eric Allman
  .\"Britton-Lee, Inc.
  .\".sp
! .\"Version 8.32
  .\".ce 0
  .bp 2
  .rs
*** mailstats/mailstats.c.OLD	Tue Jul 27 10:38:56 1993
--- mailstats/mailstats.c	Mon Dec 27 17:07:17 1993
***************
*** 40,46 ****
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)mailstats.c	8.2 (Berkeley) 7/27/93";
  #endif /* not lint */
  
  #include <sendmail.h>
--- 40,46 ----
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)mailstats.c	8.3 (Berkeley) 12/27/93";
  #endif /* not lint */
  
  #include <sendmail.h>
***************
*** 63,68 ****
--- 63,69 ----
  	char *cfile;
  	FILE *cfp;
  	bool mnames;
+ 	long frmsgs = 0, frbytes = 0, tomsgs = 0, tobytes = 0;
  	char mtable[MAXMAILERS][MNAMELEN+1];
  	char sfilebuf[100];
  	char buf[MAXLINE];
***************
*** 195,201 ****
--- 196,209 ----
  			if (mnames)
  				printf("  %s", mtable[i]);
  			printf("\n");
+ 			frmsgs += stat.stat_nf[i];
+ 			frbytes += stat.stat_bf[i];
+ 			tomsgs += stat.stat_nt[i];
+ 			tobytes += stat.stat_bt[i];
  		}
  	}
+ 	printf("========================================\n");
+ 	printf(" T %6ld %10ldK %6ld %10ldK\n",
+ 		frmsgs, frbytes, tomsgs, tobytes);
  	exit(EX_OK);
  }
*** makemap/Makefile.dist.OLD	Wed Dec  1 09:17:58 1993
--- makemap/Makefile.dist	Sat Nov 27 09:07:40 1993
***************
*** 0 ****
--- 1,81 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	@(#)Makefile.dist	8.2 (Berkeley) 11/27/93
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # location of sendmail source directory
+ SRCDIR=	../src
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ # The really old (V7) DBM library is no longer supported.
+ #
+ DBMDEF=	-DNDBM -DNEWDB
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=-I${SRCDIR} -I/usr/sww/include/db
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=-L/usr/sww/lib
+ 
+ # libraries required on your system
+ LIBS=	-ldb -ldbm
+ 
+ # location of makemap binary (usually /usr/sbin or /usr/etc)
+ BINDIR=	${DESTDIR}/usr/sbin
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	makemap.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	bin
+ BINGRP=	bin
+ BINMODE=555
+ 
+ ALL=	makemap makemap.0
+ 
+ all: ${ALL}
+ 
+ makemap: ${BEFORE} ${OBJS}
+ 	${CC} -o makemap ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ makemap.0: makemap.8
+ 	nroff -h -mandoc makemap.8 > makemap.0
+ 
+ install: install-makemap install-docs
+ 
+ install-makemap: makemap
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} makemap ${BINDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: makemap.0
+ 
+ clean:
+ 	rm -f ${OBJS} makemap makemap.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: ${SRCDIR}/conf.h
*** makemap/makemap.c.OLD	Mon Nov 22 11:26:28 1993
--- makemap/makemap.c	Mon Nov 22 11:44:10 1993
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)makemap.c	8.5 (Berkeley) 9/22/93";
  #endif /* not lint */
  
  #include <stdio.h>
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)makemap.c	8.6 (Berkeley) 11/22/93";
  #endif /* not lint */
  
  #include <stdio.h>
***************
*** 262,269 ****
  		*/
  
  		p = strchr(ibuf, '\n');
! 		if (*p != '\0')
  			*p = '\0';
  		if (ibuf[0] == '\0' || ibuf[0] == '#')
  			continue;
  		if (isspace(ibuf[0]))
--- 262,276 ----
  		*/
  
  		p = strchr(ibuf, '\n');
! 		if (p != NULL)
  			*p = '\0';
+ 		else if (!feof(stdin))
+ 		{
+ 			fprintf(stderr, "%s: %s: line %d: line too long (%d bytes max)\n",
+ 				progname, mapname, lineno, sizeof ibuf);
+ 			continue;
+ 		}
+ 			
  		if (ibuf[0] == '\0' || ibuf[0] == '#')
  			continue;
  		if (isspace(ibuf[0]))
*** praliases/Makefile.dist.OLD	Wed Dec  1 09:18:02 1993
--- praliases/Makefile.dist	Sat Nov 27 09:07:26 1993
***************
*** 0 ****
--- 1,81 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	@(#)Makefile.dist	8.1 (Berkeley) 11/27/93
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # location of sendmail source directory
+ SRCDIR=	../src
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ # The really old (V7) DBM library is no longer supported.
+ #
+ DBMDEF=	-DNDBM -DNEWDB
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=-I${SRCDIR} -I/usr/sww/include/db
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=-L/usr/sww/lib
+ 
+ # libraries required on your system
+ LIBS=	-ldb -ldbm
+ 
+ # location of praliases binary (usually /usr/sbin or /usr/etc)
+ BINDIR=	${DESTDIR}/usr/sbin
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	praliases.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	bin
+ BINGRP=	bin
+ BINMODE=555
+ 
+ ALL=	praliases praliases.0
+ 
+ all: ${ALL}
+ 
+ praliases: ${BEFORE} ${OBJS}
+ 	${CC} -o praliases ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ praliases.0: praliases.8
+ 	nroff -h -mandoc praliases.8 > praliases.0
+ 
+ install: install-praliases install-docs
+ 
+ install-praliases: praliases
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} praliases ${BINDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: praliases.0
+ 
+ clean:
+ 	rm -f ${OBJS} praliases praliases.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: ${SRCDIR}/conf.h
*** src/Makefile.OLD	Sun Aug 15 06:43:09 1993
--- src/Makefile	Mon Dec 20 10:52:10 1993
***************
*** 1,4 ****
! #	@(#)Makefile	8.2 (Berkeley) 8/15/93
  
  PROG=	sendmail
  
--- 1,4 ----
! #	@(#)Makefile	8.3 (Berkeley) 12/20/93
  
  PROG=	sendmail
  
***************
*** 34,40 ****
  beforeinstall:
  #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  #	    ${DESTDIR}/etc/sendmail.fc
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
--- 34,40 ----
  beforeinstall:
  #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  #	    ${DESTDIR}/etc/sendmail.fc
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
*** src/Makefile.386BSD.OLD	Sat Dec 18 11:20:32 1993
--- src/Makefile.386BSD	Sat Dec 18 11:21:07 1993
***************
*** 34,40 ****
  beforeinstall:
  #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  #	    ${DESTDIR}/etc/sendmail.fc
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
--- 34,40 ----
  beforeinstall:
  #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  #	    ${DESTDIR}/etc/sendmail.fc
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
*** src/Makefile.AIX.OLD	Wed Dec  1 19:08:02 1993
--- src/Makefile.AIX	Mon Jan  3 07:06:46 1994
***************
*** 5,11 ****
  #  old make program (I recommend that you get and port the new make if you
  #  are going to be doing any signficant work on sendmail).
  #
! #  This has been tested on AIX 3.1.5.
  #
  
  # use O=-O (usual) or O=-g (debugging)
--- 5,11 ----
  #  old make program (I recommend that you get and port the new make if you
  #  are going to be doing any signficant work on sendmail).
  #
! #  This has been tested on AIX 3.1.5 and 3.2.3e.
  #
  
  # use O=-O (usual) or O=-g (debugging)
***************
*** 19,24 ****
--- 19,27 ----
  # See READ_ME for a description of how these flags interact.
  #
  DBMDEF=	-DNDBM -DNEWDB
+ #
+ #  If you did not install the NEWDB on your AIX platform, use:
+ #DBMDEF=-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
  ENVDEF=	-D_AIX3
***************
*** 33,38 ****
--- 36,44 ----
  
  # libraries required on your system
  LIBS=	-ldbm -ldb
+ #
+ #  If you did not install the NEWDB on your AIX platform, use:
+ #LIBS=	-ldbm
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
  BINDIR=	${DESTDIR}/usr/sbin
***************
*** 41,51 ****
  STDIR=	${DESTDIR}/var/log
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/usr/share/misc
  
  # additional .o files needed
  OBJADD=
  
  ###################  end of user configuration flags  ######################
  
  CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
--- 47,59 ----
  STDIR=	${DESTDIR}/var/log
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/usr/lib
  
  # additional .o files needed
  OBJADD=
  
+ INSTALL=/usr/ucb/install
+ 
  ###################  end of user configuration flags  ######################
  
  CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
***************
*** 80,90 ****
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
--- 88,98 ----
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	${INSTALL} -O ${BINOWN} -G ${BINGRP} -M ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -O ${BINOWN} -G ${BINGRP} -M 644 /dev/null \
  	    ${STDIR}/sendmail.st
! 	${INSTALL} -c -O ${BINOWN} -G ${BINGRP} -M 444 sendmail.hf ${HFDIR}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
*** src/Makefile.AUX.OLD	Sat Dec 18 11:20:32 1993
--- src/Makefile.AUX	Sat Dec 18 11:21:12 1993
***************
*** 85,91 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do ; rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 85,91 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do ; rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.BSD43.OLD	Fri Nov 12 06:21:16 1993
--- src/Makefile.BSD43	Sat Dec 18 11:21:16 1993
***************
*** 33,39 ****
  #LIBDIRS=-L/usr/sww/lib
  
  # libraries required on your system
! LIBS=	-ldbm -lresolv
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
  BINDIR=	${DESTDIR}/usr/lib
--- 33,39 ----
  #LIBDIRS=-L/usr/sww/lib
  
  # libraries required on your system
! LIBS=	-ldbm -lresolv -ll
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
  BINDIR=	${DESTDIR}/usr/lib
***************
*** 48,54 ****
  OBJADD=
  
  # additional pseudo-sources needed
! BEFORE=	unistd.h stddef.h stdlib.h
  
  ###################  end of user configuration flags  ######################
  
--- 48,54 ----
  OBJADD=
  
  # additional pseudo-sources needed
! BEFORE=	unistd.h stddef.h stdlib.h dirent.h sys/time.h
  
  ###################  end of user configuration flags  ######################
  
***************
*** 72,80 ****
  sendmail: ${BEFORE} ${OBJS}
  	${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS}
  
! unistd.h stddef.h stdlib.h:
  	cp /dev/null $@
  
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
  
--- 72,89 ----
  sendmail: ${BEFORE} ${OBJS}
  	${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS}
  
! unistd.h stddef.h stdlib.h sys/time.h:
  	cp /dev/null $@
  
+ sys/time.h: sys
+ 
+ sys:
+ 	mkdir sys
+ 
+ dirent.h:
+ 	echo "#include <sys/dir.h>" > dirent.h
+ 	echo "#define dirent	direct" >> dirent.h
+ 
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
  
***************
*** 89,95 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 98,104 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.BSDI.OLD	Sat Dec 18 11:20:32 1993
--- src/Makefile.BSDI	Sat Dec 18 11:21:18 1993
***************
*** 82,88 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do (rm -f $$i; ln -s ${BINDIR}/sendmail $$i); done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 82,88 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do (rm -f $$i; ln -s ${BINDIR}/sendmail $$i); done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.ConvexOS.OLD	Sat Dec 18 11:20:32 1993
--- src/Makefile.ConvexOS	Sat Dec 18 11:21:21 1993
***************
*** 83,89 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 83,89 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.DGUX.OLD	Sat Nov 27 09:28:17 1993
--- src/Makefile.DGUX	Sat Dec 18 11:21:23 1993
***************
*** 0 ****
--- 1,94 ----
+ #
+ #  Tested on DG/UX 5.4.2 by A. Bryan Curnutt <bryan@Stoner.COM>.
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNDBM -DNIS
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=-DDGUX
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=-I/usr/sww/include/db
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=-L/usr/sww/lib
+ 
+ # libraries required on your system
+ LIBS=	-ldbm
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/bin
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/etc
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	bin
+ BINMODE=6555
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.Dell.OLD	Sat Dec 18 05:08:30 1993
--- src/Makefile.Dell	Wed Dec 22 04:39:02 1993
***************
*** 10,20 ****
  #	work on other SVR4 ports.
  #
  
  # use O=-O (usual) or O=-g (debugging)
! O=	-O
  
  CC=	gcc
! DESTDIR=/usr/local/sendmail
  
  # define the database mechanism used for alias lookups:
  #	-DNDBM -- use new DBM
--- 10,23 ----
  #	work on other SVR4 ports.
  #
  
+ # make sure the shell constructs below use the right shell
+ SHELL=	/bin/sh
+ 
  # use O=-O (usual) or O=-g (debugging)
! O=	-O2
  
  CC=	gcc
! #DESTDIR=/usr/local/sendmail
  
  # define the database mechanism used for alias lookups:
  #	-DNDBM -- use new DBM
***************
*** 26,32 ****
  DBMDEF=	-DNEWDB -DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-DDELL_SVR4
  
  # see also conf.h for additional compilation flags
  
--- 29,35 ----
  DBMDEF=	-DNEWDB -DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-D__svr4__
  
  # see also conf.h for additional compilation flags
  
***************
*** 40,52 ****
  LIBS=	-ldb -ldbm -lresolv -lsocket -lnsl -lelf
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
! BINDIR=	${DESTDIR}/bin
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
! STDIR=	${DESTDIR}/etc
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/etc
  
  # additional .o files needed
  OBJADD=
--- 43,55 ----
  LIBS=	-ldb -ldbm -lresolv -lsocket -lnsl -lelf
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
! BINDIR=	${DESTDIR}/usr/ucblib
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
! STDIR=	${DESTDIR}/usr/ucblib
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/usr/ucblib
  
  # additional .o files needed
  OBJADD=
***************
*** 63,69 ****
  
  LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
  BINOWN=	root
! BINGRP=	sys
  BINMODE=6555
  INSTALL=/usr/ucb/install
  
--- 66,72 ----
  
  LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
  BINOWN=	root
! BINGRP=	mail
  BINMODE=6555
  INSTALL=/usr/ucb/install
  
***************
*** 88,94 ****
  install-sendmail: sendmail
  	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 91,97 ----
  install-sendmail: sendmail
  	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.Dynix.OLD	Sat Nov 27 14:23:38 1993
--- src/Makefile.Dynix	Sat Dec 18 11:21:27 1993
***************
*** 0 ****
--- 1,106 ----
+ #
+ #  Tested on Dynix 3.2.0.
+ #
+ #	From Jim Davis <jdavis@cs.arizona.edu>.
+ #
+ #     ``There is no strtol in libc (well there is in the 'att universe'
+ #	libc, but I couldn't figure out how to link that in), so I
+ #	got the Chris Torek strtol.c from bsd-sources on uunet and
+ #	compiled that.  There is no native ndbm either; I couldn't
+ #	get db 1.72 to pass it's regression test, so I used gdbm-1.7
+ #	instead.  I compiled it with gcc 1.40a.  The -lseq is to pick
+ #	up getopt.''
+ #
+ 
+ CC= gcc
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O -g
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNDBM
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=
+ 
+ # libraries required on your system
+ LIBS=	-lseq -lgdbm
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/lib
+ 
+ # additional .o files needed
+ OBJADD=strtol.o
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	staff # no kmem group,
+ BINMODE=4555  # so not setgid
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.FreeBSD.OLD	Wed Dec  1 09:21:27 1993
--- src/Makefile.FreeBSD	Sat Dec 18 11:21:31 1993
***************
*** 0 ****
--- 1,49 ----
+ #
+ #  Makefile for FreeBSD
+ #
+ #	@(#)Makefile	8.2 (Berkeley) 8/15/93
+ 
+ PROG=	sendmail
+ 
+ # define the database format to use for aliases et al.  Can be -DNEWDB (for
+ # the new BSD database package -- this is preferred) or -DNDBM for the NDBM
+ # database package.  The old putrescent V7 DBM package is no longer
+ # supported.
+ # You can define both NEWDB and NDBM during a transition period; old
+ # databases are read, but the new format will be used on any rebuilds.  On
+ # really gnarly systems, you can set this to null; it will crawl like a high
+ # spiral snail, but it will work.
+ DBMDEF=	-DNEWDB
+ 
+ # FreeBSD 1.0 RELEASE has uname(2) now. Use -DUSEUNAME in order to use it.
+ CFLAGS+=-I${.CURDIR} ${DBMDEF} -DMIME -DUSEUNAME
+ 
+ SRCS=	alias.c arpadate.c clock.c collect.c conf.c convtime.c daemon.c \
+ 	deliver.c domain.c envelope.c err.c headers.c macro.c main.c map.c \
+ 	mci.c parseaddr.c queue.c readcf.c recipient.c savemail.c srvrsmtp.c \
+ 	stab.c stats.c sysexits.c trace.c udb.c usersmtp.c \
+ 	util.c version.c
+ DPADD=	
+ LDADD=	$(LIBUTIL)
+ #
+ # FreeBSD 1.0 RELEASE has GNU man and doesn't need preformatted man pages anymore
+ #
+ MAN1=	newaliases.1
+ MAN5=	aliases.5
+ MAN8=	sendmail.8 
+ LINKS=	/usr/sbin/sendmail /usr/bin/newaliases \
+ 	/usr/sbin/sendmail /usr/bin/mailq
+ BINDIR=	/usr/sbin
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ beforeinstall:
+ #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ #	    ${DESTDIR}/etc/sendmail.fc
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${DESTDIR}/var/log/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
+ 	    ${DESTDIR}/usr/share/misc
+ 
+ .include <bsd.prog.mk>
*** src/Makefile.HP-UX.OLD	Sat Dec 18 11:20:33 1993
--- src/Makefile.HP-UX	Tue Jan  4 08:00:44 1994
***************
*** 39,45 ****
  BINDIR=	${DESTDIR}/usr/lib
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
! STDIR=	${DESTDIR}/var/log
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  HFDIR=	${DESTDIR}/usr/lib
--- 39,45 ----
  BINDIR=	${DESTDIR}/usr/lib
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
! STDIR=	${DESTDIR}/usr/lib
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
  HFDIR=	${DESTDIR}/usr/lib
***************
*** 58,66 ****
  	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
  	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
  
! LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
  BINOWN=	root
! BINGRP=	sys
  BINMODE=6555
  
  ALL=	sendmail aliases.0 newaliases.0 sendmail.0
--- 58,66 ----
  	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
  	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
  
! LINKS=	${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq
  BINOWN=	root
! BINGRP=	mail
  BINMODE=6555
  
  ALL=	sendmail aliases.0 newaliases.0 sendmail.0
***************
*** 82,92 ****
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
! 	    ${STDIR}/sendmail.st
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
--- 82,91 ----
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	cpset sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	cpset /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP}
! 	cpset sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
*** src/Makefile.IRIX.OLD	Sat Dec 18 11:20:33 1993
--- src/Makefile.IRIX	Sat Dec 18 11:21:35 1993
***************
*** 83,89 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 83,89 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.Linux.OLD	Thu Dec  9 13:44:34 1993
--- src/Makefile.Linux	Mon Dec 20 05:53:18 1993
***************
*** 21,27 ****
  DBMDEF=	-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-D__USE_BSD -U__USE_POSIX2
  
  # see also conf.h for additional compilation flags
  
--- 21,27 ----
  DBMDEF=	-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-D__USE_BSD
  
  # see also conf.h for additional compilation flags
  
***************
*** 47,53 ****
  OBJADD=
  
  # additional pseudo-sources needed
! BEFORE=
  
  ###################  end of user configuration flags  ######################
  
--- 47,53 ----
  OBJADD=
  
  # additional pseudo-sources needed
! BEFORE=	features.h
  
  ###################  end of user configuration flags  ######################
  
***************
*** 59,65 ****
  	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
  	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
  
! LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
  BINOWN=	root
  BINGRP=	kmem
  BINMODE=6555
--- 59,65 ----
  	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
  	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
  
! LINKS=	${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq
  BINOWN=	root
  BINGRP=	kmem
  BINMODE=6555
***************
*** 78,83 ****
--- 78,86 ----
  	echo "#include <sys/dir.h>" > dirent.h
  	echo "#define dirent	direct" >> dirent.h
  
+ features.h:
+ 	ln features.linux.h $@
+ 
  NROFF=	nroff
  
  aliases.0: aliases.5
***************
*** 94,100 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 97,103 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.Mach386.OLD	Wed Dec  1 09:21:19 1993
--- src/Makefile.Mach386	Sat Dec 18 11:21:41 1993
***************
*** 0 ****
--- 1,102 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	@(#)Makefile.dist	8.7 (Berkeley) 9/3/93
+ #
+ 
+ CC=	gcc
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNDBM
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=
+ 
+ # libraries required on your system
+ LIBS=	-ldbm
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/lib
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.NeXT.OLD	Sat Dec 18 11:20:33 1993
--- src/Makefile.NeXT	Sun Dec 26 07:56:13 1993
***************
*** 21,27 ****
  DBMDEF=	-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-DNeXT
  
  # see also conf.h for additional compilation flags
  
--- 21,27 ----
  DBMDEF=	-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
! ENVDEF=	-DNeXT -DNETINFO
  
  # see also conf.h for additional compilation flags
  
***************
*** 92,98 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 92,98 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.NetBSD.OLD	Fri Dec 10 06:25:31 1993
--- src/Makefile.NetBSD	Mon Jan 10 07:29:03 1994
***************
*** 0 ****
--- 1,48 ----
+ #
+ #  NetBSD Makefile
+ #
+ 
+ #	@(#)Makefile	8.2 (Berkeley) 8/15/93
+ 
+ PROG=	sendmail
+ 
+ # define the database format to use for aliases et al.  Can be -DNEWDB (for
+ # the new BSD database package -- this is preferred) or -DNDBM for the NDBM
+ # database package.  The old putrescent V7 DBM package is no longer
+ # supported.
+ # You can define both NEWDB and NDBM during a transition period; old
+ # databases are read, but the new format will be used on any rebuilds.  On
+ # really gnarly systems, you can set this to null; it will crawl like a high
+ # spiral snail, but it will work.
+ DBMDEF=	-DNEWDB -DNDBM
+ 
+ #nasty warning about gcc 2.4.x caused bugs 
+ CFLAGS=-I${.CURDIR} ${DBMDEF} -DNETISO
+ #CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO
+ 
+ SRCS=	alias.c arpadate.c clock.c collect.c conf.c convtime.c daemon.c \
+ 	deliver.c domain.c envelope.c err.c headers.c macro.c main.c map.c \
+ 	mci.c parseaddr.c queue.c readcf.c recipient.c savemail.c srvrsmtp.c \
+ 	stab.c stats.c sysexits.c trace.c udb.c usersmtp.c \
+ 	util.c version.c
+ DPADD=	$(LIBUTIL)
+ LDADD=	-lutil
+ MAN1=	newaliases.0
+ MAN5=	aliases.0
+ MAN8=	sendmail.0 
+ LINKS=	/usr/sbin/sendmail /usr/bin/newaliases \
+ 	/usr/sbin/sendmail /usr/bin/mailq
+ BINDIR=	/usr/sbin
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ beforeinstall:
+ #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ #	    ${DESTDIR}/etc/sendmail.fc
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${DESTDIR}/var/log/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
+ 	    ${DESTDIR}/usr/share/misc
+ 
+ .include <bsd.prog.mk>
*** src/Makefile.OSF1.OLD	Sun Nov  7 10:38:01 1993
--- src/Makefile.OSF1	Sat Dec 18 11:22:23 1993
***************
*** 29,35 ****
  INCDIRS=-I/usr/sww/include/db
  
  # library directories
! LIBDIRS=-L/usr/sww/lib
  
  # libraries required on your system
  LIBS=	-ldbm
--- 29,35 ----
  INCDIRS=-I/usr/sww/include/db
  
  # library directories
! LIBDIRS=-L/usr/sww/lib -L/usr/shlib -L/usr/lib
  
  # libraries required on your system
  LIBS=	-ldbm
***************
*** 47,53 ****
  OBJADD=
  
  # additional link flags
! LDADD=	-non_shared
  
  ###################  end of user configuration flags  ######################
  
--- 47,53 ----
  OBJADD=
  
  # additional link flags
! #LDADD=	-non_shared
  
  ###################  end of user configuration flags  ######################
  
***************
*** 69,75 ****
  all: ${ALL}
  
  sendmail: ${BEFORE} ${OBJS}
! 	${CC} -o sendmail ${LDFLAGS} ${OBJS} ${LIBDIRS} ${LIBS}
  
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
--- 69,75 ----
  all: ${ALL}
  
  sendmail: ${BEFORE} ${OBJS}
! 	${CC} -o sendmail ${LDADD} ${OBJS} ${LIBDIRS} ${LIBS}
  
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
***************
*** 86,93 ****
  	installbsd -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
  	cp /dev/null ${STDIR}/sendmail.st
! 	chmod ${BINMOD} ${STDIR}/sendmail.st
! 	chown ${BINGRP}.${BINGRP} ${STDIR}/sendmail.st
  	installbsd -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  	rm -f /usr/sbin/smtpd
  
--- 86,93 ----
  	installbsd -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
  	cp /dev/null ${STDIR}/sendmail.st
! 	chmod 644 ${STDIR}/sendmail.st
! 	chown ${BINOWN}.${BINGRP} ${STDIR}/sendmail.st
  	installbsd -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  	rm -f /usr/sbin/smtpd
  
*** src/Makefile.RISCos.OLD	Wed Dec  1 09:08:32 1993
--- src/Makefile.RISCos	Sat Dec 18 11:22:27 1993
***************
*** 0 ****
--- 1,110 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	For Mips RISC/os 4.52.
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # be sure we are compiling in BSD mode
+ CC=	cc -systype bsd43
+ 
+ # define the database mechanism used for alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNDBM
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=	-DRISCOS -Olimit 800
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ #INCDIRS=-I/usr/sww/include/db
+ 
+ # library directories
+ #LIBDIRS=-L/usr/sww/lib
+ 
+ # libraries required on your system
+ LIBS=	-lmld
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/etc
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/lib
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ # additional pseudo-sources needed
+ BEFORE=	stdlib.h dirent.h
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ stdlib.h:
+ 	cp /dev/null $@
+ 
+ dirent.h:
+ 	echo "#include <sys/dir.h>" > dirent.h
+ 	echo "#define dirent	direct" >> dirent.h
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.SCO.OLD	Sun Dec 12 20:33:12 1993
--- src/Makefile.SCO	Sat Dec 18 11:22:31 1993
***************
*** 0 ****
--- 1,97 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #  This has been tested on SCO.
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=	-D_SCO_unix_
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=
+ 
+ # library directories
+ LIBDIRS=
+ 
+ # libraries required on your system
+ LIBS=	-lsocket
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/lib
+ 
+ # additional .o files needed
+ OBJADD=	fsync.o
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.SVR4.OLD	Tue Dec 21 06:18:28 1993
--- src/Makefile.SVR4	Wed Dec 22 04:39:09 1993
***************
*** 0 ****
--- 1,106 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	Based on a Makefile for Dell SVR4 Issue 2.2 from Kimmo Suominen
+ #	<kim@grendel.lut.fi> -- I haven't tested this myself.  It may
+ #	work on other SVR4 ports.
+ #
+ 
+ # make sure the shell constructs below use the right shell
+ SHELL=	/bin/sh
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ CC=	gcc
+ #DESTDIR=/usr/local/sendmail
+ 
+ # define the database mechanism used for alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNEWDB -DNDBM
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=	-D__svr4__
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=
+ 
+ # library directories
+ LIBDIRS=
+ 
+ # libraries required on your system
+ LIBS=	-ldb -ldbm -lresolv -lsocket -lnsl -lelf
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/ucblib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/usr/ucblib
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/ucblib
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	mail
+ BINMODE=6555
+ INSTALL=/usr/ucb/install
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.Solaris.OLD	Sun Nov 14 07:47:59 1993
--- src/Makefile.Solaris	Tue Dec 28 18:07:03 1993
***************
*** 9,17 ****
  #
  
  # use O=-O (usual) or O=-g (debugging)
! O=	-O
  
! CC=	gcc -V2.3.3
  
  # define the database mechanism used for alias lookups:
  #	-DNDBM -- use new DBM
--- 9,18 ----
  #
  
  # use O=-O (usual) or O=-g (debugging)
! # warning: do not use -O with gcc
! O=	
  
! CC=	gcc
  
  # define the database mechanism used for alias lookups:
  #	-DNDBM -- use new DBM
***************
*** 20,49 ****
  # The really old (V7) DBM library is no longer supported.
  # See READ_ME for a description of how these flags interact.
  #
! DBMDEF=	-DNDBM
  
  # environment definitions (e.g., -D_AIX3)
  ENVDEF=	-DSOLARIS
  
  # see also conf.h for additional compilation flags
  
  # include directories
! INCDIRS=-I/usr/sww/include/db
  
  # library directories
! LIBDIRS=-L/usr/sww/lib -L/usr/ucblib
  
  # libraries required on your system
  LIBS=	-lresolv -lsocket -lnsl -lelf
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
! BINDIR=	${DESTDIR}/usr/sbin
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
  STDIR=	${DESTDIR}/var/log
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/usr/share/misc
  
  # additional .o files needed
  OBJADD=
--- 21,51 ----
  # The really old (V7) DBM library is no longer supported.
  # See READ_ME for a description of how these flags interact.
  #
! DBMDEF=	-DNDBM -DNIS
  
  # environment definitions (e.g., -D_AIX3)
+ # include -DSOLARIS_2_3 for version 2.3 and higher
  ENVDEF=	-DSOLARIS
  
  # see also conf.h for additional compilation flags
  
  # include directories
! INCDIRS=-I/usr/sww/include/db -I.
  
  # library directories
! LIBDIRS=-L/usr/sww/lib
  
  # libraries required on your system
  LIBS=	-lresolv -lsocket -lnsl -lelf
  
  # location of sendmail binary (usually /usr/sbin or /usr/lib)
! BINDIR=	${DESTDIR}/usr/lib
  
  # location of sendmail.st file (usually /var/log or /usr/lib)
  STDIR=	${DESTDIR}/var/log
  
  # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
! HFDIR=	${DESTDIR}/etc/mail
  
  # additional .o files needed
  OBJADD=
***************
*** 85,91 ****
  install-sendmail: sendmail
  	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 87,93 ----
  install-sendmail: sendmail
  	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.SunOS.OLD	Sat Dec 18 11:20:33 1993
--- src/Makefile.SunOS	Sat Dec 18 11:22:35 1993
***************
*** 89,95 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 89,95 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.Titan.OLD	Wed Dec  1 09:18:46 1993
--- src/Makefile.Titan	Sat Dec 18 11:22:38 1993
***************
*** 0 ****
--- 1,109 ----
+ #
+ #  This Makefile is designed to work on the old "make" program.  It does
+ #  not use the obj subdirectory.  It also does not install documentation
+ #  automatically -- think of it as a quick start for sites that have the
+ #  old make program (I recommend that you get and port the new make if you
+ #  are going to be doing any signficant work on sendmail).
+ #
+ #	@(#)Makefile.dist	8.7 (Berkeley) 9/3/93
+ #
+ 
+ # put the compiler in BSD mode
+ CC=	cc -43
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ O=	-O
+ 
+ # define the database mechanisms available for map & alias lookups:
+ #	-DNDBM -- use new DBM
+ #	-DNEWDB -- use new Berkeley DB
+ #	-DNIS -- include NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # See READ_ME for a description of how these flags interact.
+ #
+ DBMDEF=	-DNDBM
+ 
+ # environment definitions (e.g., -D_AIX3)
+ ENVDEF=
+ 
+ # see also conf.h for additional compilation flags
+ 
+ # include directories
+ INCDIRS=
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ LIBDIRS=
+ 
+ # libraries required on your system
+ LIBS=	-ldbm
+ 
+ # location of sendmail binary (usually /usr/sbin or /usr/lib)
+ BINDIR=	${DESTDIR}/usr/lib
+ 
+ # location of sendmail.st file (usually /var/log or /usr/lib)
+ STDIR=	${DESTDIR}/var/log
+ 
+ # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
+ HFDIR=	${DESTDIR}/usr/share/misc
+ 
+ # additional .o files needed
+ OBJADD=
+ 
+ # additional pseudo-sources needed
+ BEFORE=	stddef.h stdlib.h
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF}
+ 
+ OBJS=	alias.o arpadate.o clock.o collect.o conf.o convtime.o daemon.o \
+ 	deliver.o domain.o envelope.o err.o headers.o macro.o main.o \
+ 	map.o mci.o parseaddr.o queue.o readcf.o recipient.o \
+ 	savemail.o srvrsmtp.o stab.o stats.o sysexits.o \
+ 	trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
+ 
+ LINKS=	${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq
+ BINOWN=	root
+ BINGRP=	kmem
+ BINMODE=6555
+ 
+ ALL=	sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ stddef.h stdlib.h:
+ 	cp /dev/null $@
+ 
+ aliases.0: aliases.5
+ 	nroff -h -mandoc aliases.5 > aliases.0
+ 
+ newaliases.0: newaliases.1
+ 	nroff -h -mandoc newaliases.1 > newaliases.0
+ 
+ sendmail.0: sendmail.8
+ 	nroff -h -mandoc sendmail.8 > sendmail.0
+ 
+ install: install-sendmail install-docs
+ 
+ install-sendmail: sendmail
+ 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
+ 	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
+ 	    ${STDIR}/sendmail.st
+ 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
+ 
+ # doesn't actually install them -- you may want to install pre-nroff versions
+ install-docs: aliases.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.ULTRIX.OLD	Sat Dec 18 11:20:33 1993
--- src/Makefile.ULTRIX	Sat Dec 18 11:22:41 1993
***************
*** 85,91 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 85,91 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.UMAX.OLD	Sat Dec 18 11:20:34 1993
--- src/Makefile.UMAX	Sat Dec 18 11:22:44 1993
***************
*** 92,98 ****
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
--- 92,98 ----
  install-sendmail: sendmail
  	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
*** src/Makefile.Utah.OLD	Sat Dec 18 11:20:34 1993
--- src/Makefile.Utah	Sat Dec 18 11:23:01 1993
***************
*** 31,39 ****
  BINMODE=6555
  
  beforeinstall:
! #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
! #	    ${DESTDIR}/etc/sendmail.fc
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
--- 31,37 ----
  BINMODE=6555
  
  beforeinstall:
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${DESTDIR}/var/log/sendmail.st
  	install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \
  	    ${DESTDIR}/usr/share/misc
*** src/Makefile.dist.OLD	Wed Dec  1 19:09:34 1993
--- src/Makefile.dist	Mon Dec 20 10:52:10 1993
***************
*** 5,11 ****
  #  old make program (I recommend that you get and port the new make if you
  #  are going to be doing any signficant work on sendmail).
  #
! #	@(#)Makefile.dist	8.7 (Berkeley) 9/3/93
  #
  
  # use O=-O (usual) or O=-g (debugging)
--- 5,11 ----
  #  old make program (I recommend that you get and port the new make if you
  #  are going to be doing any signficant work on sendmail).
  #
! #	@(#)Makefile.dist	8.9 (Berkeley) 12/20/93
  #
  
  # use O=-O (usual) or O=-g (debugging)
***************
*** 80,93 ****
  sendmail.0: sendmail.8
  	nroff -h -mandoc sendmail.8 > sendmail.0
  
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	install -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 666 /dev/null \
  	    ${STDIR}/sendmail.st
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
--- 80,95 ----
  sendmail.0: sendmail.8
  	nroff -h -mandoc sendmail.8 > sendmail.0
  
+ INSTALL=install
+ 
  install: install-sendmail install-docs
  
  install-sendmail: sendmail
! 	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
  	for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
  	    ${STDIR}/sendmail.st
! 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR}
  
  # doesn't actually install them -- you may want to install pre-nroff versions
  install-docs: aliases.0 newaliases.0 sendmail.0
*** src/READ_ME.OLD	Sun Nov  7 13:11:29 1993
--- src/READ_ME	Wed Jan 12 06:00:15 1994
***************
*** 30,36 ****
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #	@(#)READ_ME	8.31 (Berkeley) 10/31/93
  #
  
  This directory contains the source files for sendmail.
--- 30,36 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #	@(#)READ_ME	8.47 (Berkeley) 1/12/94
  #
  
  This directory contains the source files for sendmail.
***************
*** 39,49 ****
  
  	eqn ../doc/op.me | pic | ditroff -me
  
! The Makefile is for the new (4.4BSD) Berkeley make, available from
! ftp.uu.net in the directory /systems/unix/bsd-sources/usr.bin/make.
! (Paul Southworth <pauls@umich.edu> published a description of porting
! this make in comp.unix.bsd.)  This Makefile has assumptions about the
! 4.4 file system layout built in.
  
  There is also a Makefile.dist which is much less clever, but works on
  the old traditional make.  You can use this using:
--- 39,48 ----
  
  	eqn ../doc/op.me | pic | ditroff -me
  
! The Makefile is for the new (4.4BSD) Berkeley make and uses syntax
! that is not recognized by older makes.  It also has assumptions
! about the 4.4 file system layout built in.  See below for details
! about other Makefiles.
  
  There is also a Makefile.dist which is much less clever, but works on
  the old traditional make.  You can use this using:
***************
*** 50,75 ****
  
  	make -f Makefile.dist
  
! There are a bunch of other Makefiles for other systems -- these are
! the ones that I use, they have "Berkeley quirks" in them, and I don't
! guarantee that they will work unmodified in your environment.  However,
! they are all designed for the old make and can be used to help you get
! started.  They have names like "Makefile.HPUX".  Many of them include
! -I/usr/sww/include/db and -L/usr/sww/lib -- this is Berkeley's
! location for the new database libraries, described below.
  
  There is also a shell script (makesendmail) that tries to be clever
  about using object subdirectories.  It's pretty straightforward, and
  may help if you share a source tree among different architectures.
  
! IMPORTANT:  DO NOT USE OPTIMIZATION (``-O'') IF YOU ARE RUNNING GCC
! 2.4.x.  THERE IS A BUG IN THE GCC OPTIMIZER THAT CAUSES SENDMAIL TO
! FAIL MISERABLY.
  
! IMPORTANT:  Read the appropriate paragraphs in the section on
! ``Operating System and Compile Quirks''.
  
  
  +----------------------+
  | DATABASE DEFINITIONS |
  +----------------------+
--- 49,126 ----
  
  	make -f Makefile.dist
  
! **************************************************
! **  Read below for more details of Makefiles.	**
! **************************************************
  
  There is also a shell script (makesendmail) that tries to be clever
  about using object subdirectories.  It's pretty straightforward, and
  may help if you share a source tree among different architectures.
  
! **************************************************************************
! **  IMPORTANT:  DO NOT USE OPTIMIZATION (``-O'') IF YOU ARE RUNNING	**
! **  GCC 2.4.x or 2.5.x.  THERE IS A BUG IN THE GCC OPTIMIZER THAT	**
! **  CAUSES SENDMAIL COMPILES TO FAIL MISERABLY.				**
! **************************************************************************
  
! Jim Wilson of Cygnus believes he has found the problem -- it will
! probably be fixed in GCC 2.5.6 -- but until this is verified, be
! very suspicious of gcc -O.
  
+ **************************************************************************
+ **  IMPORTANT:  Read the appropriate paragraphs in the section on	**
+ **  ``Operating System and Compile Quirks''.				**
+ **************************************************************************
  
+ 
+ +-----------+
+ | MAKEFILES |
+ +-----------+
+ 
+ The "Makefile"s in these directories are from 4.4 BSD, and hence
+ really only work properly if you are on a 4.4 system.  In particular,
+ they use new syntax that will not be recognized on old make programs,
+ and some of them do things like ``.include ../../Makefile.inc'' to
+ pick up some system defines.  If you are getting sendmail separately,
+ these files won't be included in the distribution, as they are
+ outside of the sendmail tree.
+ 
+ Instead, you should use one of the other Makefiles, such as
+ Makefile.SunOS for a SunOS system, and so forth.  These should
+ work with the version of make that is appropriate for that
+ system.
+ 
+ There are a bunch of other Makefiles for other systems with names
+ like Makefile.HPUX for an HP-UX system.  They use the version of
+ make that is native for that system.  These are the Makefiles that
+ I use, and they have "Berkeley quirks" in them.  I can't guarantee
+ that they will work unmodified in your environment.  Many of them
+ include -I/usr/sww/include/db and -L/usr/sww/lib -- this is Berkeley's
+ location (the ``Software Warehouse'') for the new database libraries,
+ described below.  You don't have to remove these definitions if you
+ don't have these directories.
+ 
+ Please look for an appropriate Makefile before you start trying to
+ compile with Makefile or Makefile.dist.
+ 
+ If you want to port the new Berkeley make, you can get it from
+ ftp.uu.net in the directory /systems/unix/bsd-sources/usr.bin/make.
+ Diffs and instructions for building this version of make under
+ SunOS 4.1.x are available on ftp.css.itd.umich.edu in
+ /pub/systems/sun/Net2-make.sun4.diff.Z.  Diffs and instructions
+ for building this version of make under IBM AIX 3.2.4 are available
+ on ftp.uni-stuttgart.de in /sw/src/patches/bsd-make-rus-patches.
+ Paul Southworth <pauls@umich.edu> published a description of porting
+ this make in comp.unix.bsd.
+ 
+ The complete text of the Makefile.inc that is in the parent of the
+ sendmail directory is:
+ 
+ 	#	@(#)Makefile.inc	8.1 (Berkeley) 6/6/93
+ 
+ 	BINDIR?=	/usr/sbin
+ 
+ 
  +----------------------+
  | DATABASE DEFINITIONS |
  +----------------------+
***************
*** 83,89 ****
  longer supported), and NIS (Network Information Services).  Used alone
  these just include the support they indicate.  [If you are using NEWDB,
  get the latest version from FTP.CS.Berkeley.EDU in /ucb/4bsd.  DO NOT
! use the version from the Net2 distribution!]
  
  If NEWDB and NDBM are defined (but not NIS), then sendmail will read
  NDBM format alias files, but the next time a newaliases is run the
--- 134,142 ----
  longer supported), and NIS (Network Information Services).  Used alone
  these just include the support they indicate.  [If you are using NEWDB,
  get the latest version from FTP.CS.Berkeley.EDU in /ucb/4bsd.  DO NOT
! use the version from the Net2 distribution!  However, if you are on
! BSD/386 or 386BSD-based systems, use the one that already exists
! on your system.  You may need to define OLD_NEWDB to do this.]
  
  If NEWDB and NDBM are defined (but not NIS), then sendmail will read
  NDBM format alias files, but the next time a newaliases is run the
***************
*** 119,124 ****
--- 172,179 ----
  Makefile:
  
  SOLARIS		Define this if you are running Solaris 2.0 or higher.
+ SOLARIS_2_3	Define this if you are running Solaris 2.3 or higher.
+ SUNOS403	Define this if you are running SunOS 4.0.3.
  NeXT		Define this if you are on a NeXT box.  (This one may
  		be pre-defined for you.)  There are other hacks you
  		have to make -- see below.
***************
*** 125,130 ****
--- 180,186 ----
  _AIX3		Define this if you are IBM AIX 3.x.
  RISCOS		Define this if you are running RISC/os from MIPS.
  _SCO_unix_	Define this if you are on SCO UNIX.
+ _SCO_unix_4_2	Define this if you are on SCO Open Server 3.2v4.
  
  If you are a system that sendmail has already been ported to, you
  probably won't have to touch these.  But if you are porting, you may
***************
*** 131,137 ****
  have to tweak the following compilation flags in conf.h in order to
  get it to compile and link properly:
  
! SYSTEM5		Adjust for System V.
  SYS5SIGNALS	Use System V signal semantics -- the signal handler
  		is automatically dropped when the signal is caught.
  		If this is not set, use POSIX/BSD semantics, where the
--- 187,193 ----
  have to tweak the following compilation flags in conf.h in order to
  get it to compile and link properly:
  
! SYSTEM5		Adjust for System V (not necessarily Release 4).
  SYS5SIGNALS	Use System V signal semantics -- the signal handler
  		is automatically dropped when the signal is caught.
  		If this is not set, use POSIX/BSD semantics, where the
***************
*** 166,177 ****
  		your system has setresuid(2), (for example, on HP-UX) in
  		which case you will also have to #define setreuid(r, e)
  		to be the appropriate call.  Some systems (such as Solaris)
! 		have a compatibility routine that doesn't work properly.
  		The important thing is that you have a call that will set
! 		the effective uid independently of the real or saved uid.
! 		Setting this improves the security somewhat, since
! 		sendmail doesn't have to read .forward and :include: files
! 		as root.
  GIDSET_T	The type of entries in a gidset passed as the second
  		argument to getgroups(2).  Historically this has been an
  		int, so this is the default, but some systems (such as
--- 222,261 ----
  		your system has setresuid(2), (for example, on HP-UX) in
  		which case you will also have to #define setreuid(r, e)
  		to be the appropriate call.  Some systems (such as Solaris)
! 		have a compatibility routine that doesn't work properly,
! 		but may have "saved user ids" properly implemented so you
! 		can ``#define setreuid(r, e) seteuid(e)'' and have it work.
  		The important thing is that you have a call that will set
! 		the effective uid independently of the real or saved uid
! 		and be able to set the effective uid back again when done.
! 		There's a test program in ../test/t_setreuid.c that will
! 		try things on your system.  Setting this improves the
! 		security, since sendmail doesn't have to read .forward
! 		and :include: files as root.  There are certain attacks
! 		that may be unpreventable without this call.
! HASLSTAT	Define this if you have symbolic links (and thus the
! 		lstat(2) system call).  This improves security.  Unlike
! 		most other options, this one is on by default, so you
! 		need to #undef it in conf.h if you don't have symbolic
! 		links (these days everyone does).
! NEEDGETOPT	Define this if you need a reimplementation of getopt(3).
! 		On some systems, getopt does very odd things if called
! 		to scan the arguments twice.  This flag will ask sendmail
! 		to compile in a local version of getopt that works
! 		properly.
! NEEDSTRTOL	Define this if your standard C library does not define
! 		strtol(3).  This will compile in a local version.
! NEEDVPRINTF	Define this if your standard C library does not define
! 		vprintf(3).  Note that the resulting fake implementation
! 		is not very elegant and may not even work on some
! 		architectures.
! HASGETUSERSHELL	Define this to 1 if you have getusershell(3) in your
! 		standard C library.  If this is not defined, or is defined
! 		to be 0, sendmail will scan the /etc/shells file (no
! 		NIS-style support, defaults to /bin/sh and /bin/csh if
! 		that file does not exist) to get a list of unrestricted
! 		user shells.  This is used to determine whether users
! 		are allowed to forward their mail to a program or a file.
  GIDSET_T	The type of entries in a gidset passed as the second
  		argument to getgroups(2).  Historically this has been an
  		int, so this is the default, but some systems (such as
***************
*** 206,211 ****
--- 290,306 ----
  WAITUNION	The wait(2) routine takes a "union wait" argument instead
  		of an integer argument.  This is for compatibility with
  		old versions of BSD.
+ SCANF		You can set this to extend the F command to accept a
+ 		scanf string -- this gives you a primitive parser for
+ 		class definitions -- BUT it can make you vulnerable to
+ 		core dumps if the target file is poorly formed.
+ SYSLOG_BUFSIZE	You can define this to be the size of the buffer that
+ 		syslog accepts.  If it is not defined, it assumes a
+ 		1024-byte buffer.  If the buffer is very small (under
+ 		256 bytes) the log message format changes -- each
+ 		e-mail message will log many more messages, since it
+ 		will log each piece of information as a separate line
+ 		in syslog.
  
  
  +-----------------------+
***************
*** 226,235 ****
  		Normally defined in the Makefile.
  USERDB		Include support for the User Information Database.  Implied
  		by NEWDB in conf.h.
! IDENTPROTO	Define this to get IDENT (RFC 1413) protocol support.
  		This is assumed unless you are running on Ultrix or
  		HP-UX, both of which have a problem in the UDP
! 		implementation.
  MIME		Include support for MIME-encapsulated error messages.
  LOG		Set this to get syslog(3) support.  Defined by default
  		in conf.h.  You want this if at all possible.
--- 321,331 ----
  		Normally defined in the Makefile.
  USERDB		Include support for the User Information Database.  Implied
  		by NEWDB in conf.h.
! IDENTPROTO	Define this as 1 to get IDENT (RFC 1413) protocol support.
  		This is assumed unless you are running on Ultrix or
  		HP-UX, both of which have a problem in the UDP
! 		implementation.  You can define it to be 0 to explicitly
! 		turn off IDENT protocol support.
  MIME		Include support for MIME-encapsulated error messages.
  LOG		Set this to get syslog(3) support.  Defined by default
  		in conf.h.  You want this if at all possible.
***************
*** 256,265 ****
  		default in conf.h.
  
  
! +-------------------------------------+
  | OPERATING SYSTEM AND COMPILE QUIRKS |
  +-------------------------------------+
  
  SunOS 4.x (Solaris 1.x)
  	You may have to use -lresolv on SunOS.  However, beware that
  	this links in a new version of gethostbyname that does not
--- 352,420 ----
  		default in conf.h.
  
  
! +---------------------+
! | DNS/RESOLVER ISSUES |
! +---------------------+
! 
! Many systems have old versions of the resolver library.  At a minimum,
! you should be running BIND 4.8.3; older versions may compile, but they
! have known bugs that should give you pause.
! 
! Common problems in old versions include "undefined" errors for
! dn_skipname.
! 
! Some people have had a problem with BIND 4.9; it uses some routines
! that it expects to be externally defined such as strerror().  It may
! help to link with "-l44bsd" to solve this problem.
! 
! !PLEASE! be sure to link with the same version of the resolver as
! the header files you used -- some people have used the 4.9 headers
! and linked with BIND 4.8 or vice versa, and it doesn't work.
! Unfortunately, it doesn't fail in an obvious way -- things just
! subtlely don't work.
! 
! 
! +-------------------------------------+
  | OPERATING SYSTEM AND COMPILE QUIRKS |
  +-------------------------------------+
  
+ GCC 2.5.x problems  *** IMPORTANT ***
+ 	Date: Mon, 29 Nov 93 19:08:44 PST
+ 	From: wilson@cygnus.com (Jim Wilson)
+ 	Message-Id: <9311300308.AA04608@cygnus.com>
+ 	To: kenner@vlsi1.ultra.nyu.edu
+ 	Subject: [cattelan@thebarn.com: gcc 2.5.4-2.5.5 -O bug]
+ 	Cc: cattelan@thebarn.com, rms@gnu.ai.mit.edu, sendmail@cs.berkeley.edu
+ 
+ 	This fixes a problem that occurs when gcc 2.5.5 is used to compile
+ 	sendmail 8.6.4 with optimization on a sparc.
+ 
+ 	Mon Nov 29 19:00:14 1993  Jim Wilson  (wilson@sphagnum.cygnus.com)
+ 
+ 		* reload.c (find_reloads_toplev): Replace obsolete reference to
+ 		BYTE_LOADS_*_EXTEND with LOAD_EXTEND_OP.
+ 
+ 	*** clean-ss-931128/reload.c    Sun Nov 14 16:20:01 1993
+ 	--- ss-931128/reload.c  Mon Nov 29 18:52:55 1993
+ 	*************** find_reloads_toplev (x, opnum, type, ind
+ 	*** 3888,3894 ****
+ 		 force a reload in that case.  So we should not do anything here.  */
+ 	  
+ 		else if (regno >= FIRST_PSEUDO_REGISTER
+ 	! #if defined(BYTE_LOADS_ZERO_EXTEND) || defined(BYTE_LOADS_SIGN_EXTEND)
+ 		       && (GET_MODE_SIZE (GET_MODE (x))
+ 			   <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
+ 	  #endif
+ 	--- 3888,3894 ----
+ 		 force a reload in that case.  So we should not do anything here.  */
+ 	  
+ 		else if (regno >= FIRST_PSEUDO_REGISTER
+ 	! #ifdef LOAD_EXTEND_OP
+ 		       && (GET_MODE_SIZE (GET_MODE (x))
+ 			   <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x))))
+ 	  #endif
+ 
+ 
  SunOS 4.x (Solaris 1.x)
  	You may have to use -lresolv on SunOS.  However, beware that
  	this links in a new version of gethostbyname that does not
***************
*** 268,274 ****
  	Some people have reported problems with the SunOS version of
  	-lresolv and/or in.named, and suggest that you get a newer
  	version.  The symptoms are delays when you connect to the
! 	SMTP server on a SunOS machine.  There is a version of BIND
  	version 4.9 on gatekeeper.DEC.COM in pub/BSD/bind/4.9.
  
  	There is substantial disagreement about whether you can make
--- 423,430 ----
  	Some people have reported problems with the SunOS version of
  	-lresolv and/or in.named, and suggest that you get a newer
  	version.  The symptoms are delays when you connect to the
! 	SMTP server on a SunOS machine or having your domain added to
! 	addresses inappropriately.  There is a version of BIND
  	version 4.9 on gatekeeper.DEC.COM in pub/BSD/bind/4.9.
  
  	There is substantial disagreement about whether you can make
***************
*** 299,313 ****
  
  	The Solaris "syslog" function is apparently limited to something
  	about 90 characters because of a kernel limitation.  If you have
! 	source code, you can probably up this number.  Bill Wisner
! 	<wisner@well.sf.ca.us> was able to get an unofficial, unsupported
! 	patch.
  
  OSF/1
! 	If you are compiling on OSF/1 (DEC Alpha), you must use -lmld
! 	and -non_shared (otherwise it core dumps on startup).  Also,
! 	the enclosed makefile removed /usr/sbin/smtpd; if you need it,
! 	just create the link to the sendmail binary.
  
  NeXT
  	If you are compiling on NeXT, you will have to create an empty
--- 455,475 ----
  
  	The Solaris "syslog" function is apparently limited to something
  	about 90 characters because of a kernel limitation.  If you have
! 	source code, you can probably up this number.  The syslogd patch
! 	is included in kernel jumbo patch for Solaris 2.2 as of revision
! 	-39 or so.  At least one person is running with patch 100999-45
! 	and their long lost sendmail logging is finally showing up.  At
! 	least one other person is running with patch 101318 installed
! 	under Solaris 2.3 with success.
  
  OSF/1
! 	If you are compiling on OSF/1 (DEC Alpha), you must use 
! 	-L/usr/shlib (otherwise it core dumps on startup).  You may also
! 	need -mld to get the nlist() function, although some versions
! 	apparently don't need this.
! 	
! 	Also, the enclosed makefile removed /usr/sbin/smtpd; if you need
! 	it, just create the link to the sendmail binary.
  
  NeXT
  	If you are compiling on NeXT, you will have to create an empty
***************
*** 329,338 ****
  
  	You may have to use -DNeXT.
  
! BSDI (BSD/386)
! 	I have reports that the "m4" from BSDI won't handle the config
! 	files properly.  I haven't had a chance to test this myself.
  
  4.3BSD
  	If you are running a "virgin" version of 4.3BSD, you'll have
  	a very old resolver and be missing some header files.  The
--- 491,522 ----
  
  	You may have to use -DNeXT.
  
! BSDI (BSD/386) 1.0, NetBSD 0.9, FreeBSD 1.0
! 	The "m4" from BSDI won't handle the config files properly.
! 	I haven't had a chance to test this myself.
  
+ 	The M4 shipped in FreeBSD and NetBSD 0.9 don't handle the config
+ 	files properly. One must use either GNU m4 1.1 or the PD-M4
+ 	recently posted in comp.os.386bsd.bugs (and maybe others).
+ 	NetBSD-current includes the PD-M4 (as stated in the NetBSD file
+ 	CHANGES).
+ 	
+ 	FreeBSD 1.0 RELEASE has uname(2) now. Use -DUSEUNAME in order to
+ 	use it (look into Makefile.FreeBSD). NetBSD-current may have
+ 	it too but it has not been verified.
+ 
+ 	You cannot port the latest version of the Berkeley db library
+ 	and use it with sendmail without recompiling the world.  This
+ 	is because C library routines use the older version which have
+ 	incompatible header files -- the result is that it can't read
+ 	other system files, such as /etc/passwd, unless you use the
+ 	new db format throughout your system.  You should normally just
+ 	use the version of db supplied in your release.  You may need
+ 	to use -DOLD_NEWDB to make this work -- this turns off some
+ 	new interface calls (for file locking) that are not in older
+ 	versions of db.  You'll get compile errors if you need this
+ 	flag and don't have it set.
+ 
  4.3BSD
  	If you are running a "virgin" version of 4.3BSD, you'll have
  	a very old resolver and be missing some header files.  The
***************
*** 346,376 ****
  	copy ../contrib/oldbind.compat.c into src and add
  	oldbind.compat.o to OBJADD in the Makefile.
  
- Linux
- 	From: Karl London <karl@borg.demon.co.uk>
- 	Subject: Little bit to add to a readme for Linux for 8.6
- 	Date: Fri, 10 Sep 1993 20:16:05 +0100 (BST)
- 
- 	Below is a copy of a section of the /usr/include/unistd.h from
- 	linux libc-4.4.1 which needs changing because of a bug in the
- 	header files. Should be fixed for future releases..
- 
- 	Karl
- 
- 	The #if 0 and #endif are new!!
- 
- 	-------
- 
- 	   If OPTS begins with `--', then non-option arguments
- 	   are treated as arguments to the option '\0'.
- 	   This behavior is specific to the GNU `getopt'.  */
- 	#if 0
- 	extern int getopt __P ((int __argc, char *__const * __argv,
- 				__const char *__opts));
- 	#endif
- 	extern int opterr;
- 	extern int optind;
- 
  A/UX
  	Date: Tue, 12 Oct 1993 18:28:28 -0400 (EDT)
  	From: "Eric C. Hagberg" <hagberg@med.cornell.edu>
--- 530,535 ----
***************
*** 401,406 ****
--- 560,623 ----
  	DG/UX -- the person who has this working, Douglas Anderson
  	<dlander@afterlife.ncsc.mil>, used procmail instead.
  
+ System V Release 4 Based Systems
+ 	There is a single Makefile that is intended for all SVR4-based
+ 	systems (called Makefile.SVR4).  It defines __svr4__, which is
+ 	predefined by some compilers.  If your compiler already defines
+ 	this compile variable, you can delete the definition from the
+ 	Makefile.
+ 
+ 	It's been tested on Dell Issue 2.2.
+ 
+ DELL SVR4
+ 	Date:      Mon, 06 Dec 1993 10:42:29 EST
+ 	From: "Kimmo Suominen" <kim@grendel.lut.fi>
+ 	Message-ID: <2d0352f9.lento29@lento29.UUCP>
+ 	To: eric@cs.berkeley.edu
+ 	Cc: sendmail@cs.berkeley.edu
+ 	Subject:   Notes for DELL SVR4
+ 
+ 	Eric,
+ 
+ 	Here are some notes for compiling Sendmail 8.6.4 on DELL SVR4.  I ran
+ 	across these things when helping out some people who contacted me by
+ 	e-mail.
+ 
+ 	1) Use gcc 2.4.5 (or later?).  Dell distributes gcc 2.1 with their
+ 	   Issue 2.2 Unix.  It is too old, and gives you problems with
+ 	   clock.c, because sigset_t won't get defined in <sys/signal.h>.
+ 	   This is due to a problematic protection rule in there, and is
+ 	   fixed with gcc 2.4.5.
+ 
+ 	2) If you don't use the new Berkeley DB (-DNEWDB), then you need
+ 	   to add "-lc -lucb" to the libraries to link with.  This is because
+ 	   the -ldbm distributed by Dell needs the bcopy, bcmp and bzero
+ 	   functions.  It is important that you specify both libraries in
+ 	   the given order to be sure you only get the BSTRING functions
+ 	   from the UCB library (and not the signal routines etc.).
+ 
+ 	3) Don't leave out "-lelf" even if compiling with "-lc -lucb".
+ 	   The UCB library also has another copy of the nlist routines,
+ 	   but we do want the ones from "-lelf".
+ 
+ 	If anyone needs a compiled gcc 2.4.5 and/or a ported DB library, they
+ 	can use anonymous ftp to fetch them from lut.fi in the /kim directory. 
+ 	They are copies of what I use on grendel.lut.fi, and offering them
+ 	does not imply that I would also support them.  I have sent the DB
+ 	port for SVR4 back to Keith Bostic for inclusion in the official
+ 	distribution, but I haven't heard anything from him as of today.
+ 
+ 	- gcc-2.4.5-svr4.tar.gz	(gcc 2.4.5 and the corresponding libg++)
+ 	- db-1.72.tar.gz	(with source, objects and a installed copy)
+ 
+ 	Cheers
+ 	+ Kim
+ 	-- 
+ 	 *  Kimmo.Suominen@lut.fi  *  SysVr4 enthusiast at GRENDEL.LUT.FI  *
+ 	*    KIM@FINFILES.BITNET   *  Postmaster and Hostmaster at LUT.FI   *
+ 	 *    + 358 200 865 718    *  Unix area moderator at NIC.FUNET.FI  *
+ 
+ 
  Non-DNS based sites
  	This version of sendmail always tries to connect to the Domain
  	Name System (DNS) to resolve names, regardless of the setting
***************
*** 426,431 ****
--- 643,684 ----
  	by the double call.  Use the version in conf.c instead.
  
  
+ +--------------+
+ | MANUAL PAGES |
+ +--------------+
+ 
+ The manual pages have been written against the -mandoc macros
+ instead of the -man macros.  The latest version of groff has them
+ included.  You can also get a copy from FTP.UU.NET in directory
+ /systems/unix/bsd-sources/share/tmac.
+ 
+ 
+ +-----------------+
+ | DEBUGGING HOOKS |
+ +-----------------+
+ 
+ As of 8.6.5, sendmail daemons will catch a SIGUSR1 signal and log
+ some debugging output (logged at LOG_DEBUG severity).  The
+ information dumped is:
+ 
+  * The value of the $j macro.
+  * A warning if $j is not in the set $=w.
+  * A list of the open file descriptors.
+  * The contents of the connection cache.
+  * If ruleset 89 is defined, it is evaluated and the results printed.
+ 
+ This allows you to get information regarding the runtime state of the
+ daemon on the fly.  This should not be done too frequently, since
+ the process of rewriting may lose memory which will not be recovered.
+ Also, ruleset 89 may call non-reentrant routines, so there is a small
+ non-zero probability that this will cause other problems.  It is
+ really only for debugging serious problems.
+ 
+ A typical formulation of ruleset 89 would be:
+ 
+ 	R$*		$@ $>0 some test address
+ 
+ 
  +-----------------------------+
  | DESCRIPTION OF SOURCE FILES |
  +-----------------------------+
***************
*** 489,492 ****
  
  Eric Allman
  
! (Version 8.31, last update 10/31/93 11:32:52)
--- 742,745 ----
  
  Eric Allman
  
! (Version 8.47, last update 1/12/94 05:59:56)
*** src/alias.c.OLD	Thu Nov 11 06:14:30 1993
--- src/alias.c	Sat Dec 11 14:21:35 1993
***************
*** 36,42 ****
  # include <pwd.h>
  
  #ifndef lint
! static char sccsid[] = "@(#)alias.c	8.19 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  
--- 36,42 ----
  # include <pwd.h>
  
  #ifndef lint
! static char sccsid[] = "@(#)alias.c	8.21 (Berkeley) 12/11/93";
  #endif /* not lint */
  
  
***************
*** 144,150 ****
  	owner = aliaslookup(obuf, e);
  	if (owner != NULL)
  	{
! 		if (strchr(owner, ',') != NULL)
  			owner = obuf;
  		a->q_owner = newstr(owner);
  	}
--- 144,150 ----
  	owner = aliaslookup(obuf, e);
  	if (owner != NULL)
  	{
! 		if (strpbrk(owner, ",:/|\"") != NULL)
  			owner = obuf;
  		a->q_owner = newstr(owner);
  	}
***************
*** 570,576 ****
  		}
  		if (parseaddr(line, &al, RF_COPYALL, ':', NULL, CurEnv) == NULL)
  		{
! 			syserr("554 %s... illegal alias name", al.q_paddr);
  			continue;
  		}
  
--- 570,576 ----
  		}
  		if (parseaddr(line, &al, RF_COPYALL, ':', NULL, CurEnv) == NULL)
  		{
! 			syserr("554 %.40s... illegal alias name", line);
  			continue;
  		}
  
*** src/cdefs.h.OLD	Tue Jan  4 09:53:56 1994
--- src/cdefs.h	Fri Jan  7 17:20:58 1994
***************
*** 2,7 ****
--- 2,10 ----
   * Copyright (c) 1991, 1993
   *	The Regents of the University of California.  All rights reserved.
   *
+  * This code is derived from software contributed to Berkeley by
+  * Berkeley Software Design, Inc.
+  *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
***************
*** 30,36 ****
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)cdefs.h	8.2 (Berkeley) 10/4/93
   */
  
  #ifndef	_CDEFS_H_
--- 33,39 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)cdefs.h	8.5 (Berkeley) 1/4/94
   */
  
  #ifndef	_CDEFS_H_
***************
*** 56,64 ****
  #define	__CONCAT(x,y)	x ## y
  #define	__STRING(x)	#x
  
! #if !defined(__GNUC__) && !defined(__cplusplus)
! #define	inline
! #endif
  
  #else	/* !(__STDC__ || __cplusplus) */
  #define	__P(protos)	()		/* traditional C preprocessor */
--- 59,74 ----
  #define	__CONCAT(x,y)	x ## y
  #define	__STRING(x)	#x
  
! #define	__const		const		/* define reserved names to standard */
! #define	__signed	signed
! #define	__volatile	volatile
! #if defined(__cplusplus)
! #define	__inline	inline		/* convert to C++ keyword */
! #else
! #ifndef __GNUC__
! #define	__inline			/* delete GCC keyword */
! #endif /* !__GNUC__ */
! #endif /* !__cplusplus */
  
  #else	/* !(__STDC__ || __cplusplus) */
  #define	__P(protos)	()		/* traditional C preprocessor */
***************
*** 65,98 ****
  #define	__CONCAT(x,y)	x/**/y
  #define	__STRING(x)	"x"
  
! #ifdef __GNUC__
! #define	const		__const		/* GCC: ANSI C with -traditional */
! #define	inline		__inline
! #define	signed		__signed
! #define	volatile	__volatile
! 
! #else	/* !__GNUC__ */
  #define	const				/* delete ANSI C keywords */
  #define	inline
  #define	signed
  #define	volatile
  #endif	/* !__GNUC__ */
  #endif	/* !(__STDC__ || __cplusplus) */
  
  /*
!  * GCC has extensions for declaring functions as `pure' (always returns
!  * the same value given the same inputs, i.e., has no external state and
!  * no side effects) and `dead' (nonreturning).  These mainly affect
!  * optimization and warnings.  Unfortunately, GCC complains if these are
!  * used under strict ANSI mode (`gcc -ansi -pedantic'), hence we need to
!  * define them only if compiling without this.
   */
  #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
! #define __dead __volatile
! #define __pure __const
! #else
! #define __dead
! #define __pure
  #endif
  
  #endif /* !_CDEFS_H_ */
--- 75,122 ----
  #define	__CONCAT(x,y)	x/**/y
  #define	__STRING(x)	"x"
  
! #ifndef __GNUC__
! #define	__const				/* delete pseudo-ANSI C keywords */
! #define	__inline
! #define	__signed
! #define	__volatile
! /*
!  * In non-ANSI C environments, new programs will want ANSI-only C keywords
!  * deleted from the program and old programs will want them left alone.
!  * When using a compiler other than gcc, programs using the ANSI C keywords
!  * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
!  * When using "gcc -traditional", we assume that this is the intent; if
!  * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
!  */
! #ifndef	NO_ANSI_KEYWORDS
  #define	const				/* delete ANSI C keywords */
  #define	inline
  #define	signed
  #define	volatile
+ #endif
  #endif	/* !__GNUC__ */
  #endif	/* !(__STDC__ || __cplusplus) */
  
  /*
!  * GCC1 and some versions of GCC2 declare dead (non-returning) and
!  * pure (no side effects) functions using "volatile" and "const";
!  * unfortunately, these then cause warnings under "-ansi -pedantic".
!  * GCC2 uses a new, peculiar __attribute__((attrs)) style.  All of
!  * these work for GNU C++ (modulo a slight glitch in the C++ grammar
!  * in the distribution version of 2.5.5).
   */
+ #if !defined(__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 5
+ #define	__attribute__(x)	/* delete __attribute__ if non-gcc or gcc1 */
  #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
! #define	__dead		__volatile
! #define	__pure		__const
! #endif
! #endif
! 
! /* Delete pseudo-keywords wherever they are not available or needed. */
! #ifndef __dead
! #define	__dead
! #define	__pure
  #endif
  
  #endif /* !_CDEFS_H_ */
*** src/clock.c.OLD	Sun Oct 24 13:47:32 1993
--- src/clock.c	Wed Jan 12 06:00:02 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)clock.c	8.7 (Berkeley) 10/21/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)clock.c	8.8 (Berkeley) 1/12/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 60,66 ****
  **		none.
  */
  
! static void tick();
  
  EVENT *
  setevent(intvl, func, arg)
--- 60,66 ----
  **		none.
  */
  
! static void tick __P((int));
  
  EVENT *
  setevent(intvl, func, arg)
***************
*** 101,107 ****
  		printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
  			intvl, now + intvl, func, arg, ev);
  
! 	tick();
  	return (ev);
  }
  /*
--- 101,107 ----
  		printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
  			intvl, now + intvl, func, arg, ev);
  
! 	tick(0);
  	return (ev);
  }
  /*
***************
*** 143,149 ****
  	}
  
  	/* restore clocks and pick up anything spare */
! 	tick();
  }
  /*
  **  TICK -- take a clock tick
--- 143,149 ----
  	}
  
  	/* restore clocks and pick up anything spare */
! 	tick(0);
  }
  /*
  **  TICK -- take a clock tick
***************
*** 151,157 ****
  **	Called by the alarm clock.  This routine runs events as needed.
  **
  **	Parameters:
! **		none.
  **
  **	Returns:
  **		none.
--- 151,157 ----
  **	Called by the alarm clock.  This routine runs events as needed.
  **
  **	Parameters:
! **		One that is ignored; for compatibility with signal handlers.
  **
  **	Returns:
  **		none.
***************
*** 161,167 ****
  */
  
  static void
! tick()
  {
  	register time_t now;
  	register EVENT *ev;
--- 161,168 ----
  */
  
  static void
! tick(arg)
! 	int arg;
  {
  	register time_t now;
  	register EVENT *ev;
*** src/collect.c.OLD	Wed Nov 17 16:29:54 1993
--- src/collect.c	Sat Jan  8 17:29:31 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)collect.c	8.6 (Berkeley) 10/27/93";
  #endif /* not lint */
  
  # include <errno.h>
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)collect.c	8.8 (Berkeley) 1/8/94";
  #endif /* not lint */
  
  # include <errno.h>
***************
*** 160,166 ****
  			if (sfgets(freebuf, MAXLINE, InChannel,
  					TimeOuts.to_datablock,
  					"message header read") == NULL)
! 				goto readerr;
  
  			/* is this a continuation line? */
  			if (*freebuf != ' ' && *freebuf != '\t')
--- 160,169 ----
  			if (sfgets(freebuf, MAXLINE, InChannel,
  					TimeOuts.to_datablock,
  					"message header read") == NULL)
! 			{
! 				freebuf[0] = '\0';
! 				break;
! 			}
  
  			/* is this a continuation line? */
  			if (*freebuf != ' ' && *freebuf != '\t')
***************
*** 257,263 ****
  			break;
  
  		/* check for transparent dot */
! 		if (OpMode == MD_SMTP && bp[0] == '.' && bp[1] == '.')
  			bp++;
  
  		/*
--- 260,267 ----
  			break;
  
  		/* check for transparent dot */
! 		if ((OpMode == MD_SMTP || OpMode == MD_DAEMON) &&
! 		    bp[0] == '.' && bp[1] == '.')
  			bp++;
  
  		/*
***************
*** 278,283 ****
--- 282,289 ----
  	if (feof(InChannel) || ferror(InChannel))
  	{
  readerr:
+ 		if (tTd(30, 1))
+ 			printf("collect: read error\n");
  		inputerr = TRUE;
  	}
  
***************
*** 290,296 ****
  	}
  
  	/* An EOF when running SMTP is an error */
! 	if (inputerr && OpMode == MD_SMTP)
  	{
  		char *host;
  		char *problem;
--- 296,302 ----
  	}
  
  	/* An EOF when running SMTP is an error */
! 	if (inputerr && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
  	{
  		char *host;
  		char *problem;
*** src/conf.c.OLD	Sun Nov  7 14:05:27 1993
--- src/conf.c	Tue Jan 11 07:04:01 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)conf.c	8.42 (Berkeley) 10/21/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)conf.c	8.62 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 40,45 ****
--- 40,46 ----
  # include "pathnames.h"
  # include <sys/ioctl.h>
  # include <sys/param.h>
+ # include <netdb.h>
  # include <pwd.h>
  
  /*
***************
*** 597,603 ****
  # include	<compat.h>
  #endif
  
! init_md()
  {
  #ifdef _AUX_SOURCE
  	setcompat(getcompat() | COMPAT_BSDPROT);
--- 598,606 ----
  # include	<compat.h>
  #endif
  
! init_md(argc, argv)
! 	int argc;
! 	char **argv;
  {
  #ifdef _AUX_SOURCE
  	setcompat(getcompat() | COMPAT_BSDPROT);
***************
*** 792,801 ****
  #if LA_TYPE == LA_MACH
  
  /*
! **  This has been tested on NeXT release 2.1.
  */
  
! #include <mach.h>
  
  getla()
  {
--- 795,808 ----
  #if LA_TYPE == LA_MACH
  
  /*
! **  This has been tested on NEXTSTEP release 2.1/3.X.
  */
  
! #if defined(NX_CURRENT_COMPILER_RELEASE) && NX_CURRENT_COMPILER_RELEASE > NX_COMPILER_RELEASE_3_0
! # include <mach/mach.h>
! #else
! # include <mach.h>
! #endif
  
  getla()
  {
***************
*** 910,915 ****
--- 917,923 ----
  #  include <sys/exec.h>
  #  ifdef __bsdi__
  #   undef PS_STRINGS	/* BSDI 1.0 doesn't do PS_STRINGS as we expect */
+ #   define PROCTITLEPAD	'\0'
  #  endif
  #  ifdef PS_STRINGS
  #   define SETPROC_STATIC static
***************
*** 920,925 ****
--- 928,937 ----
  # endif
  #endif
  
+ #ifndef PROCTITLEPAD
+ # define PROCTITLEPAD	' '
+ #endif
+ 
  /*VARARGS1*/
  #ifdef __STDC__
  setproctitle(char *fmt, ...)
***************
*** 969,975 ****
  	(void) strcpy(Argv[0], buf);
  	p = &Argv[0][i];
  	while (p < LastArgv)
! 		*p++ = ' ';
  #   endif
  #  endif
  # endif /* SETPROCTITLE */
--- 981,987 ----
  	(void) strcpy(Argv[0], buf);
  	p = &Argv[0][i];
  	while (p < LastArgv)
! 		*p++ = PROCTITLEPAD;
  #   endif
  #  endif
  # endif /* SETPROCTITLE */
***************
*** 1258,1266 ****
  /*
   * get option letter from argument vector
   */
! int	opterr = 1,		/* if error message should be printed */
! 	optind = 1,		/* index into parent argv vector */
! 	optopt;			/* character checked for validity */
  char	*optarg;		/* argument associated with option */
  
  #define BADCH	(int)'?'
--- 1270,1282 ----
  /*
   * get option letter from argument vector
   */
! #ifdef _CONVEX_SOURCE
! extern int	optind, opterr;
! #else
! int	opterr = 1;		/* if error message should be printed */
! int	optind = 1;		/* index into parent argv vector */
! #endif
! int	optopt;			/* character checked for validity */
  char	*optarg;		/* argument associated with option */
  
  #define BADCH	(int)'?'
***************
*** 1269,1277 ****
  		fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);}
  
  getopt(nargc,nargv,ostr)
! int	nargc;
! char	**nargv,
! 	*ostr;
  {
  	static char	*place = EMSG;	/* option letter processing */
  	static char	atend = 0;
--- 1285,1293 ----
  		fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);}
  
  getopt(nargc,nargv,ostr)
! 	int		nargc;
! 	char *const	*nargv;
! 	const char	*ostr;
  {
  	static char	*place = EMSG;	/* option letter processing */
  	static char	atend = 0;
***************
*** 1356,1361 ****
--- 1372,1468 ----
  
  #endif
  /*
+ **  USERSHELLOK -- tell if a user's shell is ok for unrestricted use
+ **
+ **	Parameters:
+ **		shell -- the user's shell from /etc/passwd
+ **
+ **	Returns:
+ **		TRUE -- if it is ok to use this for unrestricted access.
+ **		FALSE -- if the shell is restricted.
+ */
+ 
+ #if !HASGETUSERSHELL
+ 
+ # ifndef _PATH_SHELLS
+ #  define _PATH_SHELLS	"/etc/shells"
+ # endif
+ 
+ char	*DefaultUserShells[] =
+ {
+ 	"/bin/sh",
+ 	"/usr/bin/sh",
+ 	"/bin/csh",
+ 	"/usr/bin/csh",
+ #ifdef __hpux
+ 	"/bin/rsh",
+ 	"/bin/ksh",
+ 	"/bin/rksh",
+ 	"/bin/pam",
+ 	"/usr/bin/keysh",
+ 	"/bin/posix/sh",
+ #endif
+ 	NULL
+ };
+ 
+ #endif
+ 
+ bool
+ usershellok(shell)
+ 	char *shell;
+ {
+ #if HASGETUSERSHELL
+ 	register char *p;
+ 	extern char *getusershell();
+ 
+ 	setusershell();
+ 	while ((p = getusershell()) != NULL)
+ 		if (strcmp(p, shell) == 0 || strcmp(p, "*") == 0)
+ 			break;
+ 	endusershell();
+ 	return p != NULL;
+ #else
+ 	register FILE *shellf;
+ 	char buf[MAXLINE];
+ 
+ 	shellf = fopen(_PATH_SHELLS, "r");
+ 	if (shellf == NULL)
+ 	{
+ 		/* no /etc/shells; see if it is one of the std shells */
+ 		char **d;
+ 
+ 		for (d = DefaultUserShells; *d != NULL; d++)
+ 		{
+ 			if (strcmp(shell, *d) == 0)
+ 				return TRUE;
+ 		}
+ 		return FALSE;
+ 	}
+ 
+ 	while (fgets(buf, sizeof buf, shellf) != NULL)
+ 	{
+ 		register char *p, *q;
+ 
+ 		p = buf;
+ 		while (*p != '\0' && *p != '#' && *p != '/')
+ 			p++;
+ 		if (*p == '#' || *p == '\0')
+ 			continue;
+ 		q = p;
+ 		while (*p != '\0' && *p != '#' && !isspace(*p))
+ 			p++;
+ 		*p = '\0';
+ 		if (strcmp(shell, q) == 0 || strcmp("*", q) == 0)
+ 		{
+ 			fclose(shellf);
+ 			return TRUE;
+ 		}
+ 	}
+ 	fclose(shellf);
+ 	return FALSE;
+ #endif
+ }
+ /*
  **  FREESPACE -- see how much free space is on the queue filesystem
  **
  **	Only implemented if you have statfs.
***************
*** 1382,1391 ****
  #endif
  
  #ifdef HASSTATFS
! # if defined(IRIX) || defined(apollo) || defined(_SCO_unix_) || defined(UMAXV) || defined(DGUX)
  #  include <sys/statfs.h>
  # else
! #  if (defined(sun) && !defined(BSD)) || defined(__hpux) || defined(_CONVEX_SOURCE) || defined(NeXT) || defined(_AUX_SOURCE)
  #   include <sys/vfs.h>
  #  else
  #   include <sys/mount.h>
--- 1489,1498 ----
  #endif
  
  #ifdef HASSTATFS
! # if defined(IRIX) || defined(apollo) || defined(_SCO_unix_) || defined(UMAXV) || defined(DGUX) || defined(_AIX3)
  #  include <sys/statfs.h>
  # else
! #  if (defined(sun) && !defined(BSD)) || defined(__hpux) || defined(_CONVEX_SOURCE) || defined(NeXT) || defined(_AUX_SOURCE) || defined(MACH386)
  #   include <sys/vfs.h>
  #  else
  #   include <sys/mount.h>
***************
*** 1726,1731 ****
--- 1833,1848 ----
  {
  	if (ConfFile != NULL)
  		return ConfFile;
+ #ifdef NETINFO
+ 	{
+ 		extern char *ni_propval();
+ 		char *cflocation;
+ 
+ 		cflocation = ni_propval("/locations/sendmail", "sendmail.cf");
+ 		if (cflocation != NULL)
+ 			return cflocation;
+ 	}
+ #endif
  	return _PATH_SENDMAILCF;
  }
  /*
***************
*** 1737,1742 ****
--- 1854,1865 ----
  **	Returns:
  **		TRUE -- if ok.
  **		FALSE -- if vendor code could not be processed.
+ **
+ **	Side Effects:
+ **		It is reasonable to set mode flags here to tweak
+ **		processing in other parts of the code if necessary.
+ **		For example, if you are a vendor that uses $%y to
+ **		indicate YP lookups, you could enable that here.
  */
  
  bool
***************
*** 1743,1747 ****
  setvendor(vendor)
  	char *vendor;
  {
! 	return (strcasecmp(vendor, "Berkeley") == 0);
  }
--- 1866,2115 ----
  setvendor(vendor)
  	char *vendor;
  {
! 	if (strcasecmp(vendor, "Berkeley") == 0)
! 		return TRUE;
! 
! 	/* add vendor extensions here */
! 
! 	return FALSE;
  }
+ /*
+ **  STRTOL -- convert string to long integer
+ **
+ **	For systems that don't have it in the C library.
+ */
+ 
+ #ifdef NEEDSTRTOL
+ 
+ long
+ strtol(p, ep, b)
+ 	char *p;
+ 	char **ep;
+ 	int b;
+ {
+ 	long l = 0;
+ 	char c;
+ 	char maxd;
+ 	int neg = 1;
+ 
+ 	maxd = (b > 10) ? '9' : b + '0';
+ 
+ 	if (p && *p == '-') {
+ 		neg = -1;
+ 		p++;
+ 	}
+ 	while (p && (c = *p)) {
+ 		if (c >= '0' && c <= maxd) {
+ 			l = l*b + *p++ - '0';
+ 			continue;
+ 		}
+ 		if (c >= 'A' && c <= 'Z')
+ 			c -= 'A' + 'a';
+ 		c = c - 'a' + 10;
+ 		if (b > c) {
+ 			l = l*b + c;
+ 			p++;
+ 			continue;
+ 		}
+ 		break;
+ 	}
+ 	l *= neg;
+ 	if (ep)
+ 		*ep = p;
+ 	return l;
+ }
+ 
+ #endif
+ /*
+ **  SOLARIS_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX
+ **
+ **	Solaris versions prior through 2.3 don't properly deliver a
+ **	canonical h_name field.  This tries to work around it.
+ */
+ 
+ #ifdef SOLARIS
+ 
+ struct hostent *
+ solaris_gethostbyname(name)
+ 	const char *name;
+ {
+ # ifdef SOLARIS_2_3
+ 	static struct hostent hp;
+ 	static char buf[1000];
+ 	extern struct hostent *_switch_gethostbyname_r();
+ 
+ 	return _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno);
+ # else
+ 	extern struct hostent *__switch_gethostbyname();
+ 
+ 	return __switch_gethostbyname(name);
+ # endif
+ }
+ 
+ struct hostent *
+ solaris_gethostbyaddr(addr, len, type)
+ 	const char *addr;
+ 	int len;
+ 	int type;
+ {
+ # ifdef SOLARIS_2_3
+ 	static struct hostent hp;
+ 	static char buf[1000];
+ 	extern struct hostent *_switch_gethostbyaddr_r();
+ 
+ 	return _switch_gethostbyaddr_r(addr, len, type, &hp, buf, sizeof(buf), &h_errno);
+ # else
+ 	extern struct hostent *__switch_gethostbyaddr();
+ 
+ 	return __switch_gethostbyaddr(addr, len, type);
+ # endif
+ }
+ 
+ #endif
+ /*
+ **  NI_PROPVAL -- netinfo property value lookup routine
+ **
+ **	Parameters:
+ **		directory -- the Netinfo directory name.
+ **		propname -- the Netinfo property name.
+ **
+ **	Returns:
+ **		NULL -- if:
+ **			1. the directory is not found
+ **			2. the property name is not found
+ **			3. the property contains multiple values
+ **			4. some error occured
+ **		else -- the location of the config file.
+ **
+ **	Notes:
+ **      	Caller should free the return value of ni_proval
+ */
+ 
+ #ifdef NETINFO
+ 
+ # include <netinfo/ni.h>
+ 
+ # define LOCAL_NETINFO_DOMAIN    "."
+ # define PARENT_NETINFO_DOMAIN   ".."
+ # define MAX_NI_LEVELS           256
+ 
+ char *
+ ni_propval(directory, propname)
+ 	char *directory;
+ 	char *propname;
+ {
+ 	char *propval;
+ 	int i;
+ 	void *ni = NULL;
+ 	void *lastni = NULL;
+ 	ni_status nis;
+ 	ni_id nid;
+ 	ni_namelist ninl;
+ 
+ 	/*
+ 	**  If the passed directory and property name are found
+ 	**  in one of netinfo domains we need to search (starting
+ 	**  from the local domain moving all the way back to the
+ 	**  root domain) set propval to the property's value
+ 	**  and return it.
+ 	*/
+ 
+ 	for (i = 0; i < MAX_NI_LEVELS; ++i)
+ 	{
+ 		if (i == 0)
+ 		{
+ 			nis = ni_open(NULL, LOCAL_NETINFO_DOMAIN, &ni);
+ 		}
+ 		else
+ 		{
+ 			if (lastni != NULL)
+ 				ni_free(lastni);
+ 			lastni = ni;
+ 			nis = ni_open(lastni, PARENT_NETINFO_DOMAIN, &ni);
+ 		}
+ 
+ 		/*
+ 		**  Don't bother if we didn't get a handle on a
+ 		**  proper domain.  This is not necessarily an error.
+ 		**  We would get a positive ni_status if, for instance
+ 		**  we never found the directory or property and tried
+ 		**  to open the parent of the root domain!
+ 		*/
+ 
+ 		if (nis != 0)
+ 			break;
+ 
+ 		/*
+ 		**  Find the path to the server information.
+ 		*/
+ 
+ 		if (ni_pathsearch(ni, &nid, directory) != 0)
+ 			continue;
+ 
+ 		/*
+ 		**  Find "host" information.
+ 		*/
+ 
+ 		if (ni_lookupprop(ni, &nid, propname, &ninl) != 0)
+ 			continue;
+ 
+ 		/*
+ 		**  If there's only one name in
+ 		**  the list, assume we've got
+ 		**  what we want.
+ 		*/
+ 
+ 		if (ninl.ni_namelist_len == 1)
+ 		{
+ 			propval = ni_name_dup(ninl.ni_namelist_val[0]);
+ 			break;
+ 		}
+ 	}
+ 
+ 	/*
+ 	**  Clean up.
+ 	*/
+ 
+ 	if (ni != NULL)
+ 		ni_free(ni);
+ 	if (lastni != NULL && ni != lastni)
+ 		ni_free(lastni);
+ 
+ 	return propval;
+ }
+ 
+ #endif /* NETINFO */
+ /*
+ **  HARD_SYSLOG -- call syslog repeatedly until it works
+ **
+ **	Needed on HP-UX, which apparently doesn't guarantee that
+ **	syslog succeeds during interrupt handlers.
+ */
+ 
+ #ifdef __hpux
+ 
+ # define MAXSYSLOGTRIES	100
+ # undef syslog
+ 
+ # ifdef __STDC__
+ hard_syslog(int pri, char *msg, ...)
+ # else
+ hard_syslog(pri, msg, va_alist)
+ 	int pri;
+ 	char *msg;
+ 	va_dcl
+ # endif
+ {
+ 	int i;
+ 	char buf[SYSLOG_BUFSIZE * 2];
+ 	VA_LOCAL_DECL;
+ 
+ 	VA_START(msg);
+ 	vsprintf(buf, msg, ap);
+ 	VA_END;
+ 
+ 	for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, "%s", buf) < 0; )
+ 		continue;
+ }
+ 
+ #endif
*** src/conf.h.OLD	Sun Nov  7 10:37:02 1993
--- src/conf.h	Sat Jan  8 17:53:13 1994
***************
*** 31,37 ****
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)conf.h	8.44 (Berkeley) 10/29/93
   */
  
  /*
--- 31,37 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)conf.h	8.75 (Berkeley) 1/8/94
   */
  
  /*
***************
*** 64,70 ****
  # define MEMCHUNKSIZE	1024		/* chunk size for memory allocation */
  # define MAXUSERENVIRON	100		/* max envars saved, must be >= 3 */
  # define MAXALIASDB	12		/* max # of alias databases */
- # define PSBUFSIZE	(MAXLINE + MAXATOM)	/* size of prescan buffer */
  
  # ifndef QUEUESIZE
  # define QUEUESIZE	1000		/* max # of jobs per queue run */
--- 64,69 ----
***************
*** 78,83 ****
--- 77,83 ----
  
  # define LOG		1	/* enable logging */
  # define UGLYUUCP	1	/* output ugly UUCP From lines */
+ # define NETUNIX	1	/* include unix domain support */
  # define NETINET	1	/* include internet support */
  # define SETPROCTITLE	1	/* munge argv to display current status */
  # define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
***************
*** 89,106 ****
  # endif
  
  /*
! **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
! **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
! **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
! **  are closed.  Some firewalls return this error if you try to connect
! **  to the IDENT port (113), so you can't receive email from these hosts
! **  on these systems.  The firewall really should use a more specific
! **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _NET_PROHIB.  This
! **  will get #undefed below as needed.
  */
  
! # define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
  
  /**********************************************************************
  **  Operating system configuration.
  **
--- 89,115 ----
  # endif
  
  /*
! **  Most systems have symbolic links today, so default them on.  You
! **  can turn them off by #undef'ing this below.
  */
  
! # define HASLSTAT	1	/* has lstat(2) call */
  
+ /*
+ **  General "standard C" defines.
+ **
+ **	These may be undone later, to cope with systems that claim to
+ **	be Standard C but aren't.  Gcc is the biggest offender -- it
+ **	doesn't realize that the library is part of the language.
+ **
+ **	Life would be much easier if we could get rid of this sort
+ **	of bozo problems.
+ */
+ 
+ #ifdef __STDC__
+ # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
+ #endif
+ 
  /**********************************************************************
  **  Operating system configuration.
  **
***************
*** 114,120 ****
  
  
  /*
! **  HP-UX -- tested for 8.07
  */
  
  # ifdef __hpux
--- 123,129 ----
  
  
  /*
! **  HP-UX -- tested for 8.07, 9.00, and 9.01.
  */
  
  # ifdef __hpux
***************
*** 126,134 ****
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define setreuid(r, e)		setresuid(r, e, -1)	
  # define LA_TYPE	LA_FLOAT
  # define _PATH_UNIX	"/hp-ux"
! # undef IDENTPROTO		/* TCP/IP implementation is broken */
  # endif
  
  
  /*
--- 135,156 ----
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define setreuid(r, e)		setresuid(r, e, -1)	
  # define LA_TYPE	LA_FLOAT
+ # define GIDSET_T	gid_t
  # define _PATH_UNIX	"/hp-ux"
! # ifndef _PATH_SENDMAILCF
! #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
  # endif
+ # ifndef IDENTPROTO
+ #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
+ # endif
+ # ifndef HASGETUSERSHELL
+ #  define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
+ # endif
+ # define syslog		hard_syslog
+ # ifdef __STDC__
+ extern int	syslog(int, char *, ...);
+ # endif
+ # endif
  
  
  /*
***************
*** 137,142 ****
--- 159,167 ----
  
  # ifdef _AIX3
  # define HASINITGROUPS	1	/* has initgroups(3) call */
+ # define HASSTATFS	1	/* has the statfs(2) syscall */
+ # define HASUNAME	1	/* use System V uname(2) system call */
+ # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
  # define FORK		fork	/* no vfork primitive available */
  # undef  SETPROCTITLE		/* setproctitle confuses AIX */
  # endif
***************
*** 153,158 ****
--- 178,184 ----
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # define HASSTATFS	1	/* has the statfs(2) syscall */
+ # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
  # define FORK		fork	/* no vfork primitive available */
  # define WAITUNION	1	/* use "union wait" as wait argument type */
  # define setpgid	BSDsetpgrp
***************
*** 161,184 ****
  
  
  /*
! **  SunOS
  */
  
  #if defined(sun) && !defined(BSD)
  
  # define LA_TYPE	LA_INT
- # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  
  # ifdef SOLARIS
  			/* Solaris 2.x (a.k.a. SunOS 5.x) */
! #  define SYSTEM5	1	/* use System V definitions */
! #  define setreuid(r, e)	seteuid(e)
! #  include <sys/sysmacros.h>
  #  include <sys/time.h>
! #  define gethostbyname	__switch_gethostbyname	/* get working version */
! #  define gethostbyaddr	__switch_gethostbyaddr	/* get working version */
! #  define _PATH_UNIX	"/kernel/unix"
  #  ifndef _PATH_SENDMAILCF
  #   define _PATH_SENDMAILCF	"/etc/mail/sendmail.cf"
  #  endif
--- 187,221 ----
  
  
  /*
! **  SunOS and Solaris
! **
! **	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
! **	Solaris 2.2 (a.k.a. SunOS 5.2).
  */
  
  #if defined(sun) && !defined(BSD)
  
  # define LA_TYPE	LA_INT
  # define HASINITGROUPS	1	/* has initgroups(3) call */
+ # define HASUNAME	1	/* use System V uname(2) system call */
+ # define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
  
+ # ifdef SOLARIS_2_3
+ #  define SOLARIS
+ # endif
+ 
  # ifdef SOLARIS
  			/* Solaris 2.x (a.k.a. SunOS 5.x) */
! #  ifndef __svr4__
! #   define __svr4__		/* use all System V Releae 4 defines below */
! #  endif
  #  include <sys/time.h>
! #  define gethostbyname	solaris_gethostbyname	/* get working version */
! #  define gethostbyaddr	solaris_gethostbyaddr	/* get working version */
! #  define GIDSET_T	gid_t
! #  ifndef _PATH_UNIX
! #   define _PATH_UNIX	"/kernel/unix"
! #  endif
  #  ifndef _PATH_SENDMAILCF
  #   define _PATH_SENDMAILCF	"/etc/mail/sendmail.cf"
  #  endif
***************
*** 187,202 ****
  #  endif
  
  # else
! 			/* SunOS 4.1.x */
  #  define HASSTATFS	1	/* has the statfs(2) syscall */
! /* #  define HASFLOCK	1	/* has flock(2) call */
  #  include <vfork.h>
  
  # endif
  #endif
  
  /*
! ** DG/UX 5.4.2
  */
  
  #ifdef	DGUX
--- 224,255 ----
  #  endif
  
  # else
! 			/* SunOS 4.0.3 or 4.1.x */
! #  define HASSETREUID	1	/* has setreuid(2) call */
  #  define HASSTATFS	1	/* has the statfs(2) syscall */
! #  define HASFLOCK	1	/* has flock(2) call */
  #  include <vfork.h>
  
+ #  ifdef SUNOS403
+ 			/* special tweaking for SunOS 4.0.3 */
+ #   include <malloc.h>
+ #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
+ #   define WAITUNION	1	/* use "union wait" as wait argument type */
+ #   undef WIFEXITED
+ #   undef WEXITSTATUS
+ #   undef HASUNAME
+ #   define setpgid	setpgrp
+ typedef int		pid_t;
+ extern char		*getenv();
+ 
+ #  endif
  # endif
  #endif
  
  /*
! **  DG/UX
! **
! **	Tested on 5.4.2
  */
  
  #ifdef	DGUX
***************
*** 207,215 ****
  # define HASUNAME	1	/* use System V uname(2) system call */
  # define HASSETSID	1	/* has Posix setsid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
! # undef IDENTPROTO		/* TCP/IP implementation is broken */
  # undef SETPROCTITLE
  # define inet_addr	dgux_inet_addr
  extern long	dgux_inet_addr();
  #endif
--- 260,274 ----
  # define HASUNAME	1	/* use System V uname(2) system call */
  # define HASSETSID	1	/* has Posix setsid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # ifndef IDENTPROTO
! #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
! # endif
  # undef SETPROCTITLE
+ 
+ /* these include files must be included early on DG/UX */
+ # include <netinet/in.h>
+ # include <arpa/inet.h>
+ 
  # define inet_addr	dgux_inet_addr
  extern long	dgux_inet_addr();
  #endif
***************
*** 229,237 ****
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # define HASFLOCK	1	/* has flock(2) call */
! # define LA_TYPE	LA_INT
! # define LA_AVENRUN	"avenrun"
! # undef IDENTPROTO		/* TCP/IP implementation is broken */
  #endif
  
  
--- 288,303 ----
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # define HASFLOCK	1	/* has flock(2) call */
! # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
! # ifdef vax
! #  define LA_TYPE	LA_FLOAT
! # else
! #  define LA_TYPE	LA_INT
! #  define LA_AVENRUN	"avenrun"
! # endif
! # ifndef IDENTPROTO
! #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
! # endif
  #endif
  
  
***************
*** 244,251 ****
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! /* # define HASFLOCK	1	/* has flock(2) call */
  # define LA_TYPE	LA_INT
  #endif
  
  
--- 310,320 ----
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # define HASFLOCK	1	/* has flock(2) call */
  # define LA_TYPE	LA_INT
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
+ # endif
  #endif
  
  
***************
*** 280,285 ****
--- 349,356 ----
  
  /*
  **  4.4 BSD
+ **
+ **	See also BSD defines.
  */
  
  #ifdef BSD4_4
***************
*** 294,305 ****
  
  
  /*
! **  386BSD / FreeBSD 1.0E (works) / NetBSD (not tested)
  **
  **  4.3BSD clone, closer to 4.4BSD
  */
  
! #ifdef __386BSD__
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
  # define HASSTATFS	1	/* has the statfs(2) syscall */
--- 365,378 ----
  
  
  /*
! **  386BSD / FreeBSD 1.0E / NetBSD (all architectures, all versions)
  **
  **  4.3BSD clone, closer to 4.4BSD
+ **
+ **	See also BSD defines.
  */
  
! #if defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
  # define HASSTATFS	1	/* has the statfs(2) syscall */
***************
*** 312,317 ****
--- 385,420 ----
  
  
  /*
+ **  Mach386
+ **
+ **	For mt Xinu's Mach386 system.
+ */
+ 
+ #if defined(MACH) && defined(i386)
+ # define MACH386	1
+ # define HASUNSETENV	1	/* has unsetenv(3) call */
+ # define HASINITGROUPS	1	/* has initgroups(3) call */
+ # define HASFLOCK	1	/* has flock(2) call */
+ # define HASSTATFS	1	/* has the statfs(2) syscall */
+ # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
+ # define NEEDSTRTOL	1	/* need the strtol() function */
+ # define setpgid	setpgrp
+ # ifndef LA_TYPE
+ #  define LA_TYPE	LA_FLOAT
+ # endif
+ # undef HASSETVBUF		/* don't actually have setvbuf(3) */
+ # undef WEXITSTATUS
+ # undef WIFEXITED
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
+ # endif
+ #endif
+ 
+ 
+ /*
  **  4.3 BSD -- this is for very old systems
  **
  **	You'll also have to install a new resolver library.
***************
*** 329,349 ****
  # ifndef _PATH_SENDMAILCF
  #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
  # endif
! # undef IDENTPROTO		/* TCP/IP implementation is broken */
  #endif
  
  
  /*
  **  SCO Unix
  */
  
  #ifdef _SCO_unix_
  # define SYSTEM5	1	/* include all the System V defines */
  # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
  # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define FORK		fork
  # define MAXPATHLEN	PATHSIZE
  # define LA_TYPE	LA_SHORT
  #endif
  
  
--- 432,476 ----
  # ifndef _PATH_SENDMAILCF
  #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
  # endif
! # ifndef IDENTPROTO
! #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
! # endif
! # undef WEXITSTATUS
! # undef WIFEXITED
! typedef short		pid_t;
! extern int		errno;
  #endif
  
  
  /*
  **  SCO Unix
+ **
+ **	This includes two parts -- the first is for SCO Open Server 3.2v4
+ **	(contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
+ **	The second is, I believe, for an older version.
  */
  
+ #ifdef _SCO_unix_4_2
+ # define _SCO_unix_
+ # define HASSETREUID	1	/* has setreuid(2) call */
+ # define _PATH_UNIX	"/unix"
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
+ # endif
+ #endif
+ 
  #ifdef _SCO_unix_
  # define SYSTEM5	1	/* include all the System V defines */
  # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
  # define HASSTATFS	1	/* has the statfs(2) syscall */
+ # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
  # define FORK		fork
  # define MAXPATHLEN	PATHSIZE
  # define LA_TYPE	LA_SHORT
+ # undef NETUNIX			/* no unix domain socket support */
  #endif
  
  
***************
*** 358,379 ****
  # define HASSETSID	1	/* has POSIX setsid(2) call */
  # define NEEDGETOPT	1	/* need replacement for getopt(3) */
  # define LA_TYPE	LA_FLOAT
! # undef IDENTPROTO
  #endif
  
  
  /*
! **  RISC/os 4.51
  **
! **	Untested...
  */
  
  #ifdef RISCOS
  # define HASUNSETENV	1	/* has unsetenv(3) call */
! /* # define HASFLOCK	1	/* has flock(2) call */
  # define LA_TYPE	LA_INT
  # define LA_AVENRUN	"avenrun"
  # define _PATH_UNIX	"/unix"
  #endif
  
  
--- 485,522 ----
  # define HASSETSID	1	/* has POSIX setsid(2) call */
  # define NEEDGETOPT	1	/* need replacement for getopt(3) */
  # define LA_TYPE	LA_FLOAT
! # ifndef IDENTPROTO
! #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
! # endif
  #endif
  
  
  /*
! **  RISC/os 4.52
  **
! **	Gives a ton of warning messages, but otherwise compiles.
  */
  
  #ifdef RISCOS
+ 
  # define HASUNSETENV	1	/* has unsetenv(3) call */
! # define HASFLOCK	1	/* has flock(2) call */
! # define WAITUNION	1	/* use "union wait" as wait argument type */
! # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define LA_TYPE	LA_INT
  # define LA_AVENRUN	"avenrun"
  # define _PATH_UNIX	"/unix"
+ # undef WIFEXITED
+ 
+ # define setpgid	setpgrp
+ 
+ extern int		errno;
+ typedef int		pid_t;
+ #define			SIGFUNC_DEFINED
+ typedef int		(*sigfunc_t)();
+ extern char		*getenv();
+ extern void		*malloc();
+ 
  #endif
  
  
***************
*** 391,396 ****
--- 534,540 ----
  #  define LA_TYPE	LA_FLOAT
  # endif
  # include <sys/sysmacros.h>
+ # define GIDSET_T	gid_t
  #endif
  
  
***************
*** 400,418 ****
  **
  **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
  **	defined, and the definitions conflict.
  */
  
  #ifdef DELL_SVR4
! # define SYSTEM5	1
! /* # define setreuid(r, e)	seteuid(e) */
! /* # include <sys/time.h> */
! # define _PATH_UNIX	"/unix"
! # ifndef _PATH_SENDMAILCF
! #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
! # endif
! # ifndef _PATH_SENDMAILPID
! #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
! # endif
  #endif
  
  
--- 544,558 ----
  **
  **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
  **	defined, and the definitions conflict.
+ **
+ **	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
+ **	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
+ **	(SVR4.0/386 version 3.0).
  */
  
  #ifdef DELL_SVR4
! 				/* no changes necessary */
! 				/* see general __svr4__ defines below */
  #endif
  
  
***************
*** 428,434 ****
  # define HASUSTAT	1	/* use System V ustat(2) syscall */
  # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
  # define SIGFUNC_DEFINED	/* sigfunc_t already defined */
! # undef IDENTPROTO		/* TCP/IP implementation is broken */
  # define FORK		fork
  # ifndef _PATH_SENDMAILCF
  #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
--- 568,576 ----
  # define HASUSTAT	1	/* use System V ustat(2) syscall */
  # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
  # define SIGFUNC_DEFINED	/* sigfunc_t already defined */
! # ifndef IDENTPROTO
! #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
! # endif
  # define FORK		fork
  # ifndef _PATH_SENDMAILCF
  #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
***************
*** 453,458 ****
--- 595,601 ----
  # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
+ # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
  # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
  # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
  # define FORK		fork	/* no vfork(2) primitive available */
***************
*** 464,470 ****
--- 607,668 ----
  #endif
  
  
+ /*
+ **  Stardent Titan 3000 running TitanOS 4.2.
+ **
+ **	Must be compiled in "cc -43" mode.
+ **
+ **	From Kate Hedstrom <kate@ahab.rutgers.edu>.
+ **
+ **	Note the tweaking below after the BSD defines are set.
+ */
  
+ #ifdef titan
+ # define setpgid	setpgrp
+ typedef int		pid_t;
+ # undef WIFEXITED
+ # undef WEXITSTATUS
+ #endif
+ 
+ 
+ /*
+ **  Sequent DYNIX 3.2.0
+ **
+ **	From Jim Davis <jdavis@cs.arizona.edu>.
+ */
+ 
+ #ifdef sequent
+ # define BSD		1
+ # define HASUNSETENV	1
+ # define BSD4_3		1	/* to get signal() in conf.c */
+ # define WAITUNION	1
+ # define LA_TYPE	LA_FLOAT
+ # ifdef	_POSIX_VERSION
+ #  undef _POSIX_VERSION		/* set in <unistd.h> */
+ # endif
+ # undef HASSETVBUF		/* don't actually have setvbuf(3) */
+ # define setpgid	setpgrp
+ 
+ /* Have to redefine WIFEXITED to take an int, to work with waitfor() */
+ # undef	WIFEXITED
+ # define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
+ 			 ((union wait*)&(s))->w_termsig == 0)
+ # define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
+ typedef int		pid_t;
+ # define isgraph(c)	(isprint(c) && (c != ' '))
+ 
+ # ifndef _PATH_UNIX
+ #  define _PATH_UNIX	"/dynix"
+ # endif
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ 
+ #endif
+ 
+ 
+ 
+ 
  /**********************************************************************
  **  End of Per-Operating System defines
  **********************************************************************/
***************
*** 481,491 ****
--- 679,714 ----
  # define HASFLOCK	1	/* has flock(2) call */
  #endif
  
+ /* general System V Release 4 defines */
+ #ifdef __svr4__
+ # define SYSTEM5	1
+ # define HASSETREUID	1	/* has seteuid(2) call & working saved uids */
+ # ifndef HASGETUSERSHELL
+ #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
+ # endif
+ # define setreuid(r, e)	seteuid(e)
+ 
+ # ifndef _PATH_UNIX
+ #  define _PATH_UNIX		"/unix"
+ # endif
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
+ # endif
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
+ # endif
+ # ifndef SYSLOG_BUFSIZE
+ #  define SYSLOG_BUFSIZE	128
+ # endif
+ #endif
+ 
  /* general System V defines */
  # ifdef SYSTEM5
+ # include <sys/sysmacros.h>
  # define HASUNAME	1	/* use System V uname(2) system call */
  # define HASUSTAT	1	/* use System V ustat(2) syscall */
  # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
+ # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_INT
  # endif
***************
*** 494,504 ****
  # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
  # endif
  
- /* general "standard C" defines */
- #if defined(__STDC__) || defined(SYSTEM5)
- # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
- #endif
- 
  /* general POSIX defines */
  #ifdef _POSIX_VERSION
  # define HASSETSID	1	/* has Posix setsid(2) call */
--- 717,722 ----
***************
*** 515,521 ****
--- 733,767 ----
  # define GIDSET_T	int
  #endif
  
+ /*
+ **  Tweaking for systems that (for example) claim to be BSD but
+ **  don't have all the standard BSD routines (boo hiss).
+ */
  
+ #ifdef titan
+ # undef HASINITGROUPS		/* doesn't have initgroups(3) call */
+ #endif
+ 
+ /*
+ **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
+ **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
+ **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
+ **  are closed.  Some firewalls return this error if you try to connect
+ **  to the IDENT port (113), so you can't receive email from these hosts
+ **  on these systems.  The firewall really should use a more specific
+ **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _NET_PROHIB.  If
+ **  not explicitly set to zero above, default it on.
+ */
+ 
+ #ifndef IDENTPROTO
+ # define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
+ #endif
+ 
+ #ifndef HASGETUSERSHELL
+ # define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
+ #endif
+ 
+ 
  /**********************************************************************
  **  Remaining definitions should never have to be changed.  They are
  **  primarily to provide back compatibility for older systems -- for
***************
*** 524,531 ****
  
  /* System 5 compatibility */
  #ifndef S_ISREG
! #define S_ISREG(foo)	((foo & S_IFREG) == S_IFREG)
  #endif
  #ifndef S_IWGRP
  #define S_IWGRP		020
  #endif
--- 770,780 ----
  
  /* System 5 compatibility */
  #ifndef S_ISREG
! # define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
  #endif
+ #if !defined(S_ISLNK) && defined(S_IFLNK)
+ # define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
+ #endif
  #ifndef S_IWGRP
  #define S_IWGRP		020
  #endif
***************
*** 656,661 ****
--- 905,915 ----
  typedef void		(*sigfunc_t) __P((int));
  #endif
  
+ /* size of syslog buffer */
+ #ifndef SYSLOG_BUFSIZE
+ # define SYSLOG_BUFSIZE	1024
+ #endif
+ 
  /*
  **  Size of tobuf (deliver.c)
  **	Tweak this to match your syslog implementation.  It will have to
***************
*** 663,671 ****
  */
  
  #ifndef TOBUFSIZE
! # define TOBUFSIZE (1024 - 256)
  #endif
  
  /* fork routine -- set above using #ifdef _osname_ or in Makefile */
  # ifndef FORK
  # define FORK		vfork		/* function to call to fork mailer */
--- 917,936 ----
  */
  
  #ifndef TOBUFSIZE
! # if (SYSLOG_BUFSIZE) > 512
! #  define TOBUFSIZE	(SYSLOG_BUFSIZE - 256)
! # else
! #  define TOBUFSIZE	256
! # endif
  #endif
  
+ /*
+ **  Size of prescan buffer.
+ **	Despite comments in the _sendmail_ book, this probably should
+ **	not be changed; there are some hard-to-define dependencies.
+ */
+ 
+ # define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
  /* fork routine -- set above using #ifdef _osname_ or in Makefile */
  # ifndef FORK
  # define FORK		vfork		/* function to call to fork mailer */
*** src/daemon.c.OLD	Sun Nov  7 10:37:39 1993
--- src/daemon.c	Sat Jan  8 17:29:32 1994
***************
*** 37,45 ****
  
  #ifndef lint
  #ifdef DAEMON
! static char sccsid[] = "@(#)daemon.c	8.21 (Berkeley) 10/31/93 (with daemon mode)";
  #else
! static char sccsid[] = "@(#)daemon.c	8.21 (Berkeley) 10/31/93 (without daemon mode)";
  #endif
  #endif /* not lint */
  
--- 37,45 ----
  
  #ifndef lint
  #ifdef DAEMON
! static char sccsid[] = "@(#)daemon.c	8.30 (Berkeley) 1/8/94 (with daemon mode)";
  #else
! static char sccsid[] = "@(#)daemon.c	8.30 (Berkeley) 1/8/94 (without daemon mode)";
  #endif
  #endif /* not lint */
  
***************
*** 110,119 ****
  getrequests()
  {
  	int t;
- 	register struct servent *sp;
  	int on = 1;
  	bool refusingconnections = TRUE;
  	FILE *pidf;
  	extern void reapchild();
  
  	/*
--- 110,119 ----
  getrequests()
  {
  	int t;
  	int on = 1;
  	bool refusingconnections = TRUE;
  	FILE *pidf;
+ 	int socksize;
  	extern void reapchild();
  
  	/*
***************
*** 126,138 ****
  		DaemonAddr.sin.sin_addr.s_addr = INADDR_ANY;
  	if (DaemonAddr.sin.sin_port == 0)
  	{
  		sp = getservbyname("smtp", "tcp");
  		if (sp == NULL)
  		{
  			syserr("554 service \"smtp\" unknown");
! 			goto severe;
  		}
! 		DaemonAddr.sin.sin_port = sp->s_port;
  	}
  
  	/*
--- 126,141 ----
  		DaemonAddr.sin.sin_addr.s_addr = INADDR_ANY;
  	if (DaemonAddr.sin.sin_port == 0)
  	{
+ 		register struct servent *sp;
+ 
  		sp = getservbyname("smtp", "tcp");
  		if (sp == NULL)
  		{
  			syserr("554 service \"smtp\" unknown");
! 			DaemonAddr.sin.sin_port = htons(25);
  		}
! 		else
! 			DaemonAddr.sin.sin_port = sp->s_port;
  	}
  
  	/*
***************
*** 177,198 ****
  	{
  # ifdef NETINET
  	  case AF_INET:
! 		t = sizeof DaemonAddr.sin;
  		break;
  # endif
  
  # ifdef NETISO
  	  case AF_ISO:
! 		t = sizeof DaemonAddr.siso;
  		break;
  # endif
  
  	  default:
! 		t = sizeof DaemonAddr;
  		break;
  	}
  
! 	if (bind(DaemonSocket, &DaemonAddr.sa, t) < 0)
  	{
  		syserr("getrequests: cannot bind");
  		(void) close(DaemonSocket);
--- 180,201 ----
  	{
  # ifdef NETINET
  	  case AF_INET:
! 		socksize = sizeof DaemonAddr.sin;
  		break;
  # endif
  
  # ifdef NETISO
  	  case AF_ISO:
! 		socksize = sizeof DaemonAddr.siso;
  		break;
  # endif
  
  	  default:
! 		socksize = sizeof DaemonAddr;
  		break;
  	}
  
! 	if (bind(DaemonSocket, &DaemonAddr.sa, socksize) < 0)
  	{
  		syserr("getrequests: cannot bind");
  		(void) close(DaemonSocket);
***************
*** 260,266 ****
  		do
  		{
  			errno = 0;
! 			lotherend = sizeof RealHostAddr;
  			t = accept(DaemonSocket,
  			    (struct sockaddr *)&RealHostAddr, &lotherend);
  		} while (t < 0 && errno == EINTR);
--- 263,269 ----
  		do
  		{
  			errno = 0;
! 			lotherend = socksize;
  			t = accept(DaemonSocket,
  			    (struct sockaddr *)&RealHostAddr, &lotherend);
  		} while (t < 0 && errno == EINTR);
***************
*** 299,305 ****
  			*/
  
  			(void) setsignal(SIGCHLD, SIG_DFL);
- 			OpMode = MD_SMTP;
  
  			/* determine host name */
  			p = hostnamebyanyaddr(&RealHostAddr);
--- 302,307 ----
***************
*** 613,619 ****
  		  case AF_INET:
  			bcopy(hp->h_addr,
  				&addr.sin.sin_addr,
! 				hp->h_length);
  			break;
  #endif
  
--- 615,621 ----
  		  case AF_INET:
  			bcopy(hp->h_addr,
  				&addr.sin.sin_addr,
! 				sizeof addr.sin.sin_addr);
  			break;
  #endif
  
***************
*** 639,647 ****
  		if (sp == NULL)
  		{
  			syserr("554 makeconnection: service \"smtp\" unknown");
! 			return (EX_OSERR);
  		}
! 		port = sp->s_port;
  	}
  
  	switch (addr.sa.sa_family)
--- 641,650 ----
  		if (sp == NULL)
  		{
  			syserr("554 makeconnection: service \"smtp\" unknown");
! 			port = htons(25);
  		}
! 		else
! 			port = sp->s_port;
  	}
  
  	switch (addr.sa.sa_family)
***************
*** 742,748 ****
  			  case AF_INET:
  				bcopy(hp->h_addr_list[i++],
  				      &addr.sin.sin_addr,
! 				      hp->h_length);
  				break;
  #endif
  
--- 745,751 ----
  			  case AF_INET:
  				bcopy(hp->h_addr_list[i++],
  				      &addr.sin.sin_addr,
! 				      sizeof addr.sin.sin_addr);
  				break;
  #endif
  
***************
*** 846,852 ****
  **		Sets RealHostName to the name of the host at the other end.
  */
  
! #ifdef IDENTPROTO
  
  static jmp_buf	CtxAuthTimeout;
  
--- 849,855 ----
  **		Sets RealHostName to the name of the host at the other end.
  */
  
! #if IDENTPROTO
  
  static jmp_buf	CtxAuthTimeout;
  
***************
*** 865,871 ****
  	SOCKADDR fa;
  	int falen;
  	register char *p;
! #ifdef IDENTPROTO
  	SOCKADDR la;
  	int lalen;
  	register struct servent *sp;
--- 868,874 ----
  	SOCKADDR fa;
  	int falen;
  	register char *p;
! #if IDENTPROTO
  	SOCKADDR la;
  	int lalen;
  	register struct servent *sp;
***************
*** 878,884 ****
  	extern char RealUserName[];			/* main.c */
  
  	falen = sizeof fa;
! 	if (getpeername(fd, &fa.sa, &falen) < 0 || falen <= 0)
  	{
  		RealHostName = "localhost";
  		(void) sprintf(hbuf, "%s@localhost", RealUserName);
--- 881,888 ----
  	extern char RealUserName[];			/* main.c */
  
  	falen = sizeof fa;
! 	if (getpeername(fd, &fa.sa, &falen) < 0 || falen <= 0 ||
! 	    fa.sa.sa_family == 0)
  	{
  		RealHostName = "localhost";
  		(void) sprintf(hbuf, "%s@localhost", RealUserName);
***************
*** 891,897 ****
  	RealHostName = newstr(p);
  	RealHostAddr = fa;
  
! #ifdef IDENTPROTO
  	lalen = sizeof la;
  	if (fa.sa.sa_family != AF_INET ||
  	    getsockname(fd, &la.sa, &lalen) < 0 || lalen <= 0 ||
--- 895,901 ----
  	RealHostName = newstr(p);
  	RealHostAddr = fa;
  
! #if IDENTPROTO
  	lalen = sizeof la;
  	if (fa.sa.sa_family != AF_INET ||
  	    getsockname(fd, &la.sa, &lalen) < 0 || lalen <= 0 ||
***************
*** 1049,1055 ****
  	char *cp;
  	int i;
  	register STAB *s;
- 	char *timeoutmsg = "Recipient domain nameserver timed out";
  	char hbuf[MAXNAME];
  	extern struct hostent *gethostbyaddr();
  	extern int h_errno;
--- 1053,1058 ----
***************
*** 1069,1075 ****
  		h_errno = s->s_namecanon.nc_herrno;
  		*statp = s->s_namecanon.nc_stat;
  		if (CurEnv->e_message == NULL && *statp == EX_TEMPFAIL)
! 			CurEnv->e_message = newstr(timeoutmsg);
  		return s->s_namecanon.nc_cname;
  	}
  
--- 1072,1082 ----
  		h_errno = s->s_namecanon.nc_herrno;
  		*statp = s->s_namecanon.nc_stat;
  		if (CurEnv->e_message == NULL && *statp == EX_TEMPFAIL)
! 		{
! 			sprintf(hbuf, "%s: Name server timeout",
! 				shortenstring(name, 33));
! 			CurEnv->e_message = newstr(hbuf);
! 		}
  		return s->s_namecanon.nc_cname;
  	}
  
***************
*** 1109,1117 ****
  			  case TRY_AGAIN:
  				if (UseNameServer)
  				{
! 					message(timeoutmsg);
  					if (CurEnv->e_message == NULL)
! 						CurEnv->e_message = newstr(timeoutmsg);
  				}
  				*statp = EX_TEMPFAIL;
  				break;
--- 1116,1126 ----
  			  case TRY_AGAIN:
  				if (UseNameServer)
  				{
! 					sprintf(hbuf, "%s: Name server timeout",
! 						shortenstring(name, 33));
! 					message("%s", hbuf);
  					if (CurEnv->e_message == NULL)
! 						CurEnv->e_message = newstr(hbuf);
  				}
  				*statp = EX_TEMPFAIL;
  				break;
***************
*** 1200,1205 ****
--- 1209,1215 ----
  	switch (sap->sa.sa_family)
  	{
  #ifdef MAYBENEXTRELEASE		/*** UNTESTED *** UNTESTED *** UNTESTED ***/
+ #ifdef NETUNIX
  	  case AF_UNIX:
  	  	if (sap->sunix.sun_path[0] != '\0')
  	  		sprintf(buf, "[UNIX: %.64s]", sap->sunix.sun_path);
***************
*** 1206,1211 ****
--- 1216,1222 ----
  	  	else
  	  		sprintf(buf, "[UNIX: localhost]");
  		return buf;
+ #endif
  #endif
  
  #ifdef NETINET
*** src/deliver.c.OLD	Thu Nov  4 06:54:43 1993
--- src/deliver.c	Wed Jan 12 12:38:48 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)deliver.c	8.37 (Berkeley) 10/29/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)deliver.c	8.62 (Berkeley) 1/12/94";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 46,51 ****
--- 46,53 ----
  extern int	h_errno;
  #endif
  
+ extern char	SmtpError[];
+ 
  /*
  **  SENDALL -- actually send all the messages.
  **
***************
*** 82,88 ****
  	**  addresses to be sent.
  	*/
  
! 	if (bitset(EF_FATALERRS, e->e_flags) && OpMode == MD_SMTP)
  	{
  		e->e_flags |= EF_CLRQUEUE;
  		return;
--- 84,91 ----
  	**  addresses to be sent.
  	*/
  
! 	if (bitset(EF_FATALERRS, e->e_flags) &&
! 	    (OpMode == MD_SMTP || OpMode == MD_DAEMON))
  	{
  		e->e_flags |= EF_CLRQUEUE;
  		return;
***************
*** 89,94 ****
--- 92,98 ----
  	}
  
  	/* determine actual delivery mode */
+ 	CurrentLA = getla();
  	if (mode == SM_DEFAULT)
  	{
  		mode = e->e_sendmode;
***************
*** 333,339 ****
  	**  addresses to be sent.
  	*/
  
! 	if (bitset(EF_FATALERRS, e->e_flags) && OpMode == MD_SMTP)
  	{
  		e->e_flags |= EF_CLRQUEUE;
  		return;
--- 337,344 ----
  	**  addresses to be sent.
  	*/
  
! 	if (bitset(EF_FATALERRS, e->e_flags) &&
! 	    (OpMode == MD_SMTP || OpMode == MD_DAEMON))
  	{
  		e->e_flags |= EF_CLRQUEUE;
  		return;
***************
*** 447,456 ****
  			e->e_to = q->q_paddr;
  			if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
  			{
! 				message("deliverable: mailer %s, host %s, user %s",
! 					q->q_mailer->m_name,
! 					q->q_host,
! 					q->q_user);
  			}
  		}
  		else if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
--- 452,466 ----
  			e->e_to = q->q_paddr;
  			if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
  			{
! 				if (q->q_host != NULL && q->q_host[0] != '\0')
! 					message("deliverable: mailer %s, host %s, user %s",
! 						q->q_mailer->m_name,
! 						q->q_host,
! 						q->q_user);
! 				else
! 					message("deliverable: mailer %s, user %s",
! 						q->q_mailer->m_name,
! 						q->q_user);
  			}
  		}
  		else if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
***************
*** 589,595 ****
  	char buf[MAXNAME];
  	char rpathbuf[MAXNAME];		/* translated return path */
  	extern int checkcompat();
- 	extern char SmtpError[];
  
  	errno = 0;
  	if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags))
--- 599,604 ----
***************
*** 597,603 ****
  
  #ifdef NAMED_BIND
  	/* unless interactive, try twice, over a minute */
! 	if (OpMode == MD_DAEMON || OpMode == MD_SMTP) {
  		_res.retrans = 30;
  		_res.retry = 2;
  	}
--- 606,613 ----
  
  #ifdef NAMED_BIND
  	/* unless interactive, try twice, over a minute */
! 	if (OpMode == MD_DAEMON || OpMode == MD_SMTP)
! 	{
  		_res.retrans = 30;
  		_res.retry = 2;
  	}
***************
*** 759,765 ****
  		}
  
  		/* compute effective uid/gid when sending */
! 		if (to->q_mailer == ProgMailer)
  			ctladdr = getctladdr(to);
  
  		user = to->q_user;
--- 769,777 ----
  		}
  
  		/* compute effective uid/gid when sending */
! 		/* XXX perhaps this should be to->q_mailer != LocalMailer ?? */
! 		/* XXX perhaps it should be a mailer flag? */
! 		if (to->q_mailer == ProgMailer || to->q_mailer == FileMailer)
  			ctladdr = getctladdr(to);
  
  		user = to->q_user;
***************
*** 831,840 ****
  
  		if (m == FileMailer)
  		{
! 			ADDRESS *caddr = getctladdr(to);
! 
! 			rcode = mailfile(user, caddr, e);
! 			giveresponse(rcode, m, NULL, caddr, e);
  			if (rcode == EX_OK)
  				to->q_flags |= QSENT;
  			continue;
--- 843,850 ----
  
  		if (m == FileMailer)
  		{
! 			rcode = mailfile(user, ctladdr, e);
! 			giveresponse(rcode, m, NULL, ctladdr, e);
  			if (rcode == EX_OK)
  				to->q_flags |= QSENT;
  			continue;
***************
*** 905,912 ****
  	**	If we are running SMTP, we just need to clean up.
  	*/
  
! 	if (ctladdr == NULL && m != ProgMailer)
  		ctladdr = &e->e_from;
  #ifdef NAMED_BIND
  	if (ConfigLevel < 2)
  		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
--- 915,924 ----
  	**	If we are running SMTP, we just need to clean up.
  	*/
  
! 	/*XXX this seems a bit wierd */
! 	if (ctladdr == NULL && bitset(QGOODUID, e->e_from.q_flags))
  		ctladdr = &e->e_from;
+ 
  #ifdef NAMED_BIND
  	if (ConfigLevel < 2)
  		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
***************
*** 961,972 ****
  		register int i;
  		register u_short port;
  
  		CurHostName = pv[1];
  		curhost = hostsignature(m, pv[1], e);
  
  		if (curhost == NULL || curhost[0] == '\0')
  		{
! 			syserr("null signature");
  			rcode = EX_OSERR;
  			goto give_up;
  		}
--- 973,991 ----
  		register int i;
  		register u_short port;
  
+ 		if (pv[0] == NULL || pv[1] == NULL || pv[1][0] == '\0')
+ 		{
+ 			syserr("null host name for %s mailer", m->m_mailer);
+ 			rcode = EX_CONFIG;
+ 			goto give_up;
+ 		}
+ 
  		CurHostName = pv[1];
  		curhost = hostsignature(m, pv[1], e);
  
  		if (curhost == NULL || curhost[0] == '\0')
  		{
! 			syserr("null host signature for %s", pv[1]);
  			rcode = EX_OSERR;
  			goto give_up;
  		}
***************
*** 1153,1158 ****
--- 1172,1178 ----
  				if (ctladdr == NULL || ctladdr->q_uid == 0)
  				{
  					(void) initgroups(DefUser, DefGid);
+ 					(void) setgid(DefGid);
  					(void) setuid(DefUid);
  				}
  				else
***************
*** 1160,1165 ****
--- 1180,1186 ----
  					(void) initgroups(ctladdr->q_ruser?
  						ctladdr->q_ruser: ctladdr->q_user,
  						ctladdr->q_gid);
+ 					(void) setgid(ctladdr->q_gid);
  					(void) setuid(ctladdr->q_uid);
  				}
  			}
***************
*** 1202,1208 ****
  				}
  				(void) close(rpvect[1]);
  			}
! 			else if (OpMode == MD_SMTP || HoldErrs)
  			{
  				/* put mailer output in transcript */
  				if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
--- 1223,1229 ----
  				}
  				(void) close(rpvect[1]);
  			}
! 			else if (OpMode == MD_SMTP || OpMode == MD_DAEMON || HoldErrs)
  			{
  				/* put mailer output in transcript */
  				if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
***************
*** 1333,1339 ****
  				rcode, mci->mci_state, firstsig);
  			rcode = EX_SOFTWARE;
  		}
! 		else if (rcode == EX_TEMPFAIL && *curhost != '\0')
  		{
  			/* try next MX site */
  			goto tryhost;
--- 1354,1360 ----
  				rcode, mci->mci_state, firstsig);
  			rcode = EX_SOFTWARE;
  		}
! 		else if (rcode == EX_TEMPFAIL && curhost != NULL && *curhost != '\0')
  		{
  			/* try next MX site */
  			goto tryhost;
***************
*** 1403,1409 ****
  			if (!bitset(MCIF_CACHED, mci->mci_flags))
  				smtpquit(m, mci, e);
  		}
! 		if (rcode != EX_OK && *curhost != '\0')
  		{
  			/* try next MX site */
  			goto tryhost;
--- 1424,1430 ----
  			if (!bitset(MCIF_CACHED, mci->mci_flags))
  				smtpquit(m, mci, e);
  		}
! 		if (rcode != EX_OK && curhost != NULL && *curhost != '\0')
  		{
  			/* try next MX site */
  			goto tryhost;
***************
*** 1500,1511 ****
  {
  	char buf[MAXLINE];
  
! 	if (rcode == EX_OK)
! 		return;
! 	else if (rcode == EX_TEMPFAIL)
  		q->q_flags |= QQUEUEUP;
! 	else if (rcode != EX_IOERR && rcode != EX_OSERR)
  		q->q_flags |= QBADADDR;
  }
  /*
  **  ENDMAILER -- Wait for mailer to terminate.
--- 1521,1541 ----
  {
  	char buf[MAXLINE];
  
! 	switch (rcode)
! 	{
! 	  case EX_OK:
! 		break;
! 
! 	  case EX_TEMPFAIL:
! 	  case EX_IOERR:
! 	  case EX_OSERR:
  		q->q_flags |= QQUEUEUP;
! 		break;
! 
! 	  default:
  		q->q_flags |= QBADADDR;
+ 		break;
+ 	}
  }
  /*
  **  ENDMAILER -- Wait for mailer to terminate.
***************
*** 1537,1545 ****
  
  	/* close any connections */
  	if (mci->mci_in != NULL)
! 		(void) xfclose(mci->mci_in, pv[0], "mci_in");
  	if (mci->mci_out != NULL)
! 		(void) xfclose(mci->mci_out, pv[0], "mci_out");
  	mci->mci_in = mci->mci_out = NULL;
  	mci->mci_state = MCIS_CLOSED;
  
--- 1567,1575 ----
  
  	/* close any connections */
  	if (mci->mci_in != NULL)
! 		(void) xfclose(mci->mci_in, mci->mci_mailer->m_name, "mci_in");
  	if (mci->mci_out != NULL)
! 		(void) xfclose(mci->mci_out, mci->mci_mailer->m_name, "mci_out");
  	mci->mci_in = mci->mci_out = NULL;
  	mci->mci_state = MCIS_CLOSED;
  
***************
*** 1562,1571 ****
  	}
  
  	/* it died a horrid death */
! 	syserr("mailer %s died with signal %o", pv[0], st);
  
  	/* log the arguments */
! 	if (e->e_xfp != NULL)
  	{
  		register char **av;
  
--- 1592,1602 ----
  	}
  
  	/* it died a horrid death */
! 	syserr("451 mailer %s died with signal %o",
! 		mci->mci_mailer->m_name, st);
  
  	/* log the arguments */
! 	if (pv != NULL && e->e_xfp != NULL)
  	{
  		register char **av;
  
***************
*** 1647,1654 ****
  			else
  			{
  #ifdef SMTP
- 				extern char SmtpError[];
- 
  				statmsg = SmtpError;
  #else /* SMTP */
  				statmsg = NULL;
--- 1678,1683 ----
***************
*** 1710,1716 ****
  
  	if (stat != EX_TEMPFAIL)
  		setstat(stat);
! 	if (stat != EX_OK)
  	{
  		if (e->e_message != NULL)
  			free(e->e_message);
--- 1739,1745 ----
  
  	if (stat != EX_TEMPFAIL)
  		setstat(stat);
! 	if (stat != EX_OK && (stat != EX_TEMPFAIL || e->e_message == NULL))
  	{
  		if (e->e_message != NULL)
  			free(e->e_message);
***************
*** 1724,1729 ****
--- 1753,1762 ----
  /*
  **  LOGDELIVERY -- log the delivery in the system log
  **
+ **	Care is taken to avoid logging lines that are too long, because
+ **	some versions of syslog have an unfortunate proclivity for core
+ **	dumping.  This is a hack, to be sure, that is at best empirical.
+ **
  **	Parameters:
  **		m -- the mailer info.  Can be NULL for initial queue.
  **		mci -- the mailer connection info -- can be NULL if the
***************
*** 1748,1760 ****
  {
  # ifdef LOG
  	register char *bp;
  	char buf[512];
  
  	bp = buf;
  	if (ctladdr != NULL)
  	{
  		strcpy(bp, ", ctladdr=");
! 		strcat(bp, ctladdr->q_paddr);
  		bp += strlen(bp);
  		if (bitset(QGOODUID, ctladdr->q_flags))
  		{
--- 1781,1796 ----
  {
  # ifdef LOG
  	register char *bp;
+ 	register char *p;
+ 	int l;
  	char buf[512];
  
+ #  if (SYSLOG_BUFSIZE) >= 256
  	bp = buf;
  	if (ctladdr != NULL)
  	{
  		strcpy(bp, ", ctladdr=");
! 		strcat(bp, shortenstring(ctladdr->q_paddr, 83));
  		bp += strlen(bp);
  		if (bitset(QGOODUID, ctladdr->q_flags))
  		{
***************
*** 1799,1807 ****
  			(void) strcat(bp, p);
  		}
  	}
  		
! 	syslog(LOG_INFO, "%s: to=%s%s, stat=%s",
! 	       e->e_id, e->e_to, buf, stat);
  # endif /* LOG */
  }
  /*
--- 1835,1945 ----
  			(void) strcat(bp, p);
  		}
  	}
+ 	bp += strlen(bp);
+ 
+ #define STATLEN		(((SYSLOG_BUFSIZE) - 100) / 4)
+ #if (STATLEN) < 63
+ # undef STATLEN
+ # define STATLEN	63
+ #endif
+ #if (STATLEN) > 203
+ # undef STATLEN
+ # define STATLEN	203
+ #endif
+ 
+ 	if ((bp - buf) > (sizeof buf - ((STATLEN) + 20)))
+ 	{
+ 		/* desperation move -- truncate data */
+ 		bp = buf + sizeof buf - ((STATLEN) + 17);
+ 		strcpy(bp, "...");
+ 		bp += 3;
+ 	}
+ 
+ 	(void) strcpy(bp, ", stat=");
+ 	bp += strlen(bp);
+ 
+ 	(void) strcpy(bp, shortenstring(stat, (STATLEN)));
  		
! 	l = SYSLOG_BUFSIZE - 100 - strlen(buf);
! 	p = e->e_to;
! 	while (strlen(p) >= l)
! 	{
! 		register char *q = strchr(p + l, ',');
! 
! 		if (q == NULL)
! 			break;
! 		syslog(LOG_INFO, "%s: to=%.*s [more]%s",
! 			e->e_id, ++q - p, p, buf);
! 		p = q;
! 	}
! 	syslog(LOG_INFO, "%s: to=%s%s", e->e_id, p, buf);
! 
! #  else		/* we have a very short log buffer size */
! 
! 	l = SYSLOG_BUFSIZE - 80;
! 	p = e->e_to;
! 	while (strlen(p) >= l)
! 	{
! 		register char *q = strchr(p + l, ',');
! 
! 		if (q == NULL)
! 			break;
! 		syslog(LOG_INFO, "%s: to=%.*s [more]",
! 			e->e_id, ++q - p, p);
! 		p = q;
! 	}
! 	syslog(LOG_INFO, "%s: to=%s", e->e_id, p);
! 
! 	if (ctladdr != NULL)
! 	{
! 		bp = buf;
! 		strcpy(buf, "ctladdr=");
! 		bp += strlen(buf);
! 		strcpy(bp, shortenstring(ctladdr->q_paddr, 83));
! 		bp += strlen(buf);
! 		if (bitset(QGOODUID, ctladdr->q_flags))
! 		{
! 			(void) sprintf(bp, " (%d/%d)",
! 					ctladdr->q_uid, ctladdr->q_gid);
! 			bp += strlen(bp);
! 		}
! 		syslog(LOG_INFO, "%s: %s", e->e_id, buf);
! 	}
! 	bp = buf;
! 	sprintf(bp, "delay=%s", pintvl(curtime() - e->e_ctime, TRUE));
! 	bp += strlen(bp);
! 
! 	if (m != NULL)
! 	{
! 		sprintf(bp, ", mailer=%s", m->m_name);
! 		bp += strlen(bp);
! 	}
! 
! 	if (mci != NULL && mci->mci_host != NULL)
! 	{
! # ifdef DAEMON
! 		extern SOCKADDR CurHostAddr;
! # endif
! 
! 		sprintf(bp, ", relay=%s", mci->mci_host);
! 
! # ifdef DAEMON
! 		(void) strcat(bp, " (");
! 		(void) strcat(bp, anynet_ntoa(&CurHostAddr));
! 		(void) strcat(bp, ")");
! # endif
! 	}
! 	else
! 	{
! 		char *p = macvalue('h', e);
! 
! 		if (p != NULL && p[0] != '\0')
! 			sprintf(bp, ", relay=%s", p);
! 	}
! 	syslog(LOG_INFO, "%s: %s", e->e_id, buf);
! 
! 	syslog(LOG_INFO, "%s: stat=%s", e->e_id, shortenstring(stat, 63));
! #  endif /* short log buffer */
  # endif /* LOG */
  }
  /*
***************
*** 2013,2021 ****
  
  		if (bitset(0111, stb.st_mode))
  			exit(EX_CANTCREAT);
! 		if (ctladdr == NULL)
! 			ctladdr = &e->e_from;
! 		else
  		{
  			/* ignore setuid and setgid bits */
  			mode &= ~(S_ISGID|S_ISUID);
--- 2151,2157 ----
  
  		if (bitset(0111, stb.st_mode))
  			exit(EX_CANTCREAT);
! 		if (ctladdr != NULL)
  		{
  			/* ignore setuid and setgid bits */
  			mode &= ~(S_ISGID|S_ISUID);
***************
*** 2034,2040 ****
  
  		if (!bitset(S_ISGID, mode) || setgid(stb.st_gid) < 0)
  		{
! 			if (ctladdr->q_uid == 0)
  			{
  				(void) initgroups(DefUser, DefGid);
  			}
--- 2170,2176 ----
  
  		if (!bitset(S_ISGID, mode) || setgid(stb.st_gid) < 0)
  		{
! 			if (ctladdr == NULL || ctladdr->q_uid == 0)
  			{
  				(void) initgroups(DefUser, DefGid);
  			}
***************
*** 2047,2053 ****
  		}
  		if (!bitset(S_ISUID, mode) || setuid(stb.st_uid) < 0)
  		{
! 			if (ctladdr->q_uid == 0)
  				(void) setuid(DefUid);
  			else
  				(void) setuid(ctladdr->q_uid);
--- 2183,2189 ----
  		}
  		if (!bitset(S_ISUID, mode) || setuid(stb.st_uid) < 0)
  		{
! 			if (ctladdr == NULL || ctladdr->q_uid == 0)
  				(void) setuid(DefUid);
  			else
  				(void) setuid(ctladdr->q_uid);
***************
*** 2174,2180 ****
  		if (nmx <= 0)
  		{
  			register MCI *mci;
- 			extern int errno;
  
  			/* update the connection info for this host */
  			mci = mci_get(hp, m);
--- 2310,2315 ----
*** src/domain.c.OLD	Fri Nov 26 17:49:18 1993
--- src/domain.c	Tue Dec 21 14:52:18 1993
***************
*** 36,44 ****
  
  #ifndef lint
  #ifdef NAMED_BIND
! static char sccsid[] = "@(#)domain.c	8.8 (Berkeley) 9/29/93 (with name server)";
  #else
! static char sccsid[] = "@(#)domain.c	8.8 (Berkeley) 9/29/93 (without name server)";
  #endif
  #endif /* not lint */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef NAMED_BIND
! static char sccsid[] = "@(#)domain.c	8.10 (Berkeley) 12/21/93 (with name server)";
  #else
! static char sccsid[] = "@(#)domain.c	8.10 (Berkeley) 12/21/93 (without name server)";
  #endif
  #endif /* not lint */
  
***************
*** 158,163 ****
--- 158,169 ----
  		  case HOST_NOT_FOUND:
  			/* the host just doesn't exist */
  			*rcode = EX_NOHOST;
+ 
+ 			if (!UseNameServer)
+ 			{
+ 				/* might exist in /etc/hosts */
+ 				goto punt;
+ 			}
  			break;
  
  		  case TRY_AGAIN:
***************
*** 419,426 ****
--- 425,434 ----
  	bool gotmx;
  	int qtype;
  	int loopcnt;
+ 	char *xp;
  	char nbuf[MAX(PACKETSZ, MAXDNAME*2+2)];
  	char *searchlist[MAXDNSRCH+2];
+ 	extern char *gethostalias();
  
  	if (tTd(8, 2))
  		printf("getcanonname(%s)\n", host);
***************
*** 444,449 ****
--- 452,471 ----
  		if (*cp == '.')
  			n++;
  
+ 	if (n == 0 && (xp = gethostalias(host)) != NULL)
+ 	{
+ 		if (loopcnt++ > MAXCNAMEDEPTH)
+ 		{
+ 			syserr("loop in ${HOSTALIASES} file");
+ 		}
+ 		else
+ 		{
+ 			strncpy(host, xp, hbsize);
+ 			host[hbsize - 1] = '\0';
+ 			goto cnameloop;
+ 		}
+ 	}
+ 
  	dp = searchlist;
  	if (n > 0)
  		*dp++ = "";
***************
*** 636,641 ****
--- 658,711 ----
  	host[hbsize - 1] = '\0';
  	return TRUE;
  }
+ 
+ 
+ char *
+ gethostalias(host)
+ 	char *host;
+ {
+ 	char *fname;
+ 	FILE *fp;
+ 	register char *p;
+ 	char buf[MAXLINE];
+ 	static char hbuf[MAXDNAME];
+ 
+ 	fname = getenv("HOSTALIASES");
+ 	if (fname == NULL || (fp = fopen(fname, "r")) == NULL)
+ 		return NULL;
+ 	while (fgets(buf, sizeof buf, fp) != NULL)
+ 	{
+ 		for (p = buf; p != '\0' && !(isascii(*p) && isspace(*p)); p++)
+ 			continue;
+ 		if (*p == 0)
+ 		{
+ 			/* syntax error */
+ 			continue;
+ 		}
+ 		*p++ = '\0';
+ 		if (strcasecmp(buf, host) == 0)
+ 			break;
+ 	}
+ 
+ 	if (feof(fp))
+ 	{
+ 		/* no match */
+ 		fclose(fp);
+ 		return NULL;
+ 	}
+ 
+ 	/* got a match; extract the equivalent name */
+ 	while (*p != '\0' && isascii(*p) && isspace(*p))
+ 		p++;
+ 	host = p;
+ 	while (*p != '\0' && !(isascii(*p) && isspace(*p)))
+ 		p++;
+ 	*p = '\0';
+ 	strncpy(hbuf, host, sizeof hbuf - 1);
+ 	hbuf[sizeof hbuf - 1] = '\0';
+ 	return hbuf;
+ }
+ 
  
  #else /* not NAMED_BIND */
  
*** src/envelope.c.OLD	Tue Nov  9 14:38:25 1993
--- src/envelope.c	Sun Jan  9 09:22:39 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)envelope.c	8.17 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)envelope.c	8.28 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 110,116 ****
  	{
  		printf("dropenvelope %x: id=", e);
  		xputs(e->e_id);
! 		printf(", flags=%o\n", e->e_flags);
  		if (tTd(50, 10))
  		{
  			printf("sendq=");
--- 110,116 ----
  	{
  		printf("dropenvelope %x: id=", e);
  		xputs(e->e_id);
! 		printf(", flags=0x%x\n", e->e_flags);
  		if (tTd(50, 10))
  		{
  			printf("sendq=");
***************
*** 123,132 ****
  		return;
  
  #ifdef LOG
  	if (LogLevel > 84)
! 		syslog(LOG_DEBUG, "dropenvelope, id=%s, flags=%o, pid=%d",
  				  id, e->e_flags, getpid());
  #endif /* LOG */
  
  	/* post statistics */
  	poststats(StatFile);
--- 123,135 ----
  		return;
  
  #ifdef LOG
+ 	if (LogLevel > 4 && bitset(EF_LOGSENDER, e->e_flags))
+ 		logsender(e, NULL);
  	if (LogLevel > 84)
! 		syslog(LOG_DEBUG, "dropenvelope, id=%s, flags=0x%x, pid=%d",
  				  id, e->e_flags, getpid());
  #endif /* LOG */
+ 	e->e_flags &= ~EF_LOGSENDER;
  
  	/* post statistics */
  	poststats(StatFile);
***************
*** 214,219 ****
--- 217,223 ----
  
  		(void) sendtolist(e->e_receiptto, NULLADDR, &rlist, e);
  		(void) returntosender("Return receipt", rlist, FALSE, e);
+ 		e->e_flags &= ~EF_SENDRECEIPT;
  	}
  
  	/*
***************
*** 272,280 ****
  		(void) xfclose(e->e_dfp, "dropenvelope", e->e_df);
  	e->e_dfp = NULL;
  	e->e_id = e->e_df = NULL;
- #ifdef XDEBUG
- 	checkfd012("dropenvelope");
- #endif
  }
  /*
  **  CLEARENVELOPE -- clear an envelope without unlocking
--- 276,281 ----
***************
*** 583,589 ****
  	**	Username can return errno != 0 on non-errors.
  	*/
  
! 	if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP)
  		realname = from;
  	if (realname == NULL || realname[0] == '\0')
  		realname = username();
--- 584,591 ----
  	**	Username can return errno != 0 on non-errors.
  	*/
  
! 	if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
! 	    OpMode == MD_DAEMON)
  		realname = from;
  	if (realname == NULL || realname[0] == '\0')
  		realname = username();
***************
*** 619,625 ****
  			}
  			syslog(LOG_NOTICE,
  				"setsender: %s: invalid or unparseable, received from %s",
! 				from, p);
  		}
  # endif /* LOG */
  		if (from != NULL)
--- 621,627 ----
  			}
  			syslog(LOG_NOTICE,
  				"setsender: %s: invalid or unparseable, received from %s",
! 				shortenstring(from, 83), p);
  		}
  # endif /* LOG */
  		if (from != NULL)
***************
*** 681,687 ****
  				**  We have an alternate address for the sender
  				*/
  
! 				pvp = prescan(p, '\0', pvpbuf, NULL);
  			}
  # endif /* USERDB */
  		}
--- 683,689 ----
  				**  We have an alternate address for the sender
  				*/
  
! 				pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL);
  			}
  # endif /* USERDB */
  		}
***************
*** 700,705 ****
--- 702,708 ----
  			/* extract user and group id */
  			e->e_from.q_uid = pw->pw_uid;
  			e->e_from.q_gid = pw->pw_gid;
+ 			e->e_from.q_flags |= QGOODUID;
  
  			/* extract full name from passwd file */
  			if (FullName == NULL && pw->pw_gecos != NULL &&
***************
*** 714,725 ****
  		if (FullName != NULL && !internal)
  			define('x', FullName, e);
  	}
! 	else if (!internal)
  	{
  		if (e->e_from.q_home == NULL)
  			e->e_from.q_home = getenv("HOME");
  		e->e_from.q_uid = RealUid;
  		e->e_from.q_gid = RealGid;
  	}
  
  	/*
--- 717,729 ----
  		if (FullName != NULL && !internal)
  			define('x', FullName, e);
  	}
! 	else if (!internal && OpMode != MD_DAEMON)
  	{
  		if (e->e_from.q_home == NULL)
  			e->e_from.q_home = getenv("HOME");
  		e->e_from.q_uid = RealUid;
  		e->e_from.q_gid = RealGid;
+ 		e->e_from.q_flags |= QGOODUID;
  	}
  
  	/*
***************
*** 728,734 ****
  	*/
  
  	if (pvp == NULL)
! 		pvp = prescan(from, '\0', pvpbuf, NULL);
  	if (pvp == NULL)
  	{
  		/* don't need to give error -- prescan did that already */
--- 732,738 ----
  	*/
  
  	if (pvp == NULL)
! 		pvp = prescan(from, delimchar, pvpbuf, sizeof pvpbuf, NULL);
  	if (pvp == NULL)
  	{
  		/* don't need to give error -- prescan did that already */
***************
*** 738,746 ****
  # endif
  		finis();
  	}
! 	(void) rewrite(pvp, 3, e);
! 	(void) rewrite(pvp, 1, e);
! 	(void) rewrite(pvp, 4, e);
  	bp = buf + 1;
  	cataddr(pvp, NULL, bp, sizeof buf - 2, '\0');
  	if (*bp == '@')
--- 742,750 ----
  # endif
  		finis();
  	}
! 	(void) rewrite(pvp, 3, 0, e);
! 	(void) rewrite(pvp, 1, 0, e);
! 	(void) rewrite(pvp, 4, 0, e);
  	bp = buf + 1;
  	cataddr(pvp, NULL, bp, sizeof buf - 2, '\0');
  	if (*bp == '@')
***************
*** 753,759 ****
  	define('f', e->e_sender, e);
  
  	/* save the domain spec if this mailer wants it */
! 	if (!internal && e->e_from.q_mailer != NULL &&
  	    bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags))
  	{
  		extern char **copyplist();
--- 757,763 ----
  	define('f', e->e_sender, e);
  
  	/* save the domain spec if this mailer wants it */
! 	if (e->e_from.q_mailer != NULL &&
  	    bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags))
  	{
  		extern char **copyplist();
*** src/err.c.OLD	Sun Nov  7 12:03:39 1993
--- src/err.c	Sat Jan  8 17:29:31 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)err.c	8.14 (Berkeley) 10/29/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)err.c	8.19 (Berkeley) 1/8/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 159,166 ****
  #endif
  {
  	VA_LOCAL_DECL
- 	extern char SuprErrs;
- 	extern int errno;
  
  	if (SuprErrs)
  		return;
--- 159,164 ----
***************
*** 287,299 ****
  		msg[0] = '5';
  
  	(void) fflush(stdout);
! 	if (OpMode == MD_SMTP)
  		fprintf(OutChannel, "%s\r\n", msg);
  	else
  		fprintf(OutChannel, "%s\n", &msg[4]);
  	if (TrafficLogFile != NULL)
  		fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(),
! 			OpMode == MD_SMTP ? msg : &msg[4]);
  	if (msg[3] == ' ')
  		(void) fflush(OutChannel);
  	if (!ferror(OutChannel))
--- 285,297 ----
  		msg[0] = '5';
  
  	(void) fflush(stdout);
! 	if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
  		fprintf(OutChannel, "%s\r\n", msg);
  	else
  		fprintf(OutChannel, "%s\n", &msg[4]);
  	if (TrafficLogFile != NULL)
  		fprintf(TrafficLogFile, "%05d >>> %s\n", getpid(),
! 			(OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
  	if (msg[3] == ' ')
  		(void) fflush(OutChannel);
  	if (!ferror(OutChannel))
***************
*** 449,454 ****
--- 447,453 ----
  errstring(errno)
  	int errno;
  {
+ 	char *dnsmsg;
  	static char buf[MAXLINE];
  # ifndef ERRLIST_PREDEFINED
  	extern char *sys_errlist[];
***************
*** 458,465 ****
  	extern char *SmtpPhase;
  # endif /* SMTP */
  
- # ifdef DAEMON
- # ifdef ETIMEDOUT
  	/*
  	**  Handle special network error codes.
  	**
--- 457,462 ----
***************
*** 466,473 ****
--- 463,472 ----
  	**	These are 4.2/4.3bsd specific; they should be in daemon.c.
  	*/
  
+ 	dnsmsg = NULL;
  	switch (errno)
  	{
+ # if defined(DAEMON) && defined(ETIMEDOUT)
  	  case ETIMEDOUT:
  	  case ECONNRESET:
  		(void) strcpy(buf, sys_errlist[errno]);
***************
*** 494,499 ****
--- 493,499 ----
  			break;
  		(void) sprintf(buf, "Connection refused by %s", CurHostName);
  		return (buf);
+ # endif
  
  	  case EOPENTIMEOUT:
  		return "Timeout on file open";
***************
*** 500,519 ****
  
  # ifdef NAMED_BIND
  	  case HOST_NOT_FOUND + E_DNSBASE:
! 		return ("Name server: host not found");
  
  	  case TRY_AGAIN + E_DNSBASE:
! 		return ("Name server: host name lookup failure");
  
  	  case NO_RECOVERY + E_DNSBASE:
! 		return ("Name server: non-recoverable error");
  
  	  case NO_DATA + E_DNSBASE:
! 		return ("Name server: no data known for name");
  # endif
  	}
! # endif
! # endif
  
  	if (errno > 0 && errno < sys_nerr)
  		return (sys_errlist[errno]);
--- 500,537 ----
  
  # ifdef NAMED_BIND
  	  case HOST_NOT_FOUND + E_DNSBASE:
! 		dnsmsg = "host not found";
! 		break;
  
  	  case TRY_AGAIN + E_DNSBASE:
! 		dnsmsg = "host name lookup failure";
! 		break;
  
  	  case NO_RECOVERY + E_DNSBASE:
! 		dnsmsg = "non-recoverable error";
! 		break;
  
  	  case NO_DATA + E_DNSBASE:
! 		dnsmsg = "no data known";
! 		break;
  # endif
+ 
+ 	  case EPERM:
+ 		/* SunOS gives "Not owner" -- this is the POSIX message */
+ 		return "Operation not permitted";
  	}
! 
! 	if (dnsmsg != NULL)
! 	{
! 		(void) strcpy(buf, "Name server: ");
! 		if (CurHostName != NULL)
! 		{
! 			(void) strcat(buf, CurHostName);
! 			(void) strcat(buf, ": ");
! 		}
! 		(void) strcat(buf, dnsmsg);
! 		return buf;
! 	}
  
  	if (errno > 0 && errno < sys_nerr)
  		return (sys_errlist[errno]);
*** src/features.linux.h.OLD	Thu Dec 16 16:02:45 1993
--- src/features.linux.h	Thu Dec  9 13:43:51 1993
***************
*** 0 ****
--- 1,14 ----
+ /*
+ **  This should be renamed features.h on Linux.  DO NOT USE IT
+ **  on any other system.
+ */
+ 
+ #include_next <features.h>
+ #undef  __USE_POSIX2
+ 
+ #ifndef __USE_POSIX
+ #define __USE_POSIX
+ #endif
+ #ifndef __USE_BSD
+ #define __USE_BSD
+ #endif
*** src/headers.c.OLD	Thu Dec  9 13:50:15 1993
--- src/headers.c	Wed Jan 12 12:38:49 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)headers.c	8.13 (Berkeley) 10/24/93";
  #endif /* not lint */
  
  # include <errno.h>
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)headers.c	8.22 (Berkeley) 1/13/94";
  #endif /* not lint */
  
  # include <errno.h>
***************
*** 371,376 ****
--- 371,381 ----
  	else
  		define('u', NULL, e);
  
+ 	/* full name of from person */
+ 	p = hvalue("full-name", e);
+ 	if (p != NULL)
+ 		define('x', p, e);
+ 
  	if (tTd(32, 1))
  		printf("----- collected header -----\n");
  	msgid = "<none>";
***************
*** 395,401 ****
  		}
  
  		if (tTd(32, 1))
! 			printf("%s: %s\n", h->h_field, h->h_value);
  
  		/* count the number of times it has been processed */
  		if (bitset(H_TRACE, h->h_flags))
--- 400,410 ----
  		}
  
  		if (tTd(32, 1))
! 		{
! 			printf("%s: ", h->h_field);
! 			xputs(h->h_value);
! 			printf("\n");
! 		}
  
  		/* count the number of times it has been processed */
  		if (bitset(H_TRACE, h->h_flags))
***************
*** 453,463 ****
  				 - e->e_class * WkClassFact
  				 + e->e_nrcpts * WkRecipFact;
  
- 	/* full name of from person */
- 	p = hvalue("full-name", e);
- 	if (p != NULL)
- 		define('x', p, e);
- 
  	/* date message originated */
  	p = hvalue("posted-date", e);
  	if (p == NULL)
--- 462,467 ----
***************
*** 471,518 ****
  
  # ifdef LOG
  	if (full && LogLevel > 4)
! 	{
! 		char *name;
! 		register char *sbp;
! 		char hbuf[MAXNAME];
! 		char sbuf[MAXLINE];
  
! 		if (bitset(EF_RESPONSE, e->e_flags))
! 			name = "[RESPONSE]";
! 		else if ((name = macvalue('_', e)) != NULL)
! 			;
! 		else if (RealHostName[0] == '[')
! 			name = RealHostName;
! 		else
  		{
! 			name = hbuf;
! 			(void) sprintf(hbuf, "%.80s", RealHostName);
! 			if (RealHostAddr.sa.sa_family != 0)
! 			{
! 				p = &hbuf[strlen(hbuf)];
! 				(void) sprintf(p, " (%s)",
! 					anynet_ntoa(&RealHostAddr));
! 			}
  		}
  
! 		/* some versions of syslog only take 5 printf args */
! 		sbp = sbuf;
! 		sprintf(sbp, "from=%.200s, size=%ld, class=%d, pri=%ld, nrcpts=%d, msgid=%.100s",
! 		    e->e_from.q_paddr, e->e_msgsize, e->e_class,
! 		    e->e_msgpriority, e->e_nrcpts, msgid);
  		sbp += strlen(sbp);
- 		if (e->e_bodytype != NULL)
- 		{
- 			(void) sprintf(sbp, ", bodytype=%.20s", e->e_bodytype);
- 			sbp += strlen(sbp);
- 		}
- 		p = macvalue('r', e);
- 		if (p != NULL)
- 			(void) sprintf(sbp, ", proto=%.20s", p);
- 		syslog(LOG_INFO, "%s: %s, relay=%s",
- 		    e->e_id, sbuf, name);
  	}
! # endif /* LOG */
  }
  /*
  **  PRIENCODE -- encode external priority names into internal values.
--- 475,571 ----
  
  # ifdef LOG
  	if (full && LogLevel > 4)
! 		logsender(e, msgid);
! # endif /* LOG */
! 	e->e_flags &= ~EF_LOGSENDER;
! }
! /*
! **  LOGSENDER -- log sender information
! **
! **	Parameters:
! **		e -- the envelope to log
! **		msgid -- the message id
! **
! **	Returns:
! **		none
! */
  
! logsender(e, msgid)
! 	register ENVELOPE *e;
! 	char *msgid;
! {
! 	char *name;
! 	register char *sbp;
! 	register char *p;
! 	char hbuf[MAXNAME];
! 	char sbuf[MAXLINE];
! 
! 	if (bitset(EF_RESPONSE, e->e_flags))
! 		name = "[RESPONSE]";
! 	else if ((name = macvalue('_', e)) != NULL)
! 		;
! 	else if (RealHostName[0] == '[')
! 		name = RealHostName;
! 	else
! 	{
! 		name = hbuf;
! 		(void) sprintf(hbuf, "%.80s", RealHostName);
! 		if (RealHostAddr.sa.sa_family != 0)
  		{
! 			p = &hbuf[strlen(hbuf)];
! 			(void) sprintf(p, " (%s)",
! 				anynet_ntoa(&RealHostAddr));
  		}
+ 	}
  
! 	/* some versions of syslog only take 5 printf args */
! #  if (SYSLOG_BUFSIZE) >= 256
! 	sbp = sbuf;
! 	sprintf(sbp, "from=%.200s, size=%ld, class=%d, pri=%ld, nrcpts=%d",
! 	    e->e_from.q_paddr, e->e_msgsize, e->e_class,
! 	    e->e_msgpriority, e->e_nrcpts);
! 	sbp += strlen(sbp);
! 	if (msgid != NULL)
! 	{
! 		sprintf(sbp, ", msgid=%.100s", msgid);
  		sbp += strlen(sbp);
  	}
! 	if (e->e_bodytype != NULL)
! 	{
! 		(void) sprintf(sbp, ", bodytype=%.20s", e->e_bodytype);
! 		sbp += strlen(sbp);
! 	}
! 	p = macvalue('r', e);
! 	if (p != NULL)
! 		(void) sprintf(sbp, ", proto=%.20s", p);
! 	syslog(LOG_INFO, "%s: %s, relay=%s",
! 	    e->e_id, sbuf, name);
! 
! #  else			/* short syslog buffer */
! 
! 	syslog(LOG_INFO, "%s: from=%s",
! 		e->e_id, shortenstring(e->e_from.q_paddr, 83));
! 	syslog(LOG_INFO, "%s: size=%ld, class=%ld, pri=%ld, nrcpts=%d",
! 		e->e_id, e->e_msgsize, e->e_class,
! 		e->e_msgpriority, e->e_nrcpts);
! 	if (msgid != NULL)
! 		syslog(LOG_INFO, "%s: msgid=%s", e->e_id, msgid);
! 	sbp = sbuf;
! 	sprintf(sbp, "%s:", e->e_id);
! 	sbp += strlen(sbp);
! 	if (e->e_bodytype != NULL)
! 	{
! 		sprintf(sbp, " bodytype=%s,", e->e_bodytype);
! 		sbp += strlen(sbp);
! 	}
! 	p = macvalue('r', e);
! 	if (p != NULL)
! 	{
! 		sprintf(sbp, " proto=%s,", p);
! 		sbp += strlen(sbp);
! 	}
! 	syslog(LOG_INFO, "%s relay=%s", sbuf, name);
! #  endif
  }
  /*
  **  PRIENCODE -- encode external priority names into internal values.
***************
*** 639,645 ****
  		}
  
  		/* check for quoted strings */
! 		if (c == '"')
  		{
  			qmode = !qmode;
  			if (copylev > 0 && !skipping)
--- 692,698 ----
  		}
  
  		/* check for quoted strings */
! 		if (c == '"' && cmtlev <= 0)
  		{
  			qmode = !qmode;
  			if (copylev > 0 && !skipping)
***************
*** 683,693 ****
  		else if (c == ')')
  		{
  			/* syntax error: unmatched ) */
! 			if (!skipping)
  				bp--;
  		}
  
- 
  		/* check for characters that may have to be quoted */
  		if (strchr(".'@,;:\\()[]", c) != NULL)
  		{
--- 736,745 ----
  		else if (c == ')')
  		{
  			/* syntax error: unmatched ) */
! 			if (copylev > 0 && !skipping)
  				bp--;
  		}
  
  		/* check for characters that may have to be quoted */
  		if (strchr(".'@,;:\\()[]", c) != NULL)
  		{
***************
*** 864,882 ****
  				printf(" (skipped (resent))\n");
  			continue;
  		}
- 		if (tTd(34, 11))
- 			printf("\n");
  
  		p = h->h_value;
  		if (bitset(H_DEFAULT, h->h_flags))
  		{
- 			/* macro expand value if generated internally */
  			expand(p, buf, &buf[sizeof buf], e);
  			p = buf;
  			if (p == NULL || *p == '\0')
  				continue;
  		}
  
  		if (bitset(H_FROM|H_RCPT, h->h_flags))
  		{
  			/* address field */
--- 916,939 ----
  				printf(" (skipped (resent))\n");
  			continue;
  		}
  
+ 		/* macro expand value if generated internally */
  		p = h->h_value;
  		if (bitset(H_DEFAULT, h->h_flags))
  		{
  			expand(p, buf, &buf[sizeof buf], e);
  			p = buf;
  			if (p == NULL || *p == '\0')
+ 			{
+ 				if (tTd(34, 11))
+ 					printf(" (skipped -- null value)\n");
  				continue;
+ 			}
  		}
  
+ 		if (tTd(34, 11))
+ 			printf("\n");
+ 
  		if (bitset(H_FROM|H_RCPT, h->h_flags))
  		{
  			/* address field */
***************
*** 980,986 ****
  			auto char *oldp;
  			char pvpbuf[PSBUFSIZE];
  
! 			(void) prescan(p, oldstyle ? ' ' : ',', pvpbuf, &oldp);
  			p = oldp;
  
  			/* look to see if we have an at sign */
--- 1037,1044 ----
  			auto char *oldp;
  			char pvpbuf[PSBUFSIZE];
  
! 			(void) prescan(p, oldstyle ? ' ' : ',', pvpbuf,
! 				       sizeof pvpbuf, &oldp);
  			p = oldp;
  
  			/* look to see if we have an at sign */
*** src/main.c.OLD	Sun Nov  7 16:45:33 1993
--- src/main.c	Sun Jan  9 11:09:20 1994
***************
*** 39,45 ****
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)main.c	8.33 (Berkeley) 10/24/93";
  #endif /* not lint */
  
  #define	_DEFINE
--- 39,45 ----
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)main.c	8.46 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  #define	_DEFINE
***************
*** 155,160 ****
--- 155,161 ----
  	extern char *getcfname();
  	extern char *optarg;
  	extern char **environ;
+ 	extern void dumpstate();
  
  	/*
  	**  Check to see if we reentered.
***************
*** 170,177 ****
  	reenter = TRUE;
  
  	/* do machine-dependent initializations */
! 	init_md();
  
  	/* in 4.4BSD, the table can be huge; impose a reasonable limit */
  	DtableSize = getdtsize();
  	if (DtableSize > 256)
--- 171,183 ----
  	reenter = TRUE;
  
  	/* do machine-dependent initializations */
! 	init_md(argc, argv);
  
+ 	/* arrange to dump state on signal */
+ #ifdef SIGUSR1
+ 	setsignal(SIGUSR1, dumpstate);
+ #endif
+ 
  	/* in 4.4BSD, the table can be huge; impose a reasonable limit */
  	DtableSize = getdtsize();
  	if (DtableSize > 256)
***************
*** 253,265 ****
  
  #if defined(__osf__) || defined(_AIX3)
  # define OPTIONS	"B:b:C:cd:e:F:f:h:Iimno:p:q:r:sTtvX:x"
- #else
- # if defined(ultrix)
- #  define OPTIONS	"B:b:C:cd:e:F:f:h:IiM:mno:p:q:r:sTtvX:"
- # else
- #  define OPTIONS	"B:b:C:cd:e:F:f:h:Iimno:p:q:r:sTtvX:"
- # endif
  #endif
  	while ((j = getopt(argc, argv, OPTIONS)) != EOF)
  	{
  		switch (j)
--- 259,274 ----
  
  #if defined(__osf__) || defined(_AIX3)
  # define OPTIONS	"B:b:C:cd:e:F:f:h:Iimno:p:q:r:sTtvX:x"
  #endif
+ #if defined(ultrix)
+ # define OPTIONS	"B:b:C:cd:e:F:f:h:IiM:mno:p:q:r:sTtvX:"
+ #endif
+ #if defined(NeXT)
+ # define OPTIONS	"B:b:C:cd:e:F:f:h:IimnOo:p:q:r:sTtvX:"
+ #endif
+ #ifndef OPTIONS
+ # define OPTIONS	"B:b:C:cd:e:F:f:h:Iimno:p:q:r:sTtvX:"
+ #endif
  	while ((j = getopt(argc, argv, OPTIONS)) != EOF)
  	{
  		switch (j)
***************
*** 334,343 ****
  
  		if (tTd(0, 4))
  			printf("canonical name: %s\n", jbuf);
- 		p = newstr(jbuf);
  		define('w', newstr(jbuf), CurEnv);	/* must be new string */
! 		define('j', p, CurEnv);
! 		setclass('w', p);
  
  		p = strchr(jbuf, '.');
  		if (p != NULL)
--- 343,351 ----
  
  		if (tTd(0, 4))
  			printf("canonical name: %s\n", jbuf);
  		define('w', newstr(jbuf), CurEnv);	/* must be new string */
! 		define('j', newstr(jbuf), CurEnv);
! 		setclass('w', jbuf);
  
  		p = strchr(jbuf, '.');
  		if (p != NULL)
***************
*** 360,365 ****
--- 368,375 ----
  			p = utsname.nodename;
  		else
  		{
+ 			if (tTd(0, 22))
+ 				printf("uname failed (%s)\n", errstring(errno));
  			makelower(jbuf);
  			p = jbuf;
  		}
***************
*** 367,372 ****
--- 377,383 ----
  			printf("UUCP nodename: %s\n", p);
  		p = newstr(p);
  		define('k', p, CurEnv);
+ 		setclass('k', p);
  		setclass('w', p);
  	}
  	while (av != NULL && *av != NULL)
***************
*** 586,591 ****
--- 597,606 ----
  		  case 'x':	/* random flag that OSF/1 & AIX mailx passes */
  			break;
  # endif
+ # if defined(NeXT)
+ 		  case 'O':	/* random flag that NeXT Mail.app passes */
+ 			break;
+ # endif
  
  		  default:
  			ExitStat = EX_USAGE;
***************
*** 601,606 ****
--- 616,624 ----
  	**	Extract special fields for local use.
  	*/
  
+ #ifdef XDEBUG
+ 	checkfd012("before readcf");
+ #endif
  	readcf(getcfname(), safecf, CurEnv);
  
  	if (tTd(0, 1))
***************
*** 761,766 ****
--- 779,788 ----
  		exit(ExitStat);
  	}
  
+ #ifdef XDEBUG
+ 	checkfd012("before main() initmaps");
+ #endif
+ 
  	/*
  	**  Do operation-mode-dependent initialization.
  	*/
***************
*** 899,905 ****
  			{
  				char pvpbuf[PSBUFSIZE];
  
! 				pvp = prescan(++p, ',', pvpbuf, &delimptr);
  				if (pvp == NULL)
  					continue;
  				p = q;
--- 921,928 ----
  			{
  				char pvpbuf[PSBUFSIZE];
  
! 				pvp = prescan(++p, ',', pvpbuf, sizeof pvpbuf,
! 					      &delimptr);
  				if (pvp == NULL)
  					continue;
  				p = q;
***************
*** 907,913 ****
  				{
  					int stat;
  
! 					stat = rewrite(pvp, atoi(p), CurEnv);
  					if (stat != EX_OK)
  						printf("== Ruleset %s status %d\n",
  							p, stat);
--- 930,936 ----
  				{
  					int stat;
  
! 					stat = rewrite(pvp, atoi(p), 0, CurEnv);
  					if (stat != EX_OK)
  						printf("== Ruleset %s status %d\n",
  							p, stat);
***************
*** 1005,1011 ****
  	**  commands.  This will never return.
  	*/
  
! 	if (OpMode == MD_SMTP)
  		smtp(CurEnv);
  # endif /* SMTP */
  
--- 1028,1034 ----
  	**  commands.  This will never return.
  	*/
  
! 	if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
  		smtp(CurEnv);
  # endif /* SMTP */
  
***************
*** 1325,1331 ****
  obsolete(argv)
  	char *argv[];
  {
! 	char *ap;
  
  	while ((ap = *++argv) != NULL)
  	{
--- 1348,1355 ----
  obsolete(argv)
  	char *argv[];
  {
! 	register char *ap;
! 	register char *op;
  
  	while ((ap = *++argv) != NULL)
  	{
***************
*** 1333,1342 ****
  		if (ap[0] != '-' || ap[1] == '-')
  			return;
  
  		/* If -C doesn't have an argument, use sendmail.cf. */
  #define	__DEFPATH	"sendmail.cf"
! 		if (ap[1] == 'C' && ap[2] == '\0' &&
! 		    (argv[1] == NULL || argv[1][0] == '-'))
  		{
  			*argv = xalloc(sizeof(__DEFPATH) + 2);
  			argv[0][0] = '-';
--- 1357,1374 ----
  		if (ap[0] != '-' || ap[1] == '-')
  			return;
  
+ 		/* skip over options that do have a value */
+ 		op = strchr(OPTIONS, ap[1]);
+ 		if (op != NULL && *++op == ':' && ap[2] == '\0' &&
+ 		    argv[1] != NULL && argv[1][0] != '-')
+ 		{
+ 			argv++;
+ 			continue;
+ 		}
+ 
  		/* If -C doesn't have an argument, use sendmail.cf. */
  #define	__DEFPATH	"sendmail.cf"
! 		if (ap[1] == 'C' && ap[2] == '\0')
  		{
  			*argv = xalloc(sizeof(__DEFPATH) + 2);
  			argv[0][0] = '-';
***************
*** 1345,1357 ****
  		}
  
  		/* If -q doesn't have an argument, run it once. */
! 		if (ap[1] == 'q' && ap[2] == '\0' &&
! 		    (argv[1] == NULL || argv[1][0] == '-'))
  			*argv = "-q0";
  
  		/* if -d doesn't have an argument, use 0-99.1 */
! 		if (ap[1] == 'd' && ap[2] == '\0' &&
! 		    (argv[1] == NULL || !isdigit(argv[1][0])))
  			*argv = "-d0-99.1";
  	}
  }
--- 1377,1387 ----
  		}
  
  		/* If -q doesn't have an argument, run it once. */
! 		if (ap[1] == 'q' && ap[2] == '\0')
  			*argv = "-q0";
  
  		/* if -d doesn't have an argument, use 0-99.1 */
! 		if (ap[1] == 'd' && ap[2] == '\0')
  			*argv = "-d0-99.1";
  	}
  }
***************
*** 1396,1399 ****
--- 1426,1466 ----
  		VA_END;
  		addheader("X-Authentication-Warning", buf, e);
  	}
+ }
+ /*
+ **  DUMPSTATE -- dump state on user signal
+ **
+ **	For debugging.
+ */
+ 
+ void
+ dumpstate()
+ {
+ #ifdef LOG
+ 	register char *j = macvalue('j', CurEnv);
+ 	register STAB *s;
+ 
+ 	syslog(LOG_DEBUG, "--- dumping state on user signal: $j = %s ---", j);
+ 	s = stab(j, ST_CLASS, ST_FIND);
+ 	if (s == NULL || !bitnset('w', s->s_class))
+ 		syslog(LOG_DEBUG, "*** $j not in $=w ***");
+ 	syslog(LOG_DEBUG, "--- open file descriptors: ---");
+ 	printopenfds(TRUE);
+ 	syslog(LOG_DEBUG, "--- connection cache: ---");
+ 	mci_dump_all(TRUE);
+ 	if (RewriteRules[89] != NULL)
+ 	{
+ 		int stat;
+ 		register char **pvp;
+ 		char *pv[MAXATOM + 1];
+ 
+ 		pv[0] = NULL;
+ 		stat = rewrite(pv, 89, 0, CurEnv);
+ 		syslog(LOG_DEBUG, "--- ruleset 89 returns stat %d, pv: ---",
+ 			stat);
+ 		for (pvp = pv; *pvp != NULL; pvp++)
+ 			syslog(LOG_DEBUG, "%s", *pvp);
+ 	}
+ 	syslog(LOG_DEBUG, "--- end of state dump ---");
+ #endif
  }
*** src/map.c.OLD	Thu Nov 25 08:16:17 1993
--- src/map.c	Sat Dec 11 08:26:17 1993
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)map.c	8.17 (Berkeley) 10/15/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)map.c	8.20 (Berkeley) 12/11/93";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 336,342 ****
  	checkfd012("entering initmaps");
  #endif
  	CurEnv = e;
! 	stabapply(map_init, rebuild);
  #ifdef XDEBUG
  	checkfd012("exiting initmaps");
  #endif
--- 336,350 ----
  	checkfd012("entering initmaps");
  #endif
  	CurEnv = e;
! 	if (rebuild)
! 	{
! 		stabapply(map_init, 1);
! 		stabapply(map_init, 2);
! 	}
! 	else
! 	{
! 		stabapply(map_init, 0);
! 	}
  #ifdef XDEBUG
  	checkfd012("exiting initmaps");
  #endif
***************
*** 358,368 ****
  		return;
  
  	if (tTd(38, 2))
! 		printf("map_init(%s:%s)\n",
  			map->map_class->map_cname == NULL ? "NULL" :
  				map->map_class->map_cname,
! 			map->map_file == NULL ? "NULL" : map->map_file);
  
  	/* if already open, close it (for nested open) */
  	if (bitset(MF_OPEN, map->map_mflags))
  	{
--- 366,385 ----
  		return;
  
  	if (tTd(38, 2))
! 		printf("map_init(%s:%s, %d)\n",
  			map->map_class->map_cname == NULL ? "NULL" :
  				map->map_class->map_cname,
! 			map->map_file == NULL ? "NULL" : map->map_file,
! 			rebuild);
  
+ 	if (rebuild == (bitset(MF_ALIAS, map->map_mflags) &&
+ 		    bitset(MCF_REBUILDABLE, map->map_class->map_cflags) ? 1 : 2))
+ 	{
+ 		if (tTd(38, 3))
+ 			printf("\twrong pass\n");
+ 		return;
+ 	}
+ 
  	/* if already open, close it (for nested open) */
  	if (bitset(MF_OPEN, map->map_mflags))
  	{
***************
*** 370,380 ****
  		map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
  	}
  
! 	if (rebuild)
  	{
! 		if (bitset(MF_ALIAS, map->map_mflags) &&
! 		    bitset(MCF_REBUILDABLE, map->map_class->map_cflags))
! 			rebuildaliases(map, FALSE);
  	}
  	else
  	{
--- 387,395 ----
  		map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
  	}
  
! 	if (rebuild == 2)
  	{
! 		rebuildaliases(map, FALSE);
  	}
  	else
  	{
***************
*** 381,387 ****
  		if (map->map_class->map_open(map, O_RDONLY))
  		{
  			if (tTd(38, 4))
! 				printf("%s:%s: valid\n",
  					map->map_class->map_cname == NULL ? "NULL" :
  						map->map_class->map_cname,
  					map->map_file == NULL ? "NULL" :
--- 396,402 ----
  		if (map->map_class->map_open(map, O_RDONLY))
  		{
  			if (tTd(38, 4))
! 				printf("\t%s:%s: valid\n",
  					map->map_class->map_cname == NULL ? "NULL" :
  						map->map_class->map_cname,
  					map->map_file == NULL ? "NULL" :
***************
*** 389,395 ****
  			map->map_mflags |= MF_OPEN;
  		}
  		else if (tTd(38, 4))
! 			printf("%s:%s: invalid: %s\n",
  				map->map_class->map_cname == NULL ? "NULL" :
  					map->map_class->map_cname,
  				map->map_file == NULL ? "NULL" :
--- 404,410 ----
  			map->map_mflags |= MF_OPEN;
  		}
  		else if (tTd(38, 4))
! 			printf("\t%s:%s: invalid: %s\n",
  				map->map_class->map_cname == NULL ? "NULL" :
  					map->map_class->map_cname,
  				map->map_file == NULL ? "NULL" :
***************
*** 434,442 ****
  		return FALSE;
  	}
  	map->map_db1 = (void *) dbm;
! 	if (mode == O_RDONLY && bitset(MF_ALIAS, map->map_mflags))
! 		if (!aliaswait(map, ".pag", TRUE))
  			return FALSE;
  	if (fstat(dbm_dirfno((DBM *) map->map_db1), &st) >= 0)
  		map->map_mtime = st.st_mtime;
  	return TRUE;
--- 449,470 ----
  		return FALSE;
  	}
  	map->map_db1 = (void *) dbm;
! 	if (mode == O_RDONLY)
! 	{
! 		if (bitset(MF_ALIAS, map->map_mflags) &&
! 		    !aliaswait(map, ".pag", TRUE))
  			return FALSE;
+ 	}
+ 	else
+ 	{
+ 		int fd;
+ 
+ 		/* exclusive lock for duration of rebuild */
+ 		fd = dbm_dirfno((DBM *) map->map_db1);
+ 		if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags) &&
+ 		    lockfile(fd, map->map_file, ".dir", LOCK_EX))
+ 			map->map_mflags |= MF_LOCKED;
+ 	}
  	if (fstat(dbm_dirfno((DBM *) map->map_db1), &st) >= 0)
  		map->map_mtime = st.st_mtime;
  	return TRUE;
***************
*** 559,565 ****
  		(void) sprintf(buf, "%010ld", curtime());
  		ndbm_map_store(map, "YP_LAST_MODIFIED", buf);
  
! 		(void) myhostname(buf, sizeof buf);
  		ndbm_map_store(map, "YP_MASTER_NAME", buf);
  
  		if (inclnull)
--- 587,593 ----
  		(void) sprintf(buf, "%010ld", curtime());
  		ndbm_map_store(map, "YP_LAST_MODIFIED", buf);
  
! 		(void) gethostname(buf, sizeof buf);
  		ndbm_map_store(map, "YP_MASTER_NAME", buf);
  
  		if (inclnull)
***************
*** 1237,1242 ****
--- 1265,1273 ----
  #if defined(NEWDB) || defined(NDBM)
  	if (Verbose)
  		message("WARNING: cannot open alias database %s", map->map_file);
+ #else
+ 	if (mode != O_RDONLY)
+ 		usrerr("Cannot rebuild aliases: no database format defined");
  #endif
  
  	return stab_map_open(map, mode);
*** src/mci.c.OLD	Sun Nov  7 15:01:11 1993
--- src/mci.c	Wed Dec  1 14:01:45 1993
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)mci.c	8.6 (Berkeley) 10/23/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)mci.c	8.9 (Berkeley) 12/1/93";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 275,280 ****
--- 275,282 ----
  	bzero(&CurHostAddr, sizeof CurHostAddr);
  #endif
  
+ 	if (m->m_mno < 0)
+ 		syserr("negative mno %d (%s)", m->m_mno, m->m_name);
  	s = stab(host, ST_MCI + m->m_mno, ST_ENTER);
  	mci = &s->s_mci;
  	mci->mci_host = s->s_name;
***************
*** 348,354 ****
  		ctime(&mci->mci_lastuse));
  printit:
  	if (logit)
! 		syslog(LOG_INFO, "%s", buf);
  	else
  		printf("%s\n", buf);
  }
--- 350,356 ----
  		ctime(&mci->mci_lastuse));
  printit:
  	if (logit)
! 		syslog(LOG_DEBUG, "%s", buf);
  	else
  		printf("%s\n", buf);
  }
***************
*** 367,372 ****
--- 369,377 ----
  	bool logit;
  {
  	register int i;
+ 
+ 	if (MciCache == NULL)
+ 		return;
  
  	for (i = 0; i < MaxMciCache; i++)
  		mci_dump(MciCache[i], logit);
*** src/parseaddr.c.OLD	Sun Nov 14 10:30:10 1993
--- src/parseaddr.c	Wed Jan  5 09:20:14 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)parseaddr.c	8.17 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)parseaddr.c	8.29 (Berkeley) 1/5/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 103,109 ****
  	if (delimptr == NULL)
  		delimptr = &delimptrbuf;
  
! 	pvp = prescan(addr, delim, pvpbuf, delimptr);
  	if (pvp == NULL)
  	{
  		if (tTd(20, 1))
--- 103,109 ----
  	if (delimptr == NULL)
  		delimptr = &delimptrbuf;
  
! 	pvp = prescan(addr, delim, pvpbuf, sizeof pvpbuf, delimptr);
  	if (pvp == NULL)
  	{
  		if (tTd(20, 1))
***************
*** 143,151 ****
  	*/
  
  	queueup = FALSE;
! 	if (rewrite(pvp, 3, e) == EX_TEMPFAIL)
  		queueup = TRUE;
! 	if (rewrite(pvp, 0, e) == EX_TEMPFAIL)
  		queueup = TRUE;
  
  
--- 143,151 ----
  	*/
  
  	queueup = FALSE;
! 	if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
  		queueup = TRUE;
! 	if (rewrite(pvp, 0, 0, e) == EX_TEMPFAIL)
  		queueup = TRUE;
  
  
***************
*** 308,313 ****
--- 308,314 ----
  **			If '\t' then we are reading the .cf file.
  **		pvpbuf -- place to put the saved text -- note that
  **			the pointers are static.
+ **		pvpbsize -- size of pvpbuf.
  **		delimptr -- if non-NULL, set to the location of the
  **			terminating delimiter.
  **
***************
*** 341,350 ****
  	/*ONE*/		OPR,	OPR,	OPR,	OPR,	OPR,
  };
  
  # define NOCHAR		-1	/* signal nothing in lookahead token */
  
  char **
! prescan(addr, delim, pvpbuf, delimptr)
  	char *addr;
  	char delim;
  	char pvpbuf[];
--- 342,375 ----
  	/*ONE*/		OPR,	OPR,	OPR,	OPR,	OPR,
  };
  
+ /* token type table -- it gets modified with $o characters */
+ static TokTypeTab[256] =
+ {
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,SPC,SPC,SPC,SPC,SPC,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	SPC,ATM,QST,ATM,ATM,ATM,ATM,ATM,ATM,SPC,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	OPR,OPR,ONE,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,
+ 	OPR,OPR,OPR,ONE,ONE,ONE,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ 	ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
+ };
+ 
+ #define toktype(c)	((int) TokTypeTab[(c) & 0xff])
+ 
+ 
  # define NOCHAR		-1	/* signal nothing in lookahead token */
  
  char **
! prescan(addr, delim, pvpbuf, pvpbsize, delimptr)
  	char *addr;
  	char delim;
  	char pvpbuf[];
***************
*** 362,369 ****
--- 387,410 ----
  	int newstate;
  	char *saveto = CurEnv->e_to;
  	static char *av[MAXATOM+1];
+ 	static char firsttime = TRUE;
  	extern int errno;
  
+ 	if (firsttime)
+ 	{
+ 		/* initialize the token type table */
+ 		char obuf[50];
+ 
+ 		firsttime = FALSE;
+ 		expand("\201o", obuf, &obuf[sizeof obuf - sizeof DELIMCHARS], CurEnv);
+ 		strcat(obuf, DELIMCHARS);
+ 		for (p = obuf; *p != '\0'; p++)
+ 		{
+ 			if (TokTypeTab[*p & 0xff] == ATM)
+ 				TokTypeTab[*p & 0xff] = OPR;
+ 		}
+ 	}
+ 
  	/* make sure error messages don't have garbage on them */
  	errno = 0;
  
***************
*** 393,401 ****
  			if (c != NOCHAR && !bslashmode)
  			{
  				/* see if there is room */
! 				if (q >= &pvpbuf[PSBUFSIZE - 5])
  				{
  					usrerr("553 Address too long");
  					if (delimptr != NULL)
  						*delimptr = p;
  					CurEnv->e_to = saveto;
--- 434,443 ----
  			if (c != NOCHAR && !bslashmode)
  			{
  				/* see if there is room */
! 				if (q >= &pvpbuf[pvpbsize - 5])
  				{
  					usrerr("553 Address too long");
+ 	returnnull:
  					if (delimptr != NULL)
  						*delimptr = p;
  					CurEnv->e_to = saveto;
***************
*** 527,537 ****
  			if (avp >= &av[MAXATOM])
  			{
  				syserr("553 prescan: too many tokens");
! 				if (delimptr != NULL)
! 					*delimptr = p;
! 				CurEnv->e_to = saveto;
! 				return (NULL);
  			}
  			*avp++ = tok;
  		}
  	} while (c != '\0' && (c != delim || anglecnt > 0));
--- 569,581 ----
  			if (avp >= &av[MAXATOM])
  			{
  				syserr("553 prescan: too many tokens");
! 				goto returnnull;
  			}
+ 			if (q - tok > MAXNAME)
+ 			{
+ 				syserr("553 prescan: token too long");
+ 				goto returnnull;
+ 			}
  			*avp++ = tok;
  		}
  	} while (c != '\0' && (c != delim || anglecnt > 0));
***************
*** 546,597 ****
  	}
  	CurEnv->e_to = saveto;
  	if (av[0] == NULL)
  		return (NULL);
  	return (av);
  }
  /*
- **  TOKTYPE -- return token type
- **
- **	Parameters:
- **		c -- the character in question.
- **
- **	Returns:
- **		Its type.
- **
- **	Side Effects:
- **		none.
- */
- 
- toktype(c)
- 	register int c;
- {
- 	static char buf[50];
- 	static bool firstime = TRUE;
- 
- 	if (firstime)
- 	{
- 		firstime = FALSE;
- 		expand("\201o", buf, &buf[sizeof buf - 1], CurEnv);
- 		(void) strcat(buf, DELIMCHARS);
- 	}
- 	c &= 0377;
- 	if (c == MATCHCLASS || c == MATCHREPL || c == MATCHNCLASS)
- 		return (ONE);
- 	if (c == MACRODEXPAND)
- 		return (ONE);
- 	if (c == '"')
- 		return (QST);
- 	if ((c & 0340) == 0200)
- 		return (OPR);
- 	if (!isascii(c))
- 		return (ATM);
- 	if (isspace(c) || c == ')')
- 		return (SPC);
- 	if (strchr(buf, c) != NULL)
- 		return (OPR);
- 	return (ATM);
- }
- /*
  **  REWRITE -- apply rewrite rules to token vector.
  **
  **	This routine is an ordered production system.  Each rewrite
--- 590,603 ----
  	}
  	CurEnv->e_to = saveto;
  	if (av[0] == NULL)
+ 	{
+ 		if (tTd(22, 1))
+ 			printf("prescan: null leading token\n");
  		return (NULL);
+ 	}
  	return (av);
  }
  /*
  **  REWRITE -- apply rewrite rules to token vector.
  **
  **	This routine is an ordered production system.  Each rewrite
***************
*** 616,621 ****
--- 622,628 ----
  **	Parameters:
  **		pvp -- pointer to token vector.
  **		ruleset -- the ruleset to use for rewriting.
+ **		reclevel -- recursion level (to catch loops).
  **		e -- the current envelope.
  **
  **	Returns:
***************
*** 635,645 ****
  
  # define MAXMATCH	9	/* max params per rewrite */
  
  
  int
! rewrite(pvp, ruleset, e)
  	char **pvp;
  	int ruleset;
  	register ENVELOPE *e;
  {
  	register char *ap;		/* address pointer */
--- 642,657 ----
  
  # define MAXMATCH	9	/* max params per rewrite */
  
+ # ifndef MAXRULERECURSION
+ #  define MAXRULERECURSION	50	/* max recursion depth */
+ # endif
  
+ 
  int
! rewrite(pvp, ruleset, reclevel, e)
  	char **pvp;
  	int ruleset;
+ 	int reclevel;
  	register ENVELOPE *e;
  {
  	register char *ap;		/* address pointer */
***************
*** 664,669 ****
--- 676,686 ----
  		syserr("554 rewrite: illegal ruleset number %d", ruleset);
  		return EX_CONFIG;
  	}
+ 	if (reclevel++ > MAXRULERECURSION)
+ 	{
+ 		syserr("rewrite: infinite recursion, ruleset %d", ruleset);
+ 		return EX_CONFIG;
+ 	}
  	if (pvp == NULL)
  		return EX_USAGE;
  
***************
*** 1124,1130 ****
  			else
  			{
  				/* scan the new replacement */
! 				xpvp = prescan(replac, '\0', pvpbuf, NULL);
  				if (xpvp == NULL)
  				{
  					/* prescan already printed error */
--- 1141,1148 ----
  			else
  			{
  				/* scan the new replacement */
! 				xpvp = prescan(replac, '\0', pvpbuf,
! 					       sizeof pvpbuf, NULL);
  				if (xpvp == NULL)
  				{
  					/* prescan already printed error */
***************
*** 1156,1170 ****
  		{
  			int stat;
  
! 			bcopy((char *) &npvp[2], (char *) pvp,
! 				(int) (avp - npvp - 2) * sizeof *avp);
! 			if (tTd(21, 3))
! 				printf("-----callsubr %s\n", npvp[1]);
! 			stat = rewrite(pvp, atoi(npvp[1]), e);
! 			if (rstat == EX_OK || stat == EX_TEMPFAIL)
! 				rstat = stat;
! 			if ((**pvp & 0377) == CANONNET)
  				rwr = NULL;
  		}
  		else
  		{
--- 1174,1197 ----
  		{
  			int stat;
  
! 			if (npvp[1] == NULL)
! 			{
! 				syserr("parseaddr: NULL subroutine call in ruleset %d, rule %d",
! 					ruleset, ruleno);
! 				*pvp = NULL;
! 			}
! 			else
! 			{
! 				bcopy((char *) &npvp[2], (char *) pvp,
! 					(int) (avp - npvp - 2) * sizeof *avp);
! 				if (tTd(21, 3))
! 					printf("-----callsubr %s\n", npvp[1]);
! 				stat = rewrite(pvp, atoi(npvp[1]), reclevel, e);
! 				if (rstat == EX_OK || stat == EX_TEMPFAIL)
! 					rstat = stat;
! 				if (*pvp != NULL && (**pvp & 0377) == CANONNET)
  				rwr = NULL;
+ 			}
  		}
  		else
  		{
***************
*** 1285,1290 ****
--- 1312,1319 ----
  			}
  			tv++;
  		}
+ 		else
+ 			setstat(EX_UNAVAILABLE);
  		if ((**tv & 0377) != CANONUSER)
  			syserr("554 buildaddr: error: no user");
  		cataddr(++tv, NULL, buf, sizeof buf, ' ');
***************
*** 1402,1412 ****
  	if (!bitset(RF_SENDERADDR|RF_HEADERADDR, flags))
  	{
  		/* sender addresses done later */
! 		(void) rewrite(tv, 2, e);
  		if (m->m_re_rwset > 0)
! 		       (void) rewrite(tv, m->m_re_rwset, e);
  	}
! 	(void) rewrite(tv, 4, e);
  
  	/* save the result for the command line/RCPT argument */
  	cataddr(tv, NULL, buf, sizeof buf, '\0');
--- 1431,1441 ----
  	if (!bitset(RF_SENDERADDR|RF_HEADERADDR, flags))
  	{
  		/* sender addresses done later */
! 		(void) rewrite(tv, 2, 0, e);
  		if (m->m_re_rwset > 0)
! 		       (void) rewrite(tv, m->m_re_rwset, 0, e);
  	}
! 	(void) rewrite(tv, 4, 0, e);
  
  	/* save the result for the command line/RCPT argument */
  	cataddr(tv, NULL, buf, sizeof buf, '\0');
***************
*** 1500,1505 ****
--- 1529,1536 ----
  	register ADDRESS *a;
  	register ADDRESS *b;
  {
+ 	register ADDRESS *ca, *cb;
+ 
  	/* if they don't have the same mailer, forget it */
  	if (a->q_mailer != b->q_mailer)
  		return (FALSE);
***************
*** 1508,1516 ****
  	if (strcmp(a->q_user, b->q_user) != 0)
  		return (FALSE);
  
! 	/* if we have good uids for both but the differ, these are different */
! 	if (bitset(QGOODUID, a->q_flags & b->q_flags) && a->q_uid != b->q_uid)
! 		return (FALSE);
  
  	/* otherwise compare hosts (but be careful for NULL ptrs) */
  	if (a->q_host == b->q_host)
--- 1539,1554 ----
  	if (strcmp(a->q_user, b->q_user) != 0)
  		return (FALSE);
  
! 	/* if we have good uids for both but they differ, these are different */
! 	if (a->q_mailer == ProgMailer)
! 	{
! 		ca = getctladdr(a);
! 		cb = getctladdr(b);
! 		if (ca != NULL && cb != NULL &&
! 		    bitset(QGOODUID, ca->q_flags & cb->q_flags) &&
! 		    ca->q_uid != cb->q_uid)
! 			return (FALSE);
! 	}
  
  	/* otherwise compare hosts (but be careful for NULL ptrs) */
  	if (a->q_host == b->q_host)
***************
*** 1655,1664 ****
  	**	domain will be appended.
  	*/
  
! 	pvp = prescan(name, '\0', pvpbuf, NULL);
  	if (pvp == NULL)
  		return (name);
! 	if (rewrite(pvp, 3, e) == EX_TEMPFAIL)
  		*pstat = EX_TEMPFAIL;
  	if (bitset(RF_ADDDOMAIN, flags) && e->e_fromdomain != NULL)
  	{
--- 1693,1702 ----
  	**	domain will be appended.
  	*/
  
! 	pvp = prescan(name, '\0', pvpbuf, sizeof pvpbuf, NULL);
  	if (pvp == NULL)
  		return (name);
! 	if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
  		*pstat = EX_TEMPFAIL;
  	if (bitset(RF_ADDDOMAIN, flags) && e->e_fromdomain != NULL)
  	{
***************
*** 1675,1681 ****
  
  			while ((*pxp++ = *qxq++) != NULL)
  				continue;
! 			if (rewrite(pvp, 3, e) == EX_TEMPFAIL)
  				*pstat = EX_TEMPFAIL;
  		}
  	}
--- 1713,1719 ----
  
  			while ((*pxp++ = *qxq++) != NULL)
  				continue;
! 			if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
  				*pstat = EX_TEMPFAIL;
  		}
  	}
***************
*** 1689,1705 ****
  
  	if (bitset(RF_SENDERADDR, flags))
  	{
! 		if (rewrite(pvp, 1, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  	else
  	{
! 		if (rewrite(pvp, 2, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  	if (rwset > 0)
  	{
! 		if (rewrite(pvp, rwset, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  
--- 1727,1743 ----
  
  	if (bitset(RF_SENDERADDR, flags))
  	{
! 		if (rewrite(pvp, 1, 0, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  	else
  	{
! 		if (rewrite(pvp, 2, 0, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  	if (rwset > 0)
  	{
! 		if (rewrite(pvp, rwset, 0, e) == EX_TEMPFAIL)
  			*pstat = EX_TEMPFAIL;
  	}
  
***************
*** 1710,1716 ****
  	**	may be used as a default to the above rules.
  	*/
  
! 	if (rewrite(pvp, 4, e) == EX_TEMPFAIL)
  		*pstat = EX_TEMPFAIL;
  
  	/*
--- 1748,1754 ----
  	**	may be used as a default to the above rules.
  	*/
  
! 	if (rewrite(pvp, 4, 0, e) == EX_TEMPFAIL)
  		*pstat = EX_TEMPFAIL;
  
  	/*
***************
*** 1719,1725 ****
  
  	cataddr(pvp, NULL, lbuf, sizeof lbuf, '\0');
  	define('g', lbuf, e);
! 	expand(fancy, buf, &buf[sizeof buf - 1], e);
  	define('g', oldg, e);
  
  	if (tTd(12, 1))
--- 1757,1769 ----
  
  	cataddr(pvp, NULL, lbuf, sizeof lbuf, '\0');
  	define('g', lbuf, e);
! 
! 	/* need to make sure route-addrs have <angle brackets> */
! 	if (bitset(RF_CANONICAL, flags) && lbuf[0] == '@')
! 		expand("<\201g>", buf, &buf[sizeof buf - 1], e);
! 	else
! 		expand(fancy, buf, &buf[sizeof buf - 1], e);
! 
  	define('g', oldg, e);
  
  	if (tTd(12, 1))
***************
*** 1753,1763 ****
  		printf("maplocaluser: ");
  		printaddr(a, FALSE);
  	}
! 	pvp = prescan(a->q_user, '\0', pvpbuf, &delimptr);
  	if (pvp == NULL)
  		return;
  
! 	(void) rewrite(pvp, 5, e);
  	if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
  		return;
  
--- 1797,1807 ----
  		printf("maplocaluser: ");
  		printaddr(a, FALSE);
  	}
! 	pvp = prescan(a->q_user, '\0', pvpbuf, sizeof pvpbuf, &delimptr);
  	if (pvp == NULL)
  		return;
  
! 	(void) rewrite(pvp, 5, 0, e);
  	if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
  		return;
  
*** src/queue.c.OLD	Thu Nov 11 17:58:27 1993
--- src/queue.c	Sun Jan  9 09:22:40 1994
***************
*** 36,44 ****
  
  #ifndef lint
  #ifdef QUEUE
! static char sccsid[] = "@(#)queue.c	8.27 (Berkeley) 10/29/93 (with queueing)";
  #else
! static char sccsid[] = "@(#)queue.c	8.27 (Berkeley) 10/29/93 (without queueing)";
  #endif
  #endif /* not lint */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef QUEUE
! static char sccsid[] = "@(#)queue.c	8.36 (Berkeley) 1/9/94 (with queueing)";
  #else
! static char sccsid[] = "@(#)queue.c	8.36 (Berkeley) 1/9/94 (without queueing)";
  #endif
  #endif /* not lint */
  
***************
*** 121,142 ****
  					break;
  #ifdef LOG
  				if (LogLevel > 0 && (i % 32) == 0)
! 					syslog(LOG_ALERT, "queueup: cannot create %s: %s",
! 						tf, errstring(errno));
  #endif
- 				continue;
  			}
! 
! 			if (lockfile(fd, tf, NULL, LOCK_EX|LOCK_NB))
! 				break;
  #ifdef LOG
! 			else if (LogLevel > 0 && (i % 32) == 0)
! 				syslog(LOG_ALERT, "queueup: cannot lock %s: %s",
! 					tf, errstring(errno));
  #endif
  
- 			close(fd);
- 
  			if ((i % 32) == 31)
  			{
  				/* save the old temp file away */
--- 121,142 ----
  					break;
  #ifdef LOG
  				if (LogLevel > 0 && (i % 32) == 0)
! 					syslog(LOG_ALERT, "queueup: cannot create %s, uid=%d: %s",
! 						tf, geteuid(), errstring(errno));
  #endif
  			}
! 			else
! 			{
! 				if (lockfile(fd, tf, NULL, LOCK_EX|LOCK_NB))
! 					break;
  #ifdef LOG
! 				else if (LogLevel > 0 && (i % 32) == 0)
! 					syslog(LOG_ALERT, "queueup: cannot lock %s: %s",
! 						tf, errstring(errno));
  #endif
+ 				close(fd);
+ 			}
  
  			if ((i % 32) == 31)
  			{
  				/* save the old temp file away */
***************
*** 146,152 ****
  				sleep(i % 32);
  		}
  		if (fd < 0 || (tfp = fdopen(fd, "w")) == NULL)
! 			syserr("!queueup: cannot create queue temp file %s", tf);
  	}
  
  	if (tTd(40, 1))
--- 146,156 ----
  				sleep(i % 32);
  		}
  		if (fd < 0 || (tfp = fdopen(fd, "w")) == NULL)
! 		{
! 			printopenfds(TRUE);
! 			syserr("!queueup: cannot create queue temp file %s, uid=%d",
! 				tf, geteuid());
! 		}
  	}
  
  	if (tTd(40, 1))
***************
*** 176,183 ****
  		e->e_df = newstr(e->e_df);
  		fd = open(e->e_df, O_WRONLY|O_CREAT, FileMode);
  		if (fd < 0 || (dfp = fdopen(fd, "w")) == NULL)
! 			syserr("!queueup: cannot create data temp file %s",
! 				e->e_df);
  		(*e->e_putbody)(dfp, FileMailer, e, NULL);
  		(void) xfclose(dfp, "queueup dfp", e->e_id);
  		e->e_putbody = putbody;
--- 180,187 ----
  		e->e_df = newstr(e->e_df);
  		fd = open(e->e_df, O_WRONLY|O_CREAT, FileMode);
  		if (fd < 0 || (dfp = fdopen(fd, "w")) == NULL)
! 			syserr("!queueup: cannot create data temp file %s, uid=%d",
! 				e->e_df, geteuid());
  		(*e->e_putbody)(dfp, FileMailer, e, NULL);
  		(void) xfclose(dfp, "queueup dfp", e->e_id);
  		e->e_putbody = putbody;
***************
*** 272,278 ****
  
  	bzero((char *) &nullmailer, sizeof nullmailer);
  	nullmailer.m_re_rwset = nullmailer.m_rh_rwset =
! 			nullmailer.m_se_rwset = nullmailer.m_sh_rwset = 0;
  	nullmailer.m_eol = "\n";
  
  	define('g', "\201f", e);
--- 276,282 ----
  
  	bzero((char *) &nullmailer, sizeof nullmailer);
  	nullmailer.m_re_rwset = nullmailer.m_rh_rwset =
! 			nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1;
  	nullmailer.m_eol = "\n";
  
  	define('g', "\201f", e);
***************
*** 288,293 ****
--- 292,305 ----
  		if (bitset(H_RESENT, h->h_flags) && !bitset(EF_RESENT, e->e_flags))
  			continue;
  
+ 		/* expand macros; if null, don't output header at all */
+ 		if (bitset(H_DEFAULT, h->h_flags))
+ 		{
+ 			(void) expand(h->h_value, buf, &buf[sizeof buf], e);
+ 			if (buf[0] == '\0')
+ 				continue;
+ 		}
+ 
  		/* output this header */
  		fprintf(tfp, "H");
  
***************
*** 306,312 ****
  		/* output the header: expand macros, convert addresses */
  		if (bitset(H_DEFAULT, h->h_flags))
  		{
- 			(void) expand(h->h_value, buf, &buf[sizeof buf], e);
  			fprintf(tfp, "%s: %s\n", h->h_field, buf);
  		}
  		else if (bitset(H_FROM|H_RCPT, h->h_flags))
--- 318,323 ----
***************
*** 345,351 ****
  		/* rename (locked) tf to be (locked) qf */
  		qf = queuename(e, 'q');
  		if (rename(tf, qf) < 0)
! 			syserr("cannot rename(%s, %s), df=%s", tf, qf, e->e_df);
  
  		/* close and unlock old (locked) qf */
  		if (e->e_lockfp != NULL)
--- 356,363 ----
  		/* rename (locked) tf to be (locked) qf */
  		qf = queuename(e, 'q');
  		if (rename(tf, qf) < 0)
! 			syserr("cannot rename(%s, %s), df=%s, uid=%d",
! 				tf, qf, e->e_df, geteuid());
  
  		/* close and unlock old (locked) qf */
  		if (e->e_lockfp != NULL)
***************
*** 461,477 ****
  	if (forkflag)
  	{
  		int pid;
  
  		pid = dofork();
  		if (pid != 0)
  		{
- 			extern void reapchild();
- 
  			/* parent -- pick up intermediate zombie */
  #ifndef SIGCHLD
  			(void) waitfor(pid);
- #else /* SIGCHLD */
- 			(void) setsignal(SIGCHLD, reapchild);
  #endif /* SIGCHLD */
  			if (QueueIntvl != 0)
  				(void) setevent(QueueIntvl, runqueue, TRUE);
--- 473,490 ----
  	if (forkflag)
  	{
  		int pid;
+ #ifdef SIGCHLD
+ 		extern void reapchild();
  
+ 		(void) setsignal(SIGCHLD, reapchild);
+ #endif
+ 
  		pid = dofork();
  		if (pid != 0)
  		{
  			/* parent -- pick up intermediate zombie */
  #ifndef SIGCHLD
  			(void) waitfor(pid);
  #endif /* SIGCHLD */
  			if (QueueIntvl != 0)
  				(void) setevent(QueueIntvl, runqueue, TRUE);
***************
*** 850,855 ****
--- 863,873 ----
  			syserr("dowork: cannot fork");
  			return 0;
  		}
+ 		else if (pid > 0)
+ 		{
+ 			/* parent -- clean out connection cache */
+ 			mci_flush(FALSE, NULL);
+ 		}
  	}
  	else
  	{
***************
*** 888,894 ****
  		e->e_header = NULL;
  
  		/* read the queue control file -- return if locked */
! 		if (!readqf(e, !requeueflag))
  		{
  			if (tTd(40, 4))
  				printf("readqf(%s) failed\n", e->e_id);
--- 906,912 ----
  		e->e_header = NULL;
  
  		/* read the queue control file -- return if locked */
! 		if (!readqf(e))
  		{
  			if (tTd(40, 4))
  				printf("readqf(%s) failed\n", e->e_id);
***************
*** 921,928 ****
  **
  **	Parameters:
  **		e -- the envelope of the job to run.
- **		announcefile -- if set, announce the name of the queue
- **			file in error messages.
  **
  **	Returns:
  **		TRUE if it successfully read the queue file.
--- 939,944 ----
***************
*** 933,941 ****
  */
  
  bool
! readqf(e, announcefile)
  	register ENVELOPE *e;
- 	bool announcefile;
  {
  	register FILE *qfp;
  	ADDRESS *ctladdr;
--- 949,956 ----
  */
  
  bool
! readqf(e)
  	register ENVELOPE *e;
  {
  	register FILE *qfp;
  	ADDRESS *ctladdr;
***************
*** 1031,1039 ****
  
  	/* do basic system initialization */
  	initsys(e);
  
- 	if (announcefile)
- 		FileName = qf;
  	LineNumber = 0;
  	e->e_flags |= EF_GLOBALERRS;
  	OpMode = MD_DELIVER;
--- 1046,1053 ----
  
  	/* do basic system initialization */
  	initsys(e);
+ 	define('i', e->e_id, e);
  
  	LineNumber = 0;
  	e->e_flags |= EF_GLOBALERRS;
  	OpMode = MD_DELIVER;
***************
*** 1121,1128 ****
  			break;
  
  		  default:
! 			syserr("readqf: bad line \"%s\"", e->e_id,
! 				LineNumber, bp);
  			fclose(qfp);
  			rename(qf, queuename(e, 'Q'));
  			return FALSE;
--- 1135,1142 ----
  			break;
  
  		  default:
! 			syserr("readqf: %s: line %s: bad line \"%s\"",
! 				qf, LineNumber, bp);
  			fclose(qfp);
  			rename(qf, queuename(e, 'Q'));
  			return FALSE;
***************
*** 1131,1138 ****
  		if (bp != buf)
  			free(bp);
  	}
- 
- 	FileName = NULL;
  
  	/*
  	**  If we haven't read any lines, this queue file is empty.
--- 1145,1150 ----
*** src/readcf.c.OLD	Sun Nov 14 10:16:20 1993
--- src/readcf.c	Sun Jan  9 09:00:09 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)readcf.c	8.14 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)readcf.c	8.18 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 109,115 ****
  	extern char **copyplist();
  	struct stat statb;
  	char exbuf[MAXLINE];
! 	char pvpbuf[PSBUFSIZE];
  	extern char *munchstring();
  	extern void makemapentry();
  
--- 109,115 ----
  	extern char **copyplist();
  	struct stat statb;
  	char exbuf[MAXLINE];
! 	char pvpbuf[MAXLINE + MAXATOM];
  	extern char *munchstring();
  	extern void makemapentry();
  
***************
*** 241,247 ****
  			/* expand and save the LHS */
  			*p = '\0';
  			expand(&bp[1], exbuf, &exbuf[sizeof exbuf], e);
! 			rwp->r_lhs = prescan(exbuf, '\t', pvpbuf, NULL);
  			nfuzzy = 0;
  			if (rwp->r_lhs != NULL)
  			{
--- 241,248 ----
  			/* expand and save the LHS */
  			*p = '\0';
  			expand(&bp[1], exbuf, &exbuf[sizeof exbuf], e);
! 			rwp->r_lhs = prescan(exbuf, '\t', pvpbuf,
! 					     sizeof pvpbuf, NULL);
  			nfuzzy = 0;
  			if (rwp->r_lhs != NULL)
  			{
***************
*** 325,331 ****
  				p++;
  			*p = '\0';
  			expand(q, exbuf, &exbuf[sizeof exbuf], e);
! 			rwp->r_rhs = prescan(exbuf, '\t', pvpbuf, NULL);
  			if (rwp->r_rhs != NULL)
  			{
  				register char **ap;
--- 326,333 ----
  				p++;
  			*p = '\0';
  			expand(q, exbuf, &exbuf[sizeof exbuf], e);
! 			rwp->r_rhs = prescan(exbuf, '\t', pvpbuf,
! 					     sizeof pvpbuf, NULL);
  			if (rwp->r_rhs != NULL)
  			{
  				register char **ap;
***************
*** 540,547 ****
--- 542,551 ----
  	{
  		/* user didn't initialize: set up host map */
  		strcpy(buf, "host host");
+ #ifdef NAMED_BIND
  		if (ConfigLevel >= 2)
  			strcat(buf, " -a.");
+ #endif
  		makemapentry(buf);
  	}
  }
***************
*** 1020,1025 ****
--- 1024,1030 ----
  	"defnames",	RES_DEFNAMES,
  	"stayopen",	RES_STAYOPEN,
  	"dnsrch",	RES_DNSRCH,
+ 	"true",		0,		/* to avoid error on old syntax */
  	NULL,		0
  };
  
***************
*** 1239,1245 ****
  				if (strcasecmp(q, rfp->rf_name) == 0)
  					break;
  			}
! 			if (clearmode)
  				_res.options &= ~rfp->rf_bits;
  			else
  				_res.options |= rfp->rf_bits;
--- 1244,1252 ----
  				if (strcasecmp(q, rfp->rf_name) == 0)
  					break;
  			}
! 			if (rfp->rf_name == NULL)
! 				syserr("readcf: I option value %s unrecognized", q);
! 			else if (clearmode)
  				_res.options &= ~rfp->rf_bits;
  			else
  				_res.options |= rfp->rf_bits;
*** src/recipient.c.OLD	Thu Nov  4 06:57:11 1993
--- src/recipient.c	Mon Jan 10 08:57:26 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)recipient.c	8.21 (Berkeley) 10/29/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)recipient.c	8.39 (Berkeley) 1/10/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 222,231 ****
  	stripquotes(buf);
  
  	/* check for direct mailing to restricted mailers */
! 	if (a->q_alias == NULL && m == ProgMailer)
  	{
! 		a->q_flags |= QBADADDR;
! 		usrerr("550 Cannot mail directly to programs");
  	}
  
  	/*
--- 222,246 ----
  	stripquotes(buf);
  
  	/* check for direct mailing to restricted mailers */
! 	if (m == ProgMailer)
  	{
! 		if (a->q_alias == NULL)
! 		{
! 			a->q_flags |= QBADADDR;
! 			usrerr("550 Cannot mail directly to programs");
! 		}
! 		else if (bitset(QBOGUSSHELL, a->q_alias->q_flags))
! 		{
! 			a->q_flags |= QBADADDR;
! 			usrerr("550 User %s@%s doesn't have a valid shell for mailing to programs",
! 				a->q_alias->q_ruser, MyHostName);
! 		}
! 		else if (bitset(QUNSAFEADDR, a->q_alias->q_flags))
! 		{
! 			a->q_flags |= QBADADDR;
! 			usrerr("550 Address %s is unsafe for mailing to programs",
! 				a->q_alias->q_paddr);
! 		}
  	}
  
  	/*
***************
*** 252,257 ****
--- 267,274 ----
  					message("duplicate suppressed");
  				q->q_flags |= a->q_flags;
  			}
+ 			else if (bitset(QSELFREF, q->q_flags))
+ 				q->q_flags |= a->q_flags & ~QDONTSEND;
  			a = q;
  			goto testselfdestruct;
  		}
***************
*** 294,299 ****
--- 311,317 ----
  						e->e_id, a->q_user, errstring(ret));
  #endif
  				a->q_flags |= QQUEUEUP;
+ 				a->q_flags &= ~QDONTSEND;
  				usrerr("451 Cannot open %s: %s",
  					a->q_user, errstring(ret));
  			}
***************
*** 307,316 ****
  	}
  	else if (m == FileMailer)
  	{
- 		struct stat stb;
  		extern bool writable();
  
- 		p = strrchr(buf, '/');
  		/* check if writable or creatable */
  		if (a->q_alias == NULL)
  		{
--- 325,332 ----
***************
*** 317,326 ****
  			a->q_flags |= QBADADDR;
  			usrerr("550 Cannot mail directly to files");
  		}
! 		else if ((stat(buf, &stb) >= 0) ? (!writable(&stb)) :
! 		    (*p = '\0', safefile(buf, RealUid, RealGid, NULL, TRUE, S_IWRITE|S_IEXEC) != 0))
  		{
  			a->q_flags |= QBADADDR;
  			giveresponse(EX_CANTCREAT, m, NULL, a->q_alias, e);
  		}
  	}
--- 333,353 ----
  			a->q_flags |= QBADADDR;
  			usrerr("550 Cannot mail directly to files");
  		}
! 		else if (bitset(QBOGUSSHELL, a->q_alias->q_flags))
  		{
  			a->q_flags |= QBADADDR;
+ 			usrerr("550 User %s@%s doesn't have a valid shell for mailing to files",
+ 				a->q_alias->q_ruser, MyHostName);
+ 		}
+ 		else if (bitset(QUNSAFEADDR, a->q_alias->q_flags))
+ 		{
+ 			a->q_flags |= QBADADDR;
+ 			usrerr("550 Address %s is unsafe for mailing to files",
+ 				a->q_alias->q_paddr);
+ 		}
+ 		else if (!writable(buf, getctladdr(a), SFF_ANYFILE))
+ 		{
+ 			a->q_flags |= QBADADDR;
  			giveresponse(EX_CANTCREAT, m, NULL, a->q_alias, e);
  		}
  	}
***************
*** 340,346 ****
  	if (!bitset(QDONTSEND|QNOTREMOTE|QVERIFIED, a->q_flags))
  	{
  		extern int udbexpand();
- 		extern int errno;
  
  		if (udbexpand(a, sendq, e) == EX_TEMPFAIL)
  		{
--- 367,372 ----
***************
*** 429,434 ****
--- 455,465 ----
  			buildfname(pw->pw_gecos, pw->pw_name, nbuf);
  			if (nbuf[0] != '\0')
  				a->q_fullname = newstr(nbuf);
+ 			if (pw->pw_shell != NULL && pw->pw_shell[0] != '\0' &&
+ 			    !usershellok(pw->pw_shell))
+ 			{
+ 				a->q_flags |= QBOGUSSHELL;
+ 			}
  			if (!quoted)
  				forward(a, sendq, e);
  		}
***************
*** 563,569 ****
  **	not writable.  This is also enforced by mailfile.
  **
  **	Parameters:
! **		s -- pointer to a stat struct for the file.
  **
  **	Returns:
  **		TRUE -- if we will be able to write this file.
--- 594,602 ----
  **	not writable.  This is also enforced by mailfile.
  **
  **	Parameters:
! **		filename -- the file name to check.
! **		ctladdr -- the controlling address for this file.
! **		flags -- SFF_* flags to control the function.
  **
  **	Returns:
  **		TRUE -- if we will be able to write this file.
***************
*** 574,608 ****
  */
  
  bool
! writable(s)
! 	register struct stat *s;
  {
  	uid_t euid;
  	gid_t egid;
  	int bits;
  
! 	if (bitset(0111, s->st_mode))
! 		return (FALSE);
! 	euid = RealUid;
! 	egid = RealGid;
! 	if (geteuid() == 0)
  	{
! 		if (bitset(S_ISUID, s->st_mode))
! 			euid = s->st_uid;
! 		if (bitset(S_ISGID, s->st_mode))
! 			egid = s->st_gid;
  	}
  
  	if (euid == 0)
- 		return (TRUE);
- 	bits = S_IWRITE;
- 	if (euid != s->st_uid)
  	{
! 		bits >>= 3;
! 		if (egid != s->st_gid)
! 			bits >>= 3;
  	}
! 	return ((s->st_mode & bits) != 0);
  }
  /*
  **  INCLUDE -- handle :include: specification.
--- 607,704 ----
  */
  
  bool
! writable(filename, ctladdr, flags)
! 	char *filename;
! 	ADDRESS *ctladdr;
! 	int flags;
  {
  	uid_t euid;
  	gid_t egid;
  	int bits;
+ 	register char *p;
+ 	char *uname;
+ 	struct stat stb;
+ 	extern char RealUserName[];
  
! 	if (tTd(29, 5))
! 		printf("writable(%s, %x)\n", filename, flags);
! 
! #ifdef HASLSTAT
! 	if ((bitset(SFF_NOSLINK, flags) ? lstat(filename, &stb)
! 					: stat(filename, &stb)) < 0)
! #else
! 	if (stat(filename, &stb) < 0)
! #endif
  	{
! 		/* file does not exist -- see if directory is safe */
! 		p = strrchr(filename, '/');
! 		if (p == NULL)
! 		{
! 			errno = ENOTDIR;
! 			return FALSE;
! 		}
! 		*p = '\0';
! 		errno = safefile(filename, RealUid, RealGid, RealUserName,
! 				 SFF_MUSTOWN, S_IWRITE|S_IEXEC);
! 		*p = '/';
! 		return errno == 0;
  	}
  
+ #ifdef SUID_ROOT_FILES_OK
+ 	/* really ought to be passed down -- and not a good idea */
+ 	flags |= SFF_ROOTOK;
+ #endif
+ 
+ 	/*
+ 	**  File does exist -- check that it is writable.
+ 	*/
+ 
+ 	if (bitset(0111, stb.st_mode))
+ 	{
+ 		if (tTd(29, 5))
+ 			printf("failed (mode %o: x bits)\n", stb.st_mode);
+ 		errno = EPERM;
+ 		return (FALSE);
+ 	}
+ 
+ 	if (ctladdr != NULL && geteuid() == 0)
+ 	{
+ 		euid = ctladdr->q_uid;
+ 		egid = ctladdr->q_gid;
+ 		uname = ctladdr->q_user;
+ 	}
+ 	else
+ 	{
+ 		euid = RealUid;
+ 		egid = RealGid;
+ 		uname = RealUserName;
+ 	}
  	if (euid == 0)
  	{
! 		euid = DefUid;
! 		uname = DefUser;
  	}
! 	if (egid == 0)
! 		egid = DefGid;
! 	if (geteuid() == 0)
! 	{
! 		if (bitset(S_ISUID, stb.st_mode) &&
! 		    (stb.st_uid != 0 || bitset(SFF_ROOTOK, flags)))
! 		{
! 			euid = stb.st_uid;
! 			uname = NULL;
! 		}
! 		if (bitset(S_ISGID, stb.st_mode) &&
! 		    (stb.st_gid != 0 || bitset(SFF_ROOTOK, flags)))
! 			egid = stb.st_gid;
! 	}
! 
! 	if (tTd(29, 5))
! 		printf("\teu/gid=%d/%d, st_u/gid=%d/%d\n",
! 			euid, egid, stb.st_uid, stb.st_gid);
! 
! 	errno = safefile(filename, euid, egid, uname, flags, S_IWRITE);
! 	return errno == 0;
  }
  /*
  **  INCLUDE -- handle :include: specification.
***************
*** 628,633 ****
--- 724,733 ----
  static jmp_buf	CtxIncludeTimeout;
  static int	includetimeout();
  
+ #ifndef S_IWOTH
+ # define S_IWOTH	(S_IWRITE >> 6)
+ #endif
+ 
  int
  include(fname, forwarding, ctladdr, sendq, e)
  	char *fname;
***************
*** 647,652 ****
--- 747,754 ----
  	gid_t savedgid, gid;
  	char *uname;
  	int rval = 0;
+ 	int sfflags = forwarding ? SFF_MUSTOWN : SFF_ANYFILE;
+ 	struct stat st;
  	char buf[MAXLINE];
  
  	if (tTd(27, 2))
***************
*** 665,673 ****
  	ca = getctladdr(ctladdr);
  	if (ca == NULL)
  	{
! 		uid = 0;
! 		gid = 0;
! 		uname = NULL;
  		saveduid = -1;
  	}
  	else
--- 767,775 ----
  	ca = getctladdr(ctladdr);
  	if (ca == NULL)
  	{
! 		uid = DefUid;
! 		gid = DefGid;
! 		uname = DefUser;
  		saveduid = -1;
  	}
  	else
***************
*** 699,705 ****
  	{
  		ctladdr->q_flags |= QQUEUEUP;
  		errno = 0;
- 		usrerr("451 open timeout on %s", fname);
  
  		/* return pseudo-error code */
  		rval = EOPENTIMEOUT;
--- 801,806 ----
***************
*** 708,748 ****
  	ev = setevent((time_t) 60, includetimeout, 0);
  
  	/* the input file must be marked safe */
! 	rval = safefile(fname, uid, gid, uname, forwarding, S_IREAD);
  	if (rval != 0)
  	{
  		/* don't use this :include: file */
- 		clrevent(ev);
  		if (tTd(27, 4))
  			printf("include: not safe (uid=%d): %s\n",
  				uid, errstring(rval));
- 		goto resetuid;
  	}
! 
! 	fp = fopen(fname, "r");
! 	if (fp == NULL)
  	{
! 		rval = errno;
! 		if (tTd(27, 4))
! 			printf("include: open: %s\n", errstring(rval));
! 	}
! 	else if (ca == NULL)
! 	{
! 		struct stat st;
! 
! 		if (fstat(fileno(fp), &st) < 0)
  		{
  			rval = errno;
! 			syserr("Cannot fstat %s!", fname);
  		}
- 		else
- 		{
- 			ctladdr->q_uid = st.st_uid;
- 			ctladdr->q_gid = st.st_gid;
- 			ctladdr->q_flags |= QGOODUID;
- 		}
  	}
- 
  	clrevent(ev);
  
  resetuid:
--- 809,832 ----
  	ev = setevent((time_t) 60, includetimeout, 0);
  
  	/* the input file must be marked safe */
! 	rval = safefile(fname, uid, gid, uname, sfflags, S_IREAD);
  	if (rval != 0)
  	{
  		/* don't use this :include: file */
  		if (tTd(27, 4))
  			printf("include: not safe (uid=%d): %s\n",
  				uid, errstring(rval));
  	}
! 	else
  	{
! 		fp = fopen(fname, "r");
! 		if (fp == NULL)
  		{
  			rval = errno;
! 			if (tTd(27, 4))
! 				printf("include: open: %s\n", errstring(rval));
  		}
  	}
  	clrevent(ev);
  
  resetuid:
***************
*** 761,769 ****
--- 845,887 ----
  	if (tTd(27, 9))
  		printf("include: reset uid = %d/%d\n", getuid(), geteuid());
  
+ 	if (rval == EOPENTIMEOUT)
+ 		usrerr("451 open timeout on %s", fname);
+ 
  	if (fp == NULL)
  		return rval;
  
+ 	if (fstat(fileno(fp), &st) < 0)
+ 	{
+ 		rval = errno;
+ 		syserr("Cannot fstat %s!", fname);
+ 		return rval;
+ 	}
+ 
+ 	if (ca == NULL)
+ 	{
+ 		ctladdr->q_uid = st.st_uid;
+ 		ctladdr->q_gid = st.st_gid;
+ 		ctladdr->q_flags |= QGOODUID;
+ 	}
+ 	if (ca != NULL && ca->q_uid == st.st_uid)
+ 	{
+ 		/* optimization -- avoid getpwuid if we already have info */
+ 		ctladdr->q_flags |= ca->q_flags & QBOGUSSHELL;
+ 		ctladdr->q_ruser = ca->q_ruser;
+ 	}
+ 	else
+ 	{
+ 		register struct passwd *pw;
+ 
+ 		pw = getpwuid(st.st_uid);
+ 		if (pw == NULL || !usershellok(pw->pw_shell))
+ 		{
+ 			ctladdr->q_ruser = newstr(pw->pw_name);
+ 			ctladdr->q_flags |= QBOGUSSHELL;
+ 		}
+ 	}
+ 
  	if (bitset(EF_VRFYONLY, e->e_flags))
  	{
  		/* don't do any more now */
***************
*** 772,777 ****
--- 890,908 ----
  		xfclose(fp, "include", fname);
  		return rval;
  	}
+ 
+ 	/*
+ 	** Check to see if some bad guy can write this file
+ 	**
+ 	**	This should really do something clever with group
+ 	**	permissions; currently we just view world writable
+ 	**	as unsafe.  Also, we don't check for writable
+ 	**	directories in the path.  We've got to leave
+ 	**	something for the local sysad to do.
+ 	*/
+ 
+ 	if (bitset(S_IWOTH, st.st_mode))
+ 		ctladdr->q_flags |= QUNSAFEADDR;
  
  	/* read the file -- each line is a comma-separated list. */
  	FileName = fname;
*** src/savemail.c.OLD	Mon Nov 22 11:50:07 1993
--- src/savemail.c	Sat Dec 18 06:25:06 1993
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)savemail.c	8.17 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)savemail.c	8.24 (Berkeley) 12/18/93";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 69,75 ****
--- 69,79 ----
  # define ESM_PANIC	6	/* leave the locked queue/transcript files */
  # define ESM_DONE	7	/* the message is successfully delivered */
  
+ # ifndef _PATH_VARTMP
+ #  define _PATH_VARTMP	"/usr/tmp/"
+ # endif
  
+ 
  savemail(e)
  	register ENVELOPE *e;
  {
***************
*** 82,87 ****
--- 86,92 ----
  	register char *p;
  	extern char *ttypath();
  	typedef int (*fnptr)();
+ 	extern bool writable();
  
  	if (tTd(6, 1))
  	{
***************
*** 374,381 ****
  				break;
  			}
  
! 			fp = dfopen("/usr/tmp/dead.letter",
! 				    O_WRONLY|O_CREAT|O_APPEND, FileMode);
  			if (fp == NULL)
  			{
  				state = ESM_PANIC;
--- 379,392 ----
  				break;
  			}
  
! 			strcpy(buf, _PATH_VARTMP);
! 			strcat(buf, "dead.letter");
! 			if (!writable(buf, NULLADDR, SFF_NOSLINK))
! 			{
! 				state = ESM_PANIC;
! 				break;
! 			}
! 			fp = dfopen(buf, O_WRONLY|O_CREAT|O_APPEND, FileMode);
  			if (fp == NULL)
  			{
  				state = ESM_PANIC;
***************
*** 399,406 ****
  
  		  case ESM_PANIC:
  			/* leave the locked queue & transcript files around */
! 			syserr("554 savemail: cannot save rejected email anywhere");
! 			exit(EX_SOFTWARE);
  		}
  	}
  }
--- 410,416 ----
  
  		  case ESM_PANIC:
  			/* leave the locked queue & transcript files around */
! 			syserr("!554 savemail: cannot save rejected email anywhere");
  		}
  	}
  }
***************
*** 466,471 ****
--- 476,482 ----
  
  	SendBody = sendbody;
  	define('g', e->e_from.q_paddr, e);
+ 	define('u', NULL, e);
  	ee = newenvelope(&errenvelope, e);
  	define('a', "\201b", ee);
  	define('r', "internal", ee);
***************
*** 602,608 ****
  	for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
  		if (bitset(QBADADDR, q->q_flags))
  			break;
! 	if (q == NULL && !bitset(EF_FATALERRS, e->e_parent->e_flags))
  	{
  		putline("    **********************************************",
  			fp, m);
--- 613,620 ----
  	for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
  		if (bitset(QBADADDR, q->q_flags))
  			break;
! 	if (q == NULL &&
! 	    !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags))
  	{
  		putline("    **********************************************",
  			fp, m);
*** src/sendmail.h.OLD	Sun Nov  7 10:37:14 1993
--- src/sendmail.h	Wed Jan  5 08:34:35 1994
***************
*** 31,37 ****
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)sendmail.h	8.26 (Berkeley) 10/31/93
   */
  
  /*
--- 31,37 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)sendmail.h	8.38 (Berkeley) 1/5/94
   */
  
  /*
***************
*** 41,47 ****
  # ifdef _DEFINE
  # define EXTERN
  # ifndef lint
! static char SmailSccsId[] =	"@(#)sendmail.h	8.26		10/31/93";
  # endif
  # else /*  _DEFINE */
  # define EXTERN extern
--- 41,47 ----
  # ifdef _DEFINE
  # define EXTERN
  # ifndef lint
! static char SmailSccsId[] =	"@(#)sendmail.h	8.38		1/5/94";
  # endif
  # else /*  _DEFINE */
  # define EXTERN extern
***************
*** 57,63 ****
  # include <string.h>
  # include <time.h>
  # include <errno.h>
- # include <sys/un.h>
  
  # include "conf.h"
  # include "useful.h"
--- 57,62 ----
***************
*** 69,74 ****
--- 68,76 ----
  # ifdef DAEMON
  # include <sys/socket.h>
  # endif
+ # ifdef NETUNIX
+ # include <sys/un.h>
+ # endif
  # ifdef NETINET
  # include <netinet/in.h>
  # endif
***************
*** 148,153 ****
--- 150,157 ----
  # define QSELFREF	000200	/* this address references itself */
  # define QVERIFIED	000400	/* verified, but not expanded */
  # define QREPORT	001000	/* report this address in return message */
+ # define QBOGUSSHELL	002000	/* this entry has an invalid shell listed */
+ # define QUNSAFEADDR	004000	/* address aquired through an unsafe path */
  
  # define NULLADDR	((ADDRESS *) NULL)
  /*
***************
*** 287,295 ****
  	ADDRESS		*e_sendqueue;	/* list of message recipients */
  	ADDRESS		*e_errorqueue;	/* the queue for error responses */
  	long		e_msgsize;	/* size of the message in bytes */
  	int		e_nrcpts;	/* number of recipients */
  	short		e_class;	/* msg class (priority, junk, etc.) */
- 	short		e_flags;	/* flags, see below */
  	short		e_hopcount;	/* number of times processed */
  	short		e_nsent;	/* number of sends since checkpoint */
  	short		e_sendmode;	/* message send mode */
--- 291,299 ----
  	ADDRESS		*e_sendqueue;	/* list of message recipients */
  	ADDRESS		*e_errorqueue;	/* the queue for error responses */
  	long		e_msgsize;	/* size of the message in bytes */
+ 	long		e_flags;	/* flags, see below */
  	int		e_nrcpts;	/* number of recipients */
  	short		e_class;	/* msg class (priority, junk, etc.) */
  	short		e_hopcount;	/* number of times processed */
  	short		e_nsent;	/* number of sends since checkpoint */
  	short		e_sendmode;	/* message send mode */
***************
*** 314,333 ****
  };
  
  /* values for e_flags */
! #define EF_OLDSTYLE	000001		/* use spaces (not commas) in hdrs */
! #define EF_INQUEUE	000002		/* this message is fully queued */
! #define EF_CLRQUEUE	000010		/* disk copy is no longer needed */
! #define EF_SENDRECEIPT	000020		/* send a return receipt */
! #define EF_FATALERRS	000040		/* fatal errors occured */
! #define EF_KEEPQUEUE	000100		/* keep queue files always */
! #define EF_RESPONSE	000200		/* this is an error or return receipt */
! #define EF_RESENT	000400		/* this message is being forwarded */
! #define EF_VRFYONLY	001000		/* verify only (don't expand aliases) */
! #define EF_WARNING	002000		/* warning message has been sent */
! #define EF_QUEUERUN	004000		/* this envelope is from queue */
! #define EF_GLOBALERRS	010000		/* treat errors as global */
! #define EF_PM_NOTIFY	020000		/* send return mail to postmaster */
! #define EF_METOO	040000		/* send to me too */
  
  EXTERN ENVELOPE	*CurEnv;	/* envelope currently being processed */
  /*
--- 318,338 ----
  };
  
  /* values for e_flags */
! #define EF_OLDSTYLE	0x0000001	/* use spaces (not commas) in hdrs */
! #define EF_INQUEUE	0x0000002	/* this message is fully queued */
! #define EF_CLRQUEUE	0x0000008	/* disk copy is no longer needed */
! #define EF_SENDRECEIPT	0x0000010	/* send a return receipt */
! #define EF_FATALERRS	0x0000020	/* fatal errors occured */
! #define EF_KEEPQUEUE	0x0000040	/* keep queue files always */
! #define EF_RESPONSE	0x0000080	/* this is an error or return receipt */
! #define EF_RESENT	0x0000100	/* this message is being forwarded */
! #define EF_VRFYONLY	0x0000200	/* verify only (don't expand aliases) */
! #define EF_WARNING	0x0000400	/* warning message has been sent */
! #define EF_QUEUERUN	0x0000800	/* this envelope is from queue */
! #define EF_GLOBALERRS	0x0001000	/* treat errors as global */
! #define EF_PM_NOTIFY	0x0002000	/* send return mail to postmaster */
! #define EF_METOO	0x0004000	/* send to me too */
! #define EF_LOGSENDER	0x0008000	/* need to log the sender */
  
  EXTERN ENVELOPE	*CurEnv;	/* envelope currently being processed */
  /*
***************
*** 722,728 ****
--- 727,744 ----
  #define RF_COPYALL		(RF_COPYPARSE|RF_COPYPADDR)
  #define RF_COPYNONE		0
  
+ 
  /*
+ **  Flags passed to safefile.
+ */
+ 
+ #define SFF_ANYFILE		0	/* no special restrictions */
+ #define SFF_MUSTOWN		0x0001	/* user must own this file */
+ #define SFF_NOSLINK		0x0002	/* file cannot be a symbolic link */
+ #define SFF_ROOTOK		0x0004	/* ok for root to own this file */
+ 
+ 
+ /*
  **  Regular UNIX sockaddrs are too small to handle ISO addresses, so
  **  we are forced to declare a supertype here.
  */
***************
*** 730,736 ****
--- 746,754 ----
  union bigsockaddr
  {
  	struct sockaddr		sa;	/* general version */
+ #ifdef NETUNIX
  	struct sockaddr_un	sunix;	/* UNIX family */
+ #endif
  #ifdef NETINET
  	struct sockaddr_in	sin;	/* INET family */
  #endif
***************
*** 804,810 ****
  EXTERN bool	MatchGecos;	/* look for user names in gecos field */
  EXTERN bool	UseErrorsTo;	/* use Errors-To: header (back compat) */
  EXTERN bool	TryNullMXList;	/* if we are the best MX, try host directly */
! EXTERN bool	CheckLoopBack;	/* check for loopback on HELO packet */
  EXTERN bool	InChild;	/* true if running in an SMTP subprocess */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	PrivacyFlags;	/* privacy flags */
--- 822,828 ----
  EXTERN bool	MatchGecos;	/* look for user names in gecos field */
  EXTERN bool	UseErrorsTo;	/* use Errors-To: header (back compat) */
  EXTERN bool	TryNullMXList;	/* if we are the best MX, try host directly */
! extern bool	CheckLoopBack;	/* check for loopback on HELO packet */
  EXTERN bool	InChild;	/* true if running in an SMTP subprocess */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	PrivacyFlags;	/* privacy flags */
***************
*** 825,831 ****
  EXTERN char	*PostMasterCopy;	/* address to get errs cc's */
  EXTERN int	CheckpointInterval;	/* queue file checkpoint interval */
  EXTERN bool	DontPruneRoutes;	/* don't prune source routes */
! EXTERN bool	BrokenSmtpPeers;	/* peers can't handle 2-line greeting */
  EXTERN int	MaxMciCache;		/* maximum entries in MCI cache */
  EXTERN time_t	MciCacheTimeout;	/* maximum idle time on connections */
  EXTERN char	*QueueLimitRecipient;	/* limit queue runs to this recipient */
--- 843,849 ----
  EXTERN char	*PostMasterCopy;	/* address to get errs cc's */
  EXTERN int	CheckpointInterval;	/* queue file checkpoint interval */
  EXTERN bool	DontPruneRoutes;	/* don't prune source routes */
! extern bool	BrokenSmtpPeers;	/* peers can't handle 2-line greeting */
  EXTERN int	MaxMciCache;		/* maximum entries in MCI cache */
  EXTERN time_t	MciCacheTimeout;	/* maximum idle time on connections */
  EXTERN char	*QueueLimitRecipient;	/* limit queue runs to this recipient */
***************
*** 832,837 ****
--- 850,856 ----
  EXTERN char	*QueueLimitSender;	/* limit queue runs to this sender */
  EXTERN char	*QueueLimitId;		/* limit queue runs to this id */
  EXTERN FILE	*TrafficLogFile;	/* file in which to log all traffic */
+ extern int	errno;
  
  
  /*
***************
*** 909,915 ****
  extern void		expand __P((char *, char *, char *, ENVELOPE *));
  extern void		define __P((int, char *, ENVELOPE *));
  extern char		*macvalue __P((int, ENVELOPE *));
! extern char		**prescan __P((char *, int, char[], char **));
  extern char		*fgetfolded __P((char *, int, FILE *));
  extern ADDRESS		*recipient __P((ADDRESS *, ADDRESS **, ENVELOPE *));
  extern ENVELOPE		*newenvelope __P((ENVELOPE *, ENVELOPE *));
--- 928,935 ----
  extern void		expand __P((char *, char *, char *, ENVELOPE *));
  extern void		define __P((int, char *, ENVELOPE *));
  extern char		*macvalue __P((int, ENVELOPE *));
! extern char		**prescan __P((char *, int, char[], int, char **));
! extern int		rewrite __P((char **, int, int, ENVELOPE *));
  extern char		*fgetfolded __P((char *, int, FILE *));
  extern ADDRESS		*recipient __P((ADDRESS *, ADDRESS **, ENVELOPE *));
  extern ENVELOPE		*newenvelope __P((ENVELOPE *, ENVELOPE *));
***************
*** 928,933 ****
--- 948,955 ----
  extern void		openxscript __P((ENVELOPE *));
  extern void		closexscript __P((ENVELOPE *));
  extern sigfunc_t	setsignal __P((int, sigfunc_t));
+ extern char		*shortenstring __P((char *, int));
+ extern bool		usershellok __P((char *));
  
  /* ellipsis is a different case though */
  #ifdef __STDC__
*** src/srvrsmtp.c.OLD	Fri Nov 26 17:21:59 1993
--- src/srvrsmtp.c	Wed Dec 22 05:07:01 1993
***************
*** 36,44 ****
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)srvrsmtp.c	8.18 (Berkeley) 10/28/93 (with SMTP)";
  #else
! static char sccsid[] = "@(#)srvrsmtp.c	8.18 (Berkeley) 10/28/93 (without SMTP)";
  #endif
  #endif /* not lint */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)srvrsmtp.c	8.23 (Berkeley) 12/21/93 (with SMTP)";
  #else
! static char sccsid[] = "@(#)srvrsmtp.c	8.23 (Berkeley) 12/21/93 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 114,119 ****
--- 114,120 ----
  };
  
  bool	OneXact = FALSE;		/* one xaction only this run */
+ char	*CurSmtpClient;			/* who's at the other end of channel */
  
  static char	*skipword();
  
***************
*** 147,153 ****
  	}
  	settime(e);
  	CurHostName = RealHostName;
! 	setproctitle("server %s startup", CurHostName);
  	expand("\201e", inp, &inp[sizeof inp], e);
  	if (BrokenSmtpPeers)
  	{
--- 148,158 ----
  	}
  	settime(e);
  	CurHostName = RealHostName;
! 	CurSmtpClient = macvalue('_', e);
! 	if (CurSmtpClient == NULL)
! 		CurSmtpClient = RealHostName;
! 
! 	setproctitle("server %s startup", CurSmtpClient);
  	expand("\201e", inp, &inp[sizeof inp], e);
  	if (BrokenSmtpPeers)
  	{
***************
*** 192,202 ****
  		{
  			/* end of file, just die */
  			message("421 %s Lost input channel from %s",
! 				MyHostName, CurHostName);
  #ifdef LOG
  			if (LogLevel > (gotmail ? 1 : 19))
  				syslog(LOG_NOTICE, "lost input channel from %s",
! 					CurHostName);
  #endif
  			if (InChild)
  				ExitStat = EX_QUIT;
--- 197,207 ----
  		{
  			/* end of file, just die */
  			message("421 %s Lost input channel from %s",
! 				MyHostName, CurSmtpClient);
  #ifdef LOG
  			if (LogLevel > (gotmail ? 1 : 19))
  				syslog(LOG_NOTICE, "lost input channel from %s",
! 					CurSmtpClient);
  #endif
  			if (InChild)
  				ExitStat = EX_QUIT;
***************
*** 211,219 ****
  			fprintf(e->e_xfp, "<<< %s\n", inp);
  
  		if (e->e_id == NULL)
! 			setproctitle("%s: %s", CurHostName, inp);
  		else
! 			setproctitle("%s %s: %s", e->e_id, CurHostName, inp);
  
  		/* break off command */
  		for (p = inp; isascii(*p) && isspace(*p); p++)
--- 216,224 ----
  			fprintf(e->e_xfp, "<<< %s\n", inp);
  
  		if (e->e_id == NULL)
! 			setproctitle("%s: %.80s", CurSmtpClient, inp);
  		else
! 			setproctitle("%s %s: %.80s", e->e_id, CurSmtpClient, inp);
  
  		/* break off command */
  		for (p = inp; isascii(*p) && isspace(*p); p++)
***************
*** 262,270 ****
  				auth_warning(e, "Host %s claimed to be %s",
  					RealHostName, p);
  			}
- 			p = macvalue('_', e);
- 			if (p == NULL)
- 				p = RealHostName;
  
  			gothello = TRUE;
  			if (c->cmdcode != CMDEHLO)
--- 267,272 ----
***************
*** 271,277 ****
  			{
  				/* print old message and be done with it */
  				message("250 %s Hello %s, pleased to meet you",
! 					MyHostName, p);
  				break;
  			}
  			
--- 273,279 ----
  			{
  				/* print old message and be done with it */
  				message("250 %s Hello %s, pleased to meet you",
! 					MyHostName, CurSmtpClient);
  				break;
  			}
  			
***************
*** 332,338 ****
  			define('s', sendinghost, e);
  			initsys(e);
  			nrcpts = 0;
! 			setproctitle("%s %s: %s", e->e_id, CurHostName, inp);
  
  			/* child -- go do the processing */
  			p = skipword(p, "from");
--- 334,341 ----
  			define('s', sendinghost, e);
  			initsys(e);
  			nrcpts = 0;
! 			e->e_flags |= EF_LOGSENDER;
! 			setproctitle("%s %s: %.80s", e->e_id, CurSmtpClient, inp);
  
  			/* child -- go do the processing */
  			p = skipword(p, "from");
***************
*** 626,632 ****
  				if (vrfy)
  					message("252 Who's to say?");
  				else
! 					message("502 That's none of your business");
  				break;
  			}
  			else if (!gothello &&
--- 629,640 ----
  				if (vrfy)
  					message("252 Who's to say?");
  				else
! 					message("502 Sorry, we do not allow this operation");
! #ifdef LOG
! 				if (LogLevel > 5)
! 					syslog(LOG_INFO, "%s: %s [rejected]",
! 						CurSmtpClient, inp);
! #endif
  				break;
  			}
  			else if (!gothello &&
***************
*** 640,646 ****
  				break;
  #ifdef LOG
  			if (LogLevel > 5)
! 				syslog(LOG_INFO, "%s: %s", CurHostName, inp);
  #endif
  			vrfyqueue = NULL;
  			QuickAbort = TRUE;
--- 648,654 ----
  				break;
  #ifdef LOG
  			if (LogLevel > 5)
! 				syslog(LOG_INFO, "%s: %s", CurSmtpClient, inp);
  #endif
  			vrfyqueue = NULL;
  			QuickAbort = TRUE;
***************
*** 942,947 ****
--- 950,958 ----
  			st = waitfor(childpid);
  			if (st == -1)
  				syserr("%s: lost child", label);
+ 			else if (!WIFEXITED(st))
+ 				syserr("%s: died on signal %d",
+ 					label, st & 0177);
  
  			/* if we exited on a QUIT command, complete the process */
  			if (st == (EX_QUIT << 8))
*** src/udb.c.OLD	Thu Nov 25 08:54:38 1993
--- src/udb.c	Thu Nov 25 11:23:27 1993
***************
*** 36,44 ****
  
  #ifndef lint
  #ifdef USERDB
! static char sccsid [] = "@(#)udb.c	8.3 (Berkeley) 8/25/93 (with USERDB)";
  #else
! static char sccsid [] = "@(#)udb.c	8.3 (Berkeley) 8/25/93 (without USERDB)";
  #endif
  #endif
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef USERDB
! static char sccsid [] = "@(#)udb.c	8.4 (Berkeley) 11/25/93 (with USERDB)";
  #else
! static char sccsid [] = "@(#)udb.c	8.4 (Berkeley) 11/25/93 (without USERDB)";
  #endif
  #endif
  
***************
*** 603,609 ****
  				up->udb_addr.sin_family = h->h_addrtype;
  				bcopy(h->h_addr_list[0],
  				      (char *) &up->udb_addr.sin_addr,
! 				      h->h_length);
  				up->udb_addr.sin_port = UdbPort;
  				up->udb_timeout = UdbTimeout;
  				up++;
--- 603,609 ----
  				up->udb_addr.sin_family = h->h_addrtype;
  				bcopy(h->h_addr_list[0],
  				      (char *) &up->udb_addr.sin_addr,
! 				      sizeof up->udb_addr.sin_addr);
  				up->udb_addr.sin_port = UdbPort;
  				up->udb_timeout = UdbTimeout;
  				up++;
*** src/usersmtp.c.OLD	Sun Nov  7 15:33:58 1993
--- src/usersmtp.c	Wed Jan  5 09:20:15 1994
***************
*** 36,44 ****
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)usersmtp.c	8.13 (Berkeley) 10/24/93 (with SMTP)";
  #else
! static char sccsid[] = "@(#)usersmtp.c	8.13 (Berkeley) 10/24/93 (without SMTP)";
  #endif
  #endif /* not lint */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)usersmtp.c	8.17 (Berkeley) 1/5/94 (with SMTP)";
  #else
! static char sccsid[] = "@(#)usersmtp.c	8.17 (Berkeley) 1/5/94 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 218,226 ****
  			goto tempfail2;
  	}
  
! 	mci->mci_state = MCIS_OPEN;
! 	return;
  
    tempfail1:
    tempfail2:
  	mci->mci_exitstat = EX_TEMPFAIL;
--- 218,231 ----
  			goto tempfail2;
  	}
  
! 	if (mci->mci_state != MCIS_CLOSED)
! 	{
! 		mci->mci_state = MCIS_OPEN;
! 		return;
! 	}
  
+ 	/* got a 421 error code during startup */
+ 
    tempfail1:
    tempfail2:
  	mci->mci_exitstat = EX_TEMPFAIL;
***************
*** 317,322 ****
--- 322,328 ----
  	ENVELOPE *e;
  {
  	int r;
+ 	char *bufp;
  	char buf[MAXNAME];
  	char optbuf[MAXLINE];
  
***************
*** 341,355 ****
  		(void) strcpy(buf, "");
  	else
  		expand("\201g", buf, &buf[sizeof buf - 1], e);
  	if (e->e_from.q_mailer == LocalMailer ||
  	    !bitnset(M_FROMPATH, m->m_flags))
  	{
! 		smtpmessage("MAIL From:<%s>%s", m, mci, buf, optbuf);
  	}
  	else
  	{
  		smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
! 			buf[0] == '@' ? ',' : ':', buf, optbuf);
  	}
  	SmtpPhase = mci->mci_phase = "client MAIL";
  	setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
--- 347,371 ----
  		(void) strcpy(buf, "");
  	else
  		expand("\201g", buf, &buf[sizeof buf - 1], e);
+ 	if (buf[0] == '<')
+ 	{
+ 		/* strip off <angle brackets> (put back on below) */
+ 		bufp = &buf[strlen(buf) - 1];
+ 		if (*bufp == '>')
+ 			*bufp = '\0';
+ 		bufp = &buf[1];
+ 	}
+ 	else
+ 		bufp = buf;
  	if (e->e_from.q_mailer == LocalMailer ||
  	    !bitnset(M_FROMPATH, m->m_flags))
  	{
! 		smtpmessage("MAIL From:<%s>%s", m, mci, bufp, optbuf);
  	}
  	else
  	{
  		smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
! 			*bufp == '@' ? ',' : ':', bufp, optbuf);
  	}
  	SmtpPhase = mci->mci_phase = "client MAIL";
  	setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
***************
*** 594,601 ****
  	register MCI *mci;
  	ENVELOPE *e;
  {
! 	int i;
  
  	/* send the quit message if we haven't gotten I/O error */
  	if (mci->mci_state != MCIS_ERROR)
  	{
--- 610,626 ----
  	register MCI *mci;
  	ENVELOPE *e;
  {
! 	bool oldSuprErrs = SuprErrs;
  
+ 	/*
+ 	**	Suppress errors here -- we may be processing a different
+ 	**	job when we do the quit connection, and we don't want the 
+ 	**	new job to be penalized for something that isn't it's
+ 	**	problem.
+ 	*/
+ 
+ 	SuprErrs = TRUE;
+ 
  	/* send the quit message if we haven't gotten I/O error */
  	if (mci->mci_state != MCIS_ERROR)
  	{
***************
*** 602,615 ****
  		SmtpPhase = "client QUIT";
  		smtpmessage("QUIT", m, mci);
  		(void) reply(m, mci, e, TimeOuts.to_quit, NULL);
  		if (mci->mci_state == MCIS_CLOSED)
  			return;
  	}
  
  	/* now actually close the connection and pick up the zombie */
! 	i = endmailer(mci, e, m->m_argv);
! 	if (i != EX_OK)
! 		syserr("451 smtpquit %s: stat %d", m->m_argv[0], i);
  }
  /*
  **  SMTPRSET -- send a RSET (reset) command
--- 627,644 ----
  		SmtpPhase = "client QUIT";
  		smtpmessage("QUIT", m, mci);
  		(void) reply(m, mci, e, TimeOuts.to_quit, NULL);
+ 		SuprErrs = oldSuprErrs;
  		if (mci->mci_state == MCIS_CLOSED)
+ 		{
+ 			SuprErrs = oldSuprErrs;
  			return;
+ 		}
  	}
  
  	/* now actually close the connection and pick up the zombie */
! 	(void) endmailer(mci, e, NULL);
! 
! 	SuprErrs = oldSuprErrs;
  }
  /*
  **  SMTPRSET -- send a RSET (reset) command
*** src/util.c.OLD	Sun Nov  7 11:14:47 1993
--- src/util.c	Tue Jan  4 06:40:38 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)util.c	8.15 (Berkeley) 10/31/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)util.c	8.28 (Berkeley) 1/4/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 407,413 ****
  **		gid -- group id to compare against.
  **		uname -- user name to compare against (used for group
  **			sets).
! **		mustown -- to be safe, this uid must own the file.
  **		mode -- mode bits that must match.
  **
  **	Returns:
--- 407,415 ----
  **		gid -- group id to compare against.
  **		uname -- user name to compare against (used for group
  **			sets).
! **		flags -- modifiers:
! **			SFF_MUSTOWN -- "uid" must own this file.
! **			SFF_NOSLINK -- file cannot be a symbolic link.
  **		mode -- mode bits that must match.
  **
  **	Returns:
***************
*** 433,444 ****
  #endif
  
  int
! safefile(fn, uid, gid, uname, mustown, mode)
  	char *fn;
  	uid_t uid;
  	gid_t gid;
  	char *uname;
! 	bool mustown;
  	int mode;
  {
  	register char *p;
--- 435,446 ----
  #endif
  
  int
! safefile(fn, uid, gid, uname, flags, mode)
  	char *fn;
  	uid_t uid;
  	gid_t gid;
  	char *uname;
! 	int flags;
  	int mode;
  {
  	register char *p;
***************
*** 446,453 ****
  	struct stat stbuf;
  
  	if (tTd(54, 4))
! 		printf("safefile(%s, uid=%d, gid=%d, mustown=%d, mode=%o):\n",
! 			fn, uid, gid, mustown, mode);
  	errno = 0;
  
  	for (p = fn; (p = strchr(++p, '/')) != NULL; *p = '/')
--- 448,455 ----
  	struct stat stbuf;
  
  	if (tTd(54, 4))
! 		printf("safefile(%s, uid=%d, gid=%d, flags=%x, mode=%o):\n",
! 			fn, uid, gid, flags, mode);
  	errno = 0;
  
  	for (p = fn; (p = strchr(++p, '/')) != NULL; *p = '/')
***************
*** 455,460 ****
--- 457,468 ----
  		*p = '\0';
  		if (stat(fn, &stbuf) < 0)
  			break;
+ 		if (uid == 0 && !bitset(SFF_ROOTOK, flags))
+ 		{
+ 			if (bitset(S_IXOTH, stbuf.st_mode))
+ 				continue;
+ 			break;
+ 		}
  		if (stbuf.st_uid == uid && bitset(S_IXUSR, stbuf.st_mode))
  			continue;
  		if (stbuf.st_gid == gid && bitset(S_IXGRP, stbuf.st_mode))
***************
*** 488,494 ****
--- 496,507 ----
  		return ret;
  	}
  
+ #ifdef HASLSTAT
+ 	if ((bitset(SFF_NOSLINK, flags) ? lstat(fn, &stbuf)
+ 					: stat(fn, &stbuf)) < 0)
+ #else
  	if (stat(fn, &stbuf) < 0)
+ #endif
  	{
  		int ret = errno;
  
***************
*** 498,504 ****
  		errno = 0;
  		return ret;
  	}
! 	if (uid == 0)
  		mode >>= 6;
  	else if (stbuf.st_uid != uid)
  	{
--- 511,527 ----
  		errno = 0;
  		return ret;
  	}
! 
! #ifdef S_ISLNK
! 	if (bitset(SFF_NOSLINK, flags) && S_ISLNK(stbuf.st_mode))
! 	{
! 		if (tTd(54, 4))
! 			printf("\t[slink mode %o]\tEPERM\n", stbuf.st_mode);
! 		return EPERM;
! 	}
! #endif
! 
! 	if (uid == 0 && !bitset(SFF_ROOTOK, flags))
  		mode >>= 6;
  	else if (stbuf.st_uid != uid)
  	{
***************
*** 525,531 ****
  	if (tTd(54, 4))
  		printf("\t[uid %d, stat %o, mode %o] ",
  			stbuf.st_uid, stbuf.st_mode, mode);
! 	if ((stbuf.st_uid == uid || uid == 0 || !mustown) &&
  	    (stbuf.st_mode & mode) == mode)
  	{
  		if (tTd(54, 4))
--- 548,555 ----
  	if (tTd(54, 4))
  		printf("\t[uid %d, stat %o, mode %o] ",
  			stbuf.st_uid, stbuf.st_mode, mode);
! 	if ((stbuf.st_uid == uid || stbuf.st_uid == 0 ||
! 	     !bitset(SFF_MUSTOWN, flags)) &&
  	    (stbuf.st_mode & mode) == mode)
  	{
  		if (tTd(54, 4))
***************
*** 836,847 ****
  
  	/* try to read */
  	p = NULL;
! 	while (p == NULL && !feof(fp) && !ferror(fp))
  	{
  		errno = 0;
  		p = fgets(buf, siz, fp);
! 		if (errno == EINTR)
! 			clearerr(fp);
  	}
  
  	/* clear the event if it has not sprung */
--- 860,872 ----
  
  	/* try to read */
  	p = NULL;
! 	while (!feof(fp) && !ferror(fp))
  	{
  		errno = 0;
  		p = fgets(buf, siz, fp);
! 		if (p != NULL || errno != EINTR)
! 			break;
! 		clearerr(fp);
  	}
  
  	/* clear the event if it has not sprung */
***************
*** 1120,1137 ****
  	register char *a;
  	register char *b;
  {
! 	int l;
  
! 	l = strlen(a);
! 	for (;;)
  	{
! 		b = strchr(b, a[0]);
! 		if (b == NULL)
! 			return FALSE;
! 		if (strncmp(a, b, l) == 0)
  			return TRUE;
- 		b++;
  	}
  }
  /*
  **  CHECKFD012 -- check low numbered file descriptors
--- 1145,1167 ----
  	register char *a;
  	register char *b;
  {
! 	int la;
! 	int lb;
! 	int c;
  
! 	la = strlen(a);
! 	lb = strlen(b);
! 	c = *a;
! 	if (isascii(c) && isupper(c))
! 		c = tolower(c);
! 	for (; lb-- >= la; b++)
  	{
! 		if (*b != c && isascii(*b) && isupper(*b) && tolower(*b) != c)
! 			continue;
! 		if (strncasecmp(a, b, la) == 0)
  			return TRUE;
  	}
+ 	return FALSE;
  }
  /*
  **  CHECKFD012 -- check low numbered file descriptors
***************
*** 1279,1284 ****
--- 1309,1335 ----
  		p += strlen(p);
  		goto defprint;
  
+ #ifdef S_IFIFO
+ 	  case S_IFIFO:
+ 		sprintf(p, "FIFO: ");
+ 		p += strlen(p);
+ 		goto defprint;
+ #endif
+ 
+ #ifdef S_IFDIR
+ 	  case S_IFDIR:
+ 		sprintf(p, "DIR: ");
+ 		p += strlen(p);
+ 		goto defprint;
+ #endif
+ 
+ #ifdef S_IFLNK
+ 	  case S_IFLNK:
+ 		sprintf(p, "LNK: ");
+ 		p += strlen(p);
+ 		goto defprint;
+ #endif
+ 
  	  default:
  defprint:
  		sprintf(p, "dev=%d/%d, ino=%d, nlink=%d, u/gid=%d/%d, size=%ld",
***************
*** 1289,1295 ****
  
  printit:
  	if (logit)
! 		syslog(LOG_INFO, "%s", buf);
  	else
  		printf("%s\n", buf);
  }
--- 1340,1395 ----
  
  printit:
  	if (logit)
! 		syslog(LOG_DEBUG, "%s", buf);
  	else
  		printf("%s\n", buf);
+ }
+ /*
+ **  SHORTENSTRING -- return short version of a string
+ **
+ **	If the string is already short, just return it.  If it is too
+ **	long, return the head and tail of the string.
+ **
+ **	Parameters:
+ **		s -- the string to shorten.
+ **		m -- the max length of the string.
+ **
+ **	Returns:
+ **		Either s or a short version of s.
+ */
+ 
+ #ifndef MAXSHORTSTR
+ # define MAXSHORTSTR	203
+ #endif
+ 
+ char *
+ shortenstring(s, m)
+ 	register char *s;
+ 	int m;
+ {
+ 	int l;
+ 	static char buf[MAXSHORTSTR + 1];
+ 
+ 	l = strlen(s);
+ 	if (l < m)
+ 		return s;
+ 	if (m > MAXSHORTSTR)
+ 		m = MAXSHORTSTR;
+ 	else if (m < 10)
+ 	{
+ 		if (m < 5)
+ 		{
+ 			strncpy(buf, s, m);
+ 			buf[m] = '\0';
+ 			return buf;
+ 		}
+ 		strncpy(buf, s, m - 3);
+ 		strcpy(buf + m - 3, "...");
+ 		return buf;
+ 	}
+ 	m = (m - 3) / 2;
+ 	strncpy(buf, s, m);
+ 	strcpy(buf + m, "...");
+ 	strcpy(buf + m + 3, s + l - m);
+ 	return buf;
  }
*** src/version.c.OLD	Tue Nov 30 08:59:46 1993
--- src/version.c	Thu Jan 13 06:41:44 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)version.c	8.6.1.4 (Berkeley) 10/31/93";
  #endif /* not lint */
  
! char	Version[] = "8.6.4";
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)version.c	8.6.1.5 (Berkeley) 1/13/94";
  #endif /* not lint */
  
! char	Version[] = "8.6.5";
