Subject: sendmail - mailing to file/program bug +FIX (#191)
Index:	usr.lib/sendmail/src/<several>  2.11BSD

Description:
	There is a bug in the handling of "file" addresses.  It is illegal
	to specify a file or program directly as an address but sendmail
	will permit this if one is persistent even though an initial error
	is reported.  Thus sendmail could append to almost any file in the 
	system.

Repeat-By:
	Using telnet to the SMTP port attempt to send a mail item 
	directly to a file.  Note that you do get an error message, but
	if you repeat the recipient command the addressee is accepted.

Fix:
	The basic problem is that a 'longjmp' is performed out of the
	error reporting routine "usrerr()" - this bypasses the setting
	of the invalid address bit.

	In addition to fixing the "mailing directly to a file" bug a number
	of other changes were made:

		1) Forcemail and Queuerun are no longer used in several 
		   places.  If something is normally illegal then it should
		   not be legal during a queue-run.

		2) a number of 'register' declarations were added to produce
		   smaller/faster code.

		3) The 'string extraction' was enhanced.  This moves even more
		   strings to sendmail.sr but did require that several data
		   initialization declarations (Arpa_...) be changed from
		   'char Arpa_Info[] = "xxx";' to "char *Arpa_Info = "xxx"'.

		4) Superfluous references to 'Version[]' were removed.

		5) Unreferenced routines (holdsigs, etc.) were removed.

		6) The use of 'sys_errlist[]' has been deprecated.  References
		   to 'sys_errlist' have been replaced with calls to the
		   function 'strerror()'.

		7) The Makefile.m4 file has been modified so that the same
		   version can be used whether or not the nameserver resolver
		   (res_*) routines are present.  Previously the Makefile 
		   needed to have the overlay structure modified depending
		   on whether the hosts file or resolver routines were used.


	NOTE:  these changes only apply directly to the non-MX
	       version of sendmail.  Since the normal use of sendmail
	       on a 2.11 system is to handle local (on the attached
	       LAN) mail itself and forward everything else to a larger
	       system this is not usually a problem.  If you are
	       using the sendmail in /usr/src/usr.lib/sendmail.MX
	       you will need to fit these changes into those sources.

	Save the patch below to a file (/tmp/foo), then:

		patch -p0 < /tmp/foo
		cd /usr/src/usr.lib/sendmail/src
		m4 < Makefile.m4 > Makefile
		make
		make install
		/usr/lib/sendmail -bz

		then kill and restart the sendmail daemon

====================cut here
*** /usr/src/usr.lib/sendmail/src/recipient.c.old	Fri Jan  6 09:19:06 1989
--- /usr/src/usr.lib/sendmail/src/recipient.c	Wed Jul 13 21:12:14 1994
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)recipient.c	5.7 (Berkeley) 1/9/86";
  #endif
  
  # include <pwd.h>
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)recipient.c	5.7.1 (2.11BSD GTE) 7/13/94";
  #endif
  
  # include <pwd.h>
***************
*** 41,47 ****
  # define MAXRCRSN	10
  
  sendtolist(list, ctladdr, sendq)
! 	char *list;
  	ADDRESS *ctladdr;
  	ADDRESS **sendq;
  {
--- 41,47 ----
  # define MAXRCRSN	10
  
  sendtolist(list, ctladdr, sendq)
! 	register char *list;
  	ADDRESS *ctladdr;
  	ADDRESS **sendq;
  {
***************
*** 142,148 ****
  ADDRESS *
  recipient(a, sendq)
  	register ADDRESS *a;
! 	register ADDRESS **sendq;
  {
  	register ADDRESS *q;
  	ADDRESS **pq;
--- 142,148 ----
  ADDRESS *
  recipient(a, sendq)
  	register ADDRESS *a;
! 	ADDRESS **sendq;
  {
  	register ADDRESS *q;
  	ADDRESS **pq;
***************
*** 196,205 ****
  	{
  		a->q_mailer = m = ProgMailer;
  		a->q_user++;
! 		if (a->q_alias == NULL && !QueueRun && !ForceMail)
  		{
- 			usrerr("Cannot mail directly to programs");
  			a->q_flags |= QDONTSEND|QBADADDR;
  		}
  	}
  
--- 196,205 ----
  	{
  		a->q_mailer = m = ProgMailer;
  		a->q_user++;
! 		if (a->q_alias == NULL)
  		{
  			a->q_flags |= QDONTSEND|QBADADDR;
+ 			usrerr("Cannot mail directly to programs");
  		}
  	}
  
***************
*** 214,220 ****
  
  	for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
  	{
! 		if (!ForceMail && sameaddr(q, a))
  		{
  # ifdef DEBUG
  			if (tTd(26, 1))
--- 214,220 ----
  
  	for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
  	{
! 		if (sameaddr(q, a))
  		{
  # ifdef DEBUG
  			if (tTd(26, 1))
***************
*** 245,252 ****
  		if (strncmp(a->q_user, ":include:", 9) == 0)
  		{
  			a->q_flags |= QDONTSEND;
! 			if (a->q_alias == NULL && !tTd(0, 1) && !QueueRun && !ForceMail)
  				usrerr("Cannot mail directly to :include:s");
  			else
  			{
  				message(Arpa_Info, "including file %s", &a->q_user[9]);
--- 245,255 ----
  		if (strncmp(a->q_user, ":include:", 9) == 0)
  		{
  			a->q_flags |= QDONTSEND;
! 			if (a->q_alias == NULL)
! 				{
! 				a->q_flags |= QBADADDR;
  				usrerr("Cannot mail directly to :include:s");
+ 				}
  			else
  			{
  				message(Arpa_Info, "including file %s", &a->q_user[9]);
***************
*** 275,284 ****
  		{
  			p = rindex(buf, '/');
  			/* check if writable or creatable */
! 			if (a->q_alias == NULL && !tTd(0, 1) && !QueueRun && !ForceMail)
  			{
  				usrerr("Cannot mail directly to files");
- 				a->q_flags |= QDONTSEND;
  			}
  			else if ((stat(buf, &stb) >= 0) ? (!writable(&stb)) :
  			    (*p = '\0', !safefile(buf, getruid(), S_IWRITE|S_IEXEC)))
--- 278,287 ----
  		{
  			p = rindex(buf, '/');
  			/* check if writable or creatable */
! 			if (a->q_alias == NULL)
  			{
+ 				a->q_flags |= (QBADADDR|QDONTSEND);
  				usrerr("Cannot mail directly to files");
  			}
  			else if ((stat(buf, &stb) >= 0) ? (!writable(&stb)) :
  			    (*p = '\0', !safefile(buf, getruid(), S_IWRITE|S_IEXEC)))
***************
*** 410,416 ****
  	register struct stat *s;
  {
  	int euid, egid;
! 	int bits;
  
  	if (bitset(0111, s->st_mode))
  		return (FALSE);
--- 413,419 ----
  	register struct stat *s;
  {
  	int euid, egid;
! 	register int bits;
  
  	if (bitset(0111, s->st_mode))
  		return (FALSE);
*** /usr/src/usr.lib/sendmail/src/sendmail.h.old	Tue May  2 22:25:05 1989
--- /usr/src/usr.lib/sendmail/src/sendmail.h	Fri Jul 15 14:40:40 1994
***************
*** 7,13 ****
  **  All rights reserved.  The Berkeley software License Agreement
  **  specifies the terms and conditions for redistribution.
  **
! **	@(#)sendmail.h	5.8 (Berkeley) 1/10/86
  */
  
  /*
--- 7,13 ----
  **  All rights reserved.  The Berkeley software License Agreement
  **  specifies the terms and conditions for redistribution.
  **
! **	@(#)sendmail.h	5.8.1 (2.11BSD GTE) 7/15/94
  */
  
  /*
***************
*** 19,25 ****
  # ifdef _DEFINE
  # define EXTERN
  # if !defined(lint) && !defined(NOSCCS)
! static char SmailSccsId[] =	"@(#)sendmail.h	5.8		1/10/86";
  # endif lint
  # else  _DEFINE
  # define EXTERN extern
--- 19,25 ----
  # ifdef _DEFINE
  # define EXTERN
  # if !defined(lint) && !defined(NOSCCS)
! static char SmailSccsId[] =	"@(#)sendmail.h	5.8.1		7/15/94";
  # endif lint
  # else  _DEFINE
  # define EXTERN extern
***************
*** 520,526 ****
  EXTERN bool	QuickAbort;	/*  .... but only if we want a quick abort */
  extern char	*ConfFile;	/* location of configuration file [conf.c] */
  extern char	*FreezeFile;	/* location of frozen memory image [conf.c] */
! extern char	Arpa_Info[];	/* the reply code for Arpanet info [conf.c] */
  extern ADDRESS	NullAddress;	/* a null (template) address [main.c] */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	WkClassFact;	/* multiplier for message class -> priority */
--- 520,530 ----
  EXTERN bool	QuickAbort;	/*  .... but only if we want a quick abort */
  extern char	*ConfFile;	/* location of configuration file [conf.c] */
  extern char	*FreezeFile;	/* location of frozen memory image [conf.c] */
! extern char	*Arpa_Info;	/* the reply code for Arpanet info [conf.c] */
! extern char	*Arpa_TSyserr;
! extern char	*Arpa_PSyserr;
! extern char	*Arpa_Usrerr;
! extern char	*Version;	/* the version of sendmail [Version.c] */
  extern ADDRESS	NullAddress;	/* a null (template) address [main.c] */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	WkClassFact;	/* multiplier for message class -> priority */
*** /usr/src/usr.lib/sendmail/src/srvrsmtp.c.old	Fri Jan  6 09:20:02 1989
--- /usr/src/usr.lib/sendmail/src/srvrsmtp.c	Fri Jul 15 15:41:48 1994
***************
*** 15,26 ****
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)srvrsmtp.c	5.18 (Berkeley) 1/5/86	(no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)srvrsmtp.c	5.18 (Berkeley) 1/5/86";
  # endif
  
  /*
--- 15,26 ----
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)srvrsmtp.c 5.18.1 (2.11BSD GTE) 7/15/94 (no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)srvrsmtp.c	5.18.1 (2.11BSD GTE) 7/15/94";
  # endif
  
  /*
***************
*** 88,95 ****
  
  # ifdef WIZ
  bool	IsWiz = FALSE;			/* set if we are a wizard */
- # endif WIZ
  char	*WizWord;			/* the wizard word to compare against */
  bool	InChild = FALSE;		/* true if running in a subprocess */
  bool	OneXact = FALSE;		/* one xaction only this run */
  
--- 88,95 ----
  
  # ifdef WIZ
  bool	IsWiz = FALSE;			/* set if we are a wizard */
  char	*WizWord;			/* the wizard word to compare against */
+ # endif WIZ
  bool	InChild = FALSE;		/* true if running in a subprocess */
  bool	OneXact = FALSE;		/* one xaction only this run */
  
***************
*** 107,113 ****
  	ADDRESS *a;
  	char inp[MAXLINE];
  	char cmdbuf[100];
- 	extern char Version[];
  	extern tick();
  	extern bool iswiz();
  	extern char *arpadate();
--- 107,112 ----
*** /usr/src/usr.lib/sendmail/src/usersmtp.c.old	Wed Feb 10 15:26:30 1988
--- /usr/src/usr.lib/sendmail/src/usersmtp.c	Fri Jul 15 14:38:05 1994
***************
*** 16,31 ****
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)usersmtp.c	5.7 (Berkeley) 4/2/86	(no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)usersmtp.c	5.7 (Berkeley) 4/2/86";
  # endif
  
  
- 
  /*
  **  USERSMTP -- run SMTP protocol from the user end.
  **
--- 16,30 ----
  
  # ifndef SMTP
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.1 (2.11BSD GTE) 7/15/94 (no SMTP)";
  # endif
  # else SMTP
  
  #if !defined(lint) && !defined(NOSCCS)
! static char SccsId[] = "@(#)usersmtp.c	5.7.1 (2.11BSD GTE) 7/15/94";
  # endif
  
  
  /*
  **  USERSMTP -- run SMTP protocol from the user end.
  **
***************
*** 38,44 ****
  
  char	SmtpMsgBuffer[MAXLINE];		/* buffer for commands */
  char	SmtpReplyBuffer[MAXLINE];	/* buffer for replies */
! char	SmtpError[MAXLINE] = "";	/* save failure error messages */
  FILE	*SmtpOut;			/* output file */
  FILE	*SmtpIn;			/* input file */
  int	SmtpPid;			/* pid of mailer */
--- 37,43 ----
  
  char	SmtpMsgBuffer[MAXLINE];		/* buffer for commands */
  char	SmtpReplyBuffer[MAXLINE];	/* buffer for replies */
! char	SmtpError[MAXLINE];		/* save failure error messages */
  FILE	*SmtpOut;			/* output file */
  FILE	*SmtpIn;			/* input file */
  int	SmtpPid;			/* pid of mailer */
***************
*** 400,406 ****
  		if (p == NULL)
  		{
  			extern char MsgBuf[];		/* err.c */
! 			extern char Arpa_TSyserr[];	/* conf.c */
  
  			/* if the remote end closed early, fake an error */
  			if (errno == 0)
--- 399,405 ----
  		if (p == NULL)
  		{
  			extern char MsgBuf[];		/* err.c */
! 			extern char *Arpa_TSyserr;	/* conf.c */
  
  			/* if the remote end closed early, fake an error */
  			if (errno == 0)
*** /usr/src/usr.lib/sendmail/src/Makefile.m4.old	Tue Jun  9 11:37:55 1992
--- /usr/src/usr.lib/sendmail/src/Makefile.m4	Fri Jul 15 15:47:38 1994
***************
*** 7,13 ****
  #  All rights reserved.  The Berkeley software License Agreement
  #  specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile.m4	5.10 (Berkeley) 5/2/86
  #
  #
  #  SENDMAIL Makefile.
--- 7,13 ----
  #  All rights reserved.  The Berkeley software License Agreement
  #  specifies the terms and conditions for redistribution.
  #
! #	@(#)Makefile.m4	5.10.1 (2.11BSD GTE) 7/15/94
  #
  #
  #  SENDMAIL Makefile.
***************
*** 17,22 ****
--- 17,23 ----
  
  # Uncomment these two lines to enable string extractions
  CC= ./mkstrcc
+ XSTR=/usr/ucb/xstr
  EXTRACT=extract.o
  
  LIBS=	m4LIBS
***************
*** 27,39 ****
  	stats.o daemon.o usersmtp.o srvrsmtp.o queue.o \
  	macro.o util.o clock.o trace.o envelope.o
  OBJS2=	sysexits.o arpadate.o convtime.o ctime.o
! OBJS=	$(OBJS1) $(OBJS2) $(EXTRACT)
  
  SBASE=	conf.o collect.o parseaddr.o alias.o deliver.o headers.o \
! 	recipient.o srvrsmtp.o queue.o macro.o util.o \
  	envelope.o sysexits.o arpadate.o convtime.o Version.o \
! 	ctime.o $(EXTRACT)
! SOV1=	main.o readcf.o
  SOV2=	daemon.o savemail.o usersmtp.o err.o clock.o stats.o trace.o stab.o
  
  SRCS1=	conf.h sendmail.h \
--- 28,40 ----
  	stats.o daemon.o usersmtp.o srvrsmtp.o queue.o \
  	macro.o util.o clock.o trace.o envelope.o
  OBJS2=	sysexits.o arpadate.o convtime.o ctime.o
! OBJS=	$(OBJS1) $(OBJS2) $(EXTRACT) str.o
  
  SBASE=	conf.o collect.o parseaddr.o alias.o deliver.o headers.o \
! 	recipient.o srvrsmtp.o queue.o util.o \
  	envelope.o sysexits.o arpadate.o convtime.o Version.o \
! 	ctime.o $(EXTRACT) str.o
! SOV1=	main.o readcf.o macro.o
  SOV2=	daemon.o savemail.o usersmtp.o err.o clock.o stats.o trace.o stab.o
  
  SRCS1=	conf.h sendmail.h \
***************
*** 45,68 ****
  SRCS=	Version.c $(SRCS1) $(SRCS2)
  ALL=	sendmail ctimed
  
- CHOWN=	-echo chown
- CHMOD=	chmod
  O=	-O
  COPTS=
  CCONFIG=-I../`include' m4CONFIG
  CFLAGS=	$O $(COPTS) $(CCONFIG)
  SEPFLAG=-i
- ASMSED=	../`include'/asm.sed
- AR=	-ar
- ARFLAGS=rvu
  LINT=	lint
  XREF=	ctags -x
- CP=	cp
- MV=	mv
  INSTALL=install -c -s -o root
- M4=	m4
- TOUCH=	touch
- ABORT=	false
  
  GET=	sccs get
  DELTA=	sccs delta
--- 46,59 ----
***************
*** 74,88 ****
  OBJMODE=755
  
  .c.o:
! 	$(CC) -S ${CFLAGS} $*.c
! 	sed -f $(ASMSED) $*.s >_xx.s
! 	as -V - -o $*.o _xx.s
! 	rm -f $*.s _xx.s
  
  sendmail: $(OBJS) Version.o
  	ld $(SEPFLAG) $(COPTS) /lib/crt0.o -o sendmail \
  		-Z $(SOV1) -Z $(SOV2) -Y $(SBASE) $(LIBS) -lc
! 	$(CHMOD) $(OBJMODE) sendmail
  	size sendmail; ls -l sendmail; ifdef(`m4SCCS', `$(WHAT) < Version.o')
  
  ctimed:
--- 65,78 ----
  OBJMODE=755
  
  .c.o:
! 	$(CC) ${CFLAGS} -c $*.c
  
+ all: $(ALL)
+ 
  sendmail: $(OBJS) Version.o
  	ld $(SEPFLAG) $(COPTS) /lib/crt0.o -o sendmail \
  		-Z $(SOV1) -Z $(SOV2) -Y $(SBASE) $(LIBS) -lc
! 	chmod $(OBJMODE) sendmail
  	size sendmail; ls -l sendmail; ifdef(`m4SCCS', `$(WHAT) < Version.o')
  
  ctimed:
***************
*** 91,97 ****
  install: all
  	$(INSTALL) -m 4755 sendmail $(DESTDIR)/usr/lib
  	chgrp kmem $(DESTDIR)/usr/lib/sendmail
! 	$(CP) /dev/null $(DESTDIR)/usr/lib/sendmail.fc
  	-if [ -s sendmail.sr ]; then \
  		install -c -o bin -m 644 sendmail.sr \
  			$(DESTDIR)/usr/lib/sendmail.sr; \
--- 81,87 ----
  install: all
  	$(INSTALL) -m 4755 sendmail $(DESTDIR)/usr/lib
  	chgrp kmem $(DESTDIR)/usr/lib/sendmail
! 	cp /dev/null $(DESTDIR)/usr/lib/sendmail.fc
  	-if [ -s sendmail.sr ]; then \
  		install -c -o bin -m 644 sendmail.sr \
  			$(DESTDIR)/usr/lib/sendmail.sr; \
***************
*** 133,140 ****
  
  sendmail.h util.o: ../`include'/useful.h
  
- all: $(ALL)
- 
  #
  #  Auxiliary support entries
  #
--- 123,128 ----
***************
*** 141,153 ****
  
  clean:
  	rm -f core sendmail rmail usersmtp uucp a.out XREF sendmail.cf
! 	rm -f sendmail.sr *.o ctimed
  
  sources: $(SRCS)
  
  ifdef(`m4SCCS',
  `$(SRCS1) $(SRCS2):
! 	if test -d SCCS; then $(GET) $(REL) SCCS/s.$@; else $(TOUCH) $@; fi'
  )dnl
  
  print: $(SRCS)
--- 129,141 ----
  
  clean:
  	rm -f core sendmail rmail usersmtp uucp a.out XREF sendmail.cf
! 	rm -f sendmail.sr *.o ctimed strings
  
  sources: $(SRCS)
  
  ifdef(`m4SCCS',
  `$(SRCS1) $(SRCS2):
! 	if test -d SCCS; then $(GET) $(REL) SCCS/s.$@; else touch $@; fi'
  )dnl
  
  print: $(SRCS)
***************
*** 158,160 ****
--- 146,154 ----
  
  lint:
  	$(LINT) $(CCONFIG) $(SRCS1)
+ 
+ str.o:	strings
+ 	${XSTR}
+ 	cc -c xs.c
+ 	mv xs.o str.o
+ 	rm -f xs.c
*** /usr/src/usr.lib/sendmail/src/Version.c.old	Wed Feb 10 15:26:07 1988
--- /usr/src/usr.lib/sendmail/src/Version.c	Fri Jul 15 14:15:12 1994
***************
*** 9,18 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)version.c	5.51 (Berkeley) 5/2/86";
  #endif
  
! char	Version[] = "5.51";
  
  # ifdef COMMENT
  
--- 9,18 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)version.c	5.51.1 (2.11BSD GTE) 7/15/94";
  #endif
  
! char	*Version = "5.51.1";
  
  # ifdef COMMENT
  
*** /usr/src/usr.lib/sendmail/src/conf.c.old	Sat Feb  5 20:31:32 1994
--- /usr/src/usr.lib/sendmail/src/conf.c	Fri Jul 15 15:40:22 1994
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)conf.c	5.14.1 (2.11BSD GTE) 1/1/94";
  #endif
  
  # include <pwd.h>
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)conf.c	5.14.2 (2.11BSD GTE) 7/15/94";
  #endif
  
  # include <pwd.h>
***************
*** 101,110 ****
  **  ARPANET error message numbers.
  */
  
! char	Arpa_Info[] =		"050";	/* arbitrary info */
! char	Arpa_TSyserr[] =	"451";	/* some (transient) system error */
! char	Arpa_PSyserr[] =	"554";	/* some (permanent) system error */
! char	Arpa_Usrerr[] =		"554";	/* some (fatal) user error */
  
  
  
--- 101,110 ----
  **  ARPANET error message numbers.
  */
  
! char	*Arpa_Info =		"050";	/* arbitrary info */
! char	*Arpa_TSyserr =		"451";	/* some (transient) system error */
! char	*Arpa_PSyserr =		"554";	/* some (permanent) system error */
! char	*Arpa_Usrerr =		"554";	/* some (fatal) user error */
  
  
  
***************
*** 496,535 ****
  	}
  # endif EXAMPLE_CODE
  	return (TRUE);
- }
- /*
- **  HOLDSIGS -- arrange to hold all signals
- **
- **	Parameters:
- **		none.
- **
- **	Returns:
- **		none.
- **
- **	Side Effects:
- **		Arranges that signals are held.
- */
- 
- holdsigs()
- {
- }
- /*
- **  RLSESIGS -- arrange to release all signals
- **
- **	This undoes the effect of holdsigs.
- **
- **	Parameters:
- **		none.
- **
- **	Returns:
- **		none.
- **
- **	Side Effects:
- **		Arranges that signals are released.
- */
- 
- rlsesigs()
- {
  }
  /*
  **  GETLA -- get the current load average
--- 496,501 ----
*** /usr/src/usr.lib/sendmail/src/envelope.c.old	Wed Feb 10 15:26:15 1988
--- /usr/src/usr.lib/sendmail/src/envelope.c	Fri Jul 15 14:22:24 1994
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)envelope.c	5.12 (Berkeley) 12/17/85";
  #endif
  
  #include <pwd.h>
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)envelope.c	5.12.1 (2.11BSD GTE) 7/15/94";
  #endif
  
  #include <pwd.h>
***************
*** 232,238 ****
  #endif TTYNAME
  	extern char *ttyname();
  	extern char *macvalue();
- 	extern char Version[];
  
  	/*
  	**  Give this envelope a reality.
--- 232,237 ----
*** /usr/src/usr.lib/sendmail/src/err.c.old	Wed Feb 10 15:26:16 1988
--- /usr/src/usr.lib/sendmail/src/err.c	Fri Jul 15 14:27:52 1994
***************
*** 9,20 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)err.c	5.7 (Berkeley) 11/22/85";
  #endif
  
  # include "sendmail.h"
  # include <errno.h>
  # include <netdb.h>
  
  /*
  **  SYSERR -- Print error message.
--- 9,21 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)err.c	5.7.1 (2.11BSD GTE) 7/14/94";
  #endif
  
  # include "sendmail.h"
  # include <errno.h>
  # include <netdb.h>
+ # include <string.h>
  
  /*
  **  SYSERR -- Print error message.
***************
*** 35,44 ****
  **		sets ExitStat.
  */
  
- # ifdef lint
- int	sys_nerr;
- char	*sys_errlist[];
- # endif lint
  char	MsgBuf[BUFSIZ*2];	/* text of most recent message */
  
  /*VARARGS1*/
--- 36,41 ----
***************
*** 47,54 ****
  {
  	register char *p;
  	int olderrno = errno;
- 	extern char Arpa_PSyserr[];
- 	extern char Arpa_TSyserr[];
  
  	/* format and output the error message */
  	if (olderrno == 0)
--- 44,49 ----
***************
*** 98,104 ****
  	char *fmt;
  {
  	extern char SuprErrs;
- 	extern char Arpa_Usrerr[];
  	extern int errno;
  
  	if (SuprErrs)
--- 93,98 ----
***************
*** 310,317 ****
  errstring(errno)
  	int errno;
  {
- 	extern char *sys_errlist[];
- 	extern int sys_nerr;
  	static char buf[100];
  # ifdef SMTP
  	extern char *SmtpPhase;
--- 304,309 ----
***************
*** 329,335 ****
  	{
  	  case ETIMEDOUT:
  	  case ECONNRESET:
! 		(void) strcpy(buf, sys_errlist[errno]);
  		if (SmtpPhase != NULL)
  		{
  			(void) strcat(buf, " during ");
--- 321,327 ----
  	{
  	  case ETIMEDOUT:
  	  case ECONNRESET:
! 		(void) strcpy(buf, strerror(errno));
  		if (SmtpPhase != NULL)
  		{
  			(void) strcat(buf, " during ");
***************
*** 361,369 ****
  # endif VMUNIX
  # endif DAEMON
  
! 	if (errno > 0 && errno < sys_nerr)
! 		return (sys_errlist[errno]);
! 
! 	(void) sprintf(buf, "Error %d", errno);
! 	return (buf);
  }
--- 353,357 ----
  # endif VMUNIX
  # endif DAEMON
  
! 	return (strerror(errno));
  }
*** /usr/src/usr.lib/sendmail/src/extract.c.old	Wed Apr 13 21:30:59 1994
--- /usr/src/usr.lib/sendmail/src/extract.c	Thu Jul 14 15:06:00 1994
***************
*** 140,142 ****
--- 140,153 ----
  	errprep(fmt, buf);
  	message(num, buf, a, b, c, d, e);
  }
+ 
+ strputlinerror(str, fp, m)
+ 	int	str;
+ 	FILE	*fp;
+ 	struct	mailer	*m;
+ 	{
+ 	char	buf[BUFLEN];
+ 	
+ 	errprep(str, buf);
+ 	putline(buf, fp, m);
+ 	}
*** /usr/src/usr.lib/sendmail/src/main.c.old	Fri Dec 14 14:41:14 1990
--- /usr/src/usr.lib/sendmail/src/main.c	Fri Jul 15 14:25:16 1994
***************
*** 12,21 ****
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
- #endif
  
! #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)main.c	5.11 (Berkeley) 1/30/86";
  #endif
  
  # define  _DEFINE
--- 12,19 ----
  char copyright[] =
  "@(#) Copyright (c) 1980 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char	SccsId[] = "@(#)main.c	5.11.1 (2.11BSD GTE) 7/15/94";
  #endif
  
  # define  _DEFINE
***************
*** 100,106 ****
  	register char *p;
  	char **av;
  	extern int finis();
- 	extern char Version[];
  	char *from;
  	typedef int (*fnptr)();
  	STAB *st;
--- 98,103 ----
***************
*** 869,875 ****
  	union frz fhdr;
  	extern char edata, end;
  	extern char *sbrk();
- 	extern char Version[];
  
  	if (freezefile == NULL)
  		return;
--- 866,871 ----
***************
*** 921,927 ****
  	int f;
  	union frz fhdr;
  	extern char edata, end;
- 	extern char Version[];
  	extern caddr_t brk();
  
  	if (freezefile == NULL)
--- 917,922 ----
*** /usr/src/usr.lib/sendmail/src/mkstrcc.old	Sat Feb  4 18:48:53 1989
--- /usr/src/usr.lib/sendmail/src/mkstrcc	Fri Jul 15 13:46:39 1994
***************
*** 33,53 ****
  
  # String extractions
  echo Extracting strings from ${csrc}...
! cc -E $args $csrc > xxmk.c
! sed -e 's/ferror(/strferrorf(/'				\
      -e 's/sprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strsrerror(\2, \1\3/' \
      -e 's/fprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strfrerror(\2, \1\3/' \
      -e 's/printf("/strprerror("/'				\
      -e 's/syslog(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/slogerror(\2, \1\3/' \
      -e 's/syserr(\(".*"\)\([,)]\)/syserror(\1\2/'		\
      -e 's/usrerr(\(".*"\)\([,)]\)/usrerror(\1\2/'		\
      -e 's/nmessage(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/nmesserror(\2, \1\3/' \
      -e 's/message(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/messerror(\2, \1\3/' \
! 	xxmk.c > mk.c
  mkstr - $STRINGS xx mk.c
! sed -e 's/^# \([0-9]\)/#line \1/' xxmk.c > mk.c
  echo Compiling...
! cc -Dstrferrorf=ferror -Dstrprnf=fprintf -Dstrsprnf=sprintf \
! 	-Dstrnmessagef=nmessage $args mk.c
! mv mk.s `basename $csrc .c`.s
! rm -f mk.c xxmk.c
--- 33,55 ----
  
  # String extractions
  echo Extracting strings from ${csrc}...
! cc -E $args $csrc | \
! sed -e 's/ferror(/ferror_(/'				\
!     -e 's/smtpmessage(/smtpmessage_(/'	\
      -e 's/sprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strsrerror(\2, \1\3/' \
      -e 's/fprintf(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/strfrerror(\2, \1\3/' \
      -e 's/printf("/strprerror("/'				\
+     -e 's/putline("/strputlinerror("/'				\
      -e 's/syslog(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/slogerror(\2, \1\3/' \
      -e 's/syserr(\(".*"\)\([,)]\)/syserror(\1\2/'		\
      -e 's/usrerr(\(".*"\)\([,)]\)/usrerror(\1\2/'		\
      -e 's/nmessage(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/nmesserror(\2, \1\3/' \
      -e 's/message(\([^,][^,]*\),[ ]*\("[^"]*"\)\([,)]\)/messerror(\2, \1\3/' \
!     -e 's/^# \([0-9]\)/#line \1/' > mk.c
  mkstr - $STRINGS xx mk.c
! echo Doing shared strings...
! cc -E -Dferror=ferror_ -Dsmtpmessage=smtpmessage_ $args xxmk.c | xstr -c -
  echo Compiling...
! cc $args -c x.c
! mv x.o `basename $csrc .c`.o
! rm -f x.c mk.c xxmk.c
*** /usr/src/usr.lib/sendmail/src/version.c.old	Wed Feb 10 15:26:32 1988
--- /usr/src/usr.lib/sendmail/src/version.c	Fri Jul 15 14:19:52 1994
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)version.c	5.52 (Berkeley) 5/6/86";
  #endif
  
! char	Version[] = "5.52";
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)version.c	5.52.1 (2.11BSD GTE) 7/15/94";
  #endif
  
! char	*Version = "5.52.1";
