*** KNOWNBUGS.OLD	Wed Jan 12 06:00:44 1994
--- KNOWNBUGS	Sun Mar 13 10:10:15 1994
***************
*** 1,25 ****
  
  
  	     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
  but which have not been fixed in the current release.  You probably
  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
--- 1,19 ----
  
  
  	     K N O W N   B U G S   I N   S E N D M A I L
! 			     (for 8.6.6)
  
  
  The following are bugs or deficiencies in sendmail that I am aware of
  but which have not been fixed in the current release.  You probably
  want to get the most up to date version of this from FTP.CS.Berkeley.EDU
! in /ucb/sendmail/KNOWNBUGS.  For descriptions of bugs that have been
! fixed, see the file RELEASE_NOTES (in the root directory of the sendmail
! distribution).
  
! This list is not guaranteed to be complete.
  
  
  * Null bytes are not handled properly.
  
    Sendmail should handle full binary data.  As it stands, it handles
***************
*** 125,171 ****
    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)
--- 119,131 ----
    You can eliminate this by adding commas at the end of each line
    of the :include: file.
  
+ * Excessive mailing list nesting can run out of file descriptors.
  
!   If you have a mailing list that includes lots of other mailing
!   lists, each of which has a separate owner, you can run out of
!   file descriptors.  Each mailing list with a separate owner uses
!   one open file descriptor (prior to 8.6.6 it was three open
!   file descriptors per list).  This is particularly egregious if
!   you have your connection cache set to be large.
  
! (Version 8.17, last updated 3/13/94)
*** Makefile.OLD	Sat Sep 25 08:37:04 1993
--- Makefile	Sun Feb 27 09:01:37 1994
***************
*** 1,22 ****
! #       @(#)Makefile	8.2 (Berkeley) 9/25/93
  
  SUBDIR= src mailstats makemap praliases
  VER=	XX
  
  tar: Files.base Files.cf Files.misc Files.xdoc
  	(cd src; ${MAKE})
  	(cd doc; PRINTER=ps ${MAKE})
  	(cd cf/cf; ${MAKE})
! 	pax -w -x tar -L -f sendmail.${VER}.base.tar `cat Files.base`
  	compress sendmail.${VER}.base.tar
! 	pax -w -x tar -L -f sendmail.${VER}.cf.tar `cat Files.cf`
  	compress sendmail.${VER}.cf.tar
! 	pax -w -x tar -L -f sendmail.${VER}.misc.tar `cat Files.misc`
  	compress sendmail.${VER}.misc.tar
! 	pax -w -x tar -L -f sendmail.${VER}.xdoc.tar `cat Files.xdoc`
  	compress sendmail.${VER}.xdoc.tar
  
  ftp: sendmail.${VER}.base.tar.Z sendmail.${VER}.cf.tar.Z sendmail.${VER}.misc.tar.Z sendmail.${VER}.xdoc.tar.Z
! 	rcp sendmail.${VER}.*.tar.Z RELEASE_NOTES barad-dur:/disks/barad-dur/ftp/sendmail/.
  
  .include <bsd.subdir.mk>
--- 1,24 ----
! #       @(#)Makefile	8.3 (Berkeley) 2/27/94
  
  SUBDIR= src mailstats makemap praliases
+ FTPDIR=	barad-dur:/disks/barad-dur/ftp/sendmail/.
  VER=	XX
  
  tar: Files.base Files.cf Files.misc Files.xdoc
  	(cd src; ${MAKE})
  	(cd doc; PRINTER=ps ${MAKE})
+ 	(cd doc; chmod 444 op/op.ps intro/intro.ps usenix/usenix.ps)
  	(cd cf/cf; ${MAKE})
! 	pax -w -x tar -L -f sendmail.${VER}.base.tar `grep -v ^# Files.base`
  	compress sendmail.${VER}.base.tar
! 	pax -w -x tar -L -f sendmail.${VER}.cf.tar `grep -v ^# Files.cf`
  	compress sendmail.${VER}.cf.tar
! 	pax -w -x tar -L -f sendmail.${VER}.misc.tar `grep -v ^# Files.misc`
  	compress sendmail.${VER}.misc.tar
! 	pax -w -x tar -L -f sendmail.${VER}.xdoc.tar `grep -v ^# Files.xdoc`
  	compress sendmail.${VER}.xdoc.tar
  
  ftp: sendmail.${VER}.base.tar.Z sendmail.${VER}.cf.tar.Z sendmail.${VER}.misc.tar.Z sendmail.${VER}.xdoc.tar.Z
! 	rcp sendmail.${VER}.*.tar.Z RELEASE_NOTES FAQ KNOWNBUGS ${FTPDIR}
  
  .include <bsd.subdir.mk>
*** READ_ME.OLD	Tue Jan  4 07:52:09 1994
--- READ_ME	Wed Jan 26 17:39:28 1994
***************
*** 1,5 ****
  /*-
!  *	@(#)READ_ME	8.8 (Berkeley) 1/4/94
   */
  
  			SENDMAIL RELEASE 8
--- 1,5 ----
  /*-
!  *	@(#)READ_ME	8.9 (Berkeley) 1/26/94
   */
  
  			SENDMAIL RELEASE 8
***************
*** 113,123 ****
  	RFC987	Mapping between RFC822 and X.400
  	RFC1049	Content-Type header field (extension to RFC822)
  
! Unfortunately, for a variety of reasons the Makefiles are for the new
! Berkeley "make" and will not work on the old, traditional make.  I urge
! you to get this make from Net2 (available on many public FTP archives).
! Failing that, some directories have a "Makefile.dist" that will work on
! older versions of make (but don't have the niceties included).
  
  
  +-------------------+
--- 113,121 ----
  	RFC987	Mapping between RFC822 and X.400
  	RFC1049	Content-Type header field (extension to RFC822)
  
! Warning to AIX users: this version of sendmail does not implement
! MB, MR, or MG DNS resource records, as defined as experiments in
! RFC883.
  
  
  +-------------------+
***************
*** 134,140 ****
--- 132,142 ----
  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.
  
+ Be sure you remove ndbm.h and ndbm.o from the db distribution.  These
+ will cause problems with sendmail because sendmail already understands
+ about NEWDB and NDBM coexisting.
  
+ 
  +-------------+
  | USE WITH MH |
  +-------------+
***************
*** 163,169 ****
  	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.
  
  
  +---------------------+
--- 165,177 ----
  	BINDIR?=	/usr/sbin
  
  The other directories should all have Makefile.dist files that work
! on the old make, albeit without all the niceties included.
! 
! You can also get a new Berkeley make from the Net2 release (available
! on many public FTP archives).  This version should also interpret old
! Makefiles, so you could drop it in as your default make.
! 
! For more details, see src/READ_ME.
  
  
  +---------------------+
*** RELEASE_NOTES.OLD	Fri Jan 14 07:13:10 1994
--- RELEASE_NOTES	Sun Mar 13 09:42:08 1994
***************
*** 1,3 ****
--- 1,242 ----
+ 			SENDMAIL RELEASE NOTES
+ 	     @(#)RELEASE_NOTES	8.6.6.1 (Berkeley) 3/13/94
+ 
+ This listing shows the version of the sendmail binary, the version
+ of the sendmail configuration files, the date of release, and a
+ summary of the changes in that release.
+ 
+ 8.6.6/8.6.6	94/03/13
+ 	SECURITY: the ability to give files away on System V-based
+ 		systems proved dangerous -- don't run as the owner
+ 		of a :include: file on a system that allows giveaways.
+ 		Unfortunately, this also applies to determining a
+ 		valid shell.
+ 	IMPORTANT: Previous versions weren't expiring old connections
+ 		in the connection cache for a long time under some
+ 		circumstances.  This could result in resource exhaustion,
+ 		both at your end and at the other end.  This checks the
+ 		connections for timeouts much more frequently.  From
+ 		Doug Anderson of NCSC.
+ 	Fix a glitch that snuck in that caused programs to be run as
+ 		the sender instead of the recipient if the mail was
+ 		from a local user to another local user.  From
+ 		Motonori Nakamura of Kyoto University.
+ 	Fix "wildcard" on /etc/shell matching -- instead of looking
+ 		for "*", look for "/SENDMAIL/ANY/SHELL/".  From
+ 		Bryan Costales of ICSI.
+ 	Change the method used to declare the "statfs" availability;
+ 		instead of HASSTATFS and/or HASUSTAT with a ton of
+ 		tweaking in conf.c, there is a single #define called
+ 		SFS_TYPE which takes on one of six values (SFS_NONE
+ 		for no statfs availability, SFS_USTAT for the ustat(2)
+ 		syscall, SFS_4ARGS for a four argument statfs(2) call,
+ 		and SFS_VFS, SFS_MOUNT, or SFS_STATFS for a two argument
+ 		statfs(2) call with the declarations in <sys/vfs.h>,
+ 		<sys/mount.h>, or <sys/statfs.h> respectively).
+ 	Fix glitch in NetInfo support that could return garbage if
+ 		there was no "/locations/sendmail" property.  From
+ 		David Meyer of the University of Virginia.
+ 	Change HASFLOCK from defined/not-defined to a 0/1 definition
+ 		to allow Linux to turn it off even though it is a
+ 		BSD-like system.
+ 	Allow setting of "ident" timeout to zero to turn off the ident
+ 		protocol entirely.
+ 	Make 7-bit stripping local to a connection (instead of to a
+ 		mailer); this allows you to specify that SMTP is a
+ 		7-bit channel, but revert to 8-bit should it advertise
+ 		that it supports 8BITMIME.  You still have to specify
+ 		mailer flag 7 to get this stripping at all.
+ 	Improve makesendmail script so it handles more cases automatically.
+ 	Tighten up restrictions on taking ownership of :include: files
+ 		to avoid problems on systems that allow you to give away
+ 		files.
+ 	Fix a problem that made it impossible to rebuild the alias
+ 		file if it was on a read-only file system.  From
+ 		Harry Edmon of the University of Washington.
+ 	Improve MX randomization function.  From John Gardiner Myers
+ 		of CMU.
+ 	Fix a minor glitch causing a bogus message to be printed (used
+ 		%s instead of %d in a printf string for the line number)
+ 		when a bad queue file was read.  From Harry Edmon.
+ 	Allow $s to remain NULL on locally generated mail.  I'm not
+ 		sure this is necessary, but a lot of people have complained
+ 		about it, and there is a legitimate question as to whether
+ 		"localhost" is legal as an 822-style domain.
+ 	Fix a problem with very short line lengths (mailer L= flag) in
+ 		headers.  This causes a leading space to be added onto
+ 		continuation lines (including in the body!), and also
+ 		tries to wrap headers containing addresses (From:, To:,
+ 		etc) intelligently at the shorter line lengths.  Problem
+ 		Reported by Lars-Johan Liman of SUNET Operations Center.
+ 	Log the real user name when logging syserrs, since these can have
+ 		security implications.  Suggested by several people.
+ 	Fix address logging of cached connections -- it used to always
+ 		log the numeric address as zero.  This is a somewhat
+ 		bogus implementation in that it does an extra system
+ 		call, but it should be an inexpensive one.  Fix from
+ 		Motonori Nakamura.
+ 	Tighten up handling of short syslog buffers even more -- there
+ 		were cases where the outgoing relay= name was too long
+ 		to share a line with delay= and mailer= logging.
+ 	Limit the overhead on split envelopes to one open file descriptor
+ 		per envelope -- previously the overhead was three
+ 		descriptors.  This was in response to a problem reported
+ 		by P{r (Pell) Emanuelsson.
+ 	Fixes to better handle the case of unexpected connection closes;
+ 		this redirects the output to the transcript so the info
+ 		is not lost.  From Eric Wassenaar.
+ 	Fix potential string overrun if you macro evaluate a string that
+ 		has a naked $ at the end.  Problem noted by James Matheson
+ 		<jmrm@eng.cam.ac.uk>.
+ 	Make default error number on $#error messages 553 (``Requested
+ 		action not taken: mailbox name not allowed'') instead of
+ 		501 (``Syntax error in parameters or arguments'') to
+ 		avoid bogus "protocol error" messages.
+ 	Strip off any existing trailing dot on names during $[ ... $]
+ 		lookup.  This prevents it from ending up with two dots
+ 		on the end of dot terminated names.  From Wesley Craig
+ 		of the University of Michigan and Bryan Costales of ICSI.
+ 	Clean up file class reading so that the debugging information is
+ 		more informative.  It hadn't been using setclass, so you
+ 		didn't see the class items being added.
+ 	Avoid core dump if you are running a version of sendmail where
+ 		NIS is compiled in, and you specify an NIS map, but
+ 		NIS is not running.  Fix from John Oleynick of
+ 		Rutgers.
+ 	Diagnose bizarre case where res_search returns a failure value,
+ 		but sets h_errno to a success value.
+ 	Make sure that "too many hops" messages are considered important
+ 		enough to send an error to the Postmaster (that is, the
+ 		address specified in the P option).  This fix should
+ 		help problems that cause the df file to be left around
+ 		sometimes -- unfortunately, I can't seem to reproduce
+ 		the problem myself.
+ 	Avoid core dump (null pointer reference) on EXPN command; this
+ 		only occurred if your log level was set to 10 or higher
+ 		and the target account was an alias or had a .forward file.
+ 		Problem noted by Janne Himanka.
+ 	Avoid "denial of service" attacks by someone who is flooding your
+ 		SMTP port with bad commands by shutting the connection
+ 		after 25 bad commands are issued.  From Kyle Jones of
+ 		UUNET.
+ 	Fix core dump on error messages with very long "to" buffers;
+ 		fmtmsg overflows the message buffer.  Fixed by trimming
+ 		the to address to 203 characters.  Problem reported by
+ 		John Oleynick.
+ 	Fix configuration for HASFLOCK -- there were some spots where
+ 		a #ifndef was incorrectly #ifdef.  Pointed out by
+ 		George Baltz of the University of Maryland.
+ 	Fix a typo in savemail() that could cause the error message To:
+ 		lists to be incorrect in some places.  From Motonori
+ 		Nakamura.
+ 	Fix a glitch that can cause duplicate error messages on split
+ 		envelopes where an address on one of the lists has a
+ 		name server failure.  Fix from Voradesh Yenbut of the
+ 		University of Washington.
+ 	Fix possible bogus pointer reference on ESMTP parameters that
+ 		don't have an ``=value'' part.
+ 	CNAME loops caused an error message to be generated, but also
+ 		re-queued the message.  Changed to just re-queue the
+ 		message (it's really hard to just bounce it because
+ 		of the wierd way the name server works in the presence
+ 		of CNAME loops).  Problem noted by James M.R.Matheson
+ 		of Cambridge University.
+ 	Avoid giving ``warning: foo owned process doing -bs'' messages
+ 		if they use ``MAIL FROM:<foo>'' where foo is their true
+ 		user name.  Suggested by Andreas Stolcke of ICSI.
+ 	Change the NAMED_BIND compile flag to be a 0/1 flag so you can
+ 		override it easily in the Makefile -- that is, you can
+ 		turn it off using -DNAMED_BIND=0.
+ 	If a gethostbyname(...) of an address with a trailing dot fails,
+ 		try it without the trailing dot.  This is because if
+ 		you have a version of gethostbyname() that falls back
+ 		to NIS or the /etc/hosts file it will fail to find
+ 		perfectly reasonable names that just don't happen to
+ 		be dot terminated in the hosts file.  You don't want to
+ 		strip the dot first though because we're trying to ensure
+ 		that country names that match one of your subdomains get
+ 		a chance.
+ 	PRALIASES: fix bogus output on non-null-terminated strings.
+ 		From Bill Gianopoulos of Raytheon.
+ 	CONFIG: Avoid rewriting anything that matches $w to be $j.
+ 		This was in code intended to only catch the self-literal
+ 		address (that is, [1.2.3.4], where 1.2.3.4 is your
+ 		IP address), but the code was broken.  However, it will
+ 		still do this if $M is defined; this is necessary to
+ 		get client configurations to work (sigh).  Note that this
+ 		means that $M overrides :mailname entries in the user
+ 		database!  Problem noted by Paul Southworth.
+ 	CONFIG: Fix definition of Solaris help file location.  From
+ 		Steve Cliffe <steve@gorgon.cs.uow.edu.au>.
+ 	CONFIG: Fix bug that broke news.group.USENET mappings.
+ 	CONFIG: Allow declaration of SMTP_MAILER_MAX, FAX_MAILER_MAX,
+ 		and USENET_MAILER_MAX to tweak the maximum message
+ 		size for various mailers.
+ 	CONFIG: Change definition of USENET_MAILER_ARGS to include argv[0]
+ 		instead of assuming that it is "inews" for consistency
+ 		with other mailers.  From Michael Corrigan of UC San Diego.
+ 	CONFIG: When mail is forwarded to a LOCAL_RELAY or a MAIL_HUB,
+ 		qualify the address in the SMTP envelope as user@{relay|hub}
+ 		instead of user@$j.  From Bill Wisner of The Well.
+ 	CONFIG: Fix route-addr syntax in nullrelay configuration set.
+ 	CONFIG: Don't turn off case mapping of user names in the local
+ 		mailer for IRIX.  This was different than most every other
+ 		system.
+ 	CONFIG: Avoid infinite loops on certainly list:; syntaxes in
+ 		envelope.  Noted by Thierry Besancon
+ 		<besancon@excalibur.ens.fr>.
+ 	CONFIG: Don't include -z by default on uux line -- most systems
+ 		don't want it set by default.  Pointed out by Philippe
+ 		Michel of Thomson CSF.
+ 	CONFIG: Fix some bugs with mailertables -- for example, if your
+ 		host name was foo.bar.ray.com and you matched against
+ 		".ray.com", the old implementation bound %1 to "bar"
+ 		instead of "foo.bar".  Also, allow "." in the mailertable
+ 		to match anything -- essentially, take over SMART_HOST.
+ 		This also moves matching of explicit local host names
+ 		before the mailertable so they don't have to be special
+ 		cased in the mailertable data.  Reported by Bill
+ 		Gianopoulos of Raytheon; the fix for the %1 binding
+ 		problem was contributed by Nicholas Comanos of the
+ 		University of Sydney.
+ 	CONFIG: Don't include "root" in class $=L (users to deliver
+ 		locally, even if a hub or relay exists) by default.
+ 		This is because of the known bug where definition of
+ 		both a LOCAL_RELAY and a MAIL_HUB causes $=L to ignore
+ 		both and deliver into the local mailbox.
+ 	CONFIG: Move up bitdomain and uudomain handling so that they
+ 		are done before .UUCP class matching; uudomain was
+ 		reported as ineffective before.  This also frees up
+ 		diversion 8 for future use.  Problem reported by Kimmo
+ 		Suominen.
+ 	CONFIG: Don't try to convert dotted IP address (e.g., [1.2.3.4])
+ 		into host names.  As pointed out by Jonathan Kamens,
+ 		these are often used because either the forward or reverse
+ 		mapping is broken; this translation makes it broken again.
+ 	DOC: Clarify $@ and $: in the Install & Op Guide.  From Kimmo
+ 		Suominen.
+ 	Portability fixes:
+ 		Unicos from David L. Kensiski of Sterling Sofware.
+ 		DomainOS from Don Lewis of Silicon Systems.
+ 		GNU m4 1.0.3 from Karst Koymans of Utrecht University.
+ 		Convex from Kimmo Suominen <kim@tac.nyc.ny.us>.
+ 		NetBSD from Adam Glass <glass@sun-lamp.cs.berkeley.edu>.
+ 		BSD/386 from Tony Sanders of BSDI.
+ 		Apollo from Eric Wassenaar.
+ 		DGUX from Doug Anderson.
+ 		Sequent DYNIX/ptx 2.0 from Tim Wright of Sequent.
+ 	NEW FILES:
+ 		src/Makefile.DomainOS
+ 		src/Makefile.PTX
+ 		src/Makefile.SunOS.5.1
+ 		src/Makefile.SunOS.5.2
+ 		src/Makefile.SunOS.5.x
+ 		src/mailq.1
+ 		cf/ostype/domainos.m4
+ 		doc/op/Makefile
+ 		doc/intro/Makefile
+ 		doc/usenix/Makefile
+ 
  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
***************
*** 185,190 ****
--- 424,431 ----
  		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.
+ 	Fix the code that was intended to allow two users to forward their
+ 		mail to the same program and have them appear unique.
  	Portability fixes for:
  		SCO UNIX from Murray Kucherawy.
  		SCO Open Server 3.2v4 from Philippe Brand.
*** cf/README.OLD	Wed Jan 12 06:19:02 1994
--- cf/README	Sat Mar 12 08:49:57 1994
***************
*** 4,10 ****
  
  		Eric Allman <eric@CS.Berkeley.EDU>
  
! 		@(#)README	8.21 (Berkeley) 1/12/94
  
  
  This document describes the sendmail configuration files being used
--- 4,10 ----
  
  		Eric Allman <eric@CS.Berkeley.EDU>
  
! 		@(#)README	8.27 (Berkeley) 3/12/94
  
  
  This document describes the sendmail configuration files being used
***************
*** 13,19 ****
  old versions of sendmail and cannot be expected to work well.
  
  These configuration files are probably not as general as previous
! versions, and don't handle as many of the wierd cases automagically.
  I was able to simplify by them for two reasons.  First, the network
  has become more consistent -- for example, at this point, everyone
  on the internet is supposed to be running a name server, so hacks to
--- 13,19 ----
  old versions of sendmail and cannot be expected to work well.
  
  These configuration files are probably not as general as previous
! versions, and don't handle as many of the weird cases automagically.
  I was able to simplify by them for two reasons.  First, the network
  has become more consistent -- for example, at this point, everyone
  on the internet is supposed to be running a name server, so hacks to
***************
*** 23,30 ****
  does describe the vast majority of sites with which I am familiar,
  including those outside the US.
  
! Of course, the downside of this is that if you do live in a wierd
! world, things are going to get wierder for you.  I'm sorry about that,
  but at the time we at Berkeley had a problem, and it seemed like the
  right thing to do.
  
--- 23,30 ----
  does describe the vast majority of sites with which I am familiar,
  including those outside the US.
  
! Of course, the downside of this is that if you do live in a weird
! world, things are going to get weirder for you.  I'm sorry about that,
  but at the time we at Berkeley had a problem, and it seemed like the
  right thing to do.
  
***************
*** 163,170 ****
--- 163,174 ----
  USENET_MAILER_FLAGS	[rlsDFMmn] The mailer flags for the usenet mailer.
  USENET_MAILER_ARGS	[-m -h -n] The command line arguments for the
  			usenet mailer.
+ USENET_MAILER_MAX	[100000] The maximum size of messages that will
+ 			be accepted by the usenet mailer.
  SMTP_MAILER_FLAGS	[undefined] Flags added to SMTP mailer.  Default
  			flags are `mDFMUX' (and `a' for esmtp mailer).
+ SMTP_MAILER_MAX		[undefined] The maximum size of messages that will
+ 			be transported using the smtp or esmtp mailers.
  UUCP_MAILER_FLAGS	[undefined] Flags added to UUCP mailer.  Default
  			flags are `DFMhuU' (and `m' for suucp mailer, minus
  			`U' for uucp-dom mailer).
***************
*** 172,182 ****
  			passed to the UUCP mailer.
  UUCP_MAX_SIZE		[100000] The maximum size message accepted for
  			transmission by the UUCP mailers.
! HOSTMAP_SPEC		[dbm -o /etc/hostmap] The value for the builtin
! 			hostmap key definition.  You can redefine this
! 			to change the class, flags, and filename of
! 			the hostmap.  The default flag (-o) makes this
! 			map optional.
  
  +---------+
  | DOMAINS |
--- 176,185 ----
  			passed to the UUCP mailer.
  UUCP_MAX_SIZE		[100000] The maximum size message accepted for
  			transmission by the UUCP mailers.
! FAX_MAILER_PATH		[/usr/local/lib/fax/mailfax] The program used to
! 			submit FAX messages.
! FAX_MAILER_MAX		[100000] The maximum size message accepted for
! 			transmission by FAX.
  
  +---------+
  | DOMAINS |
***************
*** 410,415 ****
--- 413,432 ----
  lists of UUCP hosts they speak with directly.  This can get a bit more
  tricky.  For an example of a "complex" site, see cf/ucbvax.mc.
  
+ If your host is known by several different names, you need to augment
+ the $=w class.  This is a list of names by which you are known, and
+ anything sent to an address using a host name in this list will be
+ treated as local mail.  You can do this in two ways: either create
+ the file /etc/sendmail.cw containing a list of your aliases (one per
+ line), and use ``FEATURE(use_cw_file)'' in the .mc file, or add the
+ line:
+ 
+ 	Cw alias.host.name
+ 
+ at the end of that file.  See the ``vangogh.mc'' file for an example.
+ Be sure you use the fully-qualified name of the host, rather than a
+ short name.
+ 
  The SITECONFIG macro allows you to indirectly reference site-dependent
  configuration information stored in the siteconfig subdirectory.  For
  example, the line
***************
*** 418,435 ****
  
  reads the file uucp.ucbvax for local connection information.  The
  second parameter is the local name (in this case just "ucbvax" since
! it is locally connected, and hence a UUCP hostname) and the name of
! the class in which to store the host information.  Another SITECONFIG
! line reads
  
  	SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W)
  
  This says that the file uucp.ucbarpa contains the list of UUCP sites
  connected to ucbarpa.Berkeley.EDU.  The $=W class will be used to
! store this list.  [The machine ucbarpa is gone now, but I've left
  this out-of-date configuration file around to demonstrate how you
  might do this.]
  
  The siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing
  more than a sequence of SITE macros describing connectivity.  For
  example:
--- 435,460 ----
  
  reads the file uucp.ucbvax for local connection information.  The
  second parameter is the local name (in this case just "ucbvax" since
! it is locally connected, and hence a UUCP hostname).  The third
! parameter is the name of both a macro to store the local name (in
! this case, $U) and the name of the class (e.g., $=U) in which to store
! the host information read from the file.  Another SITECONFIG line reads
  
  	SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W)
  
  This says that the file uucp.ucbarpa contains the list of UUCP sites
  connected to ucbarpa.Berkeley.EDU.  The $=W class will be used to
! store this list, and $W is defined to be ucbarpa.Berkeley.EDU, that
! is, the name of the relay to which the hosts listed in uucp.ucbarpa
! are connected.  [The machine ucbarpa is gone now, but I've left
  this out-of-date configuration file around to demonstrate how you
  might do this.]
  
+ Note that the case of SITECONFIG with a third parameter of ``U'' is
+ special; the second parameter is assumed to be the UUCP name of the
+ local site, rather than the name of a remote site, and the UUCP name
+ is entered into $=w (the list of local hostnames) as $U.UUCP.
+ 
  The siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing
  more than a sequence of SITE macros describing connectivity.  For
  example:
***************
*** 547,553 ****
  to be converted to "user@decvax.dec.com" and "user@research.att.com"
  respectively.
  
! This could also be used to look hosts in a database map:
  
  	LOCAL_RULE_3
  	R$* < @ $+ > $*		$: $1 < @ $(hostmap $2 $) > $3
--- 572,578 ----
  to be converted to "user@decvax.dec.com" and "user@research.att.com"
  respectively.
  
! This could also be used to look up hosts in a database map:
  
  	LOCAL_RULE_3
  	R$* < @ $+ > $*		$: $1 < @ $(hostmap $2 $) > $3
***************
*** 559,565 ****
  via MX records.  For example, you might have:
  
  	LOCAL_RULE_0
! 	R$+ < @ cnmat.Berkeley.EDU >	$#uucp $@ cnmat $: $1
  
  You would use this if you had installed an MX record for cnmat.Berkeley.EDU
  pointing at this host; this rule catches the message and forwards it on
--- 584,590 ----
  via MX records.  For example, you might have:
  
  	LOCAL_RULE_0
! 	R$+ <@ host.dom.ain.>	$#uucp $@ cnmat $: $1 < @ host.dom.ain.>
  
  You would use this if you had installed an MX record for cnmat.Berkeley.EDU
  pointing at this host; this rule catches the message and forwards it on
***************
*** 585,593 ****
  
  	MASQUERADE_AS(host.domain)
  
! This causes outgoing SMTP mail to be labelled as coming from the
  indicated domain, rather than $j.  One normally masquerades as one
! of your own subdomains (for example, it's unlikely that I would
  choose to masquerade as an MIT site).
  
  The masquerade name is not normally canonified, so it is important
--- 610,618 ----
  
  	MASQUERADE_AS(host.domain)
  
! This causes outgoing SMTP mail to be labeled as coming from the
  indicated domain, rather than $j.  One normally masquerades as one
! of one's own subdomains (for example, it's unlikely that I would
  choose to masquerade as an MIT site).
  
  The masquerade name is not normally canonified, so it is important
***************
*** 628,636 ****
  	define(`MAIL_HUB', mailer:hostname)
  
  Again, ``mailer:'' defaults to "smtp".  If you define both LOCAL_RELAY
! and MAIL_HUB, unqualified names and names in class L will be sent to
! the LOCAL_RELAY and other local names will be sent to MAIL_HUB.  For
! example, if are on machine mastodon.CS.Berkeley.EDU, the following
  combinations of settings will have the indicated effects:
  
  email sent to....	eric			  eric@mastodon.CS.Berkeley.EDU
--- 653,663 ----
  	define(`MAIL_HUB', mailer:hostname)
  
  Again, ``mailer:'' defaults to "smtp".  If you define both LOCAL_RELAY
! and MAIL_HUB, unqualified names will be sent to the LOCAL_RELAY and
! other local names will be sent to MAIL_HUB.  Names in $=L will be
! delivered locally, so you MUST have aliases or .forward files for them.
! 
! For example, if are on machine mastodon.CS.Berkeley.EDU, the following
  combinations of settings will have the indicated effects:
  
  email sent to....	eric			  eric@mastodon.CS.Berkeley.EDU
***************
*** 1081,1087 ****
  hack		Local hacks.  These can be referenced using the HACK
  		macro.  They shouldn't be of more than voyeuristic
  		interest outside the .Berkeley.EDU domain, but who knows?
! 		We've all got our own peccadilloes.
  
  siteconfig	Site configuration -- e.g., tables of locally connected
  		UUCP sites.
--- 1108,1114 ----
  hack		Local hacks.  These can be referenced using the HACK
  		macro.  They shouldn't be of more than voyeuristic
  		interest outside the .Berkeley.EDU domain, but who knows?
! 		We've all got our own peccadillos.
  
  siteconfig	Site configuration -- e.g., tables of locally connected
  		UUCP sites.
***************
*** 1197,1201 ****
     5	locally interpreted names (overrides $R)
     6	local configuration (at top of file)
     7	mailer definitions
!    8	special local name recognition (late in ruleset 3)
     9	special local rulesets (1 and 2)
--- 1224,1228 ----
     5	locally interpreted names (overrides $R)
     6	local configuration (at top of file)
     7	mailer definitions
!    8
     9	special local rulesets (1 and 2)
*** cf/cf/vangogh.mc.OLD	Mon Jun  7 10:07:59 1993
--- cf/cf/vangogh.mc	Wed Jan 26 17:38:50 1994
***************
*** 34,43 ****
  #
  
  include(`../m4/cf.m4')
! VERSIONID(`@(#)vangogh.mc	8.1 (Berkeley) 6/7/93')
  DOMAIN(cs.exposed)dnl
  OSTYPE(bsd4.4)dnl
  MAILER(local)dnl
  MAILER(smtp)dnl
  define(`MCI_CACHE_SIZE', 5)
! Cw okeeffe
--- 34,44 ----
  #
  
  include(`../m4/cf.m4')
! VERSIONID(`@(#)vangogh.mc	8.2 (Berkeley) 1/26/94')
  DOMAIN(cs.exposed)dnl
  OSTYPE(bsd4.4)dnl
  MAILER(local)dnl
  MAILER(smtp)dnl
  define(`MCI_CACHE_SIZE', 5)
! Cw okeeffe.CS.Berkeley.EDU
! Cw python.CS.Berkeley.EDU
*** cf/domain/Berkeley.m4.OLD	Mon Dec 20 10:49:11 1993
--- cf/domain/Berkeley.m4	Fri Feb 18 13:04:17 1994
***************
*** 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
--- 33,41 ----
  # SUCH DAMAGE.
  #
  divert(0)
! VERSIONID(`@(#)Berkeley.m4	8.5 (Berkeley) 2/18/94')
  define(`UUCP_RELAY', `ucbvax.Berkeley.EDU')dnl
! define(`BITNET_RELAY', `CMSA.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/allmasquerade.m4.OLD	Wed Jul  7 14:59:27 1993
--- cf/feature/allmasquerade.m4	Sat Jan 22 09:47:51 1994
***************
*** 34,41 ****
  #
  
  divert(0)
! VERSIONID(`@(#)allmasquerade.m4	8.1 (Berkeley) 7/7/93')
  divert(-1)
  
  
! define(`_ALL_MASQUERADE_')
--- 34,41 ----
  #
  
  divert(0)
! VERSIONID(`@(#)allmasquerade.m4	8.2 (Berkeley) 1/22/94')
  divert(-1)
  
  
! define(`_ALL_MASQUERADE_', 1)
*** cf/feature/bitdomain.m4.OLD	Tue Nov 30 09:01:07 1993
--- cf/feature/bitdomain.m4	Sat Feb 19 07:56:20 1994
***************
*** 34,40 ****
  #
  
  divert(0)
! VERSIONID(`@(#)bitdomain.m4	8.4 (Berkeley) 11/30/93')
  divert(-1)
  
  
--- 34,40 ----
  #
  
  divert(0)
! VERSIONID(`@(#)bitdomain.m4	8.6 (Berkeley) 2/19/94')
  divert(-1)
  
  
***************
*** 43,49 ****
  POPDIVERT
  
  
! PUSHDIVERT(8)
  # handle BITNET mapping
! R$* < @ $+ .BITNET. > $*	$: $1 < @ $(bitdomain $2 $: $2.BITNET. $) > $3
  POPDIVERT
--- 43,49 ----
  POPDIVERT
  
  
! PUSHDIVERT(2)
  # handle BITNET mapping
! R$* < @ $+ .BITNET > $*		$: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3
  POPDIVERT
*** cf/feature/uucpdomain.m4.OLD	Tue Nov 30 09:01:08 1993
--- cf/feature/uucpdomain.m4	Sat Feb 19 07:56:20 1994
***************
*** 34,40 ****
  #
  
  divert(0)
! VERSIONID(`@(#)uucpdomain.m4	8.4 (Berkeley) 11/30/93')
  divert(-1)
  
  
--- 34,40 ----
  #
  
  divert(0)
! VERSIONID(`@(#)uucpdomain.m4	8.6 (Berkeley) 2/19/94')
  divert(-1)
  
  
***************
*** 43,49 ****
  POPDIVERT
  
  
! PUSHDIVERT(8)
  # handle UUCP mapping
! R$* < @ $+ .UUCP. > $*		$: $1 < @ $(uudomain $2 $: $2.UUCP. $) > $3
  POPDIVERT
--- 43,49 ----
  POPDIVERT
  
  
! PUSHDIVERT(2)
  # handle UUCP mapping
! R$* < @ $+ .UUCP > $*		$: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3
  POPDIVERT
*** cf/m4/nullrelay.m4.OLD	Fri Sep  3 09:20:38 1993
--- cf/m4/nullrelay.m4	Tue Feb  1 10:16:32 1994
***************
*** 34,40 ****
  #
  divert(0)
  
! VERSIONID(`@(#)nullrelay.m4	8.4 (Berkeley) 9/3/93')
  
  #
  #  This configuration applies only to relay-only hosts.  They send
--- 34,40 ----
  #
  divert(0)
  
! VERSIONID(`@(#)nullrelay.m4	8.5 (Berkeley) 2/1/94')
  
  #
  #  This configuration applies only to relay-only hosts.  They send
***************
*** 266,272 ****
  ifdef(`_NO_CANONIFY_', `dnl',
  `# eliminate local host if present
  R@ $=w $=: $+		$@ @ $M $2 $3			@thishost ...
! R@ $+			$@ $1				@somewhere ...
  
  R$+ @ $=w		$@ $1 @ $M			...@thishost
  R$+ @ $+		$@ $1 @ $2			...@somewhere
--- 266,272 ----
  ifdef(`_NO_CANONIFY_', `dnl',
  `# eliminate local host if present
  R@ $=w $=: $+		$@ @ $M $2 $3			@thishost ...
! R@ $+			$@ @ $1				@somewhere ...
  
  R$+ @ $=w		$@ $1 @ $M			...@thishost
  R$+ @ $+		$@ $1 @ $2			...@somewhere
*** cf/m4/proto.m4.OLD	Thu Jan 13 06:40:24 1994
--- cf/m4/proto.m4	Fri Mar  4 09:10:36 1994
***************
*** 34,40 ****
  #
  divert(0)
  
! VERSIONID(`@(#)proto.m4	8.30 (Berkeley) 1/12/94')
  
  MAILER(local)dnl
  
--- 34,40 ----
  #
  divert(0)
  
! VERSIONID(`@(#)proto.m4	8.45 (Berkeley) 3/4/94')
  
  MAILER(local)dnl
  
***************
*** 118,129 ****
  # who gets all local email traffic ($R has precedence for unqualified names)
  DH`'ifdef(`MAIL_HUB', MAIL_HUB)
  
! # who I masquerade as (can be $j)
! DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME, $j)
  
  # class L: names that should be delivered locally, even if we have a relay
  # class E: names that should be exposed as from this host, even if we masquerade
! CLroot
  CEroot
  undivert(5)dnl
  
--- 118,129 ----
  # who gets all local email traffic ($R has precedence for unqualified names)
  DH`'ifdef(`MAIL_HUB', MAIL_HUB)
  
! # who I masquerade as (null for no masquerading)
! DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
  
  # class L: names that should be delivered locally, even if we have a relay
  # class E: names that should be exposed as from this host, even if we masquerade
! #CLroot
  CEroot
  undivert(5)dnl
  
***************
*** 171,177 ****
  Oa`'confALIAS_WAIT
  
  # location of alias file
! OA`'ifdef(`ALIAS_FILE', ALIAS_FILE, /etc/aliases)
  
  # minimum number of free blocks on filesystem
  Ob`'confMIN_FREE_BLOCKS
--- 171,177 ----
  Oa`'confALIAS_WAIT
  
  # location of alias file
! OA`'ifdef(`ALIAS_FILE', `ALIAS_FILE', /etc/aliases)
  
  # minimum number of free blocks on filesystem
  Ob`'confMIN_FREE_BLOCKS
***************
*** 360,366 ****
  #########################
  
  H?P?Return-Path: $g
! HReceived: $?sfrom $s $.$?_($_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
  H?D?Resent-Date: $a
  H?D?Date: $a
  H?F?Resent-From: $q
--- 360,366 ----
  #########################
  
  H?P?Return-Path: $g
! HReceived: $?sfrom $s $.$?_($?s$|from $.$_) $.by $j ($v/$Z)$?r with $r$. id $i$?u for $u$.; $b
  H?D?Resent-Date: $a
  H?D?Date: $a
  H?F?Resent-From: $q
***************
*** 443,451 ****
  R$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
  ifdef(`_NO_UUCP_', `dnl',
  `R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
! R$* < @ [ $+ ] > $*		$: $1 < @ [[ $2 ]] > $3		catch [a.b.c.d]
! R$* < @ [ $=w ] > $*		$: $1 < @ $j . > $3		self-literal
! R$* < @ [[ $+ ]] > $*		$: $1 < @ [ $2 ] > $3		strip dbl [[]]
  ifdef(`DOMAIN_TABLE', `
  # look up unqualified domains in the domain table
  R$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
--- 443,451 ----
  R$* < @ localhost . $m > $*	$: $1 < @ $j . > $2		local domain
  ifdef(`_NO_UUCP_', `dnl',
  `R$* < @ localhost . UUCP > $*	$: $1 < @ $j . > $2		.UUCP domain')
! R$* < @ [ $+ ] > $*		$: $1 < @@ [ $2 ] > $3		mark [a.b.c.d]
! R$* < @@ $=w > $*		$: $1 < @ $j . > $3		self-literal
! R$* < @@ $+ > $*		$@ $1 < @ $2 > $3		canon IP addr
  ifdef(`DOMAIN_TABLE', `
  # look up unqualified domains in the domain table
  R$* < @ $- > $*			$: $1 < @ $(domaintable $2 $) > $3',
***************
*** 483,490 ****
  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
  R$* < @ $j > $*			$: $1 < @ $j . > $2
  
--- 483,488 ----
***************
*** 496,504 ****
  
  R$*<@>			$@ $1				handle <> and list:;
  
- # resolve numeric addresses to name if possible
- R$* < @ [ $+ ] > $*	$: $1 < @ $[ [$2] $] > $3	lookup numeric internet addr
- 
  # strip trailing dot off possibly canonical name
  R$* < @ $+ . > $*	$1 < @ $2 > $3
  
--- 494,499 ----
***************
*** 533,545 ****
  S0
  
  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
- 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')
--- 528,539 ----
  S0
  
  R<@>			$#_LOCAL_ $: <>			special case error msgs
! R$* : $* ;		$#error $@ USAGE $: "list:; syntax illegal for recipient addresses"
  R<@ $+>			$#error $@ USAGE $: "user address required"
+ R<$* : $* >		$#error $@ USAGE $: "colon illegal in host name part"
  
  ifdef(`_MAILER_smtp_',
  `# handle numeric address spec
  R$* < @ [ $+ ] > $*	$: $>_SET_98_ $1 < @ [ $2 ] > $3	numeric internet spec
  R$* < @ [ $+ ] > $*	$#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3	still numeric: send',
  	`dnl')
***************
*** 551,565 ****
  
  # handle local hacks
  R$*			$: $>_SET_98_ $1
- ifdef(`MAILER_TABLE',
- `
- # try mailer table lookup
- R$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
- R< $+ . > $*		$: < $1 > $2			strip trailing dot
- R< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
- R< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
- R< $+ > $*		$: $>90 <$1> $2			try domain',
- `dnl')
  
  # short circuit local delivery so forwarded email works
  ifdef(`_LOCAL_NOT_STICKY_',
--- 545,550 ----
***************
*** 572,577 ****
--- 557,571 ----
  R$+ < $+ @ >		$#_LOCAL_ $: $1			nope, local address',
  `R$+ < $+ @ $+ >		$#_LOCAL_ $: $1			yep ....
  R$+ < $+ @ >		$#_LOCAL_ $: @ $1			nope, local address')')
+ ifdef(`MAILER_TABLE',
+ `
+ # not local -- try mailer table lookup
+ R$* <@ $+ > $*		$: < $2 > $1 < @ $2 > $3	extract host name
+ R< $+ . > $*		$: < $1 > $2			strip trailing dot
+ R< $+ > $*		$: < $(mailertable $1 $) > $2	lookup
+ R< $- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
+ R< $+ > $*		$: $>90 <$1> $2			try domain',
+ `dnl')
  undivert(4)dnl
  
  ifdef(`_NO_UUCP_', `dnl',
***************
*** 608,614 ****
  	`dnl')')
  ifdef(`_MAILER_usenet_', `
  # addresses sent to net.group.USENET will get forwarded to a newsgroup
! R$+ . USENET.		$#usenet $: $1',
  	`dnl')
  
  ifdef(`_LOCAL_RULES_',
--- 602,608 ----
  	`dnl')')
  ifdef(`_MAILER_usenet_', `
  # addresses sent to net.group.USENET will get forwarded to a newsgroup
! R$+ . USENET		$#usenet $: $1',
  	`dnl')
  
  ifdef(`_LOCAL_RULES_',
***************
*** 646,653 ****
  S5
  
  # see if we have a relay or a hub
! R$+			$: $>_SET_95_ < $R > $1			try relay
! R$+			$: $>_SET_95_ < $H > $1			try hub')
  ifdef(`MAILER_TABLE',
  `
  
--- 640,650 ----
  S5
  
  # see if we have a relay or a hub
! R$+			$: < $R > $1			try relay
! R< > $+			$: < $H > $1			try hub
! R< > $+			$@ $1				nope, give up
! R< $- : $+ > $+		$: $>_SET_95_ < $1 : $2 > $3 < @ $2 >
! R< $+ > $+		$@ $>_SET_95_ < $1 > $2 < @ $1 >')
  ifdef(`MAILER_TABLE',
  `
  
***************
*** 657,666 ****
  ###################################################################
  
  S90
! R<$- . $+ > $*		$: < $(mailertable .$2 $@ $1 $) > $3	lookup
! R<$- : $+ > $*		$# $1 $@ $2 $: $3		check -- resolved?
! R< . $+ > $*		$@ $>90 <$1> $2			no -- strip & try again
! R<$*> $*		$@ $2				no match',
  `dnl')
  
  ###################################################################
--- 654,665 ----
  ###################################################################
  
  S90
! R$* <$- . $+ > $*	$: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
! R$* <$- : $+ > $*	$# $2 $@ $3 $: $4		check -- resolved?
! R$* < . $+ > $*		$@ $>90 $1 . <$2> $3		no -- strip & try again
! R$* < $* > $*		$: < $(mailertable . $@ $1$2 $) > $3	try "."
! R<$- : $+ > $*		$# $1 $@ $2 $: $3		"." found?
! R< $* > $*		$@ $2				no mailertable match',
  `dnl')
  
  ###################################################################
*** cf/m4/version.m4.OLD	Sat Jan 22 08:29:11 1994
--- cf/m4/version.m4	Sun Mar 13 09:44:59 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.5 (Berkeley) 1/13/94')
  #
  divert(0)
  # Configuration version number
! DZ8.6.5
--- 32,39 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! VERSIONID(`@(#)version.m4	8.6.6.1 (Berkeley) 3/13/94')
  #
  divert(0)
  # Configuration version number
! DZ8.6.6
*** cf/mailer/fax.m4.OLD	Mon Jun  7 10:11:19 1993
--- cf/mailer/fax.m4	Mon Jan 24 12:06:57 1994
***************
*** 37,48 ****
  
  ifdef(`FAX_MAILER_PATH',,
  	`define(`FAX_MAILER_PATH', /usr/local/lib/fax/mailfax)')
  POPDIVERT
  ####################################
  ###   FAX Mailer specification   ###
  ####################################
  
! VERSIONID(`@(#)fax.m4	8.1 (Berkeley) 6/7/93')
  
! Mfax,		P=FAX_MAILER_PATH, F=DFMhu, S=14, R=24, M=100000,
  		A=mailfax $u $h $f
--- 37,50 ----
  
  ifdef(`FAX_MAILER_PATH',,
  	`define(`FAX_MAILER_PATH', /usr/local/lib/fax/mailfax)')
+ ifdef(`FAX_MAILER_MAX',,
+ 	`define(`FAX_MAILER_MAX', 100000)')
  POPDIVERT
  ####################################
  ###   FAX Mailer specification   ###
  ####################################
  
! VERSIONID(`@(#)fax.m4	8.2 (Berkeley) 1/24/94')
  
! Mfax,		P=FAX_MAILER_PATH, F=DFMhu, S=14, R=24, M=FAX_MAILER_MAX,
  		A=mailfax $u $h $f
No differences encountered
*** cf/mailer/pop.m4.OLD	Wed Dec 15 06:36:42 1993
--- cf/mailer/pop.m4	Sat Feb 19 07:55:43 1994
***************
*** 39,54 ****
  
  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
--- 39,53 ----
  
  POPDIVERT
  
  ####################################
  ###   POP Mailer specification   ###
  ####################################
  
! VERSIONID(`@(#)pop.m4	8.2 (Berkeley) 2/19/94')
  
  Mpop,		P=POP_MAILER_PATH, F=CONCAT(`lsDFM', POP_MAILER_FLAGS), S=10, R=20/40,
  		A=POP_MAILER_ARGS
+ 
+ LOCAL_CONFIG
+ # POP mailer is a pseudo-domain
+ CPPOP
*** cf/mailer/smtp.m4.OLD	Mon Dec 27 14:49:22 1993
--- cf/mailer/smtp.m4	Mon Feb 14 08:31:21 1994
***************
*** 40,51 ****
  ###   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
  
--- 40,51 ----
  ###   SMTP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)smtp.m4	8.15 (Berkeley) 2/14/94')
  
  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, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')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, ')ifdef(`SMTP_MAILER_MAX', `M=SMTP_MAILER_MAX, ')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
  
***************
*** 82,89 ****
  R$* <@> $*		$@ $1 <@> $2			pass null host through
  R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
  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
  
  
--- 82,90 ----
  R$* <@> $*		$@ $1 <@> $2			pass null host through
  R< @ $* > $*		$@ < @ $1 > $2			pass route-addr through
  R$=E < @ $=w . >	$@ $1 < @ $2 >			exposed user as is
! R$* < @ $=w . >		$: $1 < @ $2 @ $M >		masquerade as domain
! R$* < @ $+ @ >		$@ $1 < @ $2 >			in case $M undefined
! R$* < @ $+ @ $+ >	$@ $1 < @ $3 >			$M is defined -- use it
  R$*			$@ $>61 $1			qualify unqual'ed names
  
  
*** cf/mailer/usenet.m4.OLD	Mon Jun  7 10:11:32 1993
--- cf/mailer/usenet.m4	Mon Jan 24 12:07:30 1994
***************
*** 35,47 ****
  
  ifdef(`USENET_MAILER_PATH',, `define(`USENET_MAILER_PATH', /usr/lib/news/inews)')
  ifdef(`USENET_MAILER_FLAGS',, `define(`USENET_MAILER_FLAGS', `rlsDFMmn')')
! ifdef(`USENET_MAILER_ARGS',, `define(`USENET_MAILER_ARGS', `-m -h -n')')
  POPDIVERT
  ####################################
  ###  USENET Mailer specification ###
  ####################################
  
! VERSIONID(`@(#)usenet.m4	8.1 (Berkeley) 6/7/93')
  
! Musenet,	P=USENET_MAILER_PATH, F=USENET_MAILER_FLAGS, S=10, R=20,
! 		A=inews USENET_MAILER_ARGS $u
--- 35,47 ----
  
  ifdef(`USENET_MAILER_PATH',, `define(`USENET_MAILER_PATH', /usr/lib/news/inews)')
  ifdef(`USENET_MAILER_FLAGS',, `define(`USENET_MAILER_FLAGS', `rlsDFMmn')')
! ifdef(`USENET_MAILER_ARGS',, `define(`USENET_MAILER_ARGS', `inews -m -h -n')')
  POPDIVERT
  ####################################
  ###  USENET Mailer specification ###
  ####################################
  
! VERSIONID(`@(#)usenet.m4	8.3 (Berkeley) 1/24/94')
  
! Musenet,	P=USENET_MAILER_PATH, F=USENET_MAILER_FLAGS, S=10, R=20,ifdef(`USENET_MAILER_MAX', ` M=USENET_MAILER_MAX,')
! 		A=USENET_MAILER_ARGS $u
*** cf/mailer/uucp.m4.OLD	Mon Jan 10 08:01:11 1994
--- cf/mailer/uucp.m4	Wed Feb 16 07:58:07 1994
***************
*** 34,40 ****
  #
  
  ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')
! ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$f -gC $h!rmail ($u)')')
  ifdef(`UUCP_MAILER_FLAGS',, `define(`UUCP_MAILER_FLAGS', `')')
  ifdef(`UUCP_MAX_SIZE',, `define(`UUCP_MAX_SIZE', 100000)')
  POPDIVERT
--- 34,40 ----
  #
  
  ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')
! ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$f -gC $h!rmail ($u)')')
  ifdef(`UUCP_MAILER_FLAGS',, `define(`UUCP_MAILER_FLAGS', `')')
  ifdef(`UUCP_MAX_SIZE',, `define(`UUCP_MAX_SIZE', 100000)')
  POPDIVERT
***************
*** 42,48 ****
  ###   UUCP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)uucp.m4	8.13 (Berkeley) 1/10/94')
  
  #
  #  There are innumerable variations on the UUCP mailer.  It really
--- 42,48 ----
  ###   UUCP Mailer specification   ###
  #####################################
  
! VERSIONID(`@(#)uucp.m4	8.15 (Berkeley) 2/16/94')
  
  #
  #  There are innumerable variations on the UUCP mailer.  It really
***************
*** 151,157 ****
  
  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
--- 151,157 ----
  
  PUSHDIVERT(4)
  # resolve locally connected UUCP links
! R$* < @ $=Z . UUCP. > $*	$#uucp-uudom $@ $2 $: $1 < @ $2 .UUCP. > $3
  R$* < @ $=Y . UUCP. > $*	$#uucp-new $@ $2 $: $1 < @ $2 .UUCP. > $3
  R$* < @ $=U . UUCP. > $*	$#uucp-old $@ $2 $: $1 < @ $2 .UUCP. > $3
  POPDIVERT
*** cf/ostype/bsd4.3.m4.OLD	Mon Jun  7 10:11:42 1993
--- cf/ostype/bsd4.3.m4	Thu Feb 10 09:03:27 1994
***************
*** 34,38 ****
  #
  
  divert(0)
! VERSIONID(`@(#)bsd4.3.m4	8.1 (Berkeley) 6/7/93')
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
--- 34,39 ----
  #
  
  divert(0)
! VERSIONID(`@(#)bsd4.3.m4	8.2 (Berkeley) 2/10/94')
  define(`QUEUE_DIR', /usr/spool/mqueue)dnl
+ define(`UUCP_MAILER_ARGS', `uux - -r -z -a$f $h!rmail ($u)')dnl
*** cf/ostype/bsd4.4.m4.OLD	Mon Jun  7 10:11:45 1993
--- cf/ostype/bsd4.4.m4	Thu Feb 10 09:03:27 1994
***************
*** 35,41 ****
  #
  
  divert(0)
! VERSIONID(`@(#)bsd4.4.m4	8.1 (Berkeley) 6/7/93')
  define(`HELP_FILE', /usr/share/misc/sendmail.hf)dnl
  define(`STATUS_FILE', /var/log/sendmail.st)dnl
  define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)dnl
--- 35,42 ----
  #
  
  divert(0)
! VERSIONID(`@(#)bsd4.4.m4	8.2 (Berkeley) 2/10/94')
  define(`HELP_FILE', /usr/share/misc/sendmail.hf)dnl
  define(`STATUS_FILE', /var/log/sendmail.st)dnl
  define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)dnl
+ define(`UUCP_MAILER_ARGS', `uux - -r -z -a$f $h!rmail ($u)')dnl
*** cf/ostype/domainos.m4.OLD	Sun Jan 23 16:47:31 1994
--- cf/ostype/domainos.m4	Sun Jan 23 16:47:23 1994
***************
*** 0 ****
--- 1,42 ----
+ 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(`@(#)domainos.m4	8.1 (Berkeley) 1/23/94')
+ divert(-1)
+ 
+ define(`ALIAS_FILE', /usr/lib/aliases)
+ define(`STATUS_FILE', /usr/lib/sendmail.st)
+ define(`QUEUE_DIR', /usr/spool/mqueue)
*** cf/ostype/irix.m4.OLD	Sat Nov 27 09:29:26 1993
--- cf/ostype/irix.m4	Tue Feb  1 11:51:31 1994
***************
*** 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
--- 34,41 ----
  #
  
  divert(0)
! VERSIONID(`@(#)irix.m4	8.4 (Berkeley) 2/1/94')
! define(`LOCAL_MAILER_FLAGS', Ehm)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/solaris2.m4.OLD	Sat Aug  7 09:11:55 1993
--- cf/ostype/solaris2.m4	Sun Jan 23 16:48:06 1994
***************
*** 34,43 ****
  #
  
  divert(0)
! VERSIONID(`@(#)solaris2.m4	8.1 (Berkeley) 8/7/93')
  divert(-1)
  
  define(`ALIAS_FILE', /etc/mail/aliases)
! define(`HELP_FILE', /var/lib/sendmail.hf)
  define(`STATUS_FILE', /etc/mail/sendmail.st)
  define(`LOCAL_MAILER_FLAGS', `fSn')
--- 34,43 ----
  #
  
  divert(0)
! VERSIONID(`@(#)solaris2.m4	8.2 (Berkeley) 1/23/94')
  divert(-1)
  
  define(`ALIAS_FILE', /etc/mail/aliases)
! define(`HELP_FILE', /etc/mail/sendmail.hf)
  define(`STATUS_FILE', /etc/mail/sendmail.st)
  define(`LOCAL_MAILER_FLAGS', `fSn')
*** cf/sh/makeinfo.sh.OLD	Fri Jul 23 14:55:52 1993
--- cf/sh/makeinfo.sh	Fri Mar  4 07:33:00 1994
***************
*** 32,38 ****
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #	@(#)makeinfo.sh	8.3 (Berkeley) 7/23/93
  #
  
  usewhoami=0
--- 32,38 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #	@(#)makeinfo.sh	8.4 (Berkeley) 3/4/94
  #
  
  usewhoami=0
***************
*** 73,77 ****
  else
  	host=`uname -n`
  fi
! echo '#####' built by $user on `date`
! echo '#####' in `pwd` on $host
--- 73,77 ----
  else
  	host=`uname -n`
  fi
! echo '#####' built by $user@$host on `date`
! echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
*** doc/intro/Makefile.OLD	Tue Jun  8 17:25:01 1993
--- doc/intro/Makefile	Mon Feb 28 10:18:07 1994
***************
*** 1,4 ****
! #	@(#)Makefile	8.1 (Berkeley) 6/8/93
  
  DIR=	smm/09.sendmail
  SRCS=	intro.me
--- 1,4 ----
! #	@(#)Makefile	8.2 (Berkeley) 2/28/94
  
  DIR=	smm/09.sendmail
  SRCS=	intro.me
***************
*** 7,12 ****
--- 7,13 ----
  all: intro.ps
  
  intro.ps: ${SRCS}
+ 	rm -f ${.TARGET}
  	${PIC} ${SRCS} | ${ROFF} > ${.TARGET}
  
  .include <bsd.doc.mk>
*** doc/op/Makefile.OLD	Tue Jun  8 17:24:19 1993
--- doc/op/Makefile	Mon Feb 28 10:17:05 1994
***************
*** 1,4 ****
! #	@(#)Makefile	8.1 (Berkeley) 6/8/93
  
  DIR=	smm/08.sendmailop
  SRCS=	op.me
--- 1,4 ----
! #	@(#)Makefile	8.2 (Berkeley) 2/28/94
  
  DIR=	smm/08.sendmailop
  SRCS=	op.me
***************
*** 7,12 ****
--- 7,13 ----
  all: op.ps
  
  op.ps: ${SRCS}
+ 	rm -f ${.TARGET}
  	${PIC} ${SRCS} | ${EQN} | ${ROFF} > ${.TARGET}
  
  .include <bsd.doc.mk>
*** doc/op/op.me.OLD	Wed Jan 12 06:52:00 1994
--- doc/op/op.me	Thu Mar  3 08:09:48 1994
***************
*** 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'
--- 30,36 ----
  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  .\" SUCH DAMAGE.
  .\"
! .\"	@(#)op.me	8.34 (Berkeley) 3/3/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.32
  .sp
  For Sendmail Version 8.6
  .)l
--- 69,75 ----
  Mammoth Project
  eric@CS.Berkeley.EDU
  .sp
! Version 8.34
  .sp
  For Sendmail Version 8.6
  .)l
***************
*** 2471,2480 ****
  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
--- 2471,2492 ----
  and assigned to the
  .b $u
  macro.
+ As a special case, if the value to
+ .b $#
+ is
+ .q local
+ and the first character of the
+ .b $:
+ value is
+ .q @ ,
+ the
+ .q @
+ is stripped off, and a flag is set in the address descriptor
+ that causes sendmail to not do ruleset 5 processing.
  .pp
! Normally, a rule that matches is retried,
  that is,
! the rule loops until it fails.
  A RHS may also be preceded by a
  .b $@
  or a
***************
*** 3387,3393 ****
  This is the default if the
  .b L
  flag is set.
! Note that setting this is not
  sufficient to get full eight bit data passed through
  .i sendmail .
  If the
--- 3399,3405 ----
  This is the default if the
  .b L
  flag is set.
! Note that clearing this option is not
  sufficient to get full eight bit data passed through
  .i sendmail .
  If the
***************
*** 6875,6881 ****
  .\"Eric Allman
  .\"Britton-Lee, Inc.
  .\".sp
! .\"Version 8.32
  .\".ce 0
  .bp 2
  .rs
--- 6887,6893 ----
  .\"Eric Allman
  .\"Britton-Lee, Inc.
  .\".sp
! .\"Version 8.34
  .\".ce 0
  .bp 2
  .rs
*** doc/usenix/Makefile.OLD	Mon Jun  7 10:18:10 1993
--- doc/usenix/Makefile	Mon Feb 28 10:17:36 1994
***************
*** 1,4 ****
! #	@(#)Makefile	8.1 (Berkeley) 6/7/93
  
  SRCS=	usenix.me
  MACROS=	-me
--- 1,4 ----
! #	@(#)Makefile	8.2 (Berkeley) 2/28/94
  
  SRCS=	usenix.me
  MACROS=	-me
***************
*** 6,11 ****
--- 6,12 ----
  all: usenix.ps
  
  usenix.ps: ${SRCS}
+ 	rm -f ${.TARGET}
  	${PIC} ${SRCS} | ${ROFF} > ${.TARGET}
  
  .include <bsd.doc.mk>
*** praliases/praliases.c.OLD	Wed Sep 22 10:55:40 1993
--- praliases/praliases.c	Sun Mar  6 08:59:32 1994
***************
*** 39,45 ****
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)praliases.c	8.2 (Berkeley) 9/22/93";
  #endif /* not lint */
  
  #include <ndbm.h>
--- 39,45 ----
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)praliases.c	8.3 (Berkeley) 3/6/94";
  #endif /* not lint */
  
  #include <ndbm.h>
***************
*** 85,99 ****
  	if (db = dbopen(buf, O_RDONLY, 0444 , DB_HASH, NULL)) {
  		if (!argc) {
  			while(!db->seq(db, &newdbkey, &newdbcontent, R_NEXT))
! 				printf("%s:%s\n", newdbkey.data,
! 						newdbcontent.data);
  		}
  		else for (; *argv; ++argv) {
  			newdbkey.data = *argv;
  			newdbkey.size = strlen(*argv) + 1;
! 			if ( !db->get(db, &newdbkey, &newdbcontent, 0) )
! 				printf("%s:%s\n", newdbkey.data,
! 					newdbcontent.data);
  			else
  				printf("%s: No such key\n",
  					newdbkey.data);
--- 85,100 ----
  	if (db = dbopen(buf, O_RDONLY, 0444 , DB_HASH, NULL)) {
  		if (!argc) {
  			while(!db->seq(db, &newdbkey, &newdbcontent, R_NEXT))
! 				printf("%.*s:%.*s\n",
! 					newdbkey.size, newdbkey.data,
! 					newdbcontent.size, newdbcontent.data);
  		}
  		else for (; *argv; ++argv) {
  			newdbkey.data = *argv;
  			newdbkey.size = strlen(*argv) + 1;
! 			if (!db->get(db, &newdbkey, &newdbcontent, 0))
! 				printf("%s:%.*s\n", newdbkey.data,
! 					newdbcontent.size, newdbcontent.data);
  			else
  				printf("%s: No such key\n",
  					newdbkey.data);
***************
*** 110,116 ****
  			for (key = dbm_firstkey(dbp);
  			    key.dptr != NULL; key = dbm_nextkey(dbp)) {
  				content = dbm_fetch(dbp, key);
! 				(void)printf("%s:%s\n", key.dptr, content.dptr);
  			}
  		else for (; *argv; ++argv) {
  			key.dptr = *argv;
--- 111,119 ----
  			for (key = dbm_firstkey(dbp);
  			    key.dptr != NULL; key = dbm_nextkey(dbp)) {
  				content = dbm_fetch(dbp, key);
! 				(void)printf("%.*s:%.*s\n",
! 					key.dsize, key.dptr,
! 					content.dsize, content.dptr);
  			}
  		else for (; *argv; ++argv) {
  			key.dptr = *argv;
***************
*** 119,125 ****
  			if (!content.dptr)
  				(void)printf("%s: No such key\n", key.dptr);
  			else
! 				(void)printf("%s:%s\n", key.dptr, content.dptr);
  		}
  #ifdef NEWDB
  	}
--- 122,129 ----
  			if (!content.dptr)
  				(void)printf("%s: No such key\n", key.dptr);
  			else
! 				(void)printf("%s:%.*s\n", key.dptr,
! 					content.dsize, content.dptr);
  		}
  #ifdef NEWDB
  	}
*** src/Makefile.OLD	Mon Dec 20 10:52:10 1993
--- src/Makefile	Sat Mar  5 11:51:53 1994
***************
*** 1,4 ****
! #	@(#)Makefile	8.3 (Berkeley) 12/20/93
  
  PROG=	sendmail
  
--- 1,4 ----
! #	@(#)Makefile	8.4 (Berkeley) 2/3/94
  
  PROG=	sendmail
  
***************
*** 21,27 ****
  	util.c version.c
  DPADD=	
  LDADD=	
! MAN1=	newaliases.0
  MAN5=	aliases.0
  MAN8=	sendmail.0 
  LINKS=	/usr/sbin/sendmail /usr/bin/newaliases \
--- 21,27 ----
  	util.c version.c
  DPADD=	
  LDADD=	
! MAN1=	mailq.0 newaliases.0
  MAN5=	aliases.0
  MAN8=	sendmail.0 
  LINKS=	/usr/sbin/sendmail /usr/bin/newaliases \
*** src/Makefile.BSD43.OLD	Wed Feb  2 05:51:28 1994
--- src/Makefile.BSD43	Sat Mar  5 11:50:24 1994
***************
*** 8,13 ****
--- 8,18 ----
  #	This is based on work from Jim Oldroyd -- I believe he was
  #	using a fairly old Mt Xinu port.
  #
+ #	It should also work on UMIPS-BSD from MIPS, if you still have
+ #	any lying around.
+ #
+ #	@(#)Makefile.BSD43	8.2 (Berkeley) 3/5/94
+ #
  
  # use O=-O (usual) or O=-g (debugging)
  O=	-O
***************
*** 65,71 ****
  BINGRP=	kmem
  BINMODE=6555
  
! ALL=	sendmail aliases.0 newaliases.0 sendmail.0
  
  all: ${ALL}
  
--- 70,76 ----
  BINGRP=	kmem
  BINMODE=6555
  
! ALL=	sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
  
  all: ${ALL}
  
***************
*** 87,92 ****
--- 92,100 ----
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
  
+ mailq.0: mailq.1
+ 	nroff -h -mandoc mailq.1 > mailq.0
+ 
  newaliases.0: newaliases.1
  	nroff -h -mandoc newaliases.1 > newaliases.0
  
***************
*** 103,112 ****
  	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....
--- 111,120 ----
  	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 mailq.0 newaliases.0 sendmail.0
  
  clean:
! 	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
  
  # dependencies
  #   gross overkill, and yet still not quite enough....
*** src/Makefile.BSDI.OLD	Thu Feb  3 08:52:53 1994
--- src/Makefile.BSDI	Sat Mar  5 11:51:53 1994
***************
*** 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 BSDI's BSD/386 release 1.0.
! #
  
! # 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 -DNEWDB -DOLD_NEWDB
! 
! # environment definitions (e.g., -D_AIX3)
! ENVDEF= -DLA_TYPE=LA_SUBR
! 
! # 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=	-lutil -lkvm
! 
! # 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=
! 
! ###################  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/bin/newaliases ${DESTDIR}/usr/bin/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 -mandoc aliases.5 > aliases.0
! 
! newaliases.0: newaliases.1
! 	nroff -mandoc newaliases.1 > newaliases.0
! 
! sendmail.0: sendmail.8
! 	nroff -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
--- 1,32 ----
! #	@(#)Makefile.BSDI	8.1 (Berkeley) 2/26/94
  
! PROG=	sendmail
! DBMDEF=	-DNEWDB
! 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} ${LIBKVM}
! LDADD=	-lutil -lkvm
! MAN1=	mailq.0 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.DomainOS.OLD	Sat Jan 22 07:36:32 1994
--- src/Makefile.DomainOS	Tue Mar  8 10:00:08 1994
***************
*** 0 ****
--- 1,121 ----
+ #
+ #  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 DomainOS 10.3.5
+ #
+ #	@(#)Makefile.DomainOS	8.3 (Berkeley) 3/8/94
+ #
+ #
+ 
+ # 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
+ #	-DNDBM -DNEWDB -DYPCOMPAT -- use both plus YP compatility
+ #	-DNIS -- include client NIS support
+ # The really old (V7) DBM library is no longer supported.
+ # If YPCOMPAT is defined and /var/yp/Makefile exists, sendmail will build
+ #   both the NEWDB and DBM libraries (the DBM just for YP).
+ #
+ 
+ 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
+ # You might want to use the BIND 4.9 resolver library here
+ #LIBS=	-ldb -ldbm
+ LIBS=	-ldbm -lresolv
+ 
+ # 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/adm
+ 
+ # 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=	unistd.h dirent.h
+ 
+ ###################  end of user configuration flags  ######################
+ 
+ CFLAGS=	-I. -A nansi $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 mailq.0 newaliases.0 sendmail.0
+ 
+ all: ${ALL}
+ 
+ sendmail: ${BEFORE} ${OBJS}
+ 	${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
+ 
+ unistd.h:
+ 	cp /dev/null unistd.h
+ 
+ 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
+ 
+ mailq.0: mailq.1
+ 	nroff -h -mandoc mailq.1 > mailq.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 mailq.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.NetBSD.OLD	Mon Jan 10 07:29:03 1994
--- src/Makefile.NetBSD	Sat Mar  5 11:51:53 1994
***************
*** 1,9 ****
  #
  #  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
--- 1,10 ----
  #
  #  NetBSD Makefile
  #
+ #	@(#)Makefile.NetBSD	8.1 (Berkeley) 2/26/94
+ #	@Id: Makefile.NetBSD,v 1.3 1994/02/01 05:33:44 glass Exp $
+ #
  
  PROG=	sendmail
  
  # define the database format to use for aliases et al.  Can be -DNEWDB (for
***************
*** 14,20 ****
  # 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
--- 15,21 ----
  # 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 -DNIS
  
  #nasty warning about gcc 2.4.x caused bugs 
  CFLAGS=-I${.CURDIR} ${DBMDEF} -DNETISO
***************
*** 25,33 ****
  	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 \
--- 26,32 ----
  	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
! MAN1=	mailq.0 newaliases.0
  MAN5=	aliases.0
  MAN8=	sendmail.0 
  LINKS=	/usr/sbin/sendmail /usr/bin/newaliases \
***************
*** 34,41 ****
  	/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 \
--- 33,39 ----
  	/usr/sbin/sendmail /usr/bin/mailq
  BINDIR=	/usr/sbin
  BINOWN=	root
! BINMODE=4555
  
  beforeinstall:
  #	install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
*** src/Makefile.PTX.OLD	Wed Feb  9 09:42:29 1994
--- src/Makefile.PTX	Sat Mar  5 11:50:26 1994
***************
*** 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).
+ #
+ #	For Sequent DYNIX/ptx.
+ #
+ #	From Tim "Pinball Wizard" Wright <timw@sequent.com>.
+ #
+ #	@(#)Makefile.PTX	8.2 (Berkeley) 3/5/94
+ #
+ 
+ # use O=-O (usual) or O=-g (debugging)
+ 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=-I/usr/sww/include/db
+ INCDIRS=
+ 
+ # loader options
+ LDOPTS=
+ 
+ # library directories
+ #LIBDIRS=-L/usr/sww/lib
+ LIBDIRS=
+ 
+ # libraries required on your system
+ #LIBS=	-ldb -ldbm
+ LIBS=	-lsocket -linet -lnsl -lseq
+ 
+ # 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/bin/newaliases ${DESTDIR}/usr/bin/mailq
+ BINOWN=	root
+ BINGRP=	sys
+ 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
+ 
+ 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 mailq.0 newaliases.0 sendmail.0
+ 
+ clean:
+ 	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
+ 
+ # dependencies
+ #   gross overkill, and yet still not quite enough....
+ ${OBJS}: sendmail.h conf.h
*** src/Makefile.dist.OLD	Mon Dec 20 10:52:10 1993
--- src/Makefile.dist	Sat Mar  5 11:50:24 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).
  #
! #	@(#)Makefile.dist	8.9 (Berkeley) 12/20/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.11 (Berkeley) 3/5/94
  #
  
  # use O=-O (usual) or O=-g (debugging)
***************
*** 64,70 ****
  BINGRP=	kmem
  BINMODE=6555
  
! ALL=	sendmail aliases.0 newaliases.0 sendmail.0
  
  all: ${ALL}
  
--- 64,70 ----
  BINGRP=	kmem
  BINMODE=6555
  
! ALL=	sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
  
  all: ${ALL}
  
***************
*** 74,79 ****
--- 74,82 ----
  aliases.0: aliases.5
  	nroff -h -mandoc aliases.5 > aliases.0
  
+ mailq.0: mailq.1
+ 	nroff -h -mandoc mailq.1 > mailq.0
+ 
  newaliases.0: newaliases.1
  	nroff -h -mandoc newaliases.1 > newaliases.0
  
***************
*** 92,101 ****
  	${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....
--- 95,104 ----
  	${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 mailq.0 newaliases.0 sendmail.0
  
  clean:
! 	rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0
  
  # dependencies
  #   gross overkill, and yet still not quite enough....
*** src/READ_ME.OLD	Wed Jan 12 06:00:15 1994
--- src/READ_ME	Sun Mar 13 09:38:25 1994
***************
*** 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.
--- 30,36 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #	@(#)READ_ME	8.58 (Berkeley) 3/13/94
  #
  
  This directory contains the source files for sendmail.
***************
*** 138,143 ****
--- 138,149 ----
  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.]
  
+ [NOTE WELL: it is CRITICAL that you remove ndbm.o from libdb.a and
+ ndbm.h from the appropriate include directories if you want to get
+ ndbm support.  These files OVERRIDE calls to ndbm routines -- in
+ particular, if you leave ndbm.h in, you can find yourself using
+ the new db package even if you don't define NEWDB.]
+ 
  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
  format will be converted to NEWDB; that format will be used forever
***************
*** 179,184 ****
--- 185,191 ----
  		have to make -- see below.
  _AIX3		Define this if you are IBM AIX 3.x.
  RISCOS		Define this if you are running RISC/os from MIPS.
+ IRIX		Define this if you are running IRIX from SGI.
  _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.
  
***************
*** 204,215 ****
  		SYSTEM5.
  HASUNSETENV	Define this if your system library has the "unsetenv"
  		subroutine.
- HASSTATFS	Define this if you have the statfs(2) system call.  It's
- 		not a disaster to get this wrong -- but you do lose the
- 		queue free space code.
- HASUSTAT	Define this if you have the ustat(2) system call.  It's
- 		not a disaster to get this wrong -- but you do lose the
- 		queue free space code.
  HASSETSID	Define this if you have the setsid(2) system call.  This
  		is implied if your system appears to be POSIX compliant.
  HASINITGROUPS	Define this if you have the initgroups(3) routine.
--- 211,216 ----
***************
*** 270,288 ****
  		If you are an very old compiler you may need to define
  		this to be "char *".
  LA_TYPE		The type of load average your kernel supports.  These
! 		can be LA_SUBR (4) if you have the getloadavg(3) routine,
  		LA_MACH (5) to use MACH-style load averages (calls
! 		processor_set_info()), LA_FLOAT (3) if you read kmem and
! 		interpret the value as a floating point number, LA_INT (2)
! 		to interpret as a long integer, or LA_SHORT (6) to
! 		interpret as a short integer.  These last three have
! 		several other parameters that they try to divine: the
! 		name of your kernel, the name of the variable in the
! 		kernel to examine, the number of bits of precision in
! 		a fixed point load average, and so forth.  In desparation,
! 		use LA_ZERO (1) -- it always returns the load average as
! 		"zero" (and does so on all architectures).  The actual
! 		code is in conf.c -- it can be tweaked if you are brave.
  ERRLIST_PREDEFINED
  		If set, assumes that some header file defines sys_errlist.
  		This may be needed if you get type conflicts on this
--- 271,306 ----
  		If you are an very old compiler you may need to define
  		this to be "char *".
  LA_TYPE		The type of load average your kernel supports.  These
! 		can be one of:
! 		LA_ZERO (1) -- it always returns the load average as
! 			"zero" (and does so on all architectures).
! 		LA_SUBR (4) if you have the getloadavg(3) routine,
  		LA_MACH (5) to use MACH-style load averages (calls
! 			processor_set_info()),
! 		LA_PROCSTR (7) to read /proc/loadavg and interpret it
! 			as a string representing a floating-point
! 			number (Linux-style),
! 		LA_FLOAT (3) if you read kmem and interpret the value
! 			as a floating point number,
! 		LA_INT (2) to interpret as a long integer,
! 		LA_SHORT (6) to interpret as a short integer.
! 		These last three have several other parameters that they
! 		try to divine: the name of your kernel, the name of the
! 		variable in the kernel to examine, the number of bits of
! 		precision in a fixed point load average, and so forth.
! 		In desperation, use LA_ZERO.  The actual code is in
! 		conf.c -- it can be tweaked if you are brave.
! SFS_TYPE	Encodes how your kernel can locate the amount of free
! 		space on a disk partition.  This can be set to SFS_NONE
! 		(0) if you have no way of getting this information,
! 		SFS_USTAT (1) if you have the ustat(2) system call,
! 		SFS_4ARGS (2) if you have a four-argument statfs(2)
! 		system call (and the include file is <sys/statfs.h>),
! 		and SFS_VFS (3), SFS_MOUNT (4), or SFS_STATFS (5) if
! 		you have the two-argument statfs(2) system call, with
! 		includes in <sys/vfs.h>, <sys/mount.h>, or <sys/statfs.h>
! 		respectively.  The default if nothing is defined is
! 		SFS_NONE.
  ERRLIST_PREDEFINED
  		If set, assumes that some header file defines sys_errlist.
  		This may be needed if you get type conflicts on this
***************
*** 301,306 ****
--- 319,330 ----
  		e-mail message will log many more messages, since it
  		will log each piece of information as a separate line
  		in syslog.
+ BROKEN_RES_SEARCH
+ 		On Ultrix (and maybe other systems?) if you use the
+ 		res_search routine with an unknown host name, it returns
+ 		-1 but sets h_errno to 0 instead of HOST_NOT_FOUND.  If
+ 		you set this, sendmail considers 0 to be the same as
+ 		HOST_NOT_FOUND.
  
  
  +-----------------------+
***************
*** 371,377 ****
  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.
  
  
  +-------------------------------------+
--- 395,401 ----
  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
! subtly don't work.
  
  
  +-------------------------------------+
***************
*** 440,445 ****
--- 464,473 ----
  Solaris 2.x (SunOS 5.x)
  	To compile for Solaris, be sure you use -DSOLARIS.
  
+ 	To the best of my knowledge, Solaris does not have the
+ 	gethostbyname problem described above.  However, it does
+ 	have another one:
+ 
  	From a correspondent:
  
  	   For solaris 2.2, I have 
***************
*** 450,467 ****
  	   qualified host name. I think "files" has to be before "dns"
  	   in /etc/nsswitch.conf during bootup.
  
! 	To the best of my knowledge, Solaris does not have the
! 	gethostbyname problem described above.
  
  	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
--- 478,519 ----
  	   qualified host name. I think "files" has to be before "dns"
  	   in /etc/nsswitch.conf during bootup.
  
! 	From another correspondent:
  
+ 	   When running sendmail under Solaris, the gethostbyname()
+ 	   hack in conf.c which should perform proper canonicalization
+ 	   of host names could fail.  Result: the host name is not
+ 	   canonicalized despite the hack, and you'll have to define $j
+ 	   and $m in sendmail.cf somewhere.
+ 
+ 	   The reason could be that /etc/nsswitch.conf is improperly
+ 	   configured (at least from sendmail's point of view).  For
+ 	   example, the line
+ 
+ 		hosts:      files nisplus dns
+ 
+ 	   will make gethostbyname() look in /etc/hosts first, then ask
+ 	   nisplus, then dns.  However, if /etc/hosts does not contain
+ 	   the full canonicalized hostname, then no amount of
+ 	   gethostbyname()s will work.
+ 
+ 	   Solution (or rather, a workaround): Ask nisplus first, then
+ 	   dns, then local files:
+ 
+ 		hosts:      nisplus dns [NOTFOUND=return] files
+ 
  	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.  You can get patches
! 	that fix this problem: the patch ids are:
  
+ 		Solaris 2.1	100834
+ 		Solaris 2.2	100999
+ 		Solaris 2.3	101318
+ 
+ 	Be sure you have the appropriate patch installed or you won't
+ 	see system logging.
+ 
  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
***************
*** 471,476 ****
--- 523,539 ----
  	Also, the enclosed makefile removed /usr/sbin/smtpd; if you need
  	it, just create the link to the sendmail binary.
  
+ IRIX
+ 	The header files on SGI IRIX are completely prototyped, and as
+ 	a result you can sometimes get some warning messages during
+ 	compilation.  These can be ignored.  There are two errors in
+ 	deliver only if you are using gcc, both of the form ``warning:
+ 	passing arg N of `execve' from incompatible pointer type''.
+ 	Also, if you compile with -DNIS, you will get a complaint
+ 	about a declaration of struct dom_binding in a prototype
+ 	when compiling map.c; this is not important because the
+ 	function being prototyped is not used in that file.
+ 
  NeXT
  	If you are compiling on NeXT, you will have to create an empty
  	file "unistd.h" and create a file "dirent.h" containing:
***************
*** 560,565 ****
--- 623,672 ----
  	DG/UX -- the person who has this working, Douglas Anderson
  	<dlander@afterlife.ncsc.mil>, used procmail instead.
  
+ Apollo DomainOS
+ 	If you are compiling on Apollo, you will have to create an empty
+ 	file "unistd.h" and create a file "dirent.h" containing:
+ 
+ 		#include <sys/dir.h>
+ 		#define dirent	direct
+ 
+ 	(The Makefile.DomainOS will attempt to do both of these for you.)
+ 
+ HP-UX 8.00
+ 	Date: Mon, 24 Jan 1994 13:25:45 +0200
+ 	From: Kimmo Suominen <Kimmo.Suominen@lut.fi>
+ 	Subject: 8.6.5 w/ HP-UX 8.00 on s300
+ 
+ 	Just compiled and fought with sendmail 8.6.5 on a HP9000/360 (ie. a
+ 	series 300 machine) running HP-UX 8.00.
+ 
+ 	I was getting segmentation fault when delivering to a local user.
+ 	With debugging I saw it was faulting when doing _free@libc... *sigh*
+ 	It seems the new implementation of malloc on s300 is buggy as of 8.0,
+ 	so I tried out the one in -lmalloc (malloc(3X)).  With that it seems
+ 	to work just dandy.
+ 
+ 	When linking, you will get the following error:
+ 
+ 	ld: multiply defined symbol _freespace in file /usr/lib/libmalloc.a
+ 
+ 	but you can just ignore it.  You might want to add this info to the
+ 	README file for the future...
+ 
+ Linux
+ 	Something broke between versions 0.99.13 and 0.99.14 of Linux:
+ 	the flock() system call gives errors.  If you are running .14,
+ 	you must not use flock.  You can do this with -DHASFLOCK=0.
+ 
+ AIX
+ 	This version of sendmail does not support MB, MG, and MR resource
+ 	records, which are supported by AIX sendmail.
+ 
+ RISC/os
+ 	RISC/os from MIPS is a merged AT&T/Berkeley system.  When you
+ 	compile on that platform you will get duplicate definitions
+ 	on many files.  You can ignore these.
+ 
  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
***************
*** 642,648 ****
--- 749,767 ----
  	I'm told that GNU getopt has a problem in that it gets confused
  	by the double call.  Use the version in conf.c instead.
  
+ BIND 4.9.2 and Ultrix
+ 	If you are running on Ultrix, be sure you read the conf/Info.Ultrix
+ 	carefully -- there is information in there that you need to know
+ 	in order to avoid errors of the form:
  
+ 		/lib/libc.a(gethostent.o): sethostent: multiply defined
+ 		/lib/libc.a(gethostent.o): endhostent: multiply defined
+ 		/lib/libc.a(gethostent.o): gethostbyname: multiply defined
+ 		/lib/libc.a(gethostent.o): gethostbyaddr: multiply defined
+ 
+ 	during the link stage.
+ 
+ 
  +--------------+
  | MANUAL PAGES |
  +--------------+
***************
*** 742,745 ****
  
  Eric Allman
  
! (Version 8.47, last update 1/12/94 05:59:56)
--- 861,864 ----
  
  Eric Allman
  
! (Version 8.58, last update 3/13/94 09:38:06)
*** src/alias.c.OLD	Sat Dec 11 14:21:35 1993
--- src/alias.c	Mon Feb 28 10:04:58 1994
***************
*** 36,42 ****
  # include <pwd.h>
  
  #ifndef lint
! static char sccsid[] = "@(#)alias.c	8.21 (Berkeley) 12/11/93";
  #endif /* not lint */
  
  
--- 36,42 ----
  # include <pwd.h>
  
  #ifndef lint
! static char sccsid[] = "@(#)alias.c	8.24 (Berkeley) 2/28/94";
  #endif /* not lint */
  
  
***************
*** 114,120 ****
  	message("aliased to %s", p);
  #ifdef LOG
  	if (LogLevel > 9)
! 		syslog(LOG_INFO, "%s: alias %s => %s", e->e_id, a->q_paddr, p);
  #endif
  	a->q_flags &= ~QSELFREF;
  	AliasLevel++;
--- 114,122 ----
  	message("aliased to %s", p);
  #ifdef LOG
  	if (LogLevel > 9)
! 		syslog(LOG_INFO, "%s: alias %s => %s",
! 			e->e_id == NULL ? "NOQUEUE" : e->e_id,
! 			a->q_paddr, p);
  #endif
  	a->q_flags &= ~QSELFREF;
  	AliasLevel++;
***************
*** 417,423 ****
  	/* try to lock the source file */
  	if ((af = fopen(map->map_file, "r+")) == NULL)
  	{
! 		if (errno != EACCES || automatic ||
  		    (af = fopen(map->map_file, "r")) == NULL)
  		{
  			int saveerr = errno;
--- 419,425 ----
  	/* try to lock the source file */
  	if ((af = fopen(map->map_file, "r+")) == NULL)
  	{
! 		if ((errno != EACCES && errno != EROFS) || automatic ||
  		    (af = fopen(map->map_file, "r")) == NULL)
  		{
  			int saveerr = errno;
***************
*** 748,754 ****
  #ifdef LOG
  			if (LogLevel > 2)
  				syslog(LOG_ERR, "%s: forward %s: transient error: %s",
! 					e->e_id, buf, errstring(err));
  #endif
  			message("%s: %s: message queued", buf, errstring(err));
  			user->q_flags |= QQUEUEUP;
--- 750,757 ----
  #ifdef LOG
  			if (LogLevel > 2)
  				syslog(LOG_ERR, "%s: forward %s: transient error: %s",
! 					e->e_id == NULL ? "NOQUEUE" : e->e_id,
! 					buf, errstring(err));
  #endif
  			message("%s: %s: message queued", buf, errstring(err));
  			user->q_flags |= QQUEUEUP;
*** src/collect.c.OLD	Sat Jan  8 17:29:31 1994
--- src/collect.c	Mon Jan 31 17:01:17 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)collect.c	8.8 (Berkeley) 1/8/94";
  #endif /* not lint */
  
  # include <errno.h>
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)collect.c	8.9 (Berkeley) 1/31/94";
  #endif /* not lint */
  
  # include <errno.h>
***************
*** 317,324 ****
  			    "collect: %s on connection from %s, sender=%s: %m\n",
  			    problem, host, e->e_from.q_paddr);
  # endif
! 		(feof(InChannel) ? usrerr : syserr)
! 			("451 collect: %s on connection from %s, from=%s",
  				problem, host, e->e_from.q_paddr);
  
  		/* don't return an error indication */
--- 317,327 ----
  			    "collect: %s on connection from %s, sender=%s: %m\n",
  			    problem, host, e->e_from.q_paddr);
  # endif
! 		if (feof(InChannel))
! 			usrerr("451 collect: %s on connection from %s, from=%s",
! 				problem, host, e->e_from.q_paddr);
! 		else
! 			syserr("451 collect: %s on connection from %s, from=%s",
  				problem, host, e->e_from.q_paddr);
  
  		/* don't return an error indication */
*** src/conf.c.OLD	Tue Jan 11 07:04:01 1994
--- src/conf.c	Sun Mar  6 09:31:18 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)conf.c	8.62 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)conf.c	8.82 (Berkeley) 3/6/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 628,633 ****
--- 628,634 ----
  #define LA_SUBR		4	/* call getloadavg */
  #define LA_MACH		5	/* MACH load averages (as on NeXT boxes) */
  #define LA_SHORT	6	/* read kmem for avenrun; interpret as short */
+ #define LA_PROCSTR	7	/* read string ("1.17") from /proc/loadavg */
  
  /* do guesses based on general OS type */
  #ifndef LA_TYPE
***************
*** 827,836 ****
--- 828,883 ----
  
  
  #else
+ #if LA_TYPE == LA_PROCSTR
  
+ /*
+ **  Read /proc/loadavg for the load average.  This is assumed to be
+ **  in a format like "0.15 0.12 0.06".
+ **
+ **	Initially intended for Linux.  This has been in the kernel
+ **	since at least 0.99.15.
+ */
+ 
+ # ifndef _PATH_LOADAVG
+ #  define _PATH_LOADAVG	"/proc/loadavg"
+ # endif
+ 
+ int
  getla()
  {
+ 	double avenrun;
+ 	register int result;
+ 	FILE *fp;
+ 
+ 	fp = fopen(_PATH_LOADAVG, "r");
+ 	if (fp == NULL) 
+ 	{
+ 		if (tTd(3, 1))
+ 			printf("getla: fopen(%s): %s\n",
+ 				_PATH_LOADAVG, errstring(errno));
+ 		return -1;
+ 	}
+ 	result = fscanf(fp, "%lf", &avenrun);
+ 	fclose(fp);
+ 	if (result != 1)
+ 	{
+ 		if (tTd(3, 1))
+ 			printf("getla: fscanf() = %d: %s\n",
+ 				result, errstring(errno));
+ 		return -1;
+ 	}
+ 
  	if (tTd(3, 1))
+ 		printf("getla(): %.2f\n", avenrun);
+ 
+ 	return ((int) (avenrun + 0.5));
+ }
+ 
+ #else
+ 
+ getla()
+ {
+ 	if (tTd(3, 1))
  		printf("getla: ZERO\n");
  	return (0);
  }
***************
*** 838,843 ****
--- 885,938 ----
  #endif
  #endif
  #endif
+ #endif
+ 
+ 
+ /*
+  * Copyright 1989 Massachusetts Institute of Technology
+  *
+  * Permission to use, copy, modify, distribute, and sell this software and its
+  * documentation for any purpose is hereby granted without fee, provided that
+  * the above copyright notice appear in all copies and that both that
+  * copyright notice and this permission notice appear in supporting
+  * documentation, and that the name of M.I.T. not be used in advertising or
+  * publicity pertaining to distribution of the software without specific,
+  * written prior permission.  M.I.T. makes no representations about the
+  * suitability of this software for any purpose.  It is provided "as is"
+  * without express or implied warranty.
+  *
+  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
+  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
+  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+  *
+  * Authors:  Many and varied...
+  */
+ 
+ /* Non Apollo stuff removed by Don Lewis 11/15/93 */
+ #ifndef lint
+ static char  rcsid[] = "@(#)$Id: getloadavg.c,v 1.16 1991/06/21 12:51:15 paul Exp $";
+ #endif /* !lint */
+ 
+ #ifdef apollo
+ # undef volatile
+ #    include <apollo/base.h>
+ 
+ /* ARGSUSED */
+ int getloadavg( call_data )
+      caddr_t	call_data;	/* pointer to (double) return value */
+ {
+      double *avenrun = (double *) call_data;
+      int i;
+      status_$t      st;
+      long loadav[3];
+      proc1_$get_loadav(loadav, &st);
+      *avenrun = loadav[0] / (double) (1 << 16);
+      return(0);
+ }
+ #   endif /* apollo */
  /*
  **  SHOULDQUEUE -- should this message be queued or sent?
  **
***************
*** 909,914 ****
--- 1004,1012 ----
  */
  
  #ifdef SETPROCTITLE
+ # ifdef HASSETPROCTITLE
+    *** ERROR ***  Cannot have both SETPROCTITLE and HASSETPROCTITLE defined
+ # endif
  # ifdef __hpux
  #  include <sys/pstat.h>
  # endif
***************
*** 932,937 ****
--- 1030,1037 ----
  # define PROCTITLEPAD	' '
  #endif
  
+ #ifndef HASSETPROCTITLE
+ 
  /*VARARGS1*/
  #ifdef __STDC__
  setproctitle(char *fmt, ...)
***************
*** 986,991 ****
--- 1086,1093 ----
  #  endif
  # endif /* SETPROCTITLE */
  }
+ 
+ #endif
  /*
  **  REAPCHILD -- pick up the body of my child, lest it become a zombie
  **
***************
*** 1407,1412 ****
--- 1509,1516 ----
  
  #endif
  
+ #define WILDCARD_SHELL	"/SENDMAIL/ANY/SHELL/"
+ 
  bool
  usershellok(shell)
  	char *shell;
***************
*** 1417,1423 ****
  
  	setusershell();
  	while ((p = getusershell()) != NULL)
! 		if (strcmp(p, shell) == 0 || strcmp(p, "*") == 0)
  			break;
  	endusershell();
  	return p != NULL;
--- 1521,1527 ----
  
  	setusershell();
  	while ((p = getusershell()) != NULL)
! 		if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
  			break;
  	endusershell();
  	return p != NULL;
***************
*** 1452,1458 ****
  		while (*p != '\0' && *p != '#' && !isspace(*p))
  			p++;
  		*p = '\0';
! 		if (strcmp(shell, q) == 0 || strcmp("*", q) == 0)
  		{
  			fclose(shellf);
  			return TRUE;
--- 1556,1562 ----
  		while (*p != '\0' && *p != '#' && !isspace(*p))
  			p++;
  		*p = '\0';
! 		if (strcmp(shell, q) == 0 || strcmp(WILDCARD_SHELL, q) == 0)
  		{
  			fclose(shellf);
  			return TRUE;
***************
*** 1480,1504 ****
  **		Puts the filesystem block size into bsize.
  */
  
! #ifdef HASSTATFS
! # undef HASUSTAT
  #endif
  
! #if defined(HASUSTAT)
  # include <ustat.h>
  #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>
! #  endif
! # endif
  #endif
  
  long
  freespace(dir, bsize)
--- 1584,1613 ----
  **		Puts the filesystem block size into bsize.
  */
  
! /* statfs types */
! #define SFS_NONE	0	/* no statfs implementation */
! #define SFS_USTAT	1	/* use ustat */
! #define SFS_4ARGS	2	/* use four-argument statfs call */
! #define SFS_VFS		3	/* use <sys/vfs.h> implementation */
! #define SFS_MOUNT	4	/* use <sys/mount.h> implementation */
! #define SFS_STATFS	5	/* use <sys/statfs.h> implementation */
! 
! #ifndef SFS_TYPE
! # define SFS_TYPE	SFS_NONE
  #endif
  
! #if SFS_TYPE == SFS_USTAT
  # include <ustat.h>
  #endif
! #if SFS_TYPE == SFS_4ARGS || SFS_TYPE == SFS_STATFS
! # include <sys/statfs.h>
  #endif
+ #if SFS_TYPE == SFS_VFS
+ # include <sys/vfs.h>
+ #endif
+ #if SFS_TYPE == SFS_MOUNT
+ # include <sys/mount.h>
+ #endif
  
  long
  freespace(dir, bsize)
***************
*** 1505,1512 ****
  	char *dir;
  	long *bsize;
  {
! #if defined(HASSTATFS) || defined(HASUSTAT)
! # if defined(HASUSTAT)
  	struct ustat fs;
  	struct stat statbuf;
  #  define FSBLOCKSIZE	DEV_BSIZE
--- 1614,1621 ----
  	char *dir;
  	long *bsize;
  {
! #if SFS_TYPE != SFS_NONE
! # if SFS_TYPE == SFS_USTAT
  	struct ustat fs;
  	struct stat statbuf;
  #  define FSBLOCKSIZE	DEV_BSIZE
***************
*** 1519,1525 ****
  #  else
  	struct statfs fs;
  #   define FSBLOCKSIZE	fs.f_bsize
! #   if defined(_SCO_unix_) || defined(IRIX)
  #    define f_bavail f_bfree
  #   endif
  #  endif
--- 1628,1634 ----
  #  else
  	struct statfs fs;
  #   define FSBLOCKSIZE	fs.f_bsize
! #   if defined(_SCO_unix_) || defined(IRIX) || defined(apollo)
  #    define f_bavail f_bfree
  #   endif
  #  endif
***************
*** 1526,1535 ****
  # endif
  	extern int errno;
  
! # if defined(HASUSTAT)
  	if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0)
  # else
! #  if defined(IRIX) || defined(apollo) || defined(UMAXV) || defined(DGUX)
  	if (statfs(dir, &fs, sizeof fs, 0) == 0)
  #  else
  #   if defined(ultrix)
--- 1635,1644 ----
  # endif
  	extern int errno;
  
! # if SFS_TYPE == SFS_USTAT
  	if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0)
  # else
! #  if SFS_TYPE == SFS_4ARGS
  	if (statfs(dir, &fs, sizeof fs, 0) == 0)
  #  else
  #   if defined(ultrix)
***************
*** 1694,1699 ****
--- 1803,1811 ----
  #ifdef EADDRNOTAVAIL
  	  case EADDRNOTAVAIL:		/* Can't assign requested address */
  #endif
+ #ifdef ETXTBSY
+ 	  case ETXTBSY:			/* (Apollo) file locked */
+ #endif
  #if defined(ENOSR) && (!defined(ENOBUFS) || (ENOBUFS != ENOSR))
  	  case ENOSR:			/* Out of streams resources */
  #endif
***************
*** 1726,1732 ****
  	char *ext;
  	int type;
  {
! # ifndef HASFLOCK
  	int action;
  	struct flock lfd;
  
--- 1838,1844 ----
  	char *ext;
  	int type;
  {
! # if !HASFLOCK
  	int action;
  	struct flock lfd;
  
***************
*** 1823,1828 ****
--- 1935,1999 ----
  	return FALSE;
  }
  /*
+ **  CHOWNSAFE -- tell if chown is "safe" (executable only by root)
+ **
+ **	Parameters:
+ **		fd -- the file descriptor to check.
+ **
+ **	Returns:
+ **		TRUE -- if only root can chown the file to an arbitrary
+ **			user.
+ **		FALSE -- if an arbitrary user can give away a file.
+ */
+ 
+ bool
+ chownsafe(fd)
+ 	int fd;
+ {
+ #ifdef __hpux
+ 	char *s;
+ 	int tfd;
+ 	uid_t o_uid, o_euid;
+ 	gid_t o_gid, o_egid;
+ 	bool rval;
+ 	struct stat stbuf;
+ 
+ 	o_uid = getuid();
+ 	o_euid = geteuid();
+ 	o_gid = getgid();
+ 	o_egid = getegid();
+ 	fstat(fd, &stbuf);
+ 	setresuid(stbuf.st_uid, stbuf.st_uid, -1);
+ 	setresgid(stbuf.st_gid, stbuf.st_gid, -1);
+ 	s = tmpnam(NULL);
+ 	tfd = open(s, O_RDONLY|O_CREAT, 0600);
+ 	rval = fchown(tfd, DefUid, DefGid) != 0;
+ 	close(tfd);
+ 	unlink(s);
+ 	setreuid(o_uid, o_euid);
+ 	setresgid(o_gid, o_egid, -1);
+ 	return rval;
+ #else
+ # ifdef _POSIX_CHOWN_RESTRICTED
+ #  if _POSIX_CHOWN_RESTRICTED == -1
+ 	return FALSE;
+ #  else
+ 	return TRUE;
+ #  endif
+ # else
+ #  ifdef _PC_CHOWN_RESTRICTED
+ 	return fpathconf(fd, _PC_CHOWN_RESTRICTED) > 0;
+ #  else
+ #   ifdef BSD
+ 	return TRUE;
+ #   else
+ 	return FALSE;
+ #   endif
+ #  endif
+ # endif
+ #endif
+ }
+ /*
  **  GETCFNAME -- return the name of the .cf file.
  **
  **	Some systems (e.g., NeXT) determine this dynamically.
***************
*** 1877,1922 ****
  **  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
--- 2048,2151 ----
  **  STRTOL -- convert string to long integer
  **
  **	For systems that don't have it in the C library.
+ **
+ **	This is taken verbatim from the 4.4-Lite C library.
  */
  
  #ifdef NEEDSTRTOL
  
+ #if defined(LIBC_SCCS) && !defined(lint)
+ static char sccsid[] = "@(#)strtol.c	8.1 (Berkeley) 6/4/93";
+ #endif /* LIBC_SCCS and not lint */
+ 
+ #include <limits.h>
+ 
+ /*
+  * Convert a string to a long integer.
+  *
+  * Ignores `locale' stuff.  Assumes that the upper and lower case
+  * alphabets and digits are each contiguous.
+  */
+ 
  long
! strtol(nptr, endptr, base)
! 	const char *nptr;
! 	char **endptr;
! 	register int base;
  {
! 	register const char *s = nptr;
! 	register unsigned long acc;
! 	register int c;
! 	register unsigned long cutoff;
! 	register int neg = 0, any, cutlim;
  
! 	/*
! 	 * Skip white space and pick up leading +/- sign if any.
! 	 * If base is 0, allow 0x for hex and 0 for octal, else
! 	 * assume decimal; if base is already 16, allow 0x.
! 	 */
! 	do {
! 		c = *s++;
! 	} while (isspace(c));
! 	if (c == '-') {
! 		neg = 1;
! 		c = *s++;
! 	} else if (c == '+')
! 		c = *s++;
! 	if ((base == 0 || base == 16) &&
! 	    c == '0' && (*s == 'x' || *s == 'X')) {
! 		c = s[1];
! 		s += 2;
! 		base = 16;
  	}
! 	if (base == 0)
! 		base = c == '0' ? 8 : 10;
! 
! 	/*
! 	 * Compute the cutoff value between legal numbers and illegal
! 	 * numbers.  That is the largest legal value, divided by the
! 	 * base.  An input number that is greater than this value, if
! 	 * followed by a legal input character, is too big.  One that
! 	 * is equal to this value may be valid or not; the limit
! 	 * between valid and invalid numbers is then based on the last
! 	 * digit.  For instance, if the range for longs is
! 	 * [-2147483648..2147483647] and the input base is 10,
! 	 * cutoff will be set to 214748364 and cutlim to either
! 	 * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
! 	 * a value > 214748364, or equal but the next digit is > 7 (or 8),
! 	 * the number is too big, and we will return a range error.
! 	 *
! 	 * Set any if any `digits' consumed; make it negative to indicate
! 	 * overflow.
! 	 */
! 	cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
! 	cutlim = cutoff % (unsigned long)base;
! 	cutoff /= (unsigned long)base;
! 	for (acc = 0, any = 0;; c = *s++) {
! 		if (isdigit(c))
! 			c -= '0';
! 		else if (isalpha(c))
! 			c -= isupper(c) ? 'A' - 10 : 'a' - 10;
! 		else
! 			break;
! 		if (c >= base)
! 			break;
! 		if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
! 			any = -1;
! 		else {
! 			any = 1;
! 			acc *= base;
! 			acc += c;
  		}
  	}
! 	if (any < 0) {
! 		acc = neg ? LONG_MIN : LONG_MAX;
! 		errno = ERANGE;
! 	} else if (neg)
! 		acc = -acc;
! 	if (endptr != 0)
! 		*endptr = (char *)(any ? s - 1 : nptr);
! 	return (acc);
  }
  
  #endif
***************
*** 1998,2004 ****
  	char *directory;
  	char *propname;
  {
! 	char *propval;
  	int i;
  	void *ni = NULL;
  	void *lastni = NULL;
--- 2227,2233 ----
  	char *directory;
  	char *propname;
  {
! 	char *propval = NULL;
  	int i;
  	void *ni = NULL;
  	void *lastni = NULL;
*** src/conf.h.OLD	Sat Jan  8 17:53:13 1994
--- src/conf.h	Fri Mar 11 14:42:24 1994
***************
*** 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
   */
  
  /*
--- 31,37 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)conf.h	8.96 (Berkeley) 3/11/94
   */
  
  /*
***************
*** 80,93 ****
  # 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 */
  # define MATCHGECOS	1	/* match user names from gecos field */
  # define XDEBUG		1	/* enable extended debugging */
- 
  # ifdef NEWDB
  # define USERDB		1	/* look in user database (requires NEWDB) */
  # endif
  
  /*
  **  Most systems have symbolic links today, so default them on.  You
  **  can turn them off by #undef'ing this below.
--- 80,101 ----
  # define NETUNIX	1	/* include unix domain support */
  # define NETINET	1	/* include internet support */
  # define SETPROCTITLE	1	/* munge argv to display current status */
  # define MATCHGECOS	1	/* match user names from gecos field */
  # define XDEBUG		1	/* enable extended debugging */
  # ifdef NEWDB
  # define USERDB		1	/* look in user database (requires NEWDB) */
  # endif
  
+ /**********************************************************************
+ **  0/1 Compilation options.
+ **	#define these to 1 if they are available;
+ **	#define them to 0 otherwise.
+ **********************************************************************/
+ 
+ # ifndef NAMED_BIND
+ #  define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
+ # endif
+ 
  /*
  **  Most systems have symbolic links today, so default them on.  You
  **  can turn them off by #undef'ing this below.
***************
*** 131,140 ****
  # undef m_flags
  # define SYSTEM5	1	/* include all the System V defines */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # 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
--- 139,148 ----
  # undef m_flags
  # define SYSTEM5	1	/* include all the System V defines */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
! # define setreuid(r, e)		setresuid(r, e, -1)
  # define LA_TYPE	LA_FLOAT
+ # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
  # define GIDSET_T	gid_t
  # define _PATH_UNIX	"/hp-ux"
  # ifndef _PATH_SENDMAILCF
***************
*** 159,169 ****
  
  # 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
  
  
--- 167,177 ----
  
  # ifdef _AIX3
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # 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 */
+ # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
  # endif
  
  
***************
*** 177,188 ****
  # include <sys/sysmacros.h>
  # 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
  # define GIDSET_T	gid_t
  # endif
  
  
--- 185,196 ----
  # include <sys/sysmacros.h>
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
  # 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
  # define GIDSET_T	gid_t
+ # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
  # endif
  
  
***************
*** 195,204 ****
  
  #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
--- 203,212 ----
  
  #if defined(sun) && !defined(BSD)
  
  # 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 */
+ # define LA_TYPE	LA_INT
  
  # ifdef SOLARIS_2_3
  #  define SOLARIS
***************
*** 222,233 ****
  #  ifndef _PATH_SENDMAILPID
  #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
  #  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
--- 230,246 ----
  #  ifndef _PATH_SENDMAILPID
  #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
  #  endif
+ #  ifndef SYSLOG_BUFSIZE
+ #   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
+ #  endif
  
  # else
  			/* SunOS 4.0.3 or 4.1.x */
  #  define HASSETREUID	1	/* has setreuid(2) call */
! #  ifndef HASFLOCK
! #   define HASFLOCK	1	/* has flock(2) call */
! #  endif
! #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
  #  include <vfork.h>
  
  #  ifdef SUNOS403
***************
*** 255,269 ****
  #ifdef	DGUX
  # define SYSTEM5	1
  # define LA_TYPE	LA_SUBR
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # 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>
--- 268,283 ----
  #ifdef	DGUX
  # define SYSTEM5	1
  # define LA_TYPE	LA_SUBR
  # define HASSETREUID	1	/* has setreuid(2) call */
  # 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 HASGETUSERSHELL 0	/* does not have getusershell(3) */
  # ifndef IDENTPROTO
  #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
  # endif
  # undef SETPROCTITLE
+ # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
  
  /* these include files must be included early on DG/UX */
  # include <netinet/in.h>
***************
*** 283,294 ****
  */
  
  #ifdef ultrix
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # 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
--- 297,311 ----
  */
  
  #ifdef ultrix
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # define HASUNAME	1	/* use System V uname(2) system call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
+ # define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
  # ifdef vax
  #  define LA_TYPE	LA_FLOAT
  # else
***************
*** 295,300 ****
--- 312,318 ----
  #  define LA_TYPE	LA_INT
  #  define LA_AVENRUN	"avenrun"
  # endif
+ # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
  # ifndef IDENTPROTO
  #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
  # endif
***************
*** 306,317 ****
  */
  
  #ifdef __osf__
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # 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
--- 324,337 ----
  */
  
  #ifdef __osf__
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  # define LA_TYPE	LA_INT
+ # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
  # ifndef _PATH_SENDMAILPID
  #  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
  # endif
***************
*** 324,332 ****
  
  #ifdef NeXT
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # define HASFLOCK	1	/* has flock(2) call */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define WAITUNION	1	/* use "union wait" as wait argument type */
  # define sleep		sleepX
  # define setpgid	setpgrp
--- 344,353 ----
  
  #ifdef NeXT
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define WAITUNION	1	/* use "union wait" as wait argument type */
  # define sleep		sleepX
  # define setpgid	setpgrp
***************
*** 333,338 ****
--- 354,360 ----
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_MACH
  # endif
+ # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
  # ifndef _POSIX_SOURCE
  typedef int		pid_t;
  #  undef WEXITSTATUS
***************
*** 355,370 ****
  
  #ifdef BSD4_4
  # define HASUNSETENV	1	/* has unsetenv(3) call */
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # include <sys/cdefs.h>
  # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_SUBR
  # endif
  #endif
  
  
  /*
  **  386BSD / FreeBSD 1.0E / NetBSD (all architectures, all versions)
  **
  **  4.3BSD clone, closer to 4.4BSD
--- 377,415 ----
  
  #ifdef BSD4_4
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # include <sys/cdefs.h>
  # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_SUBR
  # endif
+ # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
  #endif
  
  
  /*
+ **  BSD/386 (all versions)
+ **	From Tony Sanders, BSDI
+ */
+ 
+ #ifdef __bsdi__
+ # define HASUNSETENV	1	/* has the unsetenv(3) call */
+ # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
+ # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
+ # if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
+ #  define HASSETPROCTITLE 1	/* setproctitle is in libc */
+ # else
+ #  define SETPROCTITLE	1
+ # endif
+ # include <sys/cdefs.h>
+ # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
+ # ifndef LA_TYPE
+ #  define LA_TYPE	LA_SUBR
+ # endif
+ #endif
+ 
+ 
+ 
+ /*
  **  386BSD / FreeBSD 1.0E / NetBSD (all architectures, all versions)
  **
  **  4.3BSD clone, closer to 4.4BSD
***************
*** 375,386 ****
  #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 */
  # include <sys/cdefs.h>
  # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_SUBR
  # endif
  #endif
  
  
--- 420,431 ----
  #if defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
  # include <sys/cdefs.h>
  # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_SUBR
  # endif
+ # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
  #endif
  
  
***************
*** 394,401 ****
  # 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
--- 439,447 ----
  # define MACH386	1
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # define HASINITGROUPS	1	/* has initgroups(3) call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define NEEDSTRTOL	1	/* need the strtol() function */
  # define setpgid	setpgrp
***************
*** 402,407 ****
--- 448,454 ----
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_FLOAT
  # endif
+ # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
  # undef HASSETVBUF		/* don't actually have setvbuf(3) */
  # undef WEXITSTATUS
  # undef WIFEXITED
***************
*** 417,427 ****
  /*
  **  4.3 BSD -- this is for very old systems
  **
  **	You'll also have to install a new resolver library.
  **	I don't guarantee that support for this environment is complete.
  */
  
! #ifdef oldBSD43
  # define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define ARBPTR_T	char *
--- 464,476 ----
  /*
  **  4.3 BSD -- this is for very old systems
  **
+ **	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
+ **
  **	You'll also have to install a new resolver library.
  **	I don't guarantee that support for this environment is complete.
  */
  
! #if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
  # define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define ARBPTR_T	char *
***************
*** 465,475 ****
  #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
  
--- 514,524 ----
  #ifdef _SCO_unix_
  # define SYSTEM5	1	/* include all the System V defines */
  # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
  # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
  # define FORK		fork
  # define MAXPATHLEN	PATHSIZE
  # define LA_TYPE	LA_SHORT
+ # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
  # undef NETUNIX			/* no unix domain socket support */
  #endif
  
***************
*** 476,490 ****
  
  /*
  **  ConvexOS 11.0 and later
  */
  
  #ifdef _CONVEX_SOURCE
  # define BSD		1	/* include all the BSD defines */
  # define HASUNAME	1	/* use System V uname(2) system call */
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # 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
--- 525,553 ----
  
  /*
  **  ConvexOS 11.0 and later
+ **
+ **	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
+ **	works on 9.1 as well.
  */
  
  #ifdef _CONVEX_SOURCE
  # define BSD		1	/* include all the BSD defines */
  # define HASUNAME	1	/* use System V uname(2) system call */
  # define HASSETSID	1	/* has POSIX setsid(2) call */
  # define NEEDGETOPT	1	/* need replacement for getopt(3) */
  # define LA_TYPE	LA_FLOAT
+ # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ # ifndef S_IREAD
+ #  define S_IREAD	_S_IREAD
+ #  define S_IWRITE	_S_IWRITE
+ #  define S_IEXEC	_S_IEXEC
+ #  define S_IFMT	_S_IFMT
+ #  define S_IFCHR	_S_IFCHR
+ #  define S_IFBLK	_S_IFBLK
+ # endif
  # ifndef IDENTPROTO
  #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
  # endif
***************
*** 500,506 ****
  #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
--- 563,571 ----
  #ifdef RISCOS
  
  # define HASUNSETENV	1	/* has unsetenv(3) call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  # define WAITUNION	1	/* use "union wait" as wait argument type */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define LA_TYPE	LA_INT
***************
*** 522,540 ****
  
  /*
  **  Linux 0.99pl10 and above...
! **	From Karl London <karl@borg.demon.co.uk>.
  */
  
  #ifdef __linux__
! # define BSD		1	/* pretend to be BSD based today */
! # undef  NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
  # define HASUNSETENV	1	/* has unsetenv(3) call */
  # ifndef LA_TYPE
! #  define LA_TYPE	LA_FLOAT
  # endif
  # include <sys/sysmacros.h>
! # define GIDSET_T	gid_t
  #endif
  
  
--- 587,618 ----
  
  /*
  **  Linux 0.99pl10 and above...
! **
! **  Thanks to, in reverse order of contact:
! **
! **	John Kennedy <warlock@csuchico.edu>
! **	Florian La Roche <rzsfl@rz.uni-sb.de>
! **	Karl London <karl@borg.demon.co.uk>
! **
! **  Last compiled against:	[03/02/94 @ 05:34 PM (Wednesday)]
! **	sendmail 8.6.6.b9	named 4.9.2-931205-p1	db-1.73
! **	gcc 2.5.8		libc.so.4.5.19
! **	slackware 1.1.2		linux 0.99.15
  */
  
  #ifdef __linux__
! # define BSD		1	/* include BSD defines */
  # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
+ # define HASUNAME	1	/* use System V uname(2) system call */
  # define HASUNSETENV	1	/* has unsetenv(3) call */
+ # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
+ # define GIDSET_T	gid_t	/* from <linux/types.h> */
  # ifndef LA_TYPE
! #  define LA_TYPE	LA_PROCSTR
  # endif
+ # define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
  # include <sys/sysmacros.h>
! # undef atol			/* wounded in <stdlib.h> */
  #endif
  
  
***************
*** 563,571 ****
  #ifdef _AUX_SOURCE
  # include <sys/sysmacros.h>
  # define BSD			/* has BSD routines */
- # define HASSTATFS	1	/* has the statfs(2) syscall */
  # define HASUNAME	1	/* use System V uname(2) system call */
- # 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
--- 641,647 ----
***************
*** 578,583 ****
--- 654,660 ----
  # ifndef LA_TYPE
  #  define LA_TYPE	LA_ZERO
  # endif
+ # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
  # undef WIFEXITED
  # undef WEXITSTATUS
  #endif
***************
*** 592,598 ****
  #ifdef UMAXV
  # include <limits.h>
  # define HASUNAME	1	/* use System V uname(2) system call */
- # 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 */
--- 669,674 ----
***************
*** 599,604 ****
--- 675,681 ----
  # 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 */
+ # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
  # define MAXPATHLEN	PATH_MAX
  extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
  extern struct group	*getgrent(), *getgrnam(), *getgrgid();
***************
*** 632,637 ****
--- 709,715 ----
  */
  
  #ifdef sequent
+ 
  # define BSD		1
  # define HASUNSETENV	1
  # define BSD4_3		1	/* to get signal() in conf.c */
***************
*** 651,656 ****
--- 729,738 ----
  typedef int		pid_t;
  # define isgraph(c)	(isprint(c) && (c != ' '))
  
+ # ifndef IDENTPROTO
+ #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
+ # endif
+ 
  # ifndef _PATH_UNIX
  #  define _PATH_UNIX	"/dynix"
  # endif
***************
*** 661,668 ****
--- 743,825 ----
  #endif
  
  
+ /*
+ **  Sequent DYNIX/ptx v2.0 (and higher)
+ **
+ **	For DYNIX/ptx v1.x, undefine HASSETREUID.
+ **
+ **	From Tim Wright <timw@sequent.com>.
+ */
  
+ #ifdef _SEQUENT_
+ # define SYSTEM5	1	/* include all the System V defines */
+ # define HASSETSID	1	/* has POSIX setsid(2) call */
+ # define HASINITGROUPS	1	/* has initgroups(3) call */
+ # define HASSETREUID	1	/* has setreuid(2) call */
+ # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
+ # define GIDSET_T	gid_t
+ # define LA_TYPE	LA_INT
+ # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
+ # undef SETPROCTITLE
+ # ifndef IDENTPROTO
+ #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
+ # endif
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
+ # endif
+ #endif
  
+ 
+ /*
+ **  Cray Unicos
+ **
+ **	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
+ */
+ 
+ #ifdef UNICOS
+ # define SYSTEM5	1	/* include all the System V defines */
+ # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
+ # define MAXPATHLEN	PATHSIZE
+ # define LA_TYPE	LA_ZERO
+ # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
+ #endif
+ 
+ 
+ /*
+ **  Apollo DomainOS
+ **
+ **  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
+ **
+ **  15 Jan 1994
+ **
+ */
+ 
+ #ifdef apollo
+ # define HASSETREUID	1	/* has setreuid(2) call */
+ # define HASINITGROUPS	1	/* has initgroups(2) call */
+ # undef  SETPROCTITLE
+ # define LA_TYPE	LA_SUBR		/* use getloadavg.c */
+ # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
+ # ifndef _PATH_SENDMAILCF
+ #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
+ # endif
+ # ifndef _PATH_SENDMAILPID
+ #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
+ # endif
+ # undef  S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
+ # undef  S_IFIFO
+ # define S_IFIFO	0010000
+ # ifndef IDENTPROTO
+ #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
+ # endif
+ #endif
+ 
+ 
+ 
+ 
  /**********************************************************************
  **  End of Per-Operating System defines
  **********************************************************************/
***************
*** 676,682 ****
  # define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(2) call */
! # define HASFLOCK	1	/* has flock(2) call */
  #endif
  
  /* general System V Release 4 defines */
--- 833,841 ----
  # define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
  # define HASSETREUID	1	/* has setreuid(2) call */
  # define HASINITGROUPS	1	/* has initgroups(2) call */
! # ifndef HASFLOCK
! #  define HASFLOCK	1	/* has flock(2) call */
! # endif
  #endif
  
  /* general System V Release 4 defines */
***************
*** 703,721 ****
  #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
  # define bcopy(s, d, l)		(memmove((d), (s), (l)))
  # define bzero(d, l)		(memset((d), '\0', (l)))
  # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
! # endif
  
  /* general POSIX defines */
  #ifdef _POSIX_VERSION
--- 862,882 ----
  #endif
  
  /* general System V defines */
! #ifdef SYSTEM5
  # include <sys/sysmacros.h>
  # define HASUNAME	1	/* use System V uname(2) system call */
  # 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		/* assume integer load average */
  # endif
+ # ifndef SFS_TYPE
+ #  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
+ # endif
  # define bcopy(s, d, l)		(memmove((d), (s), (l)))
  # define bzero(d, l)		(memset((d), '\0', (l)))
  # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
! #endif
  
  /* general POSIX defines */
  #ifdef _POSIX_VERSION
***************
*** 742,747 ****
--- 903,909 ----
  # 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
***************
*** 761,767 ****
--- 923,933 ----
  # define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
  #endif
  
+ #ifndef HASFLOCK
+ # define HASFLOCK	0	/* assume no flock(2) support */
+ #endif
  
+ 
  /**********************************************************************
  **  Remaining definitions should never have to be changed.  They are
  **  primarily to provide back compatibility for older systems -- for
***************
*** 935,937 ****
--- 1101,1111 ----
  # ifndef FORK
  # define FORK		vfork		/* function to call to fork mailer */
  # endif
+ 
+ /*
+ **  If we are going to link scanf anyway, use it in readcf
+ */
+ 
+ #if !defined(HASUNAME) && !defined(SCANF)
+ # define SCANF		1
+ #endif
*** src/daemon.c.OLD	Sat Jan  8 17:29:32 1994
--- src/daemon.c	Sun Mar 13 09:21:18 1994
***************
*** 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 */
  
--- 37,45 ----
  
  #ifndef lint
  #ifdef DAEMON
! static char sccsid[] = "@(#)daemon.c	8.39 (Berkeley) 3/13/94 (with daemon mode)";
  #else
! static char sccsid[] = "@(#)daemon.c	8.39 (Berkeley) 3/13/94 (without daemon mode)";
  #endif
  #endif /* not lint */
  
***************
*** 46,55 ****
  #ifdef DAEMON
  
  # include <netdb.h>
- # include <sys/time.h>
  # include <arpa/inet.h>
  
! #ifdef NAMED_BIND
  # include <arpa/nameser.h>
  # include <resolv.h>
  #endif
--- 46,54 ----
  #ifdef DAEMON
  
  # include <netdb.h>
  # include <arpa/inet.h>
  
! #if NAMED_BIND
  # include <arpa/nameser.h>
  # include <resolv.h>
  #endif
***************
*** 302,311 ****
--- 301,315 ----
  			*/
  
  			(void) setsignal(SIGCHLD, SIG_DFL);
+ 			DisConnected = FALSE;
  
+ 			setproctitle("startup with %s",
+ 				anynet_ntoa(&RealHostAddr));
+ 
  			/* determine host name */
  			p = hostnamebyanyaddr(&RealHostAddr);
  			RealHostName = newstr(p);
+ 			setproctitle("startup with %s", p);
  
  #ifdef LOG
  			if (LogLevel > 11)
***************
*** 545,551 ****
  	SOCKADDR addr;
  	int sav_errno;
  	int addrlen;
! #ifdef NAMED_BIND
  	extern int h_errno;
  #endif
  
--- 549,555 ----
  	SOCKADDR addr;
  	int sav_errno;
  	int addrlen;
! #if NAMED_BIND
  	extern int h_errno;
  #endif
  
***************
*** 554,560 ****
  	**	Accept "[a.b.c.d]" syntax for host name.
  	*/
  
! #ifdef NAMED_BIND
  	h_errno = 0;
  #endif
  	errno = 0;
--- 558,564 ----
  	**	Accept "[a.b.c.d]" syntax for host name.
  	*/
  
! #if NAMED_BIND
  	h_errno = 0;
  #endif
  	errno = 0;
***************
*** 577,582 ****
--- 581,592 ----
  			{
  				/* try it as a host name (avoid MX lookup) */
  				hp = gethostbyname(&host[1]);
+ 				if (hp == NULL && p[-1] == '.')
+ 				{
+ 					p[-1] = '\0';
+ 					hp = gethostbyname(&host[1]);
+ 					p[-1] = '.';
+ 				}
  				*p = ']';
  				goto gothostent;
  			}
***************
*** 594,604 ****
  	}
  	else
  	{
  		hp = gethostbyname(host);
  gothostent:
  		if (hp == NULL)
  		{
! #ifdef NAMED_BIND
  			if (errno == ETIMEDOUT || h_errno == TRY_AGAIN)
  				return (EX_TEMPFAIL);
  
--- 604,622 ----
  	}
  	else
  	{
+ 		register char *p = &host[strlen(host) - 1];
+ 
  		hp = gethostbyname(host);
+ 		if (hp == NULL && *p == '.')
+ 		{
+ 			*p = '\0';
+ 			hp = gethostbyname(host);
+ 			*p = '.';
+ 		}
  gothostent:
  		if (hp == NULL)
  		{
! #if NAMED_BIND
  			if (errno == ETIMEDOUT || h_errno == TRY_AGAIN)
  				return (EX_TEMPFAIL);
  
***************
*** 844,852 ****
  **
  **	Returns:
  **		The user@host information associated with this descriptor.
- **
- **	Side Effects:
- **		Sets RealHostName to the name of the host at the other end.
  */
  
  #if IDENTPROTO
--- 862,867 ----
***************
*** 884,890 ****
  	if (getpeername(fd, &fa.sa, &falen) < 0 || falen <= 0 ||
  	    fa.sa.sa_family == 0)
  	{
- 		RealHostName = "localhost";
  		(void) sprintf(hbuf, "%s@localhost", RealUserName);
  		if (tTd(9, 1))
  			printf("getauthinfo: %s\n", hbuf);
--- 899,904 ----
***************
*** 891,901 ****
  		return hbuf;
  	}
  
- 	p = hostnamebyanyaddr(&fa);
- 	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 ||
--- 905,914 ----
  		return hbuf;
  	}
  
  #if IDENTPROTO
+ 	if (TimeOuts.to_ident == 0)
+ 		goto noident;
+ 
  	lalen = sizeof la;
  	if (fa.sa.sa_family != AF_INET ||
  	    getsockname(fd, &la.sa, &lalen) < 0 || lalen <= 0 ||
***************
*** 940,949 ****
  	if (bind(s, &la.sa, sizeof la.sin) < 0 ||
  	    connect(s, &fa.sa, sizeof fa.sin) < 0)
  	{
! closeident:
! 		(void) close(s);
! 		clrevent(ev);
! 		goto noident;
  	}
  
  	if (tTd(9, 10))
--- 953,959 ----
  	if (bind(s, &la.sa, sizeof la.sin) < 0 ||
  	    connect(s, &fa.sa, sizeof fa.sin) < 0)
  	{
! 		goto closeident;
  	}
  
  	if (tTd(9, 10))
***************
*** 1002,1017 ****
  		continue;
  
  	/* p now points to the authenticated name */
! 	(void) sprintf(hbuf, "%s@%s", p, RealHostName);
  	goto finish;
  
  #endif /* IDENTPROTO */
  
  noident:
  	(void) strcpy(hbuf, RealHostName);
  
  finish:
! 	if (RealHostName[0] != '[')
  	{
  		p = &hbuf[strlen(hbuf)];
  		(void) sprintf(p, " [%s]", anynet_ntoa(&RealHostAddr));
--- 1012,1038 ----
  		continue;
  
  	/* p now points to the authenticated name */
! 	(void) sprintf(hbuf, "%s@%s",
! 		p, RealHostName == NULL ? "localhost" : RealHostName);
  	goto finish;
  
+ closeident:
+ 	(void) close(s);
+ 	clrevent(ev);
+ 
  #endif /* IDENTPROTO */
  
  noident:
+ 	if (RealHostName == NULL)
+ 	{
+ 		if (tTd(9, 1))
+ 			printf("getauthinfo: NULL\n");
+ 		return NULL;
+ 	}
  	(void) strcpy(hbuf, RealHostName);
  
  finish:
! 	if (RealHostName != NULL && RealHostName[0] != '[')
  	{
  		p = &hbuf[strlen(hbuf)];
  		(void) sprintf(p, " [%s]", anynet_ntoa(&RealHostAddr));
***************
*** 1055,1061 ****
--- 1076,1084 ----
  	register STAB *s;
  	char hbuf[MAXNAME];
  	extern struct hostent *gethostbyaddr();
+ #if NAMED_BIND
  	extern int h_errno;
+ #endif
  
  	/*
  	**  See if we have already looked up this name.  If so, just
***************
*** 1069,1075 ****
--- 1092,1100 ----
  			printf("host_map_lookup(%s) => CACHE %s\n",
  				name, s->s_namecanon.nc_cname);
  		errno = s->s_namecanon.nc_errno;
+ #if NAMED_BIND
  		h_errno = s->s_namecanon.nc_herrno;
+ #endif
  		*statp = s->s_namecanon.nc_stat;
  		if (CurEnv->e_message == NULL && *statp == EX_TEMPFAIL)
  		{
***************
*** 1107,1116 ****
  		{
  			register struct hostent *hp;
  
- 			if (tTd(9, 1))
- 				printf("FAIL (%d)\n", h_errno);
  			s->s_namecanon.nc_errno = errno;
  			s->s_namecanon.nc_herrno = h_errno;
  			switch (h_errno)
  			{
  			  case TRY_AGAIN:
--- 1132,1142 ----
  		{
  			register struct hostent *hp;
  
  			s->s_namecanon.nc_errno = errno;
+ #if NAMED_BIND
  			s->s_namecanon.nc_herrno = h_errno;
+ 			if (tTd(9, 1))
+ 				printf("FAIL (%d)\n", h_errno);
  			switch (h_errno)
  			{
  			  case TRY_AGAIN:
***************
*** 1137,1142 ****
--- 1163,1173 ----
  				*statp = EX_UNAVAILABLE;
  				break;
  			}
+ #else
+ 			if (tTd(9, 1))
+ 				printf("FAIL\n");
+ 			*statp = EX_NOHOST;
+ #endif
  			s->s_namecanon.nc_stat = *statp;
  			if (*statp != EX_TEMPFAIL || UseNameServer)
  				return NULL;
***************
*** 1167,1173 ****
--- 1198,1206 ----
  	/* nope -- ask the name server */
  	hp = gethostbyaddr((char *)&in_addr, sizeof(struct in_addr), AF_INET);
  	s->s_namecanon.nc_errno = errno;
+ #if NAMED_BIND
  	s->s_namecanon.nc_herrno = h_errno;
+ #endif
  	s->s_namecanon.nc_flags |= NCF_VALID;		/* will be soon */
  	if (hp == NULL)
  	{
***************
*** 1261,1267 ****
  	register struct hostent *hp;
  	int saveretry;
  
! #ifdef NAMED_BIND
  	/* shorten name server timeout to avoid higher level timeouts */
  	saveretry = _res.retry;
  	_res.retry = 3;
--- 1294,1300 ----
  	register struct hostent *hp;
  	int saveretry;
  
! #if NAMED_BIND
  	/* shorten name server timeout to avoid higher level timeouts */
  	saveretry = _res.retry;
  	_res.retry = 3;
***************
*** 1298,1304 ****
  		break;
  	}
  
! #ifdef NAMED_BIND
  	_res.retry = saveretry;
  #endif /* NAMED_BIND */
  
--- 1331,1337 ----
  		break;
  	}
  
! #if NAMED_BIND
  	_res.retry = saveretry;
  #endif /* NAMED_BIND */
  
*** src/deliver.c.OLD	Wed Jan 12 12:38:48 1994
--- src/deliver.c	Fri Mar 11 14:42:23 1994
***************
*** 33,45 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)deliver.c	8.62 (Berkeley) 1/12/94";
  #endif /* not lint */
  
  #include "sendmail.h"
  #include <netdb.h>
  #include <errno.h>
! #ifdef NAMED_BIND
  #include <arpa/nameser.h>
  #include <resolv.h>
  
--- 33,45 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)deliver.c	8.78 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  #include "sendmail.h"
  #include <netdb.h>
  #include <errno.h>
! #if NAMED_BIND
  #include <arpa/nameser.h>
  #include <resolv.h>
  
***************
*** 124,132 ****
  	if (e->e_hopcount > MaxHopCount)
  	{
  		errno = 0;
  		syserr("554 too many hops %d (%d max): from %s via %s, to %s",
  			e->e_hopcount, MaxHopCount, e->e_from.q_paddr,
! 			RealHostName, e->e_sendqueue->q_paddr);
  		return;
  	}
  
--- 124,134 ----
  	if (e->e_hopcount > MaxHopCount)
  	{
  		errno = 0;
+ 		e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE;
  		syserr("554 too many hops %d (%d max): from %s via %s, to %s",
  			e->e_hopcount, MaxHopCount, e->e_from.q_paddr,
! 			RealHostName == NULL ? "localhost" : RealHostName,
! 			e->e_sendqueue->q_paddr);
  		return;
  	}
  
***************
*** 247,256 ****
--- 249,264 ----
  			
  			for (q = e->e_sendqueue; q != NULL; q = q->q_next)
  				if (q->q_owner == owner)
+ 				{
  					q->q_flags |= QDONTSEND;
+ 					q->q_flags &= ~QQUEUEUP;
+ 				}
  			for (q = ee->e_sendqueue; q != NULL; q = q->q_next)
  				if (q->q_owner != owner)
+ 				{
  					q->q_flags |= QDONTSEND;
+ 					q->q_flags &= ~QQUEUEUP;
+ 				}
  
  			if (e->e_df != NULL && mode != SM_VERIFY)
  			{
***************
*** 263,275 ****
  						e->e_df, ee->e_df);
  				}
  			}
- 
- 			if (mode != SM_VERIFY)
- 				openxscript(ee);
  #ifdef LOG
  			if (LogLevel > 4)
! 				syslog(LOG_INFO, "%s: clone %s",
! 					ee->e_id, e->e_id);
  #endif
  		}
  	}
--- 271,280 ----
  						e->e_df, ee->e_df);
  				}
  			}
  #ifdef LOG
  			if (LogLevel > 4)
! 				syslog(LOG_INFO, "%s: clone %s, owner=%s",
! 					ee->e_id, e->e_id, owner);
  #endif
  		}
  	}
***************
*** 309,323 ****
  		for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
  		{
  			CurEnv = ee;
  			sendenvelope(ee, mode);
  		}
  
  		CurEnv = e;
  	}
  	sendenvelope(e, mode);
- 
- 	for (; splitenv != NULL; splitenv = splitenv->e_sibling)
- 		dropenvelope(splitenv);
  }
  
  sendenvelope(e, mode)
--- 314,328 ----
  		for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
  		{
  			CurEnv = ee;
+ 			if (mode != SM_VERIFY)
+ 				openxscript(ee);
  			sendenvelope(ee, mode);
+ 			dropenvelope(ee);
  		}
  
  		CurEnv = e;
  	}
  	sendenvelope(e, mode);
  }
  
  sendenvelope(e, mode)
***************
*** 360,366 ****
  		if (e->e_xfp != NULL)
  			(void) fflush(e->e_xfp);
  
! # ifndef HASFLOCK
  		/*
  		**  Since fcntl locking has the interesting semantic that
  		**  the lock is owned by a process, not by an open file
--- 365,371 ----
  		if (e->e_xfp != NULL)
  			(void) fflush(e->e_xfp);
  
! # if !HASFLOCK
  		/*
  		**  Since fcntl locking has the interesting semantic that
  		**  the lock is owned by a process, not by an open file
***************
*** 401,416 ****
  				(void) xfclose(e->e_dfp, "sendenvelope", e->e_df);
  			e->e_dfp = NULL;
  			e->e_id = e->e_df = NULL;
  			return;
  		}
  
  		/* double fork to avoid zombies */
! 		if (fork() > 0)
  			exit(EX_OK);
  
  		/* be sure we are immune from the terminal */
  		disconnect(1, e);
  
  		/*
  		**  Close any cached connections.
  		**
--- 406,432 ----
  				(void) xfclose(e->e_dfp, "sendenvelope", e->e_df);
  			e->e_dfp = NULL;
  			e->e_id = e->e_df = NULL;
+ 
+ 			/* catch intermediate zombie */
+ 			(void) waitfor(pid);
  			return;
  		}
  
  		/* double fork to avoid zombies */
! 		pid = fork();
! 		if (pid > 0)
  			exit(EX_OK);
  
  		/* be sure we are immune from the terminal */
  		disconnect(1, e);
  
+ 		/* prevent parent from waiting if there was an error */
+ 		if (pid < 0)
+ 		{
+ 			e->e_flags |= EF_INQUEUE|EF_KEEPQUEUE;
+ 			finis();
+ 		}
+ 
  		/*
  		**  Close any cached connections.
  		**
***************
*** 604,610 ****
  	if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags))
  		return (0);
  
! #ifdef NAMED_BIND
  	/* unless interactive, try twice, over a minute */
  	if (OpMode == MD_DAEMON || OpMode == MD_SMTP)
  	{
--- 620,626 ----
  	if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags))
  		return (0);
  
! #if NAMED_BIND
  	/* unless interactive, try twice, over a minute */
  	if (OpMode == MD_DAEMON || OpMode == MD_SMTP)
  	{
***************
*** 620,627 ****
  	SmtpError[0] = '\0';
  
  	if (tTd(10, 1))
! 		printf("\n--deliver, mailer=%d, host=`%s', first user=`%s'\n",
! 			m->m_mno, host, to->q_user);
  	if (tTd(10, 100))
  		printopenfds(FALSE);
  
--- 636,643 ----
  	SmtpError[0] = '\0';
  
  	if (tTd(10, 1))
! 		printf("\n--deliver, id=%s, mailer=%s, host=`%s', first user=`%s'\n",
! 			e->e_id, m->m_name, host, to->q_user);
  	if (tTd(10, 100))
  		printopenfds(FALSE);
  
***************
*** 916,925 ****
  	*/
  
  	/*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 */
  #endif
--- 932,942 ----
  	*/
  
  	/*XXX this seems a bit wierd */
! 	if (ctladdr == NULL && m != ProgMailer &&
! 	    bitset(QGOODUID, e->e_from.q_flags))
  		ctladdr = &e->e_from;
  
! #if NAMED_BIND
  	if (ConfigLevel < 2)
  		_res.options &= ~(RES_DEFNAMES | RES_DNSRCH);	/* XXX */
  #endif
***************
*** 1047,1053 ****
  				bitnset(M_SECURE_PORT, m->m_flags));
  			mci->mci_exitstat = i;
  			mci->mci_errno = errno;
! #ifdef NAMED_BIND
  			mci->mci_herrno = h_errno;
  #endif
  			if (i == EX_OK)
--- 1064,1070 ----
  				bitnset(M_SECURE_PORT, m->m_flags));
  			mci->mci_exitstat = i;
  			mci->mci_errno = errno;
! #if NAMED_BIND
  			mci->mci_herrno = h_errno;
  #endif
  			if (i == EX_OK)
***************
*** 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)
--- 1240,1247 ----
  				}
  				(void) close(rpvect[1]);
  			}
! 			else if (OpMode == MD_SMTP || OpMode == MD_DAEMON ||
! 				  HoldErrs || DisConnected)
  			{
  				/* put mailer output in transcript */
  				if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
***************
*** 1260,1271 ****
  					(void) fcntl(i, F_SETFD, j | 1);
  			}
  
! 			/* set up the mailer environment */
  			i = 0;
  			env[i++] = "AGENT=sendmail";
  			for (ep = environ; *ep != NULL; ep++)
  			{
! 				if (strncmp(*ep, "TZ=", 3) == 0)
  					env[i++] = *ep;
  			}
  			env[i++] = NULL;
--- 1278,1297 ----
  					(void) fcntl(i, F_SETFD, j | 1);
  			}
  
! 			/*
! 			**  Set up the mailer environment
! 			**	TZ is timezone information.
! 			**	SYSTYPE is Apollo software sys type (required).
! 			**	ISP is Apollo hardware system type (required).
! 			*/
! 
  			i = 0;
  			env[i++] = "AGENT=sendmail";
  			for (ep = environ; *ep != NULL; ep++)
  			{
! 				if (strncmp(*ep, "TZ=", 3) == 0 ||
! 				    strncmp(*ep, "ISP=", 4) == 0 ||
! 				    strncmp(*ep, "SYSTYPE=", 8) == 0)
  					env[i++] = *ep;
  			}
  			env[i++] = NULL;
***************
*** 1344,1350 ****
  		/* couldn't open the mailer */
  		rcode = mci->mci_exitstat;
  		errno = mci->mci_errno;
! #ifdef NAMED_BIND
  		h_errno = mci->mci_herrno;
  #endif
  		if (rcode == EX_OK)
--- 1370,1376 ----
  		/* couldn't open the mailer */
  		rcode = mci->mci_exitstat;
  		errno = mci->mci_errno;
! #if NAMED_BIND
  		h_errno = mci->mci_herrno;
  #endif
  		if (rcode == EX_OK)
***************
*** 1366,1375 ****
  		**  Format and send message.
  		*/
  
! 		putfromline(mci->mci_out, m, e);
! 		(*e->e_puthdr)(mci->mci_out, m, e);
! 		putline("\n", mci->mci_out, m);
! 		(*e->e_putbody)(mci->mci_out, m, e, NULL);
  
  		/* get the exit status */
  		rcode = endmailer(mci, e, pv);
--- 1392,1401 ----
  		**  Format and send message.
  		*/
  
! 		putfromline(mci, e);
! 		(*e->e_puthdr)(mci, e);
! 		putline("\n", mci);
! 		(*e->e_putbody)(mci, e, NULL);
  
  		/* get the exit status */
  		rcode = endmailer(mci, e, pv);
***************
*** 1437,1443 ****
  		goto give_up;
  	}
  #endif /* SMTP */
! #ifdef NAMED_BIND
  	if (ConfigLevel < 2)
  		_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
  #endif
--- 1463,1469 ----
  		goto give_up;
  	}
  #endif /* SMTP */
! #if NAMED_BIND
  	if (ConfigLevel < 2)
  		_res.options |= RES_DEFNAMES | RES_DNSRCH;	/* XXX */
  #endif
***************
*** 1667,1673 ****
  	else if (stat == EX_TEMPFAIL)
  	{
  		(void) strcpy(buf, SysExMsg[i] + 1);
! #ifdef NAMED_BIND
  		if (h_errno == TRY_AGAIN)
  			statmsg = errstring(h_errno+E_DNSBASE);
  		else
--- 1693,1699 ----
  	else if (stat == EX_TEMPFAIL)
  	{
  		(void) strcpy(buf, SysExMsg[i] + 1);
! #if NAMED_BIND
  		if (h_errno == TRY_AGAIN)
  			statmsg = errstring(h_errno+E_DNSBASE);
  		else
***************
*** 1691,1697 ****
  		}
  		statmsg = buf;
  	}
! #ifdef NAMED_BIND
  	else if (stat == EX_NOHOST && h_errno != 0)
  	{
  		statmsg = errstring(h_errno + E_DNSBASE);
--- 1717,1723 ----
  		}
  		statmsg = buf;
  	}
! #if NAMED_BIND
  	else if (stat == EX_NOHOST && h_errno != 0)
  	{
  		statmsg = errstring(h_errno + E_DNSBASE);
***************
*** 1717,1723 ****
  	{
  		extern char MsgBuf[];
  
! 		message(&statmsg[4], errstring(errno));
  		if (stat == EX_TEMPFAIL && e->e_xfp != NULL)
  			fprintf(e->e_xfp, "%s\n", &MsgBuf[4]);
  	}
--- 1743,1749 ----
  	{
  		extern char MsgBuf[];
  
! 		message("%s", &statmsg[4]);
  		if (stat == EX_TEMPFAIL && e->e_xfp != NULL)
  			fprintf(e->e_xfp, "%s\n", &MsgBuf[4]);
  	}
***************
*** 1737,1742 ****
--- 1763,1772 ----
  	if (LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
  		logdelivery(m, mci, &statmsg[4], ctladdr, e);
  
+ 	if (tTd(11, 2))
+ 		printf("giveresponse: stat=%d, e->e_message=%s\n",
+ 			stat, e->e_message);
+ 
  	if (stat != EX_TEMPFAIL)
  		setstat(stat);
  	if (stat != EX_OK && (stat != EX_TEMPFAIL || e->e_message == NULL))
***************
*** 1746,1752 ****
  		e->e_message = newstr(&statmsg[4]);
  	}
  	errno = 0;
! #ifdef NAMED_BIND
  	h_errno = 0;
  #endif
  }
--- 1776,1782 ----
  		e->e_message = newstr(&statmsg[4]);
  	}
  	errno = 0;
! #if NAMED_BIND
  	h_errno = 0;
  #endif
  }
***************
*** 1820,1828 ****
  		(void) strcat(bp, mci->mci_host);
  
  # ifdef DAEMON
! 		(void) strcat(bp, " (");
  		(void) strcat(bp, anynet_ntoa(&CurHostAddr));
! 		(void) strcat(bp, ")");
  # endif
  	}
  	else
--- 1850,1858 ----
  		(void) strcat(bp, mci->mci_host);
  
  # ifdef DAEMON
! 		(void) strcat(bp, " [");
  		(void) strcat(bp, anynet_ntoa(&CurHostAddr));
! 		(void) strcat(bp, "]");
  # endif
  	}
  	else
***************
*** 1876,1882 ****
  
  #  else		/* we have a very short log buffer size */
  
! 	l = SYSLOG_BUFSIZE - 80;
  	p = e->e_to;
  	while (strlen(p) >= l)
  	{
--- 1906,1912 ----
  
  #  else		/* we have a very short log buffer size */
  
! 	l = SYSLOG_BUFSIZE - 85;
  	p = e->e_to;
  	while (strlen(p) >= l)
  	{
***************
*** 1914,1920 ****
--- 1944,1952 ----
  		sprintf(bp, ", mailer=%s", m->m_name);
  		bp += strlen(bp);
  	}
+ 	syslog(LOG_INFO, "%s: %s", e->e_id, buf);
  
+ 	buf[0] = '\0';
  	if (mci != NULL && mci->mci_host != NULL)
  	{
  # ifdef DAEMON
***************
*** 1921,1932 ****
  		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
--- 1953,1964 ----
  		extern SOCKADDR CurHostAddr;
  # endif
  
! 		sprintf(buf, "relay=%s", mci->mci_host);
  
  # ifdef DAEMON
! 		(void) strcat(buf, " [");
! 		(void) strcat(buf, anynet_ntoa(&CurHostAddr));
! 		(void) strcat(buf, "]");
  # endif
  	}
  	else
***************
*** 1934,1942 ****
  		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 */
--- 1966,1975 ----
  		char *p = macvalue('h', e);
  
  		if (p != NULL && p[0] != '\0')
! 			sprintf(buf, "relay=%s", p);
  	}
! 	if (buf[0] != '\0')
! 		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 */
***************
*** 1953,1960 ****
  **	this kind of antique garbage????
  **
  **	Parameters:
! **		fp -- the file to output to.
! **		m -- the mailer describing this entry.
  **
  **	Returns:
  **		none
--- 1986,1993 ----
  **	this kind of antique garbage????
  **
  **	Parameters:
! **		mci -- the connection information.
! **		e -- the envelope.
  **
  **	Returns:
  **		none
***************
*** 1963,1981 ****
  **		outputs some text to fp.
  */
  
! putfromline(fp, m, e)
! 	register FILE *fp;
! 	register MAILER *m;
  	ENVELOPE *e;
  {
  	char *template = "\201l\n";
  	char buf[MAXLINE];
  
! 	if (bitnset(M_NHDR, m->m_flags))
  		return;
  
  # ifdef UGLYUUCP
! 	if (bitnset(M_UGLYUUCP, m->m_flags))
  	{
  		char *bang;
  		char xbuf[MAXLINE];
--- 1996,2013 ----
  **		outputs some text to fp.
  */
  
! putfromline(mci, e)
! 	register MCI *mci;
  	ENVELOPE *e;
  {
  	char *template = "\201l\n";
  	char buf[MAXLINE];
  
! 	if (bitnset(M_NHDR, mci->mci_mailer->m_flags))
  		return;
  
  # ifdef UGLYUUCP
! 	if (bitnset(M_UGLYUUCP, mci->mci_mailer->m_flags))
  	{
  		char *bang;
  		char xbuf[MAXLINE];
***************
*** 1996,2009 ****
  	}
  # endif /* UGLYUUCP */
  	expand(template, buf, &buf[sizeof buf - 1], e);
! 	putline(buf, fp, m);
  }
  /*
  **  PUTBODY -- put the body of a message.
  **
  **	Parameters:
! **		fp -- file to output onto.
! **		m -- a mailer descriptor to control output format.
  **		e -- the envelope to put out.
  **		separator -- if non-NULL, a message separator that must
  **			not be permitted in the resulting message.
--- 2028,2040 ----
  	}
  # endif /* UGLYUUCP */
  	expand(template, buf, &buf[sizeof buf - 1], e);
! 	putline(buf, mci);
  }
  /*
  **  PUTBODY -- put the body of a message.
  **
  **	Parameters:
! **		mci -- the connection information.
  **		e -- the envelope to put out.
  **		separator -- if non-NULL, a message separator that must
  **			not be permitted in the resulting message.
***************
*** 2015,2023 ****
  **		The message is written onto fp.
  */
  
! putbody(fp, m, e, separator)
! 	FILE *fp;
! 	MAILER *m;
  	register ENVELOPE *e;
  	char *separator;
  {
--- 2046,2053 ----
  **		The message is written onto fp.
  */
  
! putbody(mci, e, separator)
! 	register MCI *mci;
  	register ENVELOPE *e;
  	char *separator;
  {
***************
*** 2037,2052 ****
  				e->e_df, e->e_to, e->e_from.q_paddr);
  		}
  		else
! 			putline("<<< No Message Collected >>>", fp, m);
  	}
  	if (e->e_dfp != NULL)
  	{
  		rewind(e->e_dfp);
! 		while (!ferror(fp) && fgets(buf, sizeof buf, e->e_dfp) != NULL)
  		{
! 			if (buf[0] == 'F' && bitnset(M_ESCFROM, m->m_flags) &&
  			    strncmp(buf, "From ", 5) == 0)
! 				(void) putc('>', fp);
  			if (buf[0] == '-' && buf[1] == '-' && separator != NULL)
  			{
  				/* possible separator */
--- 2067,2083 ----
  				e->e_df, e->e_to, e->e_from.q_paddr);
  		}
  		else
! 			putline("<<< No Message Collected >>>", mci);
  	}
  	if (e->e_dfp != NULL)
  	{
  		rewind(e->e_dfp);
! 		while (!ferror(mci->mci_out) && fgets(buf, sizeof buf, e->e_dfp) != NULL)
  		{
! 			if (buf[0] == 'F' &&
! 			    bitnset(M_ESCFROM, mci->mci_mailer->m_flags) &&
  			    strncmp(buf, "From ", 5) == 0)
! 				(void) putc('>', mci->mci_out);
  			if (buf[0] == '-' && buf[1] == '-' && separator != NULL)
  			{
  				/* possible separator */
***************
*** 2053,2061 ****
  				int sl = strlen(separator);
  
  				if (strncmp(&buf[2], separator, sl) == 0)
! 					(void) putc(' ', fp);
  			}
! 			putline(buf, fp, m);
  		}
  
  		if (ferror(e->e_dfp))
--- 2084,2092 ----
  				int sl = strlen(separator);
  
  				if (strncmp(&buf[2], separator, sl) == 0)
! 					(void) putc(' ', mci->mci_out);
  			}
! 			putline(buf, mci);
  		}
  
  		if (ferror(e->e_dfp))
***************
*** 2066,2076 ****
  	}
  
  	/* some mailers want extra blank line at end of message */
! 	if (bitnset(M_BLANKEND, m->m_flags) && buf[0] != '\0' && buf[0] != '\n')
! 		putline("", fp, m);
  
! 	(void) fflush(fp);
! 	if (ferror(fp) && errno != EPIPE)
  	{
  		syserr("putbody: write error");
  		ExitStat = EX_IOERR;
--- 2097,2108 ----
  	}
  
  	/* some mailers want extra blank line at end of message */
! 	if (bitnset(M_BLANKEND, mci->mci_mailer->m_flags) &&
! 	    buf[0] != '\0' && buf[0] != '\n')
! 		putline("", mci);
  
! 	(void) fflush(mci->mci_out);
! 	if (ferror(mci->mci_out) && errno != EPIPE)
  	{
  		syserr("putbody: write error");
  		ExitStat = EX_IOERR;
***************
*** 2135,2140 ****
--- 2167,2173 ----
  	{
  		/* child -- actually write to file */
  		struct stat stb;
+ 		MCI mcibuf;
  
  		(void) setsignal(SIGINT, SIG_DFL);
  		(void) setsignal(SIGHUP, SIG_DFL);
***************
*** 2197,2207 ****
  			exit(EX_CANTCREAT);
  		}
  
! 		putfromline(f, FileMailer, e);
! 		(*e->e_puthdr)(f, FileMailer, e);
! 		putline("\n", f, FileMailer);
! 		(*e->e_putbody)(f, FileMailer, e, NULL);
! 		putline("\n", f, FileMailer);
  		if (ferror(f))
  		{
  			message("451 I/O error: %s", errstring(errno));
--- 2230,2246 ----
  			exit(EX_CANTCREAT);
  		}
  
! 		bzero(&mcibuf, sizeof mcibuf);
! 		mcibuf.mci_mailer = FileMailer;
! 		mcibuf.mci_out = f;
! 		if (bitnset(M_7BITS, FileMailer->m_flags))
! 			mcibuf.mci_flags |= MCIF_7BIT;
! 
! 		putfromline(&mcibuf, e);
! 		(*e->e_puthdr)(&mcibuf, e);
! 		putline("\n", &mcibuf);
! 		(*e->e_putbody)(&mcibuf, e, NULL);
! 		putline("\n", &mcibuf);
  		if (ferror(f))
  		{
  			message("451 I/O error: %s", errstring(errno));
***************
*** 2260,2266 ****
  	register STAB *s;
  	int i;
  	int len;
! #ifdef NAMED_BIND
  	int nmx;
  	auto int rcode;
  	char *hp;
--- 2299,2305 ----
  	register STAB *s;
  	int i;
  	int len;
! #if NAMED_BIND
  	int nmx;
  	auto int rcode;
  	char *hp;
***************
*** 2292,2298 ****
  	**  Not already there -- create a signature.
  	*/
  
! #ifdef NAMED_BIND
  	if (ConfigLevel < 2)
  	{
  		oldoptions = _res.options;
--- 2331,2337 ----
  	**  Not already there -- create a signature.
  	*/
  
! #if NAMED_BIND
  	if (ConfigLevel < 2)
  	{
  		oldoptions = _res.options;
***************
*** 2315,2321 ****
  			mci = mci_get(hp, m);
  			mci->mci_exitstat = rcode;
  			mci->mci_errno = errno;
! #ifdef NAMED_BIND
  			mci->mci_herrno = h_errno;
  #endif
  
--- 2354,2360 ----
  			mci = mci_get(hp, m);
  			mci->mci_exitstat = rcode;
  			mci->mci_errno = errno;
! #if NAMED_BIND
  			mci->mci_herrno = h_errno;
  #endif
  
*** src/domain.c.OLD	Tue Dec 21 14:52:18 1993
--- src/domain.c	Fri Mar 11 14:42:21 1994
***************
*** 35,48 ****
  #include "sendmail.h"
  
  #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 */
  
! #ifdef NAMED_BIND
  
  #include <errno.h>
  #include <arpa/nameser.h>
--- 35,48 ----
  #include "sendmail.h"
  
  #ifndef lint
! #if NAMED_BIND
! static char sccsid[] = "@(#)domain.c	8.19 (Berkeley) 3/11/94 (with name server)";
  #else
! static char sccsid[] = "@(#)domain.c	8.19 (Berkeley) 3/11/94 (without name server)";
  #endif
  #endif /* not lint */
  
! #if NAMED_BIND
  
  #include <errno.h>
  #include <arpa/nameser.h>
***************
*** 69,74 ****
--- 69,78 ----
  # define NO_DATA	NO_ADDRESS
  #endif
  
+ #ifndef HEADERSZ
+ # define HEADERSZ	sizeof(HEADER)
+ #endif
+ 
  /* don't use sizeof because sizeof(long) is different on 64-bit machines */
  #define SHORTSIZE	2	/* size of a short (really, must be 2) */
  #define LONGSIZE	4	/* size of a long (really, must be 4) */
***************
*** 116,121 ****
--- 120,128 ----
  	int weight[MAXMXHOSTS];
  	extern bool getcanonname();
  
+ 	if (tTd(8, 2))
+ 		printf("getmxrr(%s, droplocalhost=%d)\n", host, droplocalhost);
+ 
  	if (fallbackMX != NULL)
  	{
  		if (firsttime && res_query(FallBackMX, C_IN, T_A,
***************
*** 156,161 ****
--- 163,172 ----
  			goto punt;
  
  		  case HOST_NOT_FOUND:
+ #ifdef BROKEN_RES_SEARCH
+ 			/* Ultrix resolver returns failure w/ h_errno=0 */
+ 		  case 0:
+ #endif
  			/* the host just doesn't exist */
  			*rcode = EX_NOHOST;
  
***************
*** 174,179 ****
--- 185,196 ----
  			/* it might come up later; better queue it up */
  			*rcode = EX_TEMPFAIL;
  			break;
+ 
+ 		  default:
+ 			syserr("getmxrr: res_search (%s) failed with impossible h_errno (%d)\n",
+ 				host, h_errno);
+ 			*rcode = EX_OSERR;
+ 			break;
  		}
  
  		/* irreconcilable differences */
***************
*** 182,188 ****
  
  	/* find first satisfactory answer */
  	hp = (HEADER *)&answer;
! 	cp = (u_char *)&answer + sizeof(HEADER);
  	eom = (u_char *)&answer + n;
  	for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
  		if ((n = dn_skipname(cp, eom)) < 0)
--- 199,205 ----
  
  	/* find first satisfactory answer */
  	hp = (HEADER *)&answer;
! 	cp = (u_char *)&answer + HEADERSZ;
  	eom = (u_char *)&answer + n;
  	for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
  		if ((n = dn_skipname(cp, eom)) < 0)
***************
*** 216,221 ****
--- 233,241 ----
  		    (st = stab(bp, ST_CLASS, ST_FIND)) != NULL &&
  		    bitnset('w', st->s_class))
  		{
+ 			if (tTd(8, 3))
+ 				printf("found localhost (%s) in MX list, pref=%d\n",
+ 					bp, pref);
  			if (!seenlocal || pref < localpref)
  				localpref = pref;
  			seenlocal = TRUE;
***************
*** 283,288 ****
--- 303,310 ----
  			*/
  
  			*rcode = EX_CONFIG;
+ 			syserr("MX list for %s points back to %s",
+ 				host, MyHostName);
  			return -1;
  		}
  		strcpy(MXHostBuf, host);
***************
*** 365,371 ****
  
  		if (isascii(c) && isupper(c))
  			c = tolower(c);
! 		hfunc = ((hfunc << 1) + c) % 2003;
  	}
  
  	hfunc &= 0xff;
--- 387,393 ----
  
  		if (isascii(c) && isupper(c))
  			c = tolower(c);
! 		hfunc = ((hfunc << 1) ^ c) % 2003;
  	}
  
  	hfunc &= 0xff;
***************
*** 478,483 ****
--- 500,509 ----
  	{
  		*dp++ = _res.defdname;
  	}
+ 	else if (*cp == '.')
+ 	{
+ 		*cp = '\0';
+ 	}
  	*dp = NULL;
  
  	/*
***************
*** 546,552 ****
  		*/
  
  		hp = (HEADER *) &answer;
! 		ap = (u_char *) &answer + sizeof(HEADER);
  		eom = (u_char *) &answer + ret;
  
  		/* skip question part of response -- we know what we asked */
--- 572,578 ----
  		*/
  
  		hp = (HEADER *) &answer;
! 		ap = (u_char *) &answer + HEADERSZ;
  		eom = (u_char *) &answer + ret;
  
  		/* skip question part of response -- we know what we asked */
***************
*** 597,605 ****
  			  case T_CNAME:
  				if (loopcnt++ > MAXCNAMEDEPTH)
  				{
! 					syserr("DNS failure: CNAME loop for %s",
  						host);
! 					continue;
  				}
  
  				/* value points at name */
--- 623,641 ----
  			  case T_CNAME:
  				if (loopcnt++ > MAXCNAMEDEPTH)
  				{
! 					/*XXX should notify postmaster XXX*/
! 					message("DNS failure: CNAME loop for %s",
  						host);
! 					if (CurEnv->e_message == NULL)
! 					{
! 						char ebuf[MAXLINE];
! 
! 						sprintf(ebuf, "Deferred: DNS failure: CNAME loop for %s",
! 							host);
! 						CurEnv->e_message = newstr(ebuf);
! 					}
! 					h_errno = NO_RECOVERY;
! 					return FALSE;
  				}
  
  				/* value points at name */
*** src/envelope.c.OLD	Sun Jan  9 09:22:39 1994
--- src/envelope.c	Fri Feb 25 20:33:10 1994
***************
*** 33,43 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)envelope.c	8.28 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  #include "sendmail.h"
- #include <sys/time.h>
  #include <pwd.h>
  
  /*
--- 33,42 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)envelope.c	8.33 (Berkeley) 2/10/94";
  #endif /* not lint */
  
  #include "sendmail.h"
  #include <pwd.h>
  
  /*
***************
*** 585,591 ****
  	*/
  
  	if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
! 	    OpMode == MD_DAEMON)
  		realname = from;
  	if (realname == NULL || realname[0] == '\0')
  		realname = username();
--- 584,590 ----
  	*/
  
  	if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
! 	    OpMode == MD_ARPAFTP || OpMode == MD_DAEMON)
  		realname = from;
  	if (realname == NULL || realname[0] == '\0')
  		realname = username();
***************
*** 694,702 ****
  			**  Process passwd file entry.
  			*/
  
- 
  			/* extract home directory */
! 			e->e_from.q_home = newstr(pw->pw_dir);
  			define('z', e->e_from.q_home, e);
  
  			/* extract user and group id */
--- 693,703 ----
  			**  Process passwd file entry.
  			*/
  
  			/* extract home directory */
! 			if (strcmp(pw->pw_dir, "/") == 0)
! 				e->e_from.q_home = newstr("");
! 			else
! 				e->e_from.q_home = newstr(pw->pw_dir);
  			define('z', e->e_from.q_home, e);
  
  			/* extract user and group id */
***************
*** 720,726 ****
--- 721,732 ----
  	else if (!internal && OpMode != MD_DAEMON)
  	{
  		if (e->e_from.q_home == NULL)
+ 		{
  			e->e_from.q_home = getenv("HOME");
+ 			if (e->e_from.q_home != NULL &&
+ 			    strcmp(e->e_from.q_home, "/") == 0)
+ 				e->e_from.q_home++;
+ 		}
  		e->e_from.q_uid = RealUid;
  		e->e_from.q_gid = RealGid;
  		e->e_from.q_flags |= QGOODUID;
*** src/err.c.OLD	Sat Jan  8 17:29:31 1994
--- src/err.c	Fri Mar 11 14:42:21 1994
***************
*** 33,44 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)err.c	8.19 (Berkeley) 1/8/94";
  #endif /* not lint */
  
  # include "sendmail.h"
  # include <errno.h>
  # include <netdb.h>
  
  /*
  **  SYSERR -- Print error message.
--- 33,45 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)err.c	8.26 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  # include "sendmail.h"
  # include <errno.h>
  # include <netdb.h>
+ # include <pwd.h>
  
  /*
  **  SYSERR -- Print error message.
***************
*** 68,74 ****
  
  static void	fmtmsg();
  
! #if defined(NAMED_BIND) && !defined(NO_DATA)
  # define NO_DATA	NO_ADDRESS
  #endif
  
--- 69,75 ----
  
  static void	fmtmsg();
  
! #if NAMED_BIND && !defined(NO_DATA)
  # define NO_DATA	NO_ADDRESS
  #endif
  
***************
*** 85,90 ****
--- 86,96 ----
  	register char *p;
  	int olderrno = errno;
  	bool panic;
+ #ifdef LOG
+ 	char *uname;
+ 	struct passwd *pw;
+ 	char ubuf[80];
+ #endif
  	VA_LOCAL_DECL
  
  	panic = *fmt == '!';
***************
*** 108,120 ****
  			ExitStat = EX_SOFTWARE;
  		else
  			ExitStat = EX_OSERR;
  	}
  
  # ifdef LOG
  	if (LogLevel > 0)
! 		syslog(panic ? LOG_ALERT : LOG_CRIT, "%s: SYSERR: %s",
  			CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id,
! 			&MsgBuf[4]);
  # endif /* LOG */
  	if (olderrno == EMFILE)
  	{
--- 114,137 ----
  			ExitStat = EX_SOFTWARE;
  		else
  			ExitStat = EX_OSERR;
+ 		if (tTd(54, 1))
+ 			printf("syserr: ExitStat = %d\n", ExitStat);
  	}
  
  # ifdef LOG
+ 	pw = getpwuid(getuid());
+ 	if (pw != NULL)
+ 		uname = pw->pw_name;
+ 	else
+ 	{
+ 		uname = ubuf;
+ 		sprintf(ubuf, "UID%d", getuid());
+ 	}
+ 
  	if (LogLevel > 0)
! 		syslog(panic ? LOG_ALERT : LOG_CRIT, "%s: SYSERR(%s): %s",
  			CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id,
! 			uname, &MsgBuf[4]);
  # endif /* LOG */
  	if (olderrno == EMFILE)
  	{
***************
*** 285,291 ****
  		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]);
--- 302,311 ----
  		msg[0] = '5';
  
  	(void) fflush(stdout);
! 
! 	/* if DisConnected, OutChannel now points to the transcript */
! 	if (!DisConnected &&
! 	    (OpMode == MD_SMTP || OpMode == MD_DAEMON || OpMode == MD_ARPAFTP))
  		fprintf(OutChannel, "%s\r\n", msg);
  	else
  		fprintf(OutChannel, "%s\n", &msg[4]);
***************
*** 294,300 ****
  			(OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
  	if (msg[3] == ' ')
  		(void) fflush(OutChannel);
! 	if (!ferror(OutChannel))
  		return;
  
  	/*
--- 314,320 ----
  			(OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
  	if (msg[3] == ' ')
  		(void) fflush(OutChannel);
! 	if (!ferror(OutChannel) || DisConnected)
  		return;
  
  	/*
***************
*** 404,410 ****
  	/* output the "to" person */
  	if (to != NULL && to[0] != '\0')
  	{
! 		(void) sprintf(eb, "%s... ", to);
  		while (*eb != '\0')
  			*eb++ &= 0177;
  	}
--- 424,430 ----
  	/* output the "to" person */
  	if (to != NULL && to[0] != '\0')
  	{
! 		(void) sprintf(eb, "%s... ", shortenstring(to, 203));
  		while (*eb != '\0')
  			*eb++ &= 0177;
  	}
***************
*** 434,443 ****
  **  ERRSTRING -- return string description of error code
  **
  **	Parameters:
! **		errno -- the error number to translate
  **
  **	Returns:
! **		A string description of errno.
  **
  **	Side Effects:
  **		none.
--- 454,463 ----
  **  ERRSTRING -- return string description of error code
  **
  **	Parameters:
! **		errnum -- the error number to translate
  **
  **	Returns:
! **		A string description of errnum.
  **
  **	Side Effects:
  **		none.
***************
*** 444,451 ****
  */
  
  const char *
! errstring(errno)
! 	int errno;
  {
  	char *dnsmsg;
  	static char buf[MAXLINE];
--- 464,471 ----
  */
  
  const char *
! errstring(errnum)
! 	int errnum;
  {
  	char *dnsmsg;
  	static char buf[MAXLINE];
***************
*** 464,475 ****
  	*/
  
  	dnsmsg = NULL;
! 	switch (errno)
  	{
  # if defined(DAEMON) && defined(ETIMEDOUT)
  	  case ETIMEDOUT:
  	  case ECONNRESET:
! 		(void) strcpy(buf, sys_errlist[errno]);
  		if (SmtpPhase != NULL)
  		{
  			(void) strcat(buf, " during ");
--- 484,495 ----
  	*/
  
  	dnsmsg = NULL;
! 	switch (errnum)
  	{
  # if defined(DAEMON) && defined(ETIMEDOUT)
  	  case ETIMEDOUT:
  	  case ECONNRESET:
! 		(void) strcpy(buf, sys_errlist[errnum]);
  		if (SmtpPhase != NULL)
  		{
  			(void) strcat(buf, " during ");
***************
*** 498,504 ****
  	  case EOPENTIMEOUT:
  		return "Timeout on file open";
  
! # ifdef NAMED_BIND
  	  case HOST_NOT_FOUND + E_DNSBASE:
  		dnsmsg = "host not found";
  		break;
--- 518,524 ----
  	  case EOPENTIMEOUT:
  		return "Timeout on file open";
  
! # if NAMED_BIND
  	  case HOST_NOT_FOUND + E_DNSBASE:
  		dnsmsg = "host not found";
  		break;
***************
*** 533,541 ****
  		return buf;
  	}
  
! 	if (errno > 0 && errno < sys_nerr)
! 		return (sys_errlist[errno]);
  
! 	(void) sprintf(buf, "Error %d", errno);
  	return (buf);
  }
--- 553,561 ----
  		return buf;
  	}
  
! 	if (errnum > 0 && errnum < sys_nerr)
! 		return (sys_errlist[errnum]);
  
! 	(void) sprintf(buf, "Error %d", errnum);
  	return (buf);
  }
*** src/headers.c.OLD	Wed Jan 12 12:38:49 1994
--- src/headers.c	Wed Mar  2 15:35:54 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)headers.c	8.21 (Berkeley) 1/12/94";
  #endif /* not lint */
  
  # include <errno.h>
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)headers.c	8.30 (Berkeley) 2/25/94";
  #endif /* not lint */
  
  # include <errno.h>
***************
*** 163,168 ****
--- 163,169 ----
  		{
  			auto ADDRESS a;
  			char *fancy;
+ 			bool oldSuprErrs = SuprErrs;
  			extern char *crackaddr();
  			extern char *udbsender();
  
***************
*** 170,177 ****
--- 171,186 ----
  			**  Try doing USERDB rewriting even on fully commented
  			**  names; this saves the "comment" information (such
  			**  as full name) and rewrites the electronic part.
+ 			**
+ 			** XXX	This code doesn't belong here -- parsing should
+ 			** XXX	not be done during collect() phase because
+ 			** XXX	error messages can confuse the SMTP phase.
+ 			** XXX	Setting SuprErrs is a crude hack around this
+ 			** XXX	problem.
  			*/
  
+ 			if (OpMode == MD_SMTP || OpMode == MD_ARPAFTP)
+ 				SuprErrs = TRUE;
  			fancy = crackaddr(fvalue);
  			if (parseaddr(fvalue, &a, RF_COPYNONE, '\0', NULL, e) != NULL &&
  			    a.q_mailer == LocalMailer &&
***************
*** 184,189 ****
--- 193,199 ----
  				define('g', oldg, e);
  				fvalue = buf;
  			}
+ 			SuprErrs = oldSuprErrs;
  		}
  #endif
  #endif
***************
*** 470,475 ****
--- 480,511 ----
  		define('a', p, e);
  
  	/*
+ 	**  From person in antiquated ARPANET mode
+ 	**	required by UK Grey Book e-mail gateways (sigh)
+ 	*/
+ 
+ 	if (OpMode == MD_ARPAFTP)
+ 	{
+ 		register struct hdrinfo *hi;
+ 
+ 		for (hi = HdrInfo; hi->hi_field != NULL; hi++)
+ 		{
+ 			if (bitset(H_FROM, hi->hi_flags) &&
+ 			    (!bitset(H_RESENT, hi->hi_flags) ||
+ 			     bitset(EF_RESENT, e->e_flags)) &&
+ 			    (p = hvalue(hi->hi_field, e)) != NULL)
+ 				break;
+ 		}
+ 		if (hi->hi_field != NULL)
+ 		{
+ 			if (tTd(32, 2))
+ 				printf("eatheader: setsender(*%s == %s)\n",
+ 					hi->hi_field, p);
+ 			setsender(p, e, NULL, TRUE);
+ 		}
+ 	}
+ 
+ 	/*
  	**  Log collection information.
  	*/
  
***************
*** 504,509 ****
--- 540,547 ----
  		name = "[RESPONSE]";
  	else if ((name = macvalue('_', e)) != NULL)
  		;
+ 	else if (RealHostName == NULL)
+ 		name = "localhost";
  	else if (RealHostName[0] == '[')
  		name = RealHostName;
  	else
***************
*** 561,567 ****
  	p = macvalue('r', e);
  	if (p != NULL)
  	{
! 		sprintf(sbp, " proto=%s,", e->e_id, p);
  		sbp += strlen(sbp);
  	}
  	syslog(LOG_INFO, "%s relay=%s", sbuf, name);
--- 599,605 ----
  	p = macvalue('r', e);
  	if (p != NULL)
  	{
! 		sprintf(sbp, " proto=%s,", p);
  		sbp += strlen(sbp);
  	}
  	syslog(LOG_INFO, "%s relay=%s", sbuf, name);
***************
*** 860,867 ****
  **  PUTHEADER -- put the header part of a message from the in-core copy
  **
  **	Parameters:
! **		fp -- file to put it on.
! **		m -- mailer to use.
  **		e -- envelope to use.
  **
  **	Returns:
--- 898,904 ----
  **  PUTHEADER -- put the header part of a message from the in-core copy
  **
  **	Parameters:
! **		mci -- the connection information.
  **		e -- envelope to use.
  **
  **	Returns:
***************
*** 878,886 ****
  # define MAX(a,b) (((a)>(b))?(a):(b))
  #endif
  
! putheader(fp, m, e)
! 	register FILE *fp;
! 	register MAILER *m;
  	register ENVELOPE *e;
  {
  	char buf[MAX(MAXLINE,BUFSIZ)];
--- 915,922 ----
  # define MAX(a,b) (((a)>(b))?(a):(b))
  #endif
  
! putheader(mci, e)
! 	register MCI *mci;
  	register ENVELOPE *e;
  {
  	char buf[MAX(MAXLINE,BUFSIZ)];
***************
*** 888,894 ****
  	char obuf[MAXLINE];
  
  	if (tTd(34, 1))
! 		printf("--- putheader, mailer = %s ---\n", m->m_name);
  
  	for (h = e->e_header; h != NULL; h = h->h_link)
  	{
--- 924,931 ----
  	char obuf[MAXLINE];
  
  	if (tTd(34, 1))
! 		printf("--- putheader, mailer = %s ---\n",
! 			mci->mci_mailer->m_name);
  
  	for (h = e->e_header; h != NULL; h = h->h_link)
  	{
***************
*** 902,908 ****
  		}
  
  		if (bitset(H_CHECK|H_ACHECK, h->h_flags) &&
! 		    !bitintersect(h->h_mflags, m->m_flags))
  		{
  			if (tTd(34, 11))
  				printf(" (skipped)\n");
--- 939,945 ----
  		}
  
  		if (bitset(H_CHECK|H_ACHECK, h->h_flags) &&
! 		    !bitintersect(h->h_mflags, mci->mci_mailer->m_flags))
  		{
  			if (tTd(34, 11))
  				printf(" (skipped)\n");
***************
*** 941,947 ****
  
  			if (bitset(H_FROM, h->h_flags))
  				oldstyle = FALSE;
! 			commaize(h, p, fp, oldstyle, m, e);
  		}
  		else
  		{
--- 978,984 ----
  
  			if (bitset(H_FROM, h->h_flags))
  				oldstyle = FALSE;
! 			commaize(h, p, oldstyle, mci, e);
  		}
  		else
  		{
***************
*** 954,965 ****
  				*nlp = '\0';
  				(void) strcat(obuf, p);
  				*nlp = '\n';
! 				putline(obuf, fp, m);
  				p = ++nlp;
  				obuf[0] = '\0';
  			}
  			(void) strcat(obuf, p);
! 			putline(obuf, fp, m);
  		}
  	}
  }
--- 991,1002 ----
  				*nlp = '\0';
  				(void) strcat(obuf, p);
  				*nlp = '\n';
! 				putline(obuf, mci);
  				p = ++nlp;
  				obuf[0] = '\0';
  			}
  			(void) strcat(obuf, p);
! 			putline(obuf, mci);
  		}
  	}
  }
***************
*** 969,978 ****
  **	Parameters:
  **		h -- the header field to output.
  **		p -- the value to put in it.
- **		fp -- file to put it to.
  **		oldstyle -- TRUE if this is an old style header.
! **		m -- a pointer to the mailer descriptor.  If NULL,
! **			don't transform the name at all.
  **		e -- the envelope containing the message.
  **
  **	Returns:
--- 1006,1013 ----
  **	Parameters:
  **		h -- the header field to output.
  **		p -- the value to put in it.
  **		oldstyle -- TRUE if this is an old style header.
! **		mci -- the connection information.
  **		e -- the envelope containing the message.
  **
  **	Returns:
***************
*** 982,997 ****
  **		outputs "p" to file "fp".
  */
  
! commaize(h, p, fp, oldstyle, m, e)
  	register HDR *h;
  	register char *p;
- 	FILE *fp;
  	bool oldstyle;
! 	register MAILER *m;
  	register ENVELOPE *e;
  {
  	register char *obp;
  	int opos;
  	bool firstone = TRUE;
  	char obuf[MAXLINE + 3];
  
--- 1017,1033 ----
  **		outputs "p" to file "fp".
  */
  
! void
! commaize(h, p, oldstyle, mci, e)
  	register HDR *h;
  	register char *p;
  	bool oldstyle;
! 	register MCI *mci;
  	register ENVELOPE *e;
  {
  	register char *obp;
  	int opos;
+ 	int omax;
  	bool firstone = TRUE;
  	char obuf[MAXLINE + 3];
  
***************
*** 1007,1012 ****
--- 1043,1051 ----
  	(void) sprintf(obp, "%s: ", h->h_field);
  	opos = strlen(h->h_field) + 2;
  	obp += opos;
+ 	omax = mci->mci_mailer->m_linelimit - 2;
+ 	if (omax < 0 || omax > 78)
+ 		omax = 78;
  
  	/*
  	**  Run through the list of values.
***************
*** 1070,1076 ****
  		if (bitset(H_FROM, h->h_flags))
  			flags |= RF_SENDERADDR;
  		stat = EX_OK;
! 		name = remotename(name, m, flags, &stat, e);
  		if (*name == '\0')
  		{
  			*p = savechar;
--- 1109,1115 ----
  		if (bitset(H_FROM, h->h_flags))
  			flags |= RF_SENDERADDR;
  		stat = EX_OK;
! 		name = remotename(name, mci->mci_mailer, flags, &stat, e);
  		if (*name == '\0')
  		{
  			*p = savechar;
***************
*** 1081,1092 ****
  		opos += strlen(name);
  		if (!firstone)
  			opos += 2;
! 		if (opos > 78 && !firstone)
  		{
  			(void) strcpy(obp, ",\n");
! 			putline(obuf, fp, m);
  			obp = obuf;
! 			(void) sprintf(obp, "        ");
  			opos = strlen(obp);
  			obp += opos;
  			opos += strlen(name);
--- 1120,1131 ----
  		opos += strlen(name);
  		if (!firstone)
  			opos += 2;
! 		if (opos > omax && !firstone)
  		{
  			(void) strcpy(obp, ",\n");
! 			putline(obuf, mci);
  			obp = obuf;
! 			(void) strcpy(obp, "        ");
  			opos = strlen(obp);
  			obp += opos;
  			opos += strlen(name);
***************
*** 1093,1099 ****
  		}
  		else if (!firstone)
  		{
! 			(void) sprintf(obp, ", ");
  			obp += 2;
  		}
  
--- 1132,1138 ----
  		}
  		else if (!firstone)
  		{
! 			(void) strcpy(obp, ", ");
  			obp += 2;
  		}
  
***************
*** 1103,1109 ****
  		*p = savechar;
  	}
  	(void) strcpy(obp, "\n");
! 	putline(obuf, fp, m);
  }
  /*
  **  COPYHEADER -- copy header list
--- 1142,1148 ----
  		*p = savechar;
  	}
  	(void) strcpy(obp, "\n");
! 	putline(obuf, mci);
  }
  /*
  **  COPYHEADER -- copy header list
*** src/macro.c.OLD	Thu Jul 29 08:33:17 1993
--- src/macro.c	Mon Feb  7 08:31:23 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)macro.c	8.2 (Berkeley) 7/29/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)macro.c	8.3 (Berkeley) 2/7/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 115,122 ****
  			continue;
  
  		  case MACROEXPAND:	/* macro interpolation */
! 			c = *++s;
! 			q = macvalue(c & 0177, e);
  			if (q == NULL)
  				continue;
  			break;
--- 115,128 ----
  			continue;
  
  		  case MACROEXPAND:	/* macro interpolation */
! 			c = *++s & 0177;
! 			if (c != '\0')
! 				q = macvalue(c, e);
! 			else
! 			{
! 				s--;
! 				q = NULL;
! 			}
  			if (q == NULL)
  				continue;
  			break;
*** src/mailq.1.OLD	Wed Feb  2 05:41:50 1994
--- src/mailq.1	Tue Feb 22 11:27:02 1994
***************
*** 0 ****
--- 1,88 ----
+ .\" Copyright (c) 1985, 1990, 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.
+ .\"
+ .\"     @(#)mailq.1	8.4 (Berkeley) 2/22/94
+ .\"
+ .Dd February 22, 1994
+ .Dt MAILQ 1
+ .Os BSD 4
+ .Sh NAME
+ .Nm mailq
+ .Nd print the mail queue
+ .Sh SYNOPSIS
+ .Nm mailq
+ .Op Fl v
+ .Sh DESCRIPTION
+ .Nm Mailq
+ prints a summary of the mail messages queued for future delivery.
+ .Pp
+ The first line printed for each message
+ shows the internal identifier used on this host
+ for the message,
+ the size of the message in bytes,
+ the date and time the message was accepted into the queue,
+ and the envelope sender of the message.
+ The second line shows the error message that caused this message
+ to be retained in the queue;
+ it will not be present if the message is being processed
+ for the first time.
+ The following lines show message recipients,
+ one per line.
+ .Pp
+ .Nm Mailq
+ is identical to
+ .Dq Li "sendmail -bp" .
+ .Pp
+ The options are as follows:
+ .Bl -tag -width Ds
+ .It Fl v
+ Print verbose information.
+ This adds the priority of the message and
+ a single character indicator (``+'' or blank)
+ indicating whether a warning message has been sent
+ on the first line of the message.
+ Additionally, extra lines may be intermixed with the recipients
+ indicating the ``controlling user'' information;
+ this shows who will own any programs that are executed
+ on behalf of this message
+ and the name of the alias this command expanded from, if any.
+ .El
+ .Pp
+ The
+ .Nm mailq
+ utility exits 0 on success, and >0 if an error occurs.
+ .Sh SEE ALSO
+ .Xr sendmail 8
+ .Sh HISTORY
+ The
+ .Nm mailq
+ command appeared in
+ .Bx 4.0 .
*** src/main.c.OLD	Sun Jan  9 11:09:20 1994
--- src/main.c	Fri Mar 11 14:42:20 1994
***************
*** 39,52 ****
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)main.c	8.46 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  #define	_DEFINE
  
  #include "sendmail.h"
! #include <sgtty.h>
! #ifdef NAMED_BIND
  #include <arpa/nameser.h>
  #include <resolv.h>
  #endif
--- 39,51 ----
  #endif /* not lint */
  
  #ifndef lint
! static char sccsid[] = "@(#)main.c	8.52 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  #define	_DEFINE
  
  #include "sendmail.h"
! #if NAMED_BIND
  #include <arpa/nameser.h>
  #include <resolv.h>
  #endif
***************
*** 321,327 ****
  	OpMode = MD_DELIVER;
  	FullName = getenv("NAME");
  
! #ifdef NAMED_BIND
  	if (tTd(8, 8))
  		_res.options |= RES_DEBUG;
  #endif
--- 320,326 ----
  	OpMode = MD_DELIVER;
  	FullName = getenv("NAME");
  
! #if NAMED_BIND
  	if (tTd(8, 8))
  		_res.options |= RES_DEBUG;
  #endif
***************
*** 443,448 ****
--- 442,450 ----
  			  case MD_TEST:
  			  case MD_INITALIAS:
  			  case MD_PRINT:
+ #ifdef MAYBE_NEXT_RELEASE
+ 			  case MD_ARPAFTP:
+ #endif
  				OpMode = j;
  				break;
  
***************
*** 708,720 ****
  		/* remove things that don't make sense in daemon mode */
  		FullName = NULL;
  		break;
- 
- 	  case MD_SMTP:
- 		if (RealUid != 0)
- 			auth_warning(CurEnv,
- 				"%s owned process doing -bs",
- 				RealUserName);
- 		break;
  	}
  
  	/* do heuristic mode adjustment */
--- 710,715 ----
***************
*** 1297,1302 ****
--- 1292,1298 ----
  	HoldErrs = TRUE;
  	CurEnv->e_errormode = EM_MAIL;
  	Verbose = FALSE;
+ 	DisConnected = TRUE;
  
  	/* all input from /dev/null */
  	if (InChannel != stdin)
***************
*** 1360,1366 ****
  		/* 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;
--- 1356,1362 ----
  		/* skip over options that do have a value */
  		op = strchr(OPTIONS, ap[1]);
  		if (op != NULL && *++op == ':' && ap[2] == '\0' &&
! 		    ap[1] != 'd' && argv[1] != NULL && argv[1][0] != '-')
  		{
  			argv++;
  			continue;
*** src/makesendmail.OLD	Sun Sep 26 11:38:49 1993
--- src/makesendmail	Sun Feb 27 11:51:26 1994
***************
*** 32,38 ****
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #       @(#)makesendmail	8.3 (Berkeley) 9/26/93
  #
  
  #
--- 32,38 ----
  # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  #
! #       @(#)makesendmail	8.5 (Berkeley) 2/27/94
  #
  
  #
***************
*** 45,50 ****
--- 45,52 ----
  case $arch
  in
    sun4*)	arch=sun4;;
+ 
+   9000/*)	arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
  esac
  
  # determine operating system type
***************
*** 52,67 ****
--- 54,76 ----
  
  # determine operating system release
  rel=`uname -r`
+ rbase=`echo $rel | sed 's/\..*//''`
  
  # now try to find a reasonable object directory
  if [ -r obj.$os.$arch.$rel ]; then
  	obj=obj.$os.$arch.$rel
+ elif [ -r obj.$os.$arch.$rbase.x ]; then
+ 	obj=obj.$os.$arch.$rbase.x
  elif [ -r obj.$os.$rel ]; then
  	obj=obj.$os.$rel
+ elif [ -r obj.$os.$rbase.x ]; then
+ 	obj=obj.$os.$rbase.x
  elif [ -r obj.$os.$arch ]; then
  	obj=obj.$os.$arch
  elif [ -r obj.$arch.$rel ]; then
  	obj=obj.$arch.$rel
+ elif [ -r obj.$arch.$rbase.x ]; then
+ 	obj=obj.$arch.$rbase.x
  elif [ -r obj.$os ]; then
  	obj=obj.$os
  elif [ -r obj.$arch ]; then
***************
*** 68,82 ****
  	obj=obj.$arch
  elif [ -r obj.$rel ]; then
  	obj=obj.$rel
! elif [ -r Makefile.$os ]; then
  	obj=obj.$os.$arch.$rel
! 	echo "Creating $obj using Makefile.$os"
  	mkdir $obj
! 	(cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../Makefile.$os Makefile)
! else
! 	echo "Warning: no recognized support for $arch.$os.$rel"
! 	echo "	... winging it ..."
! 	obj=.
  fi
  echo "Making in $obj"
  cd $obj
--- 77,112 ----
  	obj=obj.$arch
  elif [ -r obj.$rel ]; then
  	obj=obj.$rel
! else
! 	# no existing obj directory -- try to create one if Makefile found
  	obj=obj.$os.$arch.$rel
! 	if [ -r Makefile.$os.$arch.$rel ]; then
! 		makefile=Makefile.$os.$arch.$rel
! 	elif [ -r Makefile.$os.$arch.$rbase.x ]; then
! 		makefile=Makefile.$os.$arch.$rbase.x
! 	elif [ -r Makefile.$os.$rel ]; then
! 		makefile=Makefile.$os.$rel
! 	elif [ -r Makefile.$os.$rbase.x ]; then
! 		makefile=Makefile.$os.$rbase.x
! 	elif [ -r Makefile.$os.$arch ]; then
! 		makefile=Makefile.$os.$arch
! 	elif [ -r Makefile.$arch.$rel ]; then
! 		makefile=Makefile.$arch.$rel
! 	elif [ -r Makefile.$arch.$rbase.x ]; then
! 		makefile=Makefile.$arch.$rbase.x
! 	elif [ -r Makefile.$os ]; then
! 		makefile=Makefile.$os
! 	elif [ -r Makefile.$arch ]; then
! 		makefile=Makefile.$arch
! 	elif [ -r Makefile.$rel ]; then
! 		makefile=Makefile.$rel
! 	else
! 		echo "Cannot determine how to support $arch.$os.$rel"
! 		exit 1
! 	fi
! 	echo "Creating $obj using $makefile"
  	mkdir $obj
! 	(cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../$makefile Makefile)
  fi
  echo "Making in $obj"
  cd $obj
*** src/map.c.OLD	Sat Dec 11 08:26:17 1993
--- src/map.c	Fri Feb 18 13:00:48 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)map.c	8.20 (Berkeley) 12/11/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)map.c	8.22 (Berkeley) 2/18/94";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 638,644 ****
  	if (omode == O_RDWR)
  	{
  		omode |= O_CREAT|O_TRUNC;
! #if defined(O_EXLOCK) && defined(HASFLOCK)
  		omode |= O_EXLOCK;
  # if !defined(OLD_NEWDB)
  	}
--- 638,644 ----
  	if (omode == O_RDWR)
  	{
  		omode |= O_CREAT|O_TRUNC;
! #if defined(O_EXLOCK) && HASFLOCK
  		omode |= O_EXLOCK;
  # if !defined(OLD_NEWDB)
  	}
***************
*** 664,670 ****
  			syserr("Cannot open BTREE database %s", map->map_file);
  		return FALSE;
  	}
! #if !defined(OLD_NEWDB) && defined(HASFLOCK)
  	fd = db->fd(db);
  # if !defined(O_EXLOCK)
  	if (mode == O_RDWR && fd >= 0)
--- 664,670 ----
  			syserr("Cannot open BTREE database %s", map->map_file);
  		return FALSE;
  	}
! #if !defined(OLD_NEWDB) && HASFLOCK
  	fd = db->fd(db);
  # if !defined(O_EXLOCK)
  	if (mode == O_RDWR && fd >= 0)
***************
*** 722,728 ****
  	if (omode == O_RDWR)
  	{
  		omode |= O_CREAT|O_TRUNC;
! #if defined(O_EXLOCK) && defined(HASFLOCK)
  		omode |= O_EXLOCK;
  # if !defined(OLD_NEWDB)
  	}
--- 722,728 ----
  	if (omode == O_RDWR)
  	{
  		omode |= O_CREAT|O_TRUNC;
! #if defined(O_EXLOCK) && HASFLOCK
  		omode |= O_EXLOCK;
  # if !defined(OLD_NEWDB)
  	}
***************
*** 748,754 ****
  			syserr("Cannot open HASH database %s", map->map_file);
  		return FALSE;
  	}
! #if !defined(OLD_NEWDB) && defined(HASFLOCK)
  	fd = db->fd(db);
  # if !defined(O_EXLOCK)
  	if (mode == O_RDWR && fd >= 0)
--- 748,754 ----
  			syserr("Cannot open HASH database %s", map->map_file);
  		return FALSE;
  	}
! #if !defined(OLD_NEWDB) && HASFLOCK
  	fd = db->fd(db);
  # if !defined(O_EXLOCK)
  	if (mode == O_RDWR && fd >= 0)
***************
*** 965,975 ****
  			map->map_domain = p;
  	}
  
- 	if (map->map_domain == NULL)
- 		yp_get_default_domain(&map->map_domain);
- 
  	if (*map->map_file == '\0')
  		map->map_file = "mail.aliases";
  
  	/* check to see if this map actually exists */
  	yperr = yp_match(map->map_domain, map->map_file, "@", 1,
--- 965,983 ----
  			map->map_domain = p;
  	}
  
  	if (*map->map_file == '\0')
  		map->map_file = "mail.aliases";
+ 
+ 	if (map->map_domain == NULL)
+ 	{
+ 		yperr = yp_get_default_domain(&map->map_domain);
+ 		if (yperr != 0)
+ 		{
+ 			syserr("NIS map %s specified, but NIS not running\n",
+ 				map->map_file);
+ 			return FALSE;
+ 		}
+ 	}
  
  	/* check to see if this map actually exists */
  	yperr = yp_match(map->map_domain, map->map_file, "@", 1,
*** src/mci.c.OLD	Wed Dec  1 14:01:45 1993
--- src/mci.c	Wed Feb  9 07:40:15 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)mci.c	8.9 (Berkeley) 12/1/93";
  #endif /* not lint */
  
  #include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)mci.c	8.12 (Berkeley) 2/9/94";
  #endif /* not lint */
  
  #include "sendmail.h"
***************
*** 275,280 ****
--- 275,283 ----
  	bzero(&CurHostAddr, sizeof CurHostAddr);
  #endif
  
+ 	/* clear out any expired connections */
+ 	mci_scan(NULL);
+ 
  	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);
***************
*** 300,305 ****
--- 303,323 ----
  			mci->mci_exitstat = EX_OK;
  			mci->mci_state = MCIS_CLOSED;
  		}
+ 		else
+ 		{
+ 			/* get peer host address for logging reasons only */
+ 			/* (this should really be in the mci struct) */
+ 			int socksize = sizeof CurHostAddr;
+ 
+ 			(void) getpeername(fileno(mci->mci_in),
+ 				(struct sockaddr *) &CurHostAddr, &socksize);
+ 		}
+ 	}
+ 	if (mci->mci_state == MCIS_CLOSED)
+ 	{
+ 		/* copy out any mailer flags needed in connection state */
+ 		if (bitnset(M_7BITS, m->m_flags))
+ 			mci->mci_flags |= MCIF_7BIT;
  	}
  
  	return mci;
*** src/newaliases.1.OLD	Thu Dec 30 15:41:57 1993
--- src/newaliases.1	Tue Feb 22 11:27:02 1994
***************
*** 29,37 ****
  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  .\" SUCH DAMAGE.
  .\"
! .\"     @(#)newaliases.1	8.1 (Berkeley) 6/7/93
  .\"
! .Dd June 7, 1993
  .Dt NEWALIASES 1
  .Os BSD 4
  .Sh NAME
--- 29,37 ----
  .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  .\" SUCH DAMAGE.
  .\"
! .\"     @(#)newaliases.1	8.4 (Berkeley) 2/22/94
  .\"
! .Dd February 22, 1994
  .Dt NEWALIASES 1
  .Os BSD 4
  .Sh NAME
***************
*** 43,54 ****
  .Nm Newaliases
  rebuilds the random access data base for the mail aliases file
  .Pa /etc/aliases .
! It must be run each time
! .Pa /etc/aliases
! is changed in order
  for the change to take effect.
  .Sh SEE ALSO
! .\" .Xr aliases 5 ,
  .Xr sendmail 8
  .Sh HISTORY
  The
--- 43,65 ----
  .Nm Newaliases
  rebuilds the random access data base for the mail aliases file
  .Pa /etc/aliases .
! It must be run each time this file is changed in order
  for the change to take effect.
+ .Pp
+ .Nm Newaliases
+ is identical to
+ .Dq Li "sendmail -bi" .
+ .Pp
+ The
+ .Nm newaliases
+ utility exits 0 on success, and >0 if an error occurs.
+ .Sh FILES
+ .Bl -tag -width /etc/aliases -compact
+ .It Pa /etc/aliases
+ The mail aliases file
+ .El
  .Sh SEE ALSO
! .Xr aliases 5 ,
  .Xr sendmail 8
  .Sh HISTORY
  The
*** src/parseaddr.c.OLD	Wed Jan  5 09:20:14 1994
--- src/parseaddr.c	Wed Feb  9 11:32:30 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)parseaddr.c	8.29 (Berkeley) 1/5/94";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)parseaddr.c	8.30 (Berkeley) 2/9/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 1331,1337 ****
  		}
  		else
  		{
! 			usrerr("%s", buf);
  		}
  		goto badaddr;
  	}
--- 1331,1337 ----
  		}
  		else
  		{
! 			usrerr("553 %s", buf);
  		}
  		goto badaddr;
  	}
*** src/queue.c.OLD	Sun Jan  9 09:22:40 1994
--- src/queue.c	Sun Mar  6 09:00:40 1994
***************
*** 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 */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef QUEUE
! static char sccsid[] = "@(#)queue.c	8.40 (Berkeley) 3/6/94 (with queueing)";
  #else
! static char sccsid[] = "@(#)queue.c	8.40 (Berkeley) 3/6/94 (without queueing)";
  #endif
  #endif /* not lint */
  
***************
*** 94,99 ****
--- 94,100 ----
  	bool newid;
  	register char *p;
  	MAILER nullmailer;
+ 	MCI mcibuf;
  	char buf[MAXLINE], tf[MAXLINE];
  
  	/*
***************
*** 182,188 ****
  		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;
  	}
--- 183,192 ----
  		if (fd < 0 || (dfp = fdopen(fd, "w")) == NULL)
  			syserr("!queueup: cannot create data temp file %s, uid=%d",
  				e->e_df, geteuid());
! 		bzero(&mcibuf, sizeof mcibuf);
! 		mcibuf.mci_out = dfp;
! 		mcibuf.mci_mailer = FileMailer;
! 		(*e->e_putbody)(&mcibuf, e, NULL);
  		(void) xfclose(dfp, "queueup dfp", e->e_id);
  		e->e_putbody = putbody;
  	}
***************
*** 278,283 ****
--- 282,290 ----
  	nullmailer.m_re_rwset = nullmailer.m_rh_rwset =
  			nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1;
  	nullmailer.m_eol = "\n";
+ 	bzero(&mcibuf, sizeof mcibuf);
+ 	mcibuf.mci_mailer = &nullmailer;
+ 	mcibuf.mci_out = tfp;
  
  	define('g', "\201f", e);
  	for (h = e->e_header; h != NULL; h = h->h_link)
***************
*** 330,337 ****
  			if (bitset(H_FROM, h->h_flags))
  				oldstyle = FALSE;
  
! 			commaize(h, h->h_value, tfp, oldstyle,
! 				 &nullmailer, e);
  
  			TrafficLogFile = savetrace;
  		}
--- 337,343 ----
  			if (bitset(H_FROM, h->h_flags))
  				oldstyle = FALSE;
  
! 			commaize(h, h->h_value, oldstyle, &mcibuf, e);
  
  			TrafficLogFile = savetrace;
  		}
***************
*** 565,571 ****
  
  			pid = dowork(w->w_name + 2, ForkQueueRuns, FALSE, e);
  			errno = 0;
! 			(void) waitfor(pid);
  		}
  		free(w->w_name);
  		free((char *) w);
--- 571,578 ----
  
  			pid = dowork(w->w_name + 2, ForkQueueRuns, FALSE, e);
  			errno = 0;
! 			if (pid != 0)
! 				(void) waitfor(pid);
  		}
  		free(w->w_name);
  		free((char *) w);
***************
*** 891,896 ****
--- 898,904 ----
  		e->e_errormode = EM_MAIL;
  		e->e_id = id;
  		GrabTo = UseErrorsTo = FALSE;
+ 		ExitStat = EX_OK;
  		if (forkflag)
  		{
  			disconnect(1, e);
***************
*** 913,919 ****
  			if (forkflag)
  				exit(EX_OK);
  			else
! 				return;
  		}
  
  		e->e_flags |= EF_INQUEUE;
--- 921,927 ----
  			if (forkflag)
  				exit(EX_OK);
  			else
! 				return 0;
  		}
  
  		e->e_flags |= EF_INQUEUE;
***************
*** 1135,1141 ****
  			break;
  
  		  default:
! 			syserr("readqf: %s: line %s: bad line \"%s\"",
  				qf, LineNumber, bp);
  			fclose(qfp);
  			rename(qf, queuename(e, 'Q'));
--- 1143,1149 ----
  			break;
  
  		  default:
! 			syserr("readqf: %s: line %d: bad line \"%s\"",
  				qf, LineNumber, bp);
  			fclose(qfp);
  			rename(qf, queuename(e, 'Q'));
***************
*** 1539,1545 ****
  		*p++ = '\0';
  	if (*user != '\0' && (pw = getpwnam(user)) != NULL)
  	{
! 		a->q_home = newstr(pw->pw_dir);
  		a->q_uid = pw->pw_uid;
  		a->q_gid = pw->pw_gid;
  		a->q_user = newstr(user);
--- 1547,1556 ----
  		*p++ = '\0';
  	if (*user != '\0' && (pw = getpwnam(user)) != NULL)
  	{
! 		if (strcmp(pw->pw_dir, "/") == 0)
! 			a->q_home = "";
! 		else
! 			a->q_home = newstr(pw->pw_dir);
  		a->q_uid = pw->pw_uid;
  		a->q_gid = pw->pw_gid;
  		a->q_user = newstr(user);
*** src/readcf.c.OLD	Sun Jan  9 09:00:09 1994
--- src/readcf.c	Fri Mar 11 14:42:19 1994
***************
*** 33,45 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)readcf.c	8.18 (Berkeley) 1/9/94";
  #endif /* not lint */
  
  # include "sendmail.h"
  # include <pwd.h>
  # include <grp.h>
! #ifdef NAMED_BIND
  # include <arpa/nameser.h>
  # include <resolv.h>
  #endif
--- 33,45 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)readcf.c	8.22 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  # include "sendmail.h"
  # include <pwd.h>
  # include <grp.h>
! #if NAMED_BIND
  # include <arpa/nameser.h>
  # include <resolv.h>
  #endif
***************
*** 221,227 ****
  
  			if (*p == '\0')
  			{
! 				syserr("invalid rewrite line \"%s\"", bp);
  				break;
  			}
  
--- 221,227 ----
  
  			if (*p == '\0')
  			{
! 				syserr("invalid rewrite line \"%s\" (tab expected)", bp);
  				break;
  			}
  
***************
*** 542,548 ****
  	{
  		/* user didn't initialize: set up host map */
  		strcpy(buf, "host host");
! #ifdef NAMED_BIND
  		if (ConfigLevel >= 2)
  			strcat(buf, " -a.");
  #endif
--- 542,548 ----
  	{
  		/* user didn't initialize: set up host map */
  		strcpy(buf, "host host");
! #if NAMED_BIND
  		if (ConfigLevel >= 2)
  			strcat(buf, " -a.");
  #endif
***************
*** 600,607 ****
--- 600,618 ----
  	struct stat stbuf;
  	char buf[MAXLINE];
  
+ 	if (tTd(37, 2))
+ 		printf("fileclass(%s, fmt=%s)\n", filename, fmt);
+ 
+ 	if (filename[0] == '|')
+ 	{
+ 		syserr("fileclass: pipes (F%c%s) not supported due to security problems",
+ 			class, filename);
+ 		return;
+ 	}
  	if (stat(filename, &stbuf) < 0)
  	{
+ 		if (tTd(37, 2))
+ 			printf("  cannot stat (%s)\n", errstring(errno));
  		if (!optional)
  			syserr("fileclass: cannot stat %s", filename);
  		return;
***************
*** 659,666 ****
  				*p++ = '\0';
  
  			/* enter the word in the symbol table */
! 			s = stab(q, ST_CLASS, ST_ENTER);
! 			setbitn(class, s->s_class);
  		}
  	}
  
--- 670,676 ----
  				*p++ = '\0';
  
  			/* enter the word in the symbol table */
! 			setclass(class, q);
  		}
  	}
  
***************
*** 1007,1013 ****
  static BITMAP	StickyOpt;		/* set if option is stuck */
  
  
! #ifdef NAMED_BIND
  
  struct resolverflags
  {
--- 1017,1023 ----
  static BITMAP	StickyOpt;		/* set if option is stuck */
  
  
! #if NAMED_BIND
  
  struct resolverflags
  {
***************
*** 1216,1222 ****
  		break;
  
  	  case 'I':		/* use internet domain name server */
! #ifdef NAMED_BIND
  		UseNameServer = TRUE;
  		for (p = val; *p != 0; )
  		{
--- 1226,1232 ----
  		break;
  
  	  case 'I':		/* use internet domain name server */
! #if NAMED_BIND
  		UseNameServer = TRUE;
  		for (p = val; *p != 0; )
  		{
*** src/recipient.c.OLD	Mon Jan 10 08:57:26 1994
--- src/recipient.c	Mon Feb 28 10:04:57 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)recipient.c	8.39 (Berkeley) 1/10/94";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)recipient.c	8.44 (Berkeley) 2/28/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 307,314 ****
  			{
  #ifdef LOG
  				if (LogLevel > 2)
! 					syslog(LOG_ERR, "%s: include %s: transient error: %e",
! 						e->e_id, a->q_user, errstring(ret));
  #endif
  				a->q_flags |= QQUEUEUP;
  				a->q_flags &= ~QDONTSEND;
--- 307,315 ----
  			{
  #ifdef LOG
  				if (LogLevel > 2)
! 					syslog(LOG_ERR, "%s: include %s: transient error: %s",
! 						e->e_id == NULL ? "NOQUEUE" : e->e_id,
! 						a->q_user, errstring(ret));
  #endif
  				a->q_flags |= QQUEUEUP;
  				a->q_flags &= ~QDONTSEND;
***************
*** 376,382 ****
  # ifdef LOG
  			if (LogLevel > 8)
  				syslog(LOG_INFO, "%s: deferred: udbexpand: %s",
! 					e->e_id, errstring(errno));
  # endif
  			message("queued (user database error): %s",
  				errstring(errno));
--- 377,384 ----
  # ifdef LOG
  			if (LogLevel > 8)
  				syslog(LOG_INFO, "%s: deferred: udbexpand: %s",
! 					e->e_id == NULL ? "NOQUEUE" : e->e_id,
! 					errstring(errno));
  # endif
  			message("queued (user database error): %s",
  				errstring(errno));
***************
*** 447,453 ****
  				(void) strcpy(buf, pw->pw_name);
  				goto trylocaluser;
  			}
! 			a->q_home = newstr(pw->pw_dir);
  			a->q_uid = pw->pw_uid;
  			a->q_gid = pw->pw_gid;
  			a->q_ruser = newstr(pw->pw_name);
--- 449,458 ----
  				(void) strcpy(buf, pw->pw_name);
  				goto trylocaluser;
  			}
! 			if (strcmp(pw->pw_dir, "/") == 0)
! 				a->q_home = "";
! 			else
! 				a->q_home = newstr(pw->pw_dir);
  			a->q_uid = pw->pw_uid;
  			a->q_gid = pw->pw_gid;
  			a->q_ruser = newstr(pw->pw_name);
***************
*** 719,724 ****
--- 724,742 ----
  **	Side Effects:
  **		reads the :include: file and sends to everyone
  **		listed in that file.
+ **
+ **	Security Note:
+ **		If you have restricted chown (that is, you can't
+ **		give a file away), it is reasonable to allow programs
+ **		and files called from this :include: file to be to be
+ **		run as the owner of the :include: file.  This is bogus
+ **		if there is any chance of someone giving away a file.
+ **		We assume that pre-POSIX systems can give away files.
+ **
+ **		There is an additional restriction that if you
+ **		forward to a :include: file, it will not take on
+ **		the ownership of the :include: file.  This may not
+ **		be necessary, but shouldn't hurt.
  */
  
  static jmp_buf	CtxIncludeTimeout;
***************
*** 750,755 ****
--- 768,791 ----
  	int sfflags = forwarding ? SFF_MUSTOWN : SFF_ANYFILE;
  	struct stat st;
  	char buf[MAXLINE];
+ #ifdef _POSIX_CHOWN_RESTRICTED
+ # if _POSIX_CHOWN_RESTRICTED == -1
+ #  define safechown	FALSE
+ # else
+ #  define safechown	TRUE
+ # endif
+ #else
+ # ifdef _PC_CHOWN_RESTRICTED
+ 	bool safechown;
+ # else
+ #  ifdef BSD
+ #   define safechown	TRUE
+ #  else
+ #   define safechown	FALSE
+ #  endif
+ # endif
+ #endif
+ 	extern bool chownsafe();
  
  	if (tTd(27, 2))
  		printf("include(%s)\n", fname);
***************
*** 858,864 ****
  		return rval;
  	}
  
! 	if (ca == NULL)
  	{
  		ctladdr->q_uid = st.st_uid;
  		ctladdr->q_gid = st.st_gid;
--- 894,903 ----
  		return rval;
  	}
  
! #ifndef safechown
! 	safechown = chownsafe(fileno(fp));
! #endif
! 	if (ca == NULL && safechown)
  	{
  		ctladdr->q_uid = st.st_uid;
  		ctladdr->q_gid = st.st_gid;
***************
*** 872,884 ****
  	}
  	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;
  		}
  	}
  
--- 911,935 ----
  	}
  	else
  	{
+ 		char *sh;
  		register struct passwd *pw;
  
+ 		sh = "/SENDMAIL/ANY/SHELL/";
  		pw = getpwuid(st.st_uid);
! 		if (pw != NULL)
  		{
  			ctladdr->q_ruser = newstr(pw->pw_name);
+ 			if (safechown)
+ 				sh = pw->pw_shell;
+ 		}
+ 		if (pw == NULL)
  			ctladdr->q_flags |= QBOGUSSHELL;
+ 		else if(!usershellok(sh))
+ 		{
+ 			if (safechown)
+ 				ctladdr->q_flags |= QBOGUSSHELL;
+ 			else
+ 				ctladdr->q_flags |= QUNSAFEADDR;
  		}
  	}
  
***************
*** 924,930 ****
  #ifdef LOG
  		if (forwarding && LogLevel > 9)
  			syslog(LOG_INFO, "%s: forward %s => %s",
! 				e->e_id, oldto, buf);
  #endif
  
  		AliasLevel++;
--- 975,982 ----
  #ifdef LOG
  		if (forwarding && LogLevel > 9)
  			syslog(LOG_INFO, "%s: forward %s => %s",
! 				e->e_id == NULL ? "NOQUEUE" : e->e_id,
! 				oldto, buf);
  #endif
  
  		AliasLevel++;
*** src/savemail.c.OLD	Sat Dec 18 06:25:06 1993
--- src/savemail.c	Fri Mar 11 14:42:18 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)savemail.c	8.24 (Berkeley) 12/18/93";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)savemail.c	8.28 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 81,89 ****
  	register FILE *fp;
  	int state;
  	auto ADDRESS *q = NULL;
  	char buf[MAXLINE+1];
  	extern struct passwd *getpwnam();
- 	register char *p;
  	extern char *ttypath();
  	typedef int (*fnptr)();
  	extern bool writable();
--- 81,90 ----
  	register FILE *fp;
  	int state;
  	auto ADDRESS *q = NULL;
+ 	register char *p;
+ 	MCI mcibuf;
  	char buf[MAXLINE+1];
  	extern struct passwd *getpwnam();
  	extern char *ttypath();
  	typedef int (*fnptr)();
  	extern bool writable();
***************
*** 90,97 ****
  
  	if (tTd(6, 1))
  	{
! 		printf("\nsavemail, errormode = %c, id = %s\n  e_from=",
! 			e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id);
  		printaddr(&e->e_from, FALSE);
  	}
  
--- 91,99 ----
  
  	if (tTd(6, 1))
  	{
! 		printf("\nsavemail, errormode = %c, id = %s, ExitStat = %d\n  e_from=",
! 			e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id,
! 			ExitStat);
  		printaddr(&e->e_from, FALSE);
  	}
  
***************
*** 282,289 ****
  				state = ESM_POSTMASTER;
  				break;
  			}
! 			if (returntosender(e->e_message,
! 					   q, (e->e_class >= 0), e) == 0)
  			{
  				state = ESM_DONE;
  				break;
--- 284,291 ----
  				state = ESM_POSTMASTER;
  				break;
  			}
! 			if (returntosender(e->e_message, e->e_errorqueue,
! 					   (e->e_class >= 0), e) == 0)
  			{
  				state = ESM_DONE;
  				break;
***************
*** 393,403 ****
  				break;
  			}
  
! 			putfromline(fp, FileMailer, e);
! 			(*e->e_puthdr)(fp, FileMailer, e);
! 			putline("\n", fp, FileMailer);
! 			(*e->e_putbody)(fp, FileMailer, e, NULL);
! 			putline("\n", fp, FileMailer);
  			(void) fflush(fp);
  			state = ferror(fp) ? ESM_PANIC : ESM_DONE;
  			(void) xfclose(fp, "savemail", "/usr/tmp/dead.letter");
--- 395,411 ----
  				break;
  			}
  
! 			bzero(&mcibuf, sizeof mcibuf);
! 			mcibuf.mci_out = fp;
! 			mcibuf.mci_mailer = FileMailer;
! 			if (bitnset(M_7BITS, FileMailer->m_flags))
! 				mcibuf.mci_flags |= MCIF_7BIT;
! 
! 			putfromline(&mcibuf, e);
! 			(*e->e_puthdr)(&mcibuf, e);
! 			putline("\n", &mcibuf);
! 			(*e->e_putbody)(&mcibuf, e, NULL);
! 			putline("\n", &mcibuf);
  			(void) fflush(fp);
  			state = ferror(fp) ? ESM_PANIC : ESM_DONE;
  			(void) xfclose(fp, "savemail", "/usr/tmp/dead.letter");
***************
*** 564,571 ****
  **	original offending message.
  **
  **	Parameters:
! **		fp -- the output file.
! **		m -- the mailer to output to.
  **		e -- the envelope we are working in.
  **
  **	Returns:
--- 572,578 ----
  **	original offending message.
  **
  **	Parameters:
! **		mci -- the mailer connection information.
  **		e -- the envelope we are working in.
  **
  **	Returns:
***************
*** 575,583 ****
  **		Outputs the body of an error message.
  */
  
! errbody(fp, m, e)
! 	register FILE *fp;
! 	register struct mailer *m;
  	register ENVELOPE *e;
  {
  	register FILE *xfile;
--- 582,589 ----
  **		Outputs the body of an error message.
  */
  
! errbody(mci, e)
! 	register MCI *mci;
  	register ENVELOPE *e;
  {
  	register FILE *xfile;
***************
*** 589,595 ****
  	if (e->e_parent == NULL)
  	{
  		syserr("errbody: null parent");
! 		putline("   ----- Original message lost -----\n", fp, m);
  		return;
  	}
  
--- 595,601 ----
  	if (e->e_parent == NULL)
  	{
  		syserr("errbody: null parent");
! 		putline("   ----- Original message lost -----\n", mci);
  		return;
  	}
  
***************
*** 599,609 ****
  
  	if (e->e_msgboundary != NULL)
  	{
! 		putline("This is a MIME-encapsulated message", fp, m);
! 		putline("", fp, m);
  		(void) sprintf(buf, "--%s", e->e_msgboundary);
! 		putline(buf, fp, m);
! 		putline("", fp, m);
  	}
  
  	/*
--- 605,615 ----
  
  	if (e->e_msgboundary != NULL)
  	{
! 		putline("This is a MIME-encapsulated message", mci);
! 		putline("", mci);
  		(void) sprintf(buf, "--%s", e->e_msgboundary);
! 		putline(buf, mci);
! 		putline("", mci);
  	}
  
  	/*
***************
*** 617,637 ****
  	    !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags))
  	{
  		putline("    **********************************************",
! 			fp, m);
  		putline("    **      THIS IS A WARNING MESSAGE ONLY      **",
! 			fp, m);
  		putline("    **  YOU DO NOT NEED TO RESEND YOUR MESSAGE  **",
! 			fp, m);
  		putline("    **********************************************",
! 			fp, m);
! 		putline("", fp, m);
  	}
  	sprintf(buf, "The original message was received at %s",
  		arpadate(ctime(&e->e_parent->e_ctime)));
! 	putline(buf, fp, m);
  	expand("from \201_", buf, &buf[sizeof buf - 1], e->e_parent);
! 	putline(buf, fp, m);
! 	putline("", fp, m);
  
  	/*
  	**  Output error message header (if specified and available).
--- 623,643 ----
  	    !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags))
  	{
  		putline("    **********************************************",
! 			mci);
  		putline("    **      THIS IS A WARNING MESSAGE ONLY      **",
! 			mci);
  		putline("    **  YOU DO NOT NEED TO RESEND YOUR MESSAGE  **",
! 			mci);
  		putline("    **********************************************",
! 			mci);
! 		putline("", mci);
  	}
  	sprintf(buf, "The original message was received at %s",
  		arpadate(ctime(&e->e_parent->e_ctime)));
! 	putline(buf, mci);
  	expand("from \201_", buf, &buf[sizeof buf - 1], e->e_parent);
! 	putline(buf, mci);
! 	putline("", mci);
  
  	/*
  	**  Output error message header (if specified and available).
***************
*** 647,663 ****
  				while (fgets(buf, sizeof buf, xfile) != NULL)
  				{
  					expand(buf, buf, &buf[sizeof buf - 1], e);
! 					putline(buf, fp, m);
  				}
  				(void) fclose(xfile);
! 				putline("\n", fp, m);
  			}
  		}
  		else
  		{
  			expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e);
! 			putline(buf, fp, m);
! 			putline("", fp, m);
  		}
  	}
  
--- 653,669 ----
  				while (fgets(buf, sizeof buf, xfile) != NULL)
  				{
  					expand(buf, buf, &buf[sizeof buf - 1], e);
! 					putline(buf, mci);
  				}
  				(void) fclose(xfile);
! 				putline("\n", mci);
  			}
  		}
  		else
  		{
  			expand(ErrMsgFile, buf, &buf[sizeof buf - 1], e);
! 			putline(buf, mci);
! 			putline("", mci);
  		}
  	}
  
***************
*** 673,679 ****
  			if (printheader)
  			{
  				putline("   ----- The following addresses had delivery problems -----",
! 					fp, m);
  				printheader = FALSE;
  			}
  			strcpy(buf, q->q_paddr);
--- 679,685 ----
  			if (printheader)
  			{
  				putline("   ----- The following addresses had delivery problems -----",
! 					mci);
  				printheader = FALSE;
  			}
  			strcpy(buf, q->q_paddr);
***************
*** 681,698 ****
  				strcat(buf, "  (unrecoverable error)");
  			else
  				strcat(buf, "  (transient failure)");
! 			putline(buf, fp, m);
  			if (q->q_alias != NULL)
  			{
  				strcpy(buf, "    (expanded from: ");
  				strcat(buf, q->q_alias->q_paddr);
  				strcat(buf, ")");
! 				putline(buf, fp, m);
  			}
  		}
  	}
  	if (!printheader)
! 		putline("\n", fp, m);
  
  	/*
  	**  Output transcript of errors
--- 687,704 ----
  				strcat(buf, "  (unrecoverable error)");
  			else
  				strcat(buf, "  (transient failure)");
! 			putline(buf, mci);
  			if (q->q_alias != NULL)
  			{
  				strcpy(buf, "    (expanded from: ");
  				strcat(buf, q->q_alias->q_paddr);
  				strcat(buf, ")");
! 				putline(buf, mci);
  			}
  		}
  	}
  	if (!printheader)
! 		putline("\n", mci);
  
  	/*
  	**  Output transcript of errors
***************
*** 703,717 ****
  	if ((xfile = fopen(p, "r")) == NULL)
  	{
  		syserr("Cannot open %s", p);
! 		putline("   ----- Transcript of session is unavailable -----\n", fp, m);
  	}
  	else
  	{
! 		putline("   ----- Transcript of session follows -----\n", fp, m);
  		if (e->e_xfp != NULL)
  			(void) fflush(e->e_xfp);
  		while (fgets(buf, sizeof buf, xfile) != NULL)
! 			putline(buf, fp, m);
  		(void) xfclose(xfile, "errbody xscript", p);
  	}
  	errno = 0;
--- 709,723 ----
  	if ((xfile = fopen(p, "r")) == NULL)
  	{
  		syserr("Cannot open %s", p);
! 		putline("   ----- Transcript of session is unavailable -----\n", mci);
  	}
  	else
  	{
! 		putline("   ----- Transcript of session follows -----\n", mci);
  		if (e->e_xfp != NULL)
  			(void) fflush(e->e_xfp);
  		while (fgets(buf, sizeof buf, xfile) != NULL)
! 			putline(buf, mci);
  		(void) xfclose(xfile, "errbody xscript", p);
  	}
  	errno = 0;
***************
*** 722,763 ****
  
  	if (NoReturn)
  		SendBody = FALSE;
! 	putline("", fp, m);
  	if (e->e_parent->e_df != NULL)
  	{
  		if (SendBody)
! 			putline("   ----- Original message follows -----\n", fp, m);
  		else
! 			putline("   ----- Message header follows -----\n", fp, m);
! 		(void) fflush(fp);
  
  		if (e->e_msgboundary != NULL)
  		{
! 			putline("", fp, m);
  			(void) sprintf(buf, "--%s", e->e_msgboundary);
! 			putline(buf, fp, m);
! 			putline("Content-Type: message/rfc822", fp, m);
! 			putline("", fp, m);
  		}
! 		putheader(fp, m, e->e_parent);
! 		putline("", fp, m);
  		if (SendBody)
! 			putbody(fp, m, e->e_parent, e->e_msgboundary);
  		else
! 			putline("   ----- Message body suppressed -----", fp, m);
  	}
  	else
  	{
! 		putline("  ----- No message was collected -----\n", fp, m);
  	}
  
  	if (e->e_msgboundary != NULL)
  	{
! 		putline("", fp, m);
  		(void) sprintf(buf, "--%s--", e->e_msgboundary);
! 		putline(buf, fp, m);
  	}
! 	putline("", fp, m);
  
  	/*
  	**  Cleanup and exit
--- 728,769 ----
  
  	if (NoReturn)
  		SendBody = FALSE;
! 	putline("", mci);
  	if (e->e_parent->e_df != NULL)
  	{
  		if (SendBody)
! 			putline("   ----- Original message follows -----\n", mci);
  		else
! 			putline("   ----- Message header follows -----\n", mci);
! 		(void) fflush(mci->mci_out);
  
  		if (e->e_msgboundary != NULL)
  		{
! 			putline("", mci);
  			(void) sprintf(buf, "--%s", e->e_msgboundary);
! 			putline(buf, mci);
! 			putline("Content-Type: message/rfc822", mci);
! 			putline("", mci);
  		}
! 		putheader(mci, e->e_parent);
! 		putline("", mci);
  		if (SendBody)
! 			putbody(mci, e->e_parent, e->e_msgboundary);
  		else
! 			putline("   ----- Message body suppressed -----", mci);
  	}
  	else
  	{
! 		putline("  ----- No message was collected -----\n", mci);
  	}
  
  	if (e->e_msgboundary != NULL)
  	{
! 		putline("", mci);
  		(void) sprintf(buf, "--%s--", e->e_msgboundary);
! 		putline(buf, mci);
  	}
! 	putline("", mci);
  
  	/*
  	**  Cleanup and exit
***************
*** 786,792 ****
  pruneroute(addr)
  	char *addr;
  {
! #ifdef NAMED_BIND
  	char *start, *at, *comma;
  	char c;
  	int rcode;
--- 792,798 ----
  pruneroute(addr)
  	char *addr;
  {
! #if NAMED_BIND
  	char *start, *at, *comma;
  	char c;
  	int rcode;
*** src/sendmail.h.OLD	Wed Jan  5 08:34:35 1994
--- src/sendmail.h	Sun Feb  6 14:07:22 1994
***************
*** 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
   */
  
  /*
--- 31,37 ----
   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   *
!  *	@(#)sendmail.h	8.41 (Berkeley) 2/6/94
   */
  
  /*
***************
*** 41,47 ****
  # ifdef _DEFINE
  # define EXTERN
  # ifndef lint
! static char SmailSccsId[] =	"@(#)sendmail.h	8.38		1/5/94";
  # endif
  # else /*  _DEFINE */
  # define EXTERN extern
--- 41,47 ----
  # ifdef _DEFINE
  # define EXTERN
  # ifndef lint
! static char SmailSccsId[] =	"@(#)sendmail.h	8.41		2/6/94";
  # endif
  # else /*  _DEFINE */
  # define EXTERN extern
***************
*** 268,273 ****
--- 268,317 ----
  # define H_RECEIPTTO	02000	/* this field has return receipt info */
  # define H_ERRORSTO	04000	/* this field has error address info */
  /*
+ **  Information about currently open connections to mailers, or to
+ **  hosts that we have looked up recently.
+ */
+ 
+ # define MCI		struct mailer_con_info
+ 
+ MCI
+ {
+ 	short		mci_flags;	/* flag bits, see below */
+ 	short		mci_errno;	/* error number on last connection */
+ 	short		mci_herrno;	/* h_errno from last DNS lookup */
+ 	short		mci_exitstat;	/* exit status from last connection */
+ 	short		mci_state;	/* SMTP state */
+ 	long		mci_maxsize;	/* max size this server will accept */
+ 	FILE		*mci_in;	/* input side of connection */
+ 	FILE		*mci_out;	/* output side of connection */
+ 	int		mci_pid;	/* process id of subordinate proc */
+ 	char		*mci_phase;	/* SMTP phase string */
+ 	struct mailer	*mci_mailer;	/* ptr to the mailer for this conn */
+ 	char		*mci_host;	/* host name */
+ 	time_t		mci_lastuse;	/* last usage time */
+ };
+ 
+ 
+ /* flag bits */
+ #define MCIF_VALID	000001		/* this entry is valid */
+ #define MCIF_TEMP	000002		/* don't cache this connection */
+ #define MCIF_CACHED	000004		/* currently in open cache */
+ #define MCIF_ESMTP	000010		/* this host speaks ESMTP */
+ #define MCIF_EXPN	000020		/* EXPN command supported */
+ #define MCIF_SIZE	000040		/* SIZE option supported */
+ #define MCIF_8BITMIME	000100		/* BODY=8BITMIME supported */
+ #define MCIF_7BIT	000200		/* strip this message to 7 bits */
+ #define MCIF_MULTSTAT	000400		/* MAIL11V3: handles MULT status */
+ 
+ /* states */
+ #define MCIS_CLOSED	0		/* no traffic on this connection */
+ #define MCIS_OPENING	1		/* sending initial protocol */
+ #define MCIS_OPEN	2		/* open, initial protocol sent */
+ #define MCIS_ACTIVE	3		/* message being sent */
+ #define MCIS_QUITING	4		/* running quit protocol */
+ #define MCIS_SSD	5		/* service shutting down */
+ #define MCIS_ERROR	6		/* I/O error on connection */
+ /*
  **  Envelope structure.
  **	This structure defines the message itself.  There is usually
  **	only one of these -- for the message that we originally read
***************
*** 298,306 ****
  	short		e_nsent;	/* number of sends since checkpoint */
  	short		e_sendmode;	/* message send mode */
  	short		e_errormode;	/* error return mode */
! 	int		(*e_puthdr)__P((FILE *, MAILER *, ENVELOPE *));
  					/* function to put header of message */
! 	int		(*e_putbody)__P((FILE *, MAILER *, ENVELOPE *, char *));
  					/* function to put body of message */
  	struct envelope	*e_parent;	/* the message this one encloses */
  	struct envelope *e_sibling;	/* the next envelope of interest */
--- 342,350 ----
  	short		e_nsent;	/* number of sends since checkpoint */
  	short		e_sendmode;	/* message send mode */
  	short		e_errormode;	/* error return mode */
! 	int		(*e_puthdr)__P((MCI *, ENVELOPE *));
  					/* function to put header of message */
! 	int		(*e_putbody)__P((MCI *, ENVELOPE *, char *));
  					/* function to put body of message */
  	struct envelope	*e_parent;	/* the message this one encloses */
  	struct envelope *e_sibling;	/* the next envelope of interest */
***************
*** 429,477 ****
  	u_char	metaval;	/* internal code (as above) */
  };
  /*
- **  Information about currently open connections to mailers, or to
- **  hosts that we have looked up recently.
- */
- 
- # define MCI	struct mailer_con_info
- 
- MCI
- {
- 	short		mci_flags;	/* flag bits, see below */
- 	short		mci_errno;	/* error number on last connection */
- 	short		mci_herrno;	/* h_errno from last DNS lookup */
- 	short		mci_exitstat;	/* exit status from last connection */
- 	short		mci_state;	/* SMTP state */
- 	long		mci_maxsize;	/* max size this server will accept */
- 	FILE		*mci_in;	/* input side of connection */
- 	FILE		*mci_out;	/* output side of connection */
- 	int		mci_pid;	/* process id of subordinate proc */
- 	char		*mci_phase;	/* SMTP phase string */
- 	struct mailer	*mci_mailer;	/* ptr to the mailer for this conn */
- 	char		*mci_host;	/* host name */
- 	time_t		mci_lastuse;	/* last usage time */
- };
- 
- 
- /* flag bits */
- #define MCIF_VALID	000001		/* this entry is valid */
- #define MCIF_TEMP	000002		/* don't cache this connection */
- #define MCIF_CACHED	000004		/* currently in open cache */
- #define MCIF_ESMTP	000010		/* this host speaks ESMTP */
- #define MCIF_EXPN	000020		/* EXPN command supported */
- #define MCIF_SIZE	000040		/* SIZE option supported */
- #define MCIF_8BITMIME	000100		/* BODY=8BITMIME supported */
- #define MCIF_MULTSTAT	000200		/* MAIL11V3: handles MULT status */
- 
- /* states */
- #define MCIS_CLOSED	0		/* no traffic on this connection */
- #define MCIS_OPENING	1		/* sending initial protocol */
- #define MCIS_OPEN	2		/* open, initial protocol sent */
- #define MCIS_ACTIVE	3		/* message being sent */
- #define MCIS_QUITING	4		/* running quit protocol */
- #define MCIS_SSD	5		/* service shutting down */
- #define MCIS_ERROR	6		/* I/O error on connection */
- /*
  **  Name canonification short circuit.
  **
  **	If the name server for a host is down, the process of trying to
--- 473,478 ----
***************
*** 660,665 ****
--- 661,667 ----
  
  #define MD_DELIVER	'm'		/* be a mail sender */
  #define MD_SMTP		's'		/* run SMTP on standard input */
+ #define MD_ARPAFTP	'a'		/* obsolete ARPANET mode (Grey Book) */
  #define MD_DAEMON	'd'		/* run as a daemon */
  #define MD_VERIFY	'v'		/* verify: don't collect or deliver */
  #define MD_TEST		't'		/* test mode: resolve addrs only */
***************
*** 824,829 ****
--- 826,832 ----
  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 bool	DisConnected;	/* running with OutChannel redirected to xf */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	PrivacyFlags;	/* privacy flags */
  EXTERN char	*ConfFile;	/* location of configuration file [conf.c] */
***************
*** 950,955 ****
--- 953,959 ----
  extern sigfunc_t	setsignal __P((int, sigfunc_t));
  extern char		*shortenstring __P((char *, int));
  extern bool		usershellok __P((char *));
+ extern void		commaize __P((HDR *, char *, int, MCI *, ENVELOPE *));
  
  /* ellipsis is a different case though */
  #ifdef __STDC__
*** src/srvrsmtp.c.OLD	Wed Dec 22 05:07:01 1993
--- src/srvrsmtp.c	Tue Mar  8 10:32:21 1994
***************
*** 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 */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)srvrsmtp.c	8.32 (Berkeley) 3/8/94 (with SMTP)";
  #else
! static char sccsid[] = "@(#)srvrsmtp.c	8.32 (Berkeley) 3/8/94 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 117,123 ****
--- 117,127 ----
  char	*CurSmtpClient;			/* who's at the other end of channel */
  
  static char	*skipword();
+ extern char	RealUserName[];
  
+ 
+ #define MAXBADCOMMANDS	25		/* maximum number of bad commands */
+ 
  smtp(e)
  	register ENVELOPE *e;
  {
***************
*** 132,141 ****
--- 136,147 ----
  	char *protocol;			/* sending protocol */
  	char *sendinghost;		/* sending hostname */
  	long msize;			/* approximate maximum message size */
+ 	char *peerhostname;		/* name of SMTP peer or "localhost" */
  	auto char *delimptr;
  	char *id;
  	int nrcpts;			/* number of RCPT commands */
  	bool doublequeue;
+ 	int badcommands = 0;		/* count of bad commands */
  	char inp[MAXLINE];
  	char cmdbuf[MAXLINE];
  	extern char Version[];
***************
*** 147,156 ****
  		(void) dup2(fileno(OutChannel), fileno(stdout));
  	}
  	settime(e);
! 	CurHostName = RealHostName;
  	CurSmtpClient = macvalue('_', e);
  	if (CurSmtpClient == NULL)
! 		CurSmtpClient = RealHostName;
  
  	setproctitle("server %s startup", CurSmtpClient);
  	expand("\201e", inp, &inp[sizeof inp], e);
--- 153,165 ----
  		(void) dup2(fileno(OutChannel), fileno(stdout));
  	}
  	settime(e);
! 	peerhostname = RealHostName;
! 	if (peerhostname == NULL)
! 		peerhostname = "localhost";
! 	CurHostName = peerhostname;
  	CurSmtpClient = macvalue('_', e);
  	if (CurSmtpClient == NULL)
! 		CurSmtpClient = CurHostName;
  
  	setproctitle("server %s startup", CurSmtpClient);
  	expand("\201e", inp, &inp[sizeof inp], e);
***************
*** 170,180 ****
  	for (;;)
  	{
  		/* arrange for backout */
! 		if (setjmp(TopFrame) > 0 && InChild)
  		{
! 			QuickAbort = FALSE;
! 			SuprErrs = TRUE;
! 			finis();
  		}
  		QuickAbort = FALSE;
  		HoldErrs = FALSE;
--- 179,193 ----
  	for (;;)
  	{
  		/* arrange for backout */
! 		if (setjmp(TopFrame) > 0)
  		{
! 			/* if() nesting is necessary for Cray UNICOS */
! 			if (InChild)
! 			{
! 				QuickAbort = FALSE;
! 				SuprErrs = TRUE;
! 				finis();
! 			}
  		}
  		QuickAbort = FALSE;
  		HoldErrs = FALSE;
***************
*** 196,201 ****
--- 209,215 ----
  		if (p == NULL)
  		{
  			/* end of file, just die */
+ 			disconnect(1, e);
  			message("421 %s Lost input channel from %s",
  				MyHostName, CurSmtpClient);
  #ifdef LOG
***************
*** 260,273 ****
  				SmtpPhase = "server HELO";
  			}
  			sendinghost = newstr(p);
- 			if (strcasecmp(p, RealHostName) != 0 &&
- 			    (strcasecmp(RealHostName, "localhost") != 0 ||
- 			     strcasecmp(p, MyHostName) != 0))
- 			{
- 				auth_warning(e, "Host %s claimed to be %s",
- 					RealHostName, p);
- 			}
- 
  			gothello = TRUE;
  			if (c->cmdcode != CMDEHLO)
  			{
--- 274,279 ----
***************
*** 297,303 ****
  			{
  				/* set sending host to our known value */
  				if (sendinghost == NULL)
! 					sendinghost = RealHostName;
  
  				if (bitset(PRIV_NEEDMAILHELO, PrivacyFlags))
  				{
--- 303,309 ----
  			{
  				/* set sending host to our known value */
  				if (sendinghost == NULL)
! 					sendinghost = peerhostname;
  
  				if (bitset(PRIV_NEEDMAILHELO, PrivacyFlags))
  				{
***************
*** 326,333 ****
  			{
  				auth_warning(e,
  					"Host %s didn't use HELO protocol",
! 					RealHostName);
  			}
  			if (protocol == NULL)
  				protocol = "SMTP";
  			define('r', protocol, e);
--- 332,349 ----
  			{
  				auth_warning(e,
  					"Host %s didn't use HELO protocol",
! 					peerhostname);
  			}
+ #ifdef PICKY_HELO_CHECK
+ 			if (strcasecmp(sendinghost, peerhostname) != 0 &&
+ 			    (strcasecmp(peerhostname, "localhost") != 0 ||
+ 			     strcasecmp(sendinghost, MyHostName) != 0))
+ 			{
+ 				auth_warning(e, "Host %s claimed to be %s",
+ 					peerhostname, sendinghost);
+ 			}
+ #endif
+ 
  			if (protocol == NULL)
  				protocol = "SMTP";
  			define('r', protocol, e);
***************
*** 362,373 ****
  			if (p != NULL && *p != '\0')
  				*p++ = '\0';
  
  			/* now parse ESMTP arguments */
  			msize = 0;
  			for (; p != NULL && *p != '\0'; p++)
  			{
  				char *kp;
! 				char *vp;
  
  				/* locate the beginning of the keyword */
  				while (isascii(*p) && isspace(*p))
--- 378,398 ----
  			if (p != NULL && *p != '\0')
  				*p++ = '\0';
  
+ 			/* check for possible spoofing */
+ 			if (RealUid != 0 && OpMode == MD_SMTP &&
+ 			    (e->e_from.q_mailer != LocalMailer &&
+ 			     strcmp(e->e_from.q_user, RealUserName) != 0))
+ 			{
+ 				auth_warning(e, "%s owned process doing -bs",
+ 					RealUserName);
+ 			}
+ 
  			/* now parse ESMTP arguments */
  			msize = 0;
  			for (; p != NULL && *p != '\0'; p++)
  			{
  				char *kp;
! 				char *vp = NULL;
  
  				/* locate the beginning of the keyword */
  				while (isascii(*p) && isspace(*p))
***************
*** 700,707 ****
  		  case CMDQUIT:		/* quit -- leave mail */
  			message("221 %s closing connection", MyHostName);
  
  			/* avoid future 050 messages */
! 			Verbose = FALSE;
  
  			if (InChild)
  				ExitStat = EX_QUIT;
--- 725,733 ----
  		  case CMDQUIT:		/* quit -- leave mail */
  			message("221 %s closing connection", MyHostName);
  
+ doquit:
  			/* avoid future 050 messages */
! 			disconnect(1, e);
  
  			if (InChild)
  				ExitStat = EX_QUIT;
***************
*** 745,756 ****
  			if (LogLevel > 0)
  				syslog(LOG_CRIT,
  				    "\"%s\" command from %s (%s)",
! 				    c->cmdname, RealHostName,
  				    anynet_ntoa(&RealHostAddr));
  # endif
  			/* FALL THROUGH */
  
  		  case CMDERROR:	/* unknown command */
  			message("500 Command unrecognized");
  			break;
  
--- 771,789 ----
  			if (LogLevel > 0)
  				syslog(LOG_CRIT,
  				    "\"%s\" command from %s (%s)",
! 				    c->cmdname, peerhostname,
  				    anynet_ntoa(&RealHostAddr));
  # endif
  			/* FALL THROUGH */
  
  		  case CMDERROR:	/* unknown command */
+ 			if (++badcommands > MAXBADCOMMANDS)
+ 			{
+ 				message("421 %s Too many bad commands; closing connection",
+ 					MyHostName);
+ 				goto doquit;
+ 			}
+ 
  			message("500 Command unrecognized");
  			break;
  
***************
*** 782,787 ****
--- 815,821 ----
  	char *w;
  {
  	register char *q;
+ 	char *firstp = p;
  
  	/* find beginning of word */
  	while (isascii(*p) && isspace(*p))
***************
*** 796,802 ****
  	if (*p != ':')
  	{
  	  syntax:
! 		message("501 Syntax error in parameters");
  		Errors++;
  		return (NULL);
  	}
--- 830,837 ----
  	if (*p != ':')
  	{
  	  syntax:
! 		message("501 Syntax error in parameters scanning \"%s\"",
! 			firstp);
  		Errors++;
  		return (NULL);
  	}
***************
*** 955,962 ****
  					label, st & 0177);
  
  			/* if we exited on a QUIT command, complete the process */
! 			if (st == (EX_QUIT << 8))
  				finis();
  
  			return (1);
  		}
--- 990,1000 ----
  					label, st & 0177);
  
  			/* if we exited on a QUIT command, complete the process */
! 			if (WEXITSTATUS(st) == EX_QUIT)
! 			{
! 				disconnect(1, e);
  				finis();
+ 			}
  
  			return (1);
  		}
*** src/udb.c.OLD	Thu Nov 25 11:23:27 1993
--- src/udb.c	Fri Mar 11 14:42:17 1994
***************
*** 36,50 ****
  
  #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
  
  #ifdef USERDB
  
- #include <sys/time.h>
  #include <errno.h>
  #include <netdb.h>
  #include <db.h>
--- 36,49 ----
  
  #ifndef lint
  #ifdef USERDB
! static char sccsid [] = "@(#)udb.c	8.6 (Berkeley) 3/11/94 (with USERDB)";
  #else
! static char sccsid [] = "@(#)udb.c	8.6 (Berkeley) 3/11/94 (without USERDB)";
  #endif
  #endif
  
  #ifdef USERDB
  
  #include <errno.h>
  #include <netdb.h>
  #include <db.h>
***************
*** 571,577 ****
  		  case '*':	/* search remote database (expand MX) */
  			if (*spec == '*')
  			{
! #ifdef NAMED_BIND
  				nmx = getmxrr(spec + 1, mxhosts, FALSE, &rcode);
  #else
  				mxhosts[0] = spec + 1;
--- 570,576 ----
  		  case '*':	/* search remote database (expand MX) */
  			if (*spec == '*')
  			{
! #if NAMED_BIND
  				nmx = getmxrr(spec + 1, mxhosts, FALSE, &rcode);
  #else
  				mxhosts[0] = spec + 1;
*** src/usersmtp.c.OLD	Wed Jan  5 09:20:15 1994
--- src/usersmtp.c	Thu Mar 10 18:03:26 1994
***************
*** 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 */
  
--- 36,44 ----
  
  #ifndef lint
  #ifdef SMTP
! static char sccsid[] = "@(#)usersmtp.c	8.18 (Berkeley) 1/24/94 (with SMTP)";
  #else
! static char sccsid[] = "@(#)usersmtp.c	8.18 (Berkeley) 1/24/94 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 303,309 ****
--- 303,312 ----
  			mci->mci_maxsize = atol(p);
  	}
  	else if (strcasecmp(line, "8bitmime") == 0)
+ 	{
  		mci->mci_flags |= MCIF_8BITMIME;
+ 		mci->mci_flags &= ~MCIF_7BIT;
+ 	}
  	else if (strcasecmp(line, "expn") == 0)
  		mci->mci_flags |= MCIF_EXPN;
  }
***************
*** 536,544 ****
  	ev = setevent(timeout, datatimeout, 0);
  
  	/* now output the actual message */
! 	(*e->e_puthdr)(mci->mci_out, m, e);
! 	putline("\n", mci->mci_out, m);
! 	(*e->e_putbody)(mci->mci_out, m, e, NULL);
  
  	clrevent(ev);
  
--- 539,547 ----
  	ev = setevent(timeout, datatimeout, 0);
  
  	/* now output the actual message */
! 	(*e->e_puthdr)(mci, e);
! 	putline("\n", mci);
! 	(*e->e_putbody)(mci, e, NULL);
  
  	clrevent(ev);
  
*** src/util.c.OLD	Tue Jan  4 06:40:38 1994
--- src/util.c	Fri Mar 11 11:09:17 1994
***************
*** 33,39 ****
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)util.c	8.28 (Berkeley) 1/4/94";
  #endif /* not lint */
  
  # include "sendmail.h"
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)util.c	8.34 (Berkeley) 3/11/94";
  #endif /* not lint */
  
  # include "sendmail.h"
***************
*** 644,651 ****
  		fd = open(filename, omode, cmode);
  		if (fd >= 0)
  			break;
! 		if (errno != ENFILE && errno != EINTR)
! 			break;
  	}
  	if (fd >= 0 && fstat(fd, &st) >= 0 && S_ISREG(st.st_mode))
  	{
--- 644,659 ----
  		fd = open(filename, omode, cmode);
  		if (fd >= 0)
  			break;
! 		switch (errno)
! 		{
! 		  case ENFILE:		/* system file table full */
! 		  case EINTR:		/* interrupted syscall */
! #ifdef ETXTBSY
! 		  case ETXTBSY:		/* Apollo: net file locked */
! #endif
! 			continue;
! 		}
! 		break;
  	}
  	if (fd >= 0 && fstat(fd, &st) >= 0 && S_ISREG(st.st_mode))
  	{
***************
*** 672,679 ****
  **
  **	Parameters:
  **		l -- line to put.
! **		fp -- file to put it onto.
! **		m -- the mailer used to control output.
  **
  **	Returns:
  **		none
--- 680,686 ----
  **
  **	Parameters:
  **		l -- line to put.
! **		mci -- the mailer connection information.
  **
  **	Returns:
  **		none
***************
*** 682,697 ****
  **		output of l to fp.
  */
  
! putline(l, fp, m)
  	register char *l;
! 	FILE *fp;
! 	MAILER *m;
  {
  	register char *p;
  	register char svchar;
  
  	/* strip out 0200 bits -- these can look like TELNET protocol */
! 	if (bitnset(M_7BITS, m->m_flags))
  	{
  		for (p = l; (svchar = *p) != '\0'; ++p)
  			if (bitset(0200, svchar))
--- 689,704 ----
  **		output of l to fp.
  */
  
! putline(l, mci)
  	register char *l;
! 	register MCI *mci;
  {
  	register char *p;
  	register char svchar;
+ 	int slop = 0;
  
  	/* strip out 0200 bits -- these can look like TELNET protocol */
! 	if (bitset(MCIF_7BIT, mci->mci_flags))
  	{
  		for (p = l; (svchar = *p) != '\0'; ++p)
  			if (bitset(0200, svchar))
***************
*** 709,740 ****
  			fprintf(TrafficLogFile, "%05d >>> ", getpid());
  
  		/* check for line overflow */
! 		while (m->m_linelimit > 0 && (p - l) > m->m_linelimit)
  		{
! 			register char *q = &l[m->m_linelimit - 1];
  
  			svchar = *q;
  			*q = '\0';
! 			if (l[0] == '.' && bitnset(M_XDOT, m->m_flags))
  			{
! 				(void) putc('.', fp);
  				if (TrafficLogFile != NULL)
  					(void) putc('.', TrafficLogFile);
  			}
! 			fputs(l, fp);
! 			(void) putc('!', fp);
! 			fputs(m->m_eol, fp);
  			if (TrafficLogFile != NULL)
! 				fprintf(TrafficLogFile, "%s!\n%05d >>> ",
  					l, getpid());
  			*q = svchar;
  			l = q;
  		}
  
  		/* output last part */
! 		if (l[0] == '.' && bitnset(M_XDOT, m->m_flags))
  		{
! 			(void) putc('.', fp);
  			if (TrafficLogFile != NULL)
  				(void) putc('.', TrafficLogFile);
  		}
--- 716,752 ----
  			fprintf(TrafficLogFile, "%05d >>> ", getpid());
  
  		/* check for line overflow */
! 		while (mci->mci_mailer->m_linelimit > 0 &&
! 		       (p - l + slop) > mci->mci_mailer->m_linelimit)
  		{
! 			register char *q = &l[mci->mci_mailer->m_linelimit - slop - 1];
  
  			svchar = *q;
  			*q = '\0';
! 			if (l[0] == '.' && slop == 0 &&
! 			    bitnset(M_XDOT, mci->mci_mailer->m_flags))
  			{
! 				(void) putc('.', mci->mci_out);
  				if (TrafficLogFile != NULL)
  					(void) putc('.', TrafficLogFile);
  			}
! 			fputs(l, mci->mci_out);
! 			(void) putc('!', mci->mci_out);
! 			fputs(mci->mci_mailer->m_eol, mci->mci_out);
! 			(void) putc(' ', mci->mci_out);
  			if (TrafficLogFile != NULL)
! 				fprintf(TrafficLogFile, "%s!\n%05d >>>  ",
  					l, getpid());
  			*q = svchar;
  			l = q;
+ 			slop = 1;
  		}
  
  		/* output last part */
! 		if (l[0] == '.' && slop == 0 &&
! 		    bitnset(M_XDOT, mci->mci_mailer->m_flags))
  		{
! 			(void) putc('.', mci->mci_out);
  			if (TrafficLogFile != NULL)
  				(void) putc('.', TrafficLogFile);
  		}
***************
*** 741,748 ****
  		if (TrafficLogFile != NULL)
  			fprintf(TrafficLogFile, "%.*s\n", p - l, l);
  		for ( ; l < p; ++l)
! 			(void) putc(*l, fp);
! 		fputs(m->m_eol, fp);
  		if (*l == '\n')
  			++l;
  	} while (l[0] != '\0');
--- 753,760 ----
  		if (TrafficLogFile != NULL)
  			fprintf(TrafficLogFile, "%.*s\n", p - l, l);
  		for ( ; l < p; ++l)
! 			(void) putc(*l, mci->mci_out);
! 		fputs(mci->mci_mailer->m_eol, mci->mci_out);
  		if (*l == '\n')
  			++l;
  	} while (l[0] != '\0');
***************
*** 836,841 ****
--- 848,859 ----
  	register EVENT *ev = NULL;
  	register char *p;
  
+ 	if (fp == NULL)
+ 	{
+ 		buf[0] = '\0';
+ 		return NULL;
+ 	}
+ 
  	/* set the timeout */
  	if (timeout != 0)
  	{
***************
*** 1309,1315 ****
  		p += strlen(p);
  		goto defprint;
  
! #ifdef S_IFIFO
  	  case S_IFIFO:
  		sprintf(p, "FIFO: ");
  		p += strlen(p);
--- 1327,1333 ----
  		p += strlen(p);
  		goto defprint;
  
! #if defined(S_IFIFO) && (!defined(S_IFSOCK) || S_IFIFO != S_IFSOCK)
  	  case S_IFIFO:
  		sprintf(p, "FIFO: ");
  		p += strlen(p);
*** src/version.c.OLD	Sat Jan 15 18:44:33 1994
--- src/version.c	Sun Mar 13 09:39:08 1994
***************
*** 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";
--- 33,39 ----
   */
  
  #ifndef lint
! static char sccsid[] = "@(#)version.c	8.6.6.1 (Berkeley) 3/13/94";
  #endif /* not lint */
  
! char	Version[] = "8.6.6";
