Subject: getlogin(2)+setlogin(2) arrive,usleep(3)+sleep(3) fixed (#392 - 3 of 3)
Index:	sys/init_systent.c,lib/libc/{gen,pdp},many many more 2.11BSD

Description:
	See #390 (part 1 of 3).

Repeat-By:
 	Refer to #390 (part 1 of 3).

Fix:
	This is #392, part 3 of 3.

	There are 3 parts (390, 391, 392) to this update kit.  Make sure you
	have all of them.

	Update	Part	Content
	------	----	-------
	390	1	Contains the description, MANIFEST,
			a shell script (/tmp/390.sh) to remove old files,
			and a shar file (/tmp/390.shar) of new files.

	391	2	First (/tmp/391.patch) of two patch files.

	392	3	This file. Second (/tmp/392.patch) of two patch files.

	As always this and previous updates to 2.11BSD are available via
	anonymous FTP to either FTP.IIPO.GTEGSC.COM or MOE.2BSD.COM in the
	directory /pub/2.11BSD.

---------------------------------cut here----------------------
*** /usr/src/usr.sbin/sendmail/include/useful.h.old	Wed Feb 18 01:10:56 1987
--- /usr/src/usr.sbin/sendmail/include/useful.h	Fri Oct  3 00:31:40 1997
***************
*** 1,7 ****
  /*
  **  USEFUL.H -- Some useful stuff.
  **
! **	@(#)useful.h	4.1		7/25/83
  */
  
  # ifndef makedev
--- 1,7 ----
  /*
  **  USEFUL.H -- Some useful stuff.
  **
! **	@(#)useful.h	4.1.1		1997/10/2
  */
  
  # ifndef makedev
***************
*** 45,62 ****
  # define SCCSID(arg)
  # endif lint
  
- /* define the types of some common functions */
- extern char	*strcpy(), *strncpy();
- extern char	*strcat(), *strncat();
- extern char	*malloc();
- extern char	*index(), *rindex();
- extern int	errno;
- extern char	*sprintf();
- extern time_t	time();
- extern char	*ctime();
- # ifndef V6
- extern char	*getenv();
- # endif V6
  # ifndef VMUNIX
  typedef unsigned short	u_short;
  typedef long		u_long;
--- 45,50 ----
*** /usr/src/usr.sbin/sendmail/src/conf.c.old	Fri May  9 20:09:39 1997
--- /usr/src/usr.sbin/sendmail/src/conf.c	Fri Oct  3 00:32:59 1997
***************
*** 9,23 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)conf.c	5.14.5 (2.11BSD GTE) 1997/5/9";
  #endif
  
! # include <pwd.h>
! # include <sys/ioctl.h>
! # ifdef sun
! # include <sys/param.h>
! # endif sun
! # include "sendmail.h"
  
  /*
  **  CONF.C -- Sendmail Configuration Tables.
--- 9,20 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)conf.c	5.14.6 (2.11BSD GTE) 1997/10/2";
  #endif
  
! #include <pwd.h>
! #include <sys/ioctl.h>
! #include "sendmail.h"
  
  /*
  **  CONF.C -- Sendmail Configuration Tables.
***************
*** 193,201 ****
  username()
  {
  	static char *myname = NULL;
- 	extern char *getlogin();
  	register struct passwd *pw;
- 	extern struct passwd *getpwuid();
  
  	/* cache the result */
  	if (myname == NULL)
--- 190,196 ----
***************
*** 259,266 ****
  {
  	struct stat stbuf;
  	register char *pathn;
- 	extern char *ttyname();
- 	extern char *getlogin();
  
  	/* compute the pathname of the controlling tty */
  	if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL &&
--- 254,259 ----
*** /usr/src/usr.sbin/sendmail/src/sendmail.h.old	Mon Mar  6 21:42:03 1995
--- /usr/src/usr.sbin/sendmail/src/sendmail.h	Fri Oct  3 00:50:32 1997
***************
*** 7,13 ****
  **  All rights reserved.  The Berkeley software License Agreement
  **  specifies the terms and conditions for redistribution.
  **
! **	@(#)sendmail.h	5.8.2 (2.11BSD GTE) 3/6/95
  */
  
  /*
--- 7,13 ----
  **  All rights reserved.  The Berkeley software License Agreement
  **  specifies the terms and conditions for redistribution.
  **
! **	@(#)sendmail.h	5.8.3 (2.11BSD GTE) 1997/10/3
  */
  
  /*
***************
*** 19,25 ****
  # ifdef _DEFINE
  # define EXTERN
  # if !defined(lint) && !defined(NOSCCS)
! static char SmailSccsId[] =	"@(#)sendmail.h	5.8.2		3/6/95";
  # 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.3		1997/10/3";
  # endif lint
  # else  _DEFINE
  # define EXTERN extern
***************
*** 30,35 ****
--- 30,40 ----
  # include <setjmp.h>
  # include "conf.h"
  # include "useful.h"
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/time.h>
+ #include <unistd.h>
  
  # ifdef LOG
  # include <sys/syslog.h>
*** /usr/src/usr.sbin/sendmail/src/daemon.c.old	Sat Feb  5 20:31:28 1994
--- /usr/src/usr.sbin/sendmail/src/daemon.c	Fri Oct  3 00:49:06 1997
***************
*** 14,20 ****
  
  # ifndef DAEMON
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)daemon.c	5.20 (2.11BSD) 1/26/93	(w/o daemon mode)";
  # endif
  # else
  
--- 14,20 ----
  
  # ifndef DAEMON
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)daemon.c 5.21 (2.11BSD) 1997/10/3 (w/o daemon mode)";
  # endif
  # else
  
***************
*** 21,31 ****
  # include <netdb.h>
  # include <sys/signal.h>
  # include <sys/wait.h>
- # include <sys/time.h>
  # include <sys/resource.h>
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)daemon.c	5.20 (2.11BSD) 1/26/93 (with daemon mode)";
  # endif
  
  /*
--- 21,30 ----
  # include <netdb.h>
  # include <sys/signal.h>
  # include <sys/wait.h>
  # include <sys/resource.h>
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)daemon.c 5.21 (2.11BSD) 1997/10/3 (with daemon mode)";
  # endif
  
  /*
*** /usr/src/usr.sbin/sendmail/src/util.c.old	Sun Mar 10 19:59:58 1996
--- /usr/src/usr.sbin/sendmail/src/util.c	Fri Oct  3 01:06:51 1997
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.8.2 (2.11BSD GTE) 1996/3/10";
  #endif
  
  # include <stdio.h>
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.8.3 (2.11BSD GTE) 1997/10/3";
  #endif
  
  # include <stdio.h>
***************
*** 16,25 ****
  # include <sys/types.h>
  # include <sys/stat.h>
  # include <sysexits.h>
- # include <errno.h>
  # include <ctype.h>
  # include "sendmail.h"
- #include <string.h>
  
  /*
  **  STRIPQUOTES -- Strip quotes & quote bits from a string.
--- 16,23 ----
***************
*** 144,152 ****
  	register int sz;
  {
  	register char *p;
- 	extern char *malloc();
  
! 	p = malloc((unsigned) sz);
  	if (p == NULL)
  	{
  		syserr("Out of memory!!");
--- 142,149 ----
  	register int sz;
  {
  	register char *p;
  
! 	p = (char *)malloc((unsigned) sz);
  	if (p == NULL)
  	{
  		syserr("Out of memory!!");
No differences encountered
*** /usr/src/usr.sbin/sendmail/src/clock.c.old	Sun Mar 10 19:56:34 1996
--- /usr/src/usr.sbin/sendmail/src/clock.c	Fri Oct  3 01:14:28 1997
***************
*** 9,15 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)clock.c	5.4.1 (2.11BSD) 1996/3/10";
  #endif
  
  # include "sendmail.h"
--- 9,15 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)clock.c	5.4.2 (2.11BSD) 1997/10/3";
  #endif
  
  # include "sendmail.h"
***************
*** 215,220 ****
--- 215,221 ----
  
  static bool	SleepDone;
  
+ unsigned int
  sleep(intvl)
  	unsigned int intvl;
  {
*** /usr/src/usr.sbin/sendmail/src/arpadate.c.old	Tue Mar  7 23:12:24 1995
--- /usr/src/usr.sbin/sendmail/src/arpadate.c	Fri Oct  3 01:17:51 1997
***************
*** 33,43 ****
   */
  
  #if	!defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)arpadate.c	8.1.1 (2.11BSD GTE) 3/7/95";
  #endif
  
  #include "sendmail.h"
- #include <time.h>
  
  /*
  **  ARPADATE -- Create date in ARPANET format
--- 33,42 ----
   */
  
  #if	!defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)arpadate.c	8.1.2 (2.11BSD GTE) 1997/10/3";
  #endif
  
  #include "sendmail.h"
  
  /*
  **  ARPADATE -- Create date in ARPANET format
*** /usr/src/usr.sbin/sendmail.MX/include/useful.h.old	Thu Mar 24 14:50:58 1988
--- /usr/src/usr.sbin/sendmail.MX/include/useful.h	Fri Oct  3 00:31:40 1997
***************
*** 1,16 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *	@(#)useful.h	4.3 (Berkeley) 3/24/88
!  */
  
  # ifndef makedev
  # include <sys/types.h>
--- 1,8 ----
  /*
! **  USEFUL.H -- Some useful stuff.
! **
! **	@(#)useful.h	4.1.1		1997/10/2
! */
  
  # ifndef makedev
  # include <sys/types.h>
***************
*** 53,69 ****
  # define SCCSID(arg)
  # endif lint
  
- /* define the types of some common functions */
- extern char	*strcpy(), *strncpy();
- extern char	*strcat(), *strncat();
- extern char	*malloc();
- extern char	*index(), *rindex();
- extern int	errno;
- extern time_t	time();
- extern char	*ctime();
- # ifndef V6
- extern char	*getenv();
- # endif V6
  # ifndef VMUNIX
  typedef unsigned short	u_short;
  typedef long		u_long;
--- 45,50 ----
*** /usr/src/usr.sbin/sendmail.MX/src/conf.c.old	Thu Oct 24 20:27:52 1996
--- /usr/src/usr.sbin/sendmail.MX/src/conf.c	Fri Oct  3 00:32:59 1997
***************
*** 1,29 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
!  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)conf.c	5.16.3 (2.11BSD) 1996/10/24";
! #endif /* not lint */
  
! # include <pwd.h>
! # include <sys/ioctl.h>
! # ifdef sun
! # include <sys/param.h>
! # endif sun
! # include "sendmail.h"
  
  /*
  **  CONF.C -- Sendmail Configuration Tables.
--- 1,20 ----
  /*
! **  Sendmail
! **  Copyright (c) 1983  Eric P. Allman
! **  Berkeley, California
! **
! **  Copyright (c) 1983 Regents of the University of California.
! **  All rights reserved.  The Berkeley software License Agreement
! **  specifies the terms and conditions for redistribution.
! */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)conf.c	5.14.6 (2.11BSD GTE) 1997/10/2";
! #endif
  
! #include <pwd.h>
! #include <sys/ioctl.h>
! #include "sendmail.h"
  
  /*
  **  CONF.C -- Sendmail Configuration Tables.
***************
*** 102,111 ****
  **  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 */
  
  
  
--- 93,102 ----
  **  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 */
  
  
  
***************
*** 199,207 ****
  username()
  {
  	static char *myname = NULL;
- 	extern char *getlogin();
  	register struct passwd *pw;
- 	extern struct passwd *getpwuid();
  
  	/* cache the result */
  	if (myname == NULL)
--- 190,196 ----
***************
*** 212,218 ****
  
  			pw = getpwuid(getruid());
  			if (pw != NULL)
! 				myname = pw->pw_name;
  		}
  		else
  		{
--- 201,207 ----
  
  			pw = getpwuid(getruid());
  			if (pw != NULL)
! 				myname = newstr(pw->pw_name);
  		}
  		else
  		{
***************
*** 222,228 ****
  			{
  				pw = getpwuid(getuid());
  				if (pw != NULL)
! 					myname = pw->pw_name;
  			}
  		}
  		if (myname == NULL || myname[0] == '\0')
--- 211,217 ----
  			{
  				pw = getpwuid(getuid());
  				if (pw != NULL)
! 					myname = newstr(pw->pw_name);
  			}
  		}
  		if (myname == NULL || myname[0] == '\0')
***************
*** 265,272 ****
  {
  	struct stat stbuf;
  	register char *pathn;
- 	extern char *ttyname();
- 	extern char *getlogin();
  
  	/* compute the pathname of the controlling tty */
  	if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL &&
--- 254,259 ----
***************
*** 338,377 ****
  	}
  # 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
--- 325,330 ----
*** /usr/src/usr.sbin/sendmail.MX/src/sendmail.h.old	Wed Sep 14 21:28:38 1988
--- /usr/src/usr.sbin/sendmail.MX/src/sendmail.h	Fri Oct  3 10:05:34 1997
***************
*** 1,30 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *	@(#)sendmail.h	5.11 (Berkeley) 3/13/88
!  *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
!  *
!  */
  
  /*
  **  SENDMAIL.H -- Global definitions for sendmail.
  */
  
  # ifdef _DEFINE
  # define EXTERN
  # if !defined(lint) && !defined(NOSCCS)
! static char SmailSccsId[] =	"@(#)sendmail.h	5.11		3/13/88";
  # endif lint
  # else  _DEFINE
  # define EXTERN extern
--- 1,25 ----
  /*
! **  Sendmail
! **  Copyright (c) 1983  Eric P. Allman
! **  Berkeley, California
! **
! **  Copyright (c) 1983 Regents of the University of California.
! **  All rights reserved.  The Berkeley software License Agreement
! **  specifies the terms and conditions for redistribution.
! **
! **	@(#)sendmail.h	5.8.3 (2.11BSD GTE) 1997/10/3
! */
  
  /*
  **  SENDMAIL.H -- Global definitions for sendmail.
  */
  
+ 
+ 
  # ifdef _DEFINE
  # define EXTERN
  # if !defined(lint) && !defined(NOSCCS)
! static char SmailSccsId[] =	"@(#)sendmail.h	5.8.3		1997/10/3";
  # endif lint
  # else  _DEFINE
  # define EXTERN extern
***************
*** 35,40 ****
--- 30,40 ----
  # include <setjmp.h>
  # include "conf.h"
  # include "useful.h"
+ #include <errno.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <sys/time.h>
+ #include <unistd.h>
  
  # ifdef LOG
  # include <sys/syslog.h>
***************
*** 44,49 ****
--- 44,50 ----
  # ifdef VMUNIX
  # include <sys/socket.h>
  # include <netinet/in.h>
+ # include <arpa/inet.h>
  # endif VMUNIX
  # endif DAEMON
  
***************
*** 524,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 ADDRESS	NullAddress;	/* a null (template) address [main.c] */
  EXTERN char	SpaceSub;	/* substitution for <lwsp> */
  EXTERN int	WkClassFact;	/* multiplier for message class -> priority */
--- 525,535 ----
  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 */
***************
*** 579,581 ****
--- 584,588 ----
  extern char	*sfgets();
  extern char	*queuename();
  extern time_t	curtime();
+ extern bool	shouldqueue();
+ extern char	*denlstring();
*** /usr/src/usr.sbin/sendmail.MX/src/arpadate.c.old	Wed Sep 14 05:54:12 1988
--- /usr/src/usr.sbin/sendmail.MX/src/arpadate.c	Fri Oct  3 01:17:51 1997
***************
*** 1,37 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
   *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
   *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
   */
  
! #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)arpadate.c	5.8 (Berkeley) 4/1/88";
! #endif /* not lint */
  
! # include "conf.h"
! # ifdef USG
! # include <time.h>
! # else
! # include <sys/time.h>
! # include <sys/types.h>
! # include <sys/timeb.h>
! # endif USG
! # include "useful.h"
  
- # ifdef USG
- # define OLDTIME
- # endif USG
- 
  /*
  **  ARPADATE -- Create date in ARPANET format
  **
--- 1,43 ----
  /*
!  * 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.
   */
  
! #if	!defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)arpadate.c	8.1.2 (2.11BSD GTE) 1997/10/3";
! #endif
  
! #include "sendmail.h"
  
  /*
  **  ARPADATE -- Create date in ARPANET format
  **
***************
*** 60,84 ****
  
  char *
  arpadate(ud)
! 	register char *ud;
  {
  	register char *p;
  	register char *q;
  	static char b[40];
- 	extern char *ctime();
- 	register int i;
- 	extern struct tm *localtime();
- 	extern bool fconvert();
- # ifdef OLDTIME
- 	long t;
- 	extern long time();
- # else OLDTIME
- 	struct timeb t;
- 	extern struct timeb *ftime();
- # endif OLDTIME
- # ifdef USG
- 	extern char *tzname[2];
- # endif USG
  
  	/*
  	**  Get current time.
--- 66,81 ----
  
  char *
  arpadate(ud)
! 	char *ud;
  {
  	register char *p;
  	register char *q;
+ 	int off;
+ 	int i;
+ 	register struct tm *lt;
+ 	time_t t;
+ 	struct tm gmt;
  	static char b[40];
  
  	/*
  	**  Get current time.
***************
*** 86,100 ****
  	**	to resolve the timezone.
  	*/
  
- # ifdef OLDTIME
  	(void) time(&t);
  	if (ud == NULL)
  		ud = ctime(&t);
- # else
- 	ftime(&t);
- 	if (ud == NULL)
- 		ud = ctime(&t.time);
- # endif OLDTIME
  
  	/*
  	**  Crack the UNIX date line in a singularly unoriginal way.
--- 83,91 ----
***************
*** 123,131 ****
  	*q++ = *p++;
  	*q++ = ' ';
  
! 	p = &ud[22];		/* 79 */
  	*q++ = *p++;
  	*q++ = *p++;
  	*q++ = ' ';
  
  	p = &ud[11];		/* 01:03:52 */
--- 114,124 ----
  	*q++ = *p++;
  	*q++ = ' ';
  
! 	p = &ud[20];		/* 1979 */
  	*q++ = *p++;
  	*q++ = *p++;
+ 	*q++ = *p++;
+ 	*q++ = *p++;
  	*q++ = ' ';
  
  	p = &ud[11];		/* 01:03:52 */
***************
*** 132,227 ****
  	for (i = 8; i > 0; i--)
  		*q++ = *p++;
  
! 				/* -PST or -PDT */
! # ifdef USG
! 	if (localtime(&t)->tm_isdst)
! 		p = tzname[1];
! 	else
! 		p = tzname[0];
! # else
! 	p = localtime(&t.time)->tm_zone;
! # endif USG
! 	if ((strncmp(p, "GMT", 3) == 0 || strncmp(p, "gmt", 3) == 0) &&
! 	    p[3] != '\0')
! 	{
! 		/* hours from GMT */
! 		p += 3;
! 		*q++ = *p++;
! 		if (p[1] == ':')
! 			*q++ = '0';
! 		else
! 			*q++ = *p++;
! 		*q++ = *p++;
! 		p++;		/* skip ``:'' */
! 		*q++ = *p++;
! 		*q++ = *p++;
! 		*q = '\0';
! 	}
! 	else if (!fconvert(p, q))
! 	{
! 		*q++ = ' ';
! 		*q++ = *p++;
! 		*q++ = *p++;
! 		*q++ = *p++;
! 		*q = '\0';
! 	}
  
! 	return (b);
! }
! /*
! **  FCONVERT -- convert foreign timezones to ARPA timezones
! **
! **	This routine is essentially from Teus Hagen.
! **
! **	Parameters:
! **		a -- timezone as returned from UNIX.
! **		b -- place to put ARPA-style timezone.
! **
! **	Returns:
! **		TRUE -- if a conversion was made (and b was filled in).
! **		FALSE -- if this is not a recognized local time.
! **
! **	Side Effects:
! **		none.
! */
  
! /* UNIX to arpa conversion table */
! struct foreign
! {
! 	char *f_from; 
! 	char *f_to; 
! };
  
! static struct foreign	Foreign[] =
! {
! 	{ "EET",	"+0200" },	/* eastern europe */
! 	{ "MET",	"+0100" },	/* middle europe */
! 	{ "WET",	"GMT"   },	/* western europe */
! 	{ "EET DST",	"+0300" },	/* daylight saving times */
! 	{ "MET DST",	"+0200" },
! 	{ "WET DST",	"+0100" },
! 	{ NULL,		NULL	 }
! };
  
! bool
! fconvert(a, b)
! 	register char *a;
! 	register char *b;
! {
! 	register struct foreign *euptr;
! 	register char *p;
  
! 	for (euptr = Foreign; euptr->f_from != NULL; euptr++)
! 	{
! 		if (!strcasecmp(euptr->f_from, a))
! 		{
! 			p = euptr->f_to;
! 			*b++ = ' ';
! 			while (*p != '\0')
! 				*b++ = *p++;
! 			*b = '\0';
! 			return (TRUE);
! 		}
  	}
! 	return (FALSE);
  }
--- 125,173 ----
  	for (i = 8; i > 0; i--)
  		*q++ = *p++;
  
! 	/*
! 	 * should really get the timezone from the time in "ud" (which
! 	 * is only different if a non-null arg was passed which is different
! 	 * from the current time), but for all practical purposes, returning
! 	 * the current local zone will do (its all that is ever needed).
! 	 */
! 	gmt = *gmtime(&t);
! 	lt = localtime(&t);
  
! 	off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min;
  
! 	/* assume that offset isn't more than a day ... */
! 	if (lt->tm_year < gmt.tm_year)
! 		off -= 24 * 60;
! 	else if (lt->tm_year > gmt.tm_year)
! 		off += 24 * 60;
! 	else if (lt->tm_yday < gmt.tm_yday)
! 		off -= 24 * 60;
! 	else if (lt->tm_yday > gmt.tm_yday)
! 		off += 24 * 60;
  
! 	*q++ = ' ';
! 	if (off == 0) {
! 		*q++ = 'G';
! 		*q++ = 'M';
! 		*q++ = 'T';
! 	} else {
! 		if (off < 0) {
! 			off = -off;
! 			*q++ = '-';
! 		} else
! 			*q++ = '+';
  
! 		if (off >= 24*60)		/* should be impossible */
! 			off = 23*60+59;		/* if not, insert silly value */
  
! 		*q++ = (off / 600) + '0';
! 		*q++ = (off / 60) % 10 + '0';
! 		off %= 60;
! 		*q++ = (off / 10) + '0';
! 		*q++ = (off % 10) + '0';
  	}
! 	*q = '\0';
! 
! 	return (b);
  }
*** /usr/src/usr.sbin/sendmail.MX/src/clock.c.old	Wed Sep 14 05:56:09 1988
--- /usr/src/usr.sbin/sendmail.MX/src/clock.c	Fri Oct  3 01:14:28 1997
***************
*** 1,22 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
!  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)clock.c	5.5 (Berkeley) 3/13/88";
! #endif /* not lint */
  
  # include "sendmail.h"
  # include <signal.h>
--- 1,16 ----
  /*
! **  Sendmail
! **  Copyright (c) 1983  Eric P. Allman
! **  Berkeley, California
! **
! **  Copyright (c) 1983 Regents of the University of California.
! **  All rights reserved.  The Berkeley software License Agreement
! **  specifies the terms and conditions for redistribution.
! */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)clock.c	5.4.2 (2.11BSD) 1997/10/3";
! #endif
  
  # include "sendmail.h"
  # include <signal.h>
***************
*** 221,226 ****
--- 215,221 ----
  
  static bool	SleepDone;
  
+ unsigned int
  sleep(intvl)
  	unsigned int intvl;
  {
***************
*** 234,240 ****
  		pause();
  }
  
- static
  endsleep()
  {
  	SleepDone = TRUE;
--- 229,234 ----
*** /usr/src/usr.sbin/sendmail.MX/src/util.c.old	Wed Sep 14 06:34:39 1988
--- /usr/src/usr.sbin/sendmail.MX/src/util.c	Fri Oct  3 01:06:51 1997
***************
*** 9,22 ****
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.9 (Berkeley) 12/17/86";
! #endif not lint
  
  # include <stdio.h>
  # include <sys/types.h>
  # include <sys/stat.h>
  # include <sysexits.h>
! # include <errno.h>
  # include "sendmail.h"
  
  /*
--- 9,22 ----
  */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)util.c	5.8.3 (2.11BSD GTE) 1997/10/3";
! #endif
  
  # include <stdio.h>
  # include <sys/types.h>
  # include <sys/stat.h>
  # include <sysexits.h>
! # include <ctype.h>
  # include "sendmail.h"
  
  /*
***************
*** 142,150 ****
  	register int sz;
  {
  	register char *p;
- 	extern char *malloc();
  
! 	p = malloc((unsigned) sz);
  	if (p == NULL)
  	{
  		syserr("Out of memory!!");
--- 142,149 ----
  	register int sz;
  {
  	register char *p;
  
! 	p = (char *)malloc((unsigned) sz);
  	if (p == NULL)
  	{
  		syserr("Out of memory!!");
***************
*** 613,619 ****
  {
  	register EVENT *ev = NULL;
  	register char *p;
! 	extern readtimeout();
  
  	/* set the timeout */
  	if (ReadTimeout != 0)
--- 612,618 ----
  {
  	register EVENT *ev = NULL;
  	register char *p;
! 	int readtimeout();
  
  	/* set the timeout */
  	if (ReadTimeout != 0)
***************
*** 653,659 ****
  	return (buf);
  }
  
- static
  readtimeout()
  {
  	longjmp(CtxReadTimeout, 1);
--- 652,657 ----
***************
*** 678,685 ****
  char *
  fgetfolded(buf, n, f)
  	char *buf;
! 	register int n;
! 	FILE *f;
  {
  	register char *p = buf;
  	register int i;
--- 676,683 ----
  char *
  fgetfolded(buf, n, f)
  	char *buf;
! 	int n;
! 	register FILE *f;
  {
  	register char *p = buf;
  	register int i;
***************
*** 800,806 ****
  	int pid;
  {
  	auto int st;
! 	int i;
  
  	do
  	{
--- 798,804 ----
  	int pid;
  {
  	auto int st;
! 	register int i;
  
  	do
  	{
***************
*** 830,836 ****
  	BITMAP a;
  	BITMAP b;
  {
! 	int i;
  
  	for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
  		if ((a[i] & b[i]) != 0)
--- 828,834 ----
  	BITMAP a;
  	BITMAP b;
  {
! 	register int i;
  
  	for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
  		if ((a[i] & b[i]) != 0)
***************
*** 855,864 ****
  bitzerop(map)
  	BITMAP map;
  {
! 	int i;
  
  	for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
  		if (map[i] != 0)
  			return (FALSE);
  	return (TRUE);
  }
--- 853,948 ----
  bitzerop(map)
  	BITMAP map;
  {
! 	register int i;
  
  	for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
  		if (map[i] != 0)
  			return (FALSE);
  	return (TRUE);
+ }
+ /*
+ **  CLEANSTRCPY -- copy string keeping out bogus characters
+ **
+ **	Parameters:
+ **		t -- "to" string.
+ **		f -- "from" string.
+ **		l -- length of space available in "to" string.
+ **
+ **	Returns:
+ **		none.
+ */
+ 
+ void
+ cleanstrcpy(t, f, l)
+ 	register char *t;
+ 	register char *f;
+ 	int l;
+ {
+ #ifdef LOG
+ 	/* check for newlines and log if necessary */
+ 	(void) denlstring(f);
+ #endif
+ 
+ 	l--;
+ 	while (l > 0 && *f != '\0')
+ 	{
+ 		if (isascii(*f) &&
+ 		    (isalnum(*f) || strchr("!#$%&'*+-./^_`{|}~", *f) != NULL))
+ 		{
+ 			l--;
+ 			*t++ = *f;
+ 		}
+ 		f++;
+ 	}
+ 	*t = '\0';
+ }
+ /*
+ **  DENLSTRING -- convert newlines in a string to spaces
+ **
+ **	Parameters:
+ **		s -- the input string
+ **
+ **	Returns:
+ **		A pointer to a version of the string with newlines
+ **		mapped to spaces.  This should be copied.
+ */
+ 
+ char *
+ denlstring(s)
+ 	char *s;
+ {
+ 	register char *p;
+ 	int l;
+ 	static char *bp = NULL;
+ 	static int bl = 0;
+ 	extern	char	*macvalue();
+ 
+ 	if (strchr(s, '\n') == NULL)
+ 		return s;
+ 
+ 	l = strlen(s) + 1;
+ 	if (bl < l)
+ 	{
+ 		/* allocate more space */
+ 		if (bp != NULL)
+ 			free(bp);
+ 		bp = xalloc(l);
+ 		bl = l;
+ 	}
+ 	strcpy(bp, s);
+ 	for (p = bp; (p = strchr(p, '\n')) != NULL; )
+ 		*p++ = ' ';
+ 
+ #ifdef LOG
+ 	/*
+ 	 * V5 doesn't have IDENT capabilities so there is no macro '_'.
+ 	 * Instead we use the less "trusted" (but better than nothing) 'f'
+ 	 * macro value.
+ 	*/
+ 	p = macvalue('f', CurEnv);
+ 	syslog(LOG_ALERT, "POSSIBLE ATTACK from %s: newline in string \"%s\"",
+ 		p == NULL ? "[UNKNOWN]" : p, bp);
+ #endif
+ 
+ 	return bp;
  }
*** /usr/src/usr.sbin/sendmail.MX/src/conf.h.old	Sat Jan  1 01:11:35 1994
--- /usr/src/usr.sbin/sendmail.MX/src/conf.h	Fri Oct  3 10:16:40 1997
***************
*** 1,26 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *	@(#)conf.h	5.10.1 (2.11BSD) 1/1/94
!  *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
!  *
!  */
  
  /*
  **  CONF.H -- All user-configurable parameters for sendmail
  */
  
  /*
  **  Table sizes, etc....
  **	There shouldn't be much need to change these....
--- 1,20 ----
  /*
! **  Sendmail
! **  Copyright (c) 1983  Eric P. Allman
! **  Berkeley, California
! **
! **  Copyright (c) 1983 Regents of the University of California.
! **  All rights reserved.  The Berkeley software License Agreement
! **  specifies the terms and conditions for redistribution.
! **
! **	@(#)conf.h	5.7.1 (2.11BSD GTE) 1/1/94
! */
  
  /*
  **  CONF.H -- All user-configurable parameters for sendmail
  */
  
+ 
  /*
  **  Table sizes, etc....
  **	There shouldn't be much need to change these....
***************
*** 29,47 ****
  #ifdef pdp11
  # define MAXLINE	256		/* max line length */
  # define MAXNAME	128		/* max length of a name */
! # define MAXFIELD	640		/* max total length of a hdr field */
  # define MAXPV		30		/* max # of parms to mailers */
  # define MAXHOP		17		/* max value of HopCount */
! # define MAXATOM	40		/* max atoms per address */
! # define MAXMAILERS	12		/* maximum mailers known to system */
  # define MAXRWSETS	30		/* max # of sets of rewriting rules */
  # define MAXPRIORITIES	25		/* max values for Precedence: field */
  # define MAXTRUST	10		/* maximum number of trusted users */
! # define MAXUSERENVIRON	40		/* max # of items in user environ */
! # define QUEUESIZE	70		/* max # of jobs per queue run */
  # define MAXMXHOSTS	10		/* max # of MX records */
  
! #else !pdp11
  
  # define MAXLINE	1024		/* max line length */
  # define MAXNAME	256		/* max length of a name */
--- 23,41 ----
  #ifdef pdp11
  # define MAXLINE	256		/* max line length */
  # define MAXNAME	128		/* max length of a name */
! # define MAXFIELD	1024		/* max total length of a hdr field */
  # define MAXPV		30		/* max # of parms to mailers */
  # define MAXHOP		17		/* max value of HopCount */
! # define MAXATOM	70		/* max atoms per address */
! # define MAXMAILERS	10		/* maximum mailers known to system */
  # define MAXRWSETS	30		/* max # of sets of rewriting rules */
  # define MAXPRIORITIES	25		/* max values for Precedence: field */
  # define MAXTRUST	10		/* maximum number of trusted users */
! # define MAXUSERENVIRON	35		/* max # of items in user environ */
! # define QUEUESIZE	10		/* max # of jobs per queue run */
  # define MAXMXHOSTS	10		/* max # of MX records */
  
! #else
  
  # define MAXLINE	1024		/* max line length */
  # define MAXNAME	256		/* max length of a name */
***************
*** 72,76 ****
--- 66,71 ----
  # define QUEUE		1	/* enable queueing */
  # define UGLYUUCP	1	/* output ugly UUCP From lines */
  # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
+ # define FLOCK		1	/* use flock file locking */
  # define SETPROCTITLE	1	/* munge argv to display current status */
  /* # define WIZ		1	/* allow wizard mode */
*** /usr/src/usr.sbin/sendmail.MX/src/daemon.c.old	Fri Dec 31 23:08:24 1993
--- /usr/src/usr.sbin/sendmail.MX/src/daemon.c	Fri Oct  3 00:49:06 1997
***************
*** 1,39 ****
  /*
!  * Copyright (c) 1988 Regents of the University of California.
!  * All rights reserved.
!  *
!  * Redistribution and use in source and binary forms are permitted
!  * provided that this notice is preserved and that due credit is given
!  * to the University of California at Berkeley. The name of the University
!  * may not be used to endorse or promote products derived from this
!  * software without specific prior written permission. This software
!  * is provided ``as is'' without express or implied warranty.
!  *
!  *  Sendmail
!  *  Copyright (c) 1983  Eric P. Allman
!  *  Berkeley, California
!  */
  
- #include <errno.h>
- #include <sendmail.h>
  
  #if !defined(lint) && !defined(NOSCCS)
! #ifdef DAEMON
! static char sccsid[] = "@(#)daemon.c	5.25 (Berkeley) 4/1/88 (with daemon mode)";
! #else
! static char sccsid[] = "@(#)daemon.c	5.25 (Berkeley) 4/1/88 (without daemon mode)";
! #endif
! #endif /* not lint */
  
- #ifdef DAEMON
- 
  # include <netdb.h>
  # include <sys/signal.h>
  # include <sys/wait.h>
- # include <sys/time.h>
  # include <sys/resource.h>
- # include <arpa/inet.h>
  
  /*
  **  DAEMON.C -- routines to use when running as a daemon.
  **
--- 1,32 ----
  /*
! **  Sendmail
! **  Copyright (c) 1983  Eric P. Allman
! **  Berkeley, California
! **
! **  Copyright (c) 1983 Regents of the University of California.
! **  All rights reserved.  The Berkeley software License Agreement
! **  specifies the terms and conditions for redistribution.
! */
  
  
+ # include <errno.h>
+ # include "sendmail.h"
+ 
+ # ifndef DAEMON
  #if !defined(lint) && !defined(NOSCCS)
! static char	SccsId[] = "@(#)daemon.c 5.21 (2.11BSD) 1997/10/3 (w/o daemon mode)";
! # endif
! # else
  
  # include <netdb.h>
  # include <sys/signal.h>
  # include <sys/wait.h>
  # include <sys/resource.h>
  
+ #if !defined(lint) && !defined(NOSCCS)
+ static char	SccsId[] = "@(#)daemon.c 5.21 (2.11BSD) 1997/10/3 (with daemon mode)";
+ # endif
+ 
  /*
  **  DAEMON.C -- routines to use when running as a daemon.
  **
***************
*** 306,314 ****
  	FILE **outfile;
  	FILE **infile;
  {
! 	register int i, s;
! 	register struct hostent *hp = (struct hostent *)NULL;
! 	extern char *inet_ntoa();
  	int sav_errno;
  
  	/*
--- 299,305 ----
  	FILE **outfile;
  	FILE **infile;
  {
! 	register int s;
  	int sav_errno;
  
  	/*
***************
*** 339,345 ****
  	}
  	else
  	{
! 		hp = gethostbyname(host);
  		if (hp == NULL)
  		{
  			if (errno == ETIMEDOUT || h_errno == TRY_AGAIN)
--- 330,337 ----
  	}
  	else
  	{
! 		register struct hostent *hp = gethostbyname(host);
! 
  		if (hp == NULL)
  		{
  			if (errno == ETIMEDOUT || h_errno == TRY_AGAIN)
***************
*** 353,359 ****
  			return (EX_NOHOST);
  		}
  		bcopy(hp->h_addr, (char *) &SendmailAddress.sin_addr, hp->h_length);
- 		i = 1;
  	}
  
  	/*
--- 345,350 ----
***************
*** 378,388 ****
  	**  Try to actually open the connection.
  	*/
  
- again:
  # ifdef DEBUG
  	if (tTd(16, 1))
! 		printf("makeconnection (%s [%s])\n", host,
! 		    inet_ntoa(SendmailAddress.sin_addr.s_addr));
  # endif DEBUG
  
  	s = socket(AF_INET, SOCK_STREAM, 0);
--- 369,377 ----
  	**  Try to actually open the connection.
  	*/
  
  # ifdef DEBUG
  	if (tTd(16, 1))
! 		printf("makeconnection (%s)\n", host);
  # endif DEBUG
  
  	s = socket(AF_INET, SOCK_STREAM, 0);
***************
*** 411,423 ****
  	{
  		sav_errno = errno;
  		(void) close(s);
- 		if (hp && hp->h_addr_list[i])
- 		{
- 			bcopy(hp->h_addr_list[i++],
- 			    (char *)&SendmailAddress.sin_addr, hp->h_length);
- 			goto again;
- 		}
- 
  		/* failure, decide if temporary or not */
  	failure:
  		switch (sav_errno)
--- 400,405 ----
***************
*** 445,451 ****
  			return (EX_TEMPFAIL);
  
  		  default:
- 			message(Arpa_Info, "%s", errstring(sav_errno));
  			return (EX_UNAVAILABLE);
  		}
  	}
--- 427,432 ----
***************
*** 491,542 ****
  	else
  		return (NULL);
  }
  
- /*
-  *  MAPHOSTNAME -- turn a hostname into canonical form
-  *
-  *	Parameters:
-  *		hbuf -- a buffer containing a hostname.
-  *		hbsize -- the size of hbuf.
-  *
-  *	Returns:
-  *		none.
-  *
-  *	Side Effects:
-  *		Looks up the host specified in hbuf.  If it is not
-  *		the canonical name for that host, replace it with
-  *		the canonical name.  If the name is unknown, or it
-  *		is already the canonical name, leave it unchanged.
-  */
  maphostname(hbuf, hbsize)
  	char *hbuf;
  	int hbsize;
  {
  	register struct hostent *hp;
! 	u_long in_addr;
! 	char ptr[256];
! 	struct hostent *gethostbyaddr();
  
  	/*
! 	 * If first character is a bracket, then it is an address
! 	 * lookup.  Address is copied into a temporary buffer to
! 	 * strip the brackets and to preserve hbuf if address is
! 	 * unknown.
! 	 */
! 	if (*hbuf != '[') {
! 		getcanonname(hbuf, hbsize);
! 		return;
  	}
! 	*index(strcpy(ptr, hbuf), ']') = '\0';
! 	in_addr = inet_addr(&ptr[1]);
! 	hp = gethostbyaddr((char *)&in_addr, sizeof(struct in_addr), AF_INET);
! 	if (hp == NULL)
! 		return;
! 	if (strlen(hp->h_name) >= hbsize)
! 		hp->h_name[hbsize - 1] = '\0';
! 	(void)strcpy(hbuf, hp->h_name);
! }
  
  # else DAEMON
  /* code for systems without sophisticated networking */
  
--- 472,535 ----
  	else
  		return (NULL);
  }
+ /*
+ **  MAPHOSTNAME -- turn a hostname into canonical form
+ **
+ **	Parameters:
+ **		hbuf -- a buffer containing a hostname.
+ **		hbsize -- the size of hbuf.
+ **
+ **	Returns:
+ **		none.
+ **
+ **	Side Effects:
+ **		Looks up the host specified in hbuf.  If it is not
+ **		the canonical name for that host, replace it with
+ **		the canonical name.  If the name is unknown, or it
+ **		is already the canonical name, leave it unchanged.
+ */
  
  maphostname(hbuf, hbsize)
  	char *hbuf;
  	int hbsize;
  {
  	register struct hostent *hp;
! 	extern struct hostent *gethostbyname();
  
  	/*
! 	**  If first character is a bracket, then it is an address
! 	**  lookup.
! 	*/
! 
! 	if (*hbuf == '[')
! 	{
! 		extern struct hostent *gethostbyaddr();
! 		u_long in_addr;
! 		register char *bptr;
! 
! 		bptr = index(hbuf,']');
! 		*bptr = '\0';
! 		in_addr = inet_addr(&hbuf[1]);
! 		*bptr = ']';
! 		hp = gethostbyaddr((char *) &in_addr, sizeof(struct in_addr), AF_INET);
! 		if (hp == NULL)
! 			return;
  	}
! 	else
! 	{
! 		makelower(hbuf);
! 		hp = gethostbyname(hbuf);
! 	}
! 	if (hp != NULL)
! 	{
! 		int i = strlen(hp->h_name);
  
+ 		if (i >= hbsize)
+ 			hp->h_name[--i] = '\0';
+ 		(void) strcpy(hbuf, hp->h_name);
+ 	}
+ }
+ 
  # else DAEMON
  /* code for systems without sophisticated networking */
  
***************
*** 595,599 ****
  {
  	return;
  }
- 
  #endif DAEMON
--- 588,591 ----
*** /usr/src/usr.sbin/sendmail.MX/src/Makefile.old	Mon Sep 22 23:03:06 1997
--- /usr/src/usr.sbin/sendmail.MX/src/Makefile	Fri Oct  3 10:48:26 1997
***************
*** 44,57 ****
  	rm -f $*.s _xx.s
  
  sendmail: ${OBJS} Version.o
! 	-if [ X${SEPFLAG} = X ]; then \
! 		${CC} ${COPTS} -o $@ Version.o ${OBJS} -ldbm; \
! 	elif [ X${SEPFLAG} = X-i ]; then \
! 		cc ${SEPFLAG} ${COPTS} -o sendmail Version.o ${BASE} \
! 			-Z ${OVLY1} -Z ${OVLY2} -Z ${OVLY3} -Y -ldbm; \
! 	else \
! 		echo "Need an overlay scheme for non-separate I&D load"; \
! 	fi
  	size sendmail; ls -l sendmail; ${WHAT} < Version.o
  
  dsendmail: ${OBJS} Version.o
--- 44,51 ----
  	rm -f $*.s _xx.s
  
  sendmail: ${OBJS} Version.o
! 	cc ${SEPFLAG} ${COPTS} -o sendmail Version.o ${BASE} \
! 		-Z ${OVLY1} -Z ${OVLY2} -Z ${OVLY3} -Y -ldbm -lstubs; \
  	size sendmail; ls -l sendmail; ${WHAT} < Version.o
  
  dsendmail: ${OBJS} Version.o
***************
*** 113,278 ****
  alias.o: alias.c /usr/include/pwd.h /usr/include/sys/types.h
  alias.o: /usr/include/sys/stat.h /usr/include/signal.h /usr/include/errno.h
  alias.o: sendmail.h /usr/include/stdio.h /usr/include/ctype.h
! alias.o: /usr/include/setjmp.h conf.h ../include/useful.h
  alias.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! alias.o: /usr/include/short_names.h /usr/include/netinet/in.h
! alias.o: /usr/include/short_names.h /usr/include/sysexits.h
! alias.o: /usr/include/sys/file.h
! arpadate.o: arpadate.c conf.h /usr/include/sys/time.h /usr/include/time.h
! arpadate.o: /usr/include/sys/types.h /usr/include/sys/timeb.h
! arpadate.o: ../include/useful.h
  clock.o: clock.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  clock.o: /usr/include/setjmp.h conf.h ../include/useful.h
  clock.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! clock.o: /usr/include/sys/socket.h /usr/include/short_names.h
! clock.o: /usr/include/netinet/in.h /usr/include/short_names.h
! clock.o: /usr/include/sysexits.h /usr/include/signal.h
  collect.o: collect.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  collect.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! collect.o: ../include/useful.h /usr/include/sys/types.h
  collect.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! collect.o: /usr/include/short_names.h /usr/include/netinet/in.h
! collect.o: /usr/include/short_names.h /usr/include/sysexits.h
  conf.o: conf.c /usr/include/pwd.h /usr/include/sys/ioctl.h
  conf.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h sendmail.h
  conf.o: /usr/include/stdio.h /usr/include/ctype.h /usr/include/setjmp.h conf.h
! conf.o: ../include/useful.h /usr/include/sys/types.h /usr/include/sys/syslog.h
! conf.o: /usr/include/sys/socket.h /usr/include/short_names.h
! conf.o: /usr/include/netinet/in.h /usr/include/short_names.h
  conf.o: /usr/include/sysexits.h /usr/include/sys/stat.h /usr/include/sys/wait.h
  convtime.o: convtime.c /usr/include/ctype.h ../include/useful.h
  convtime.o: /usr/include/sys/types.h
  daemon.o: daemon.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  daemon.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h ../include/useful.h
! daemon.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! daemon.o: /usr/include/sys/socket.h /usr/include/short_names.h
! daemon.o: /usr/include/netinet/in.h /usr/include/short_names.h
  daemon.o: /usr/include/sysexits.h /usr/include/netdb.h
! daemon.o: /usr/include/short_names.h /usr/include/sys/signal.h
! daemon.o: /usr/include/sys/wait.h /usr/include/sys/time.h /usr/include/time.h
! daemon.o: /usr/include/sys/resource.h /usr/include/arpa/inet.h
! daemon.o: /usr/include/short_names.h
  deliver.o: deliver.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  deliver.o: /usr/include/setjmp.h conf.h ../include/useful.h
! deliver.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! deliver.o: /usr/include/sys/socket.h /usr/include/short_names.h
! deliver.o: /usr/include/netinet/in.h /usr/include/short_names.h
  deliver.o: /usr/include/sysexits.h /usr/include/sys/signal.h
  deliver.o: /usr/include/sys/stat.h /usr/include/sys/ioctl.h
  deliver.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
! deliver.o: /usr/include/netdb.h /usr/include/short_names.h /usr/include/errno.h
  deliver.o: /usr/include/arpa/nameser.h /usr/include/resolv.h
  domain.o: domain.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  domain.o: /usr/include/setjmp.h conf.h ../include/useful.h
! domain.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! domain.o: /usr/include/sys/socket.h /usr/include/short_names.h
! domain.o: /usr/include/netinet/in.h /usr/include/short_names.h
  domain.o: /usr/include/sysexits.h /usr/include/sys/param.h
! domain.o: /usr/include/sys/localopts.h /usr/include/machine/machparam.h
  domain.o: /usr/include/signal.h /usr/include/sys/types.h
  domain.o: /usr/include/arpa/nameser.h /usr/include/resolv.h
! domain.o: /usr/include/netdb.h /usr/include/short_names.h
  envelope.o: envelope.c /usr/include/pwd.h /usr/include/sys/time.h
! envelope.o: /usr/include/time.h sendmail.h /usr/include/stdio.h
! envelope.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! envelope.o: ../include/useful.h /usr/include/sys/types.h
  envelope.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! envelope.o: /usr/include/short_names.h /usr/include/netinet/in.h
! envelope.o: /usr/include/short_names.h /usr/include/sysexits.h
! envelope.o: /usr/include/sys/stat.h
  err.o: err.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  err.o: /usr/include/setjmp.h conf.h ../include/useful.h
  err.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! err.o: /usr/include/sys/socket.h /usr/include/short_names.h
! err.o: /usr/include/netinet/in.h /usr/include/short_names.h
! err.o: /usr/include/sysexits.h /usr/include/errno.h /usr/include/netdb.h
! err.o: /usr/include/short_names.h
  headers.o: headers.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  headers.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! headers.o: ../include/useful.h /usr/include/sys/types.h
  headers.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! headers.o: /usr/include/short_names.h /usr/include/netinet/in.h
! headers.o: /usr/include/short_names.h /usr/include/sysexits.h
  macro.o: macro.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  macro.o: /usr/include/setjmp.h conf.h ../include/useful.h
  macro.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! macro.o: /usr/include/sys/socket.h /usr/include/short_names.h
! macro.o: /usr/include/netinet/in.h /usr/include/short_names.h
! macro.o: /usr/include/sysexits.h
  main.o: main.c /usr/include/signal.h /usr/include/sgtty.h
  main.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  main.o: /usr/include/sys/ttydev.h sendmail.h /usr/include/stdio.h
  main.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h ../include/useful.h
  main.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! main.o: /usr/include/sys/socket.h /usr/include/short_names.h
! main.o: /usr/include/netinet/in.h /usr/include/short_names.h
! main.o: /usr/include/sysexits.h /usr/include/arpa/nameser.h
! main.o: /usr/include/resolv.h
  parseaddr.o: parseaddr.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  parseaddr.o: /usr/include/setjmp.h conf.h ../include/useful.h
  parseaddr.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! parseaddr.o: /usr/include/sys/socket.h /usr/include/short_names.h
! parseaddr.o: /usr/include/netinet/in.h /usr/include/short_names.h
! parseaddr.o: /usr/include/sysexits.h
  queue.o: queue.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  queue.o: /usr/include/setjmp.h conf.h ../include/useful.h
  queue.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! queue.o: /usr/include/sys/socket.h /usr/include/short_names.h
! queue.o: /usr/include/netinet/in.h /usr/include/short_names.h
! queue.o: /usr/include/sysexits.h /usr/include/sys/stat.h /usr/include/sys/dir.h
! queue.o: /usr/include/signal.h /usr/include/errno.h
  recipient.o: recipient.c /usr/include/pwd.h sendmail.h /usr/include/stdio.h
  recipient.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! recipient.o: ../include/useful.h /usr/include/sys/types.h
! recipient.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! recipient.o: /usr/include/short_names.h /usr/include/netinet/in.h
! recipient.o: /usr/include/short_names.h /usr/include/sysexits.h
  recipient.o: /usr/include/sys/stat.h
  savemail.o: savemail.c /usr/include/pwd.h sendmail.h /usr/include/stdio.h
  savemail.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! savemail.o: ../include/useful.h /usr/include/sys/types.h
! savemail.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! savemail.o: /usr/include/short_names.h /usr/include/netinet/in.h
! savemail.o: /usr/include/short_names.h /usr/include/sysexits.h
  srvrsmtp.o: srvrsmtp.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  srvrsmtp.o: /usr/include/setjmp.h conf.h ../include/useful.h
  srvrsmtp.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! srvrsmtp.o: /usr/include/sys/socket.h /usr/include/short_names.h
! srvrsmtp.o: /usr/include/netinet/in.h /usr/include/short_names.h
! srvrsmtp.o: /usr/include/sysexits.h /usr/include/errno.h /usr/include/signal.h
  stab.o: stab.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  stab.o: /usr/include/setjmp.h conf.h ../include/useful.h
  stab.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! stab.o: /usr/include/sys/socket.h /usr/include/short_names.h
! stab.o: /usr/include/netinet/in.h /usr/include/short_names.h
! stab.o: /usr/include/sysexits.h
  stats.o: stats.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  stats.o: /usr/include/setjmp.h conf.h ../include/useful.h
  stats.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! stats.o: /usr/include/sys/socket.h /usr/include/short_names.h
! stats.o: /usr/include/netinet/in.h /usr/include/short_names.h
! stats.o: /usr/include/sysexits.h mailstats.h
  sysexits.o: sysexits.c /usr/include/sysexits.h
  trace.o: trace.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  trace.o: /usr/include/setjmp.h conf.h ../include/useful.h
  trace.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! trace.o: /usr/include/sys/socket.h /usr/include/short_names.h
! trace.o: /usr/include/netinet/in.h /usr/include/short_names.h
! trace.o: /usr/include/sysexits.h
  usersmtp.o: usersmtp.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  usersmtp.o: /usr/include/setjmp.h conf.h ../include/useful.h
  usersmtp.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! usersmtp.o: /usr/include/sys/socket.h /usr/include/short_names.h
! usersmtp.o: /usr/include/netinet/in.h /usr/include/short_names.h
! usersmtp.o: /usr/include/sysexits.h /usr/include/sysexits.h
! usersmtp.o: /usr/include/errno.h
  util.o: util.c /usr/include/stdio.h /usr/include/sys/types.h
! util.o: /usr/include/sys/stat.h /usr/include/sysexits.h /usr/include/errno.h
  util.o: sendmail.h /usr/include/stdio.h /usr/include/ctype.h
! util.o: /usr/include/setjmp.h conf.h ../include/useful.h
  util.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! util.o: /usr/include/short_names.h /usr/include/netinet/in.h
! util.o: /usr/include/short_names.h /usr/include/sysexits.h
  Version.o: Version.c
  
  # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
--- 107,336 ----
  alias.o: alias.c /usr/include/pwd.h /usr/include/sys/types.h
  alias.o: /usr/include/sys/stat.h /usr/include/signal.h /usr/include/errno.h
  alias.o: sendmail.h /usr/include/stdio.h /usr/include/ctype.h
! alias.o: /usr/include/setjmp.h conf.h ../include/useful.h /usr/include/errno.h
! alias.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/sys/types.h
! alias.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! alias.o: /usr/include/unistd.h /usr/include/sys/types.h
  alias.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! alias.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
! alias.o: /usr/include/sysexits.h /usr/include/sys/file.h /usr/include/fcntl.h
! alias.o: /usr/include/sys/types.h
! arpadate.o: arpadate.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
! arpadate.o: /usr/include/setjmp.h conf.h ../include/useful.h
! arpadate.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
! arpadate.o: /usr/include/string.h /usr/include/sys/types.h
! arpadate.o: /usr/include/sys/time.h /usr/include/time.h
! arpadate.o: /usr/include/sys/types.h /usr/include/unistd.h
! arpadate.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! arpadate.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! arpadate.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  clock.o: clock.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  clock.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ clock.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ clock.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ clock.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  clock.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! clock.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! clock.o: /usr/include/arpa/inet.h /usr/include/sysexits.h /usr/include/signal.h
  collect.o: collect.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  collect.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! collect.o: ../include/useful.h /usr/include/sys/types.h /usr/include/errno.h
! collect.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/sys/types.h
! collect.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! collect.o: /usr/include/unistd.h /usr/include/sys/types.h
  collect.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! collect.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
! collect.o: /usr/include/sysexits.h
  conf.o: conf.c /usr/include/pwd.h /usr/include/sys/ioctl.h
  conf.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h sendmail.h
  conf.o: /usr/include/stdio.h /usr/include/ctype.h /usr/include/setjmp.h conf.h
! conf.o: ../include/useful.h /usr/include/sys/types.h /usr/include/errno.h
! conf.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/sys/types.h
! conf.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! conf.o: /usr/include/unistd.h /usr/include/sys/types.h
! conf.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! conf.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
  conf.o: /usr/include/sysexits.h /usr/include/sys/stat.h /usr/include/sys/wait.h
  convtime.o: convtime.c /usr/include/ctype.h ../include/useful.h
  convtime.o: /usr/include/sys/types.h
  daemon.o: daemon.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  daemon.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h ../include/useful.h
! daemon.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
! daemon.o: /usr/include/string.h /usr/include/sys/types.h
! daemon.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! daemon.o: /usr/include/unistd.h /usr/include/sys/types.h
! daemon.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! daemon.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
  daemon.o: /usr/include/sysexits.h /usr/include/netdb.h
! daemon.o: /usr/include/sys/signal.h /usr/include/sys/wait.h
! daemon.o: /usr/include/sys/resource.h
  deliver.o: deliver.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  deliver.o: /usr/include/setjmp.h conf.h ../include/useful.h
! deliver.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
! deliver.o: /usr/include/string.h /usr/include/sys/types.h
! deliver.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! deliver.o: /usr/include/unistd.h /usr/include/sys/types.h
! deliver.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! deliver.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
  deliver.o: /usr/include/sysexits.h /usr/include/sys/signal.h
  deliver.o: /usr/include/sys/stat.h /usr/include/sys/ioctl.h
  deliver.o: /usr/include/sys/ttychars.h /usr/include/sys/ttydev.h
! deliver.o: /usr/include/netdb.h /usr/include/errno.h
  deliver.o: /usr/include/arpa/nameser.h /usr/include/resolv.h
  domain.o: domain.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  domain.o: /usr/include/setjmp.h conf.h ../include/useful.h
! domain.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
! domain.o: /usr/include/string.h /usr/include/sys/types.h
! domain.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! domain.o: /usr/include/unistd.h /usr/include/sys/types.h
! domain.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! domain.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
  domain.o: /usr/include/sysexits.h /usr/include/sys/param.h
! domain.o: /usr/include/sys/localopts.h /usr/include/sys/stddef.h
! domain.o: /usr/include/machine/machparam.h /usr/include/sys/types.h
  domain.o: /usr/include/signal.h /usr/include/sys/types.h
  domain.o: /usr/include/arpa/nameser.h /usr/include/resolv.h
! domain.o: /usr/include/netdb.h
  envelope.o: envelope.c /usr/include/pwd.h /usr/include/sys/time.h
! envelope.o: /usr/include/time.h /usr/include/sys/types.h sendmail.h
! envelope.o: /usr/include/stdio.h /usr/include/ctype.h /usr/include/setjmp.h
! envelope.o: conf.h ../include/useful.h /usr/include/errno.h
! envelope.o: /usr/include/stdlib.h /usr/include/string.h
! envelope.o: /usr/include/sys/types.h /usr/include/sys/time.h
! envelope.o: /usr/include/unistd.h /usr/include/sys/types.h
  envelope.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! envelope.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
! envelope.o: /usr/include/sysexits.h /usr/include/sys/stat.h
  err.o: err.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  err.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ err.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ err.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ err.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  err.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! err.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! err.o: /usr/include/arpa/inet.h /usr/include/sysexits.h /usr/include/errno.h
! err.o: /usr/include/netdb.h
  headers.o: headers.c /usr/include/errno.h sendmail.h /usr/include/stdio.h
  headers.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! headers.o: ../include/useful.h /usr/include/sys/types.h /usr/include/errno.h
! headers.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/sys/types.h
! headers.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! headers.o: /usr/include/unistd.h /usr/include/sys/types.h
  headers.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! headers.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
! headers.o: /usr/include/sysexits.h
  macro.o: macro.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  macro.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ macro.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ macro.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ macro.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  macro.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! macro.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! macro.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  main.o: main.c /usr/include/signal.h /usr/include/sgtty.h
  main.o: /usr/include/sys/ioctl.h /usr/include/sys/ttychars.h
  main.o: /usr/include/sys/ttydev.h sendmail.h /usr/include/stdio.h
  main.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h ../include/useful.h
+ main.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ main.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ main.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  main.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! main.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! main.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
! main.o: /usr/include/arpa/nameser.h /usr/include/resolv.h
  parseaddr.o: parseaddr.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  parseaddr.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ parseaddr.o: /usr/include/sys/types.h /usr/include/errno.h
+ parseaddr.o: /usr/include/stdlib.h /usr/include/string.h
+ parseaddr.o: /usr/include/sys/types.h /usr/include/sys/time.h
+ parseaddr.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  parseaddr.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! parseaddr.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! parseaddr.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  queue.o: queue.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  queue.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ queue.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ queue.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ queue.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  queue.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! queue.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! queue.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
! queue.o: /usr/include/sys/stat.h /usr/include/sys/dir.h /usr/include/signal.h
! queue.o: /usr/include/errno.h
  recipient.o: recipient.c /usr/include/pwd.h sendmail.h /usr/include/stdio.h
  recipient.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! recipient.o: ../include/useful.h /usr/include/sys/types.h /usr/include/errno.h
! recipient.o: /usr/include/stdlib.h /usr/include/string.h
! recipient.o: /usr/include/sys/types.h /usr/include/sys/time.h
! recipient.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
! recipient.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! recipient.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! recipient.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  recipient.o: /usr/include/sys/stat.h
  savemail.o: savemail.c /usr/include/pwd.h sendmail.h /usr/include/stdio.h
  savemail.o: /usr/include/ctype.h /usr/include/setjmp.h conf.h
! savemail.o: ../include/useful.h /usr/include/sys/types.h /usr/include/errno.h
! savemail.o: /usr/include/stdlib.h /usr/include/string.h
! savemail.o: /usr/include/sys/types.h /usr/include/sys/time.h
! savemail.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
! savemail.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! savemail.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! savemail.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  srvrsmtp.o: srvrsmtp.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  srvrsmtp.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ srvrsmtp.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ srvrsmtp.o: /usr/include/string.h /usr/include/sys/types.h
+ srvrsmtp.o: /usr/include/sys/time.h /usr/include/time.h
+ srvrsmtp.o: /usr/include/sys/types.h /usr/include/unistd.h
  srvrsmtp.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! srvrsmtp.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! srvrsmtp.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
! srvrsmtp.o: /usr/include/errno.h /usr/include/signal.h
  stab.o: stab.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  stab.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ stab.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ stab.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ stab.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  stab.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! stab.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! stab.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  stats.o: stats.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  stats.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ stats.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ stats.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ stats.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  stats.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! stats.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! stats.o: /usr/include/arpa/inet.h /usr/include/sysexits.h mailstats.h
  sysexits.o: sysexits.c /usr/include/sysexits.h
  trace.o: trace.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  trace.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ trace.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ trace.o: /usr/include/string.h /usr/include/sys/types.h /usr/include/sys/time.h
+ trace.o: /usr/include/time.h /usr/include/sys/types.h /usr/include/unistd.h
  trace.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! trace.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! trace.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
  usersmtp.o: usersmtp.c sendmail.h /usr/include/stdio.h /usr/include/ctype.h
  usersmtp.o: /usr/include/setjmp.h conf.h ../include/useful.h
+ usersmtp.o: /usr/include/sys/types.h /usr/include/errno.h /usr/include/stdlib.h
+ usersmtp.o: /usr/include/string.h /usr/include/sys/types.h
+ usersmtp.o: /usr/include/sys/time.h /usr/include/time.h
+ usersmtp.o: /usr/include/sys/types.h /usr/include/unistd.h
  usersmtp.o: /usr/include/sys/types.h /usr/include/sys/syslog.h
! usersmtp.o: /usr/include/sys/socket.h /usr/include/netinet/in.h
! usersmtp.o: /usr/include/arpa/inet.h /usr/include/sysexits.h
! usersmtp.o: /usr/include/sysexits.h /usr/include/errno.h
  util.o: util.c /usr/include/stdio.h /usr/include/sys/types.h
! util.o: /usr/include/sys/stat.h /usr/include/sysexits.h /usr/include/ctype.h
  util.o: sendmail.h /usr/include/stdio.h /usr/include/ctype.h
! util.o: /usr/include/setjmp.h conf.h ../include/useful.h /usr/include/errno.h
! util.o: /usr/include/stdlib.h /usr/include/string.h /usr/include/sys/types.h
! util.o: /usr/include/sys/time.h /usr/include/time.h /usr/include/sys/types.h
! util.o: /usr/include/unistd.h /usr/include/sys/types.h
  util.o: /usr/include/sys/syslog.h /usr/include/sys/socket.h
! util.o: /usr/include/netinet/in.h /usr/include/arpa/inet.h
! util.o: /usr/include/sysexits.h
  Version.o: Version.c
  
  # IF YOU PUT ANYTHING HERE IT WILL GO AWAY
*** /usr/src/usr.sbin/sendmail.MX/src/main.c.old	Thu Oct 24 20:29:50 1996
--- /usr/src/usr.sbin/sendmail.MX/src/main.c	Fri Oct  3 10:24:45 1997
***************
*** 19,25 ****
  "@(#) Copyright (c) 1988 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)main.c	5.17.1 (2.11BSD) 1996/10/24";
  #endif
  
  #define	_DEFINE
--- 19,25 ----
  "@(#) Copyright (c) 1988 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)main.c	5.17.2 (2.11BSD) 1997/10/3";
  #endif
  
  #define	_DEFINE
***************
*** 99,105 ****
  	register char *p;
  	char **av;
  	extern int finis();
- 	extern char Version[];
  	char *from;
  	typedef int (*fnptr)();
  	STAB *st;
--- 99,104 ----
***************
*** 871,877 ****
  	union frz fhdr;
  	extern char edata, end;
  	extern char *sbrk();
- 	extern char Version[];
  
  	if (freezefile == NULL)
  		return;
--- 870,875 ----
***************
*** 923,929 ****
  	int f;
  	union frz fhdr;
  	extern char edata, end;
- 	extern char Version[];
  	extern caddr_t brk();
  
  	if (freezefile == NULL)
--- 921,926 ----
***************
*** 1032,1037 ****
--- 1029,1036 ----
  	(void) close(2);
  	while ((fd = dup(fileno(CurEnv->e_xfp))) < 2 && fd > 0)
  		continue;
+ 
+ 	XXctime();	/* XXX - close pipes to ctimed */
  
  #ifdef TIOCNOTTY
  	/* drop our controlling TTY completely if possible */
*** /usr/src/usr.sbin/sendmail.MX/src/srvrsmtp.c.old	Tue Nov  8 10:30:07 1988
--- /usr/src/usr.sbin/sendmail.MX/src/srvrsmtp.c	Fri Oct  3 10:31:50 1997
***************
*** 18,26 ****
  
  #if !defined(lint) && !defined(NOSCCS)
  #ifdef SMTP
! static char sccsid[] = "@(#)srvrsmtp.c	5.21 (Berkeley) 3/13/88 (with SMTP)";
  #else
! static char sccsid[] = "@(#)srvrsmtp.c	5.21 (Berkeley) 3/13/88 (without SMTP)";
  #endif
  #endif /* not lint */
  
--- 18,26 ----
  
  #if !defined(lint) && !defined(NOSCCS)
  #ifdef SMTP
! static char sccsid[] = "@(#)srvrsmtp.c	5.21.1 (2.11BSD) 1997/10/3 (with SMTP)";
  #else
! static char sccsid[] = "@(#)srvrsmtp.c	5.21 (2.11BSD) 1997/10/3 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 115,121 ****
  	char *sendinghost;
  	char inp[MAXLINE];
  	char cmdbuf[100];
- 	extern char Version[];
  	extern tick();
  	extern bool iswiz();
  	extern char *arpadate();
--- 115,120 ----
*** /usr/src/usr.sbin/sendmail.MX/src/err.c.old	Sat Mar 23 00:43:39 1996
--- /usr/src/usr.sbin/sendmail.MX/src/err.c	Fri Oct  3 10:42:35 1997
***************
*** 15,21 ****
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)err.c	5.8.2 (2.11BSD) 1996/3/23";
  #endif
  
  # include "sendmail.h"
--- 15,21 ----
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)err.c	5.8.3 (2.11BSD) 1997/10/3";
  #endif
  
  # include "sendmail.h"
***************
*** 53,60 ****
  {
  	register char *p;
  	int olderrno = errno;
- 	extern char Arpa_PSyserr[];
- 	extern char Arpa_TSyserr[];
  
  	/* format and output the error message */
  	if (olderrno == 0)
--- 53,58 ----
***************
*** 104,110 ****
  	char *fmt;
  {
  	extern char SuprErrs;
- 	extern char Arpa_Usrerr[];
  	extern int errno;
  
  	if (SuprErrs)
--- 102,107 ----
*** /usr/src/usr.sbin/sendmail.MX/src/envelope.c.old	Wed Sep 14 06:18:36 1988
--- /usr/src/usr.sbin/sendmail.MX/src/envelope.c	Fri Oct  3 10:47:46 1997
***************
*** 15,21 ****
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)envelope.c	5.14 (Berkeley) 4/1/88";
  #endif /* not lint */
  
  #include <pwd.h>
--- 15,21 ----
   */
  
  #if !defined(lint) && !defined(NOSCCS)
! static char sccsid[] = "@(#)envelope.c	5.14.1 (2.11BSD) 1997/10/3";
  #endif /* not lint */
  
  #include <pwd.h>
***************
*** 238,244 ****
  #endif TTYNAME
  	extern char *ttyname();
  	extern char *macvalue();
- 	extern char Version[];
  
  	/*
  	**  Give this envelope a reality.
--- 238,243 ----
*** /usr/src/usr.sbin/sendmail.MX/src/usersmtp.c.old	Wed Sep 14 06:34:04 1988
--- /usr/src/usr.sbin/sendmail.MX/src/usersmtp.c	Fri Oct  3 10:52:17 1997
***************
*** 18,26 ****
  
  #if !defined(lint) && !defined(NOSCCS)
  #ifdef SMTP
! static char sccsid[] = "@(#)usersmtp.c	5.9 (Berkeley) 3/13/88 (with SMTP)";
  #else
! static char sccsid[] = "@(#)usersmtp.c	5.9 (Berkeley) 3/13/88 (without SMTP)";
  #endif
  #endif /* not lint */
  
--- 18,26 ----
  
  #if !defined(lint) && !defined(NOSCCS)
  #ifdef SMTP
! static char sccsid[] = "@(#)usersmtp.c	5.9.1 (2.11BSD) 1997/10/3 (with SMTP)";
  #else
! static char sccsid[] = "@(#)usersmtp.c	5.9.1 (2.11BSD) 1997/10/3 (without SMTP)";
  #endif
  #endif /* not lint */
  
***************
*** 403,409 ****
  		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)
--- 403,408 ----
*** /usr/src/sbin/shutdown/shutdown.c.old	Wed Nov 27 21:19:45 1996
--- /usr/src/sbin/shutdown/shutdown.c	Fri Oct  3 11:03:35 1997
***************
*** 9,15 ****
  "@(#) Copyright (c) 1983,1986 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)shutdown.c	5.6.2 (2.11BSD GTE) 1996/11/16";
  #endif
  
  #include <stdio.h>
--- 9,15 ----
  "@(#) Copyright (c) 1983,1986 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)shutdown.c	5.6.3 (2.11BSD GTE) 1997/10/3";
  #endif
  
  #include <stdio.h>
***************
*** 19,24 ****
--- 19,27 ----
  #include <utmp.h>
  #include <pwd.h>
  #include <paths.h>
+ #include <string.h>
+ #include <stdlib.h>
+ #include <unistd.h>
  #include <sys/time.h>
  #include <sys/resource.h>
  #include <sys/param.h>
***************
*** 48,61 ****
  int	timeout();
  time_t	getsdt();
  
- extern	char *ctime();
- extern	struct tm *localtime();
- extern	long time();
- 
- extern	char *strcpy();
- extern	char *strncat();
- extern	off_t lseek();
- 
  struct	utmp utmp;
  int	sint;
  long	stogo;
--- 51,56 ----
***************
*** 97,103 ****
  	0 SECONDS,	0 SECONDS
  };
  
! char *shutter, *getlogin();
  
  main(argc,argv)
  	int argc;
--- 92,98 ----
  	0 SECONDS,	0 SECONDS
  };
  
! char *shutter;
  
  main(argc,argv)
  	int argc;
***************
*** 110,118 ****
  	int h, m;
  	int first;
  	FILE *termf;
! 	struct passwd *pw, *getpwuid();
! 	extern char *strcat();
! 	extern uid_t geteuid();
  
  	shutter = getlogin();
  	if (shutter == 0 && (pw = getpwuid(getuid())))
--- 105,111 ----
  	int h, m;
  	int first;
  	FILE *termf;
! 	struct passwd *pw;
  
  	shutter = getlogin();
  	if (shutter == 0 && (pw = getpwuid(getuid())))
***************
*** 374,380 ****
  
  doitfast()
  {
! 	FILE *fastd;
  
  	if ((fastd = fopen(fastboot, "w")) != NULL) {
  		putc('\n', fastd);
--- 367,373 ----
  
  doitfast()
  {
! 	register FILE *fastd;
  
  	if ((fastd = fopen(fastboot, "w")) != NULL) {
  		putc('\n', fastd);
***************
*** 385,391 ****
  nolog(sdt)
  	time_t sdt;
  {
! 	FILE *nologf;
  
  	(void) unlink(nologin);			/* in case linked to std file */
  	if ((nologf = fopen(nologin, "w")) != NULL) {
--- 378,384 ----
  nolog(sdt)
  	time_t sdt;
  {
! 	register FILE *nologf;
  
  	(void) unlink(nologin);			/* in case linked to std file */
  	if ((nologf = fopen(nologin, "w")) != NULL) {
*** /usr/src/sbin/reboot/reboot.c.old	Sun Feb 16 15:42:52 1997
--- /usr/src/sbin/reboot/reboot.c	Fri Oct  3 11:13:21 1997
***************
*** 9,15 ****
  "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)reboot.c	5.5.3 (2.11BSD) 1997/2/16";
  #endif
  
  /*
--- 9,15 ----
  "@(#) Copyright (c) 1980,1986 Regents of the University of California.\n\
   All rights reserved.\n";
  
! static char sccsid[] = "@(#)reboot.c	5.5.4 (2.11BSD) 1997/10/3";
  #endif
  
  /*
***************
*** 20,25 ****
--- 20,26 ----
  #include <errno.h>
  #include <pwd.h>
  #include <sysexits.h>
+ #include <unistd.h>
  #include <sys/syslog.h>
  #include <sys/file.h>
  #include <sys/reboot.h>
***************
*** 88,95 ****
  		howto &= ~RB_NOFSCK;
  	}
  	if (needlog) {
! 		char *user, *getlogin();
! 		struct passwd *pw, *getpwuid();
  
  		user = getlogin();
  		if (user == (char *)0 && (pw = getpwuid(getuid())))
--- 89,96 ----
  		howto &= ~RB_NOFSCK;
  	}
  	if (needlog) {
! 		char *user;
! 		struct passwd *pw;
  
  		user = getlogin();
  		if (user == (char *)0 && (pw = getpwuid(getuid())))
*** /VERSION.old	Wed Sep 24 19:57:13 1997
--- /VERSION	Tue Oct  7 19:56:21 1997
***************
*** 1,5 ****
! Current Patch Level: 389
! Date: September 24, 1997
  
  2.11 BSD
  ============
--- 1,5 ----
! Current Patch Level: 392
! Date: October 7, 1997
  
  2.11 BSD
  ============
