18449595gshapiro/*
2b649239gshapiro * Copyright (c) 1998-2011 Proofpoint, Inc. and its suppliers.
38449595gshapiro *	All rights reserved.
48449595gshapiro * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
58449595gshapiro * Copyright (c) 1988, 1993
68449595gshapiro *	The Regents of the University of California.  All rights reserved.
78449595gshapiro *
88449595gshapiro * By using this file, you agree to the terms and conditions set
98449595gshapiro * forth in the LICENSE file which can be found at the top level of
108449595gshapiro * the sendmail distribution.
118449595gshapiro *
128449595gshapiro *
13e978ee2gshapiro *	$Id: conf.h,v 1.147 2013-11-22 20:51:31 ca Exp $
148449595gshapiro */
158449595gshapiro
168449595gshapiro/*
178449595gshapiro**  CONF.H -- All user-configurable parameters for sendmail
188449595gshapiro**
1914e22b5gshapiro**	Send updates to Sendmail.ORG so they will be
2014e22b5gshapiro**	included in the next release; see
2114e22b5gshapiro**	http://www.sendmail.org/email-addresses.html
2214e22b5gshapiro**	for current e-mail address.
238449595gshapiro*/
248449595gshapiro
258449595gshapiro#ifndef SM_CONF_H
268449595gshapiro# define SM_CONF_H 1
278449595gshapiro
288449595gshapiro
298449595gshapiro# include <sm/config.h>
308449595gshapiro# include <sm/varargs.h>
318449595gshapiro
328449595gshapiro/*
338449595gshapiro**  General "standard C" defines.
348449595gshapiro**
358449595gshapiro**	These may be undone later, to cope with systems that claim to
368449595gshapiro**	be Standard C but aren't.  Gcc is the biggest offender -- it
378449595gshapiro**	doesn't realize that the library is part of the language.
388449595gshapiro**
398449595gshapiro**	Life would be much easier if we could get rid of this sort
408449595gshapiro**	of bozo problems.
418449595gshapiro*/
428449595gshapiro
438449595gshapiro# ifdef __STDC__
448449595gshapiro#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
458449595gshapiro# endif /* __STDC__ */
468449595gshapiro
478449595gshapiro/*
488449595gshapiro**  Assume you have standard calls; can be #undefed below if necessary.
498449595gshapiro*/
508449595gshapiro
518449595gshapiro# ifndef HASLSTAT
528449595gshapiro#  define HASLSTAT	1	/* has lstat(2) call */
538449595gshapiro# endif /* ! HASLSTAT */
548449595gshapiro
558449595gshapiro# ifndef HASNICE
568449595gshapiro#  define HASNICE	1	/* has nice(2) call */
578449595gshapiro# endif /* ! HASNICE */
588449595gshapiro
598449595gshapiro# ifndef HASRRESVPORT
608449595gshapiro#  define HASRRESVPORT	1	/* has rrsevport(3) call */
618449595gshapiro# endif /* ! HASRRESVPORT */
628449595gshapiro
638449595gshapiro/**********************************************************************
648449595gshapiro**  "Hard" compilation options.
658449595gshapiro**	#define these if they are available; comment them out otherwise.
668449595gshapiro**  These cannot be overridden from the Makefile, and should really not
678449595gshapiro**  be turned off unless absolutely necessary.
688449595gshapiro**********************************************************************/
698449595gshapiro
708449595gshapiro#define LOG		1	/* enable logging -- don't turn off */
718449595gshapiro
728449595gshapiro/**********************************************************************
738449595gshapiro**  Operating system configuration.
748449595gshapiro**
758449595gshapiro**	Unless you are porting to a new OS, you shouldn't have to
768449595gshapiro**	change these.
778449595gshapiro**********************************************************************/
788449595gshapiro
798449595gshapiro/*
808449595gshapiro**  HP-UX -- tested for 8.07, 9.00, and 9.01.
818449595gshapiro**
828449595gshapiro**	If V4FS is defined, compile for HP-UX 10.0.
838449595gshapiro**	11.x support from Richard Allen <ra@hp.is>.
848449595gshapiro*/
858449595gshapiro
868449595gshapiro# ifdef __hpux
878449595gshapiro		/* common definitions for HP-UX 9.x and 10.x */
888449595gshapiro#  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
898449595gshapiro#  define SYSTEM5	1	/* include all the System V defines */
908449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
918449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
928449595gshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
938449595gshapiro#  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
948449595gshapiro#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
958449595gshapiro#  define seteuid(e)	setresuid(-1, e, -1)
968449595gshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
978449595gshapiro#  define LA_TYPE	LA_HPUX
988449595gshapiro#  define SPT_TYPE	SPT_PSTAT
998449595gshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1008449595gshapiro#  define GIDSET_T	gid_t
1018449595gshapiro#  define LDA_USE_LOCKF	1
1028449595gshapiro#  ifndef HASGETUSERSHELL
1038449595gshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
1048449595gshapiro#  endif /* ! HASGETUSERSHELL */
1058449595gshapiro#  ifdef HPUX10
1068449595gshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
10796b960fgshapiro#   ifndef SMRSH_CMDDIR
10896b960fgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
10996b960fgshapiro#   endif /* ! SMRSH_CMDDIR */
1108449595gshapiro#  endif /* HPUX10 */
1118449595gshapiro#  ifdef HPUX11
1129e3bd35gshapiro#   define HASSETREUID	1	/* setreuid(2) works on HP-UX 11.x */
1138449595gshapiro#   define HASFCHOWN	1	/* has fchown(2) */
1148449595gshapiro#   ifndef BROKEN_RES_SEARCH
1158449595gshapiro#    define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
1168449595gshapiro#   endif /* ! BROKEN_RES_SEARCH */
11796b960fgshapiro#   ifndef SMRSH_CMDDIR
11896b960fgshapiro#    define SMRSH_CMDDIR	"/var/adm/sm.bin"
11996b960fgshapiro#   endif /* ! SMRSH_CMDDIR */
1208449595gshapiro#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
1218449595gshapiro#  else /* HPUX11 */
1228449595gshapiro#   ifndef NOT_SENDMAIL
1238449595gshapiro#    define syslog	hard_syslog
1248449595gshapiro#   endif /* ! NOT_SENDMAIL */
1258449595gshapiro#  endif /* HPUX11 */
1268449595gshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1278449595gshapiro
1288449595gshapiro#  ifdef V4FS
1298449595gshapiro		/* HP-UX 10.x */
1308449595gshapiro#   define _PATH_UNIX		"/stand/vmunix"
1318449595gshapiro#   ifndef _PATH_VENDOR_CF
1328449595gshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
1338449595gshapiro#   endif /* ! _PATH_VENDOR_CF */
1348449595gshapiro#   ifndef _PATH_SENDMAILPID
1358449595gshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
1368449595gshapiro#   endif /* ! _PATH_SENDMAILPID */
1378449595gshapiro#   ifndef IDENTPROTO
1388449595gshapiro#    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
1398449595gshapiro#   endif /* ! IDENTPROTO */
1408449595gshapiro#   include <sys/mpctl.h>	/* for mpctl() in get_num_procs_online() */
1418449595gshapiro#  else /* V4FS */
1428449595gshapiro		/* HP-UX 9.x */
1438449595gshapiro#   define _PATH_UNIX		"/hp-ux"
1448449595gshapiro#   ifndef _PATH_VENDOR_CF
1458449595gshapiro#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1468449595gshapiro#   endif /* ! _PATH_VENDOR_CF */
1478449595gshapiro#   ifndef IDENTPROTO
1488449595gshapiro#    define IDENTPROTO	0	/* TCP/IP implementation is broken */
1498449595gshapiro#   endif /* ! IDENTPROTO */
1508449595gshapiro#   ifdef __STDC__
1518449595gshapiroextern void	hard_syslog(int, char *, ...);
1528449595gshapiro#   else /* __STDC__ */
1538449595gshapiroextern void	hard_syslog();
1548449595gshapiro#   endif /* __STDC__ */
1558449595gshapiro#   define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
1568449595gshapiro#  endif /* V4FS */
1578449595gshapiro
1588449595gshapiro# endif /* __hpux */
1598449595gshapiro
1608449595gshapiro/*
1618449595gshapiro**  IBM AIX 5.x
1628449595gshapiro*/
1638449595gshapiro
1648449595gshapiro# ifdef _AIX5
16514e22b5gshapiro#  include <sys/signal.h>
16614e22b5gshapiro#  include <sys/wait.h>
1678449595gshapiro#  define _AIX4		40300
168125167cgshapiro#  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
169125167cgshapiro#  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
17096b960fgshapiro#  if _AIX5 >= 50200
17196b960fgshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
17296b960fgshapiro#  endif /* _AIX5 >= 50200 */
1738449595gshapiro# endif /* _AIX5 */
1748449595gshapiro
1758449595gshapiro/*
1768449595gshapiro**  IBM AIX 4.x
1778449595gshapiro*/
1788449595gshapiro
1798449595gshapiro# ifdef _AIX4
1808449595gshapiro#  define _AIX3		1	/* pull in AIX3 stuff */
1818449595gshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
1828449595gshapiro#  define USESETEUID	1	/* seteuid(2) works */
1838449595gshapiro#  define TZ_TYPE	TZ_NAME	/* use tzname[] vector */
184125167cgshapiro#  ifndef SOCKOPT_LEN_T
185125167cgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
186125167cgshapiro#  endif /* SOCKOPT_LEN_T */
1878449595gshapiro#  if _AIX4 >= 40200
1888449595gshapiro#   define HASSETREUID	1	/* setreuid(2) works as of AIX 4.2 */
189125167cgshapiro#   ifndef SOCKADDR_LEN_T
190125167cgshapiro#    define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
191125167cgshapiro#   endif /* SOCKADDR_LEN_T */
1928449595gshapiro#  endif /* _AIX4 >= 40200 */
1938449595gshapiro#  if defined(_ILS_MACROS)	/* IBM versions aren't side-effect clean */
1948449595gshapiro#   undef isascii
1958449595gshapiro#   define isascii(c)		!(c & ~0177)
1968449595gshapiro#   undef isdigit
1978449595gshapiro#   define isdigit(__a)		(_IS(__a,_ISDIGIT))
1988449595gshapiro#   undef isspace
1998449595gshapiro#   define isspace(__a)		(_IS(__a,_ISSPACE))
2008449595gshapiro#  endif /* defined(_ILS_MACROS) */
2018449595gshapiro# endif /* _AIX4 */
2028449595gshapiro
2038449595gshapiro
2048449595gshapiro/*
2058449595gshapiro**  IBM AIX 3.x -- actually tested for 3.2.3
2068449595gshapiro*/
2078449595gshapiro
2088449595gshapiro# ifdef _AIX3
2098449595gshapiro#  include <paths.h>
2108449595gshapiro#  include <sys/machine.h>	/* to get byte order */
2118449595gshapiro#  include <sys/select.h>
2128449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) */
2138449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
2148449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
2158449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2168449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
2178449595gshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
2188449595gshapiro#  define GIDSET_T	gid_t
2198449595gshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
2208449595gshapiro#  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
221125167cgshapiro#  ifndef LA_TYPE
222125167cgshapiro#   define LA_TYPE	LA_INT
223125167cgshapiro#  endif /* LA_TYPE */
2248449595gshapiro#  define FSHIFT	16
2258449595gshapiro#  define LA_AVENRUN	"avenrun"
2268449595gshapiro#  if !defined(_AIX4) || _AIX4 < 40300
2278449595gshapiro#   ifndef __BIT_TYPES_DEFINED__
2288449595gshapiro#    define SM_INT32	int
2298449595gshapiro#   endif /* __BIT_TYPES_DEFINED__ */
2308449595gshapiro#  endif /* !defined(_AIX4) || _AIX4 < 40300 */
2318449595gshapiro#  if !defined(_AIX4) || _AIX4 < 40200
2328449595gshapiro#   define SM_CONF_SYSLOG	0
2338449595gshapiro#  endif /* !defined(_AIX4) || _AIX4 < 40200 */
2348449595gshapiro# endif /* _AIX3 */
2358449595gshapiro
2368449595gshapiro
2378449595gshapiro/*
2388449595gshapiro**  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
2398449595gshapiro**
2408449595gshapiro**	From Mark Whetzel <markw@wg.waii.com>.
2418449595gshapiro*/
2428449595gshapiro
2438449595gshapiro# ifdef AIX			/* AIX/RT compiler pre-defines this */
2448449595gshapiro#  include <paths.h>
2458449595gshapiro#  include <sys/time.h>		/* AIX/RT resource.h does NOT include this */
2468449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
2478449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
2488449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2498449595gshapiro#  define HASFCHMOD	0	/* does not have fchmod(2) syscall */
2508449595gshapiro#  define HASSETREUID	1	/* use setreuid(2) -lbsd system call */
2518449595gshapiro#  define HASSETVBUF	1	/* use setvbuf(2) system call */
2528449595gshapiro#  define HASSETRLIMIT	0	/* does not have setrlimit call */
2538449595gshapiro#  define HASFLOCK	0	/* does not have flock call - use fcntl */
2548449595gshapiro#  define HASULIMIT	1	/* use ulimit instead of setrlimit call */
2558449595gshapiro#  define SM_CONF_GETOPT	0	/* Do we need theirs or ours */
2568449595gshapiro#  define SYS5SETPGRP	1	/* don't have setpgid on AIX/RT */
2578449595gshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
2588449595gshapiro#  define BSD4_3		1	/* NOT bsd 4.4 or posix signals */
2598449595gshapiro#  define GIDSET_T	int
2608449595gshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
2618449595gshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
2628449595gshapiro#  define LA_TYPE	LA_SUBR		/* use our ported loadavgd daemon */
2638449595gshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2648449595gshapiro#  define ARBPTR_T	int *
2658449595gshapiro#  define void		int
2668449595gshapirotypedef int		pid_t;
2678449595gshapiro/* RTisms for BSD compatibility, specified in the Makefile
2688449595gshapiro  define BSD		1
2698449595gshapiro  define BSD_INCLUDES		1
2708449595gshapiro  define BSD_REMAP_SIGNAL_TO_SIGVEC
2718449595gshapiro    RTisms needed above */
2728449595gshapiro/* make this sendmail in a completely different place */
2738449595gshapiro#  ifndef _PATH_VENDOR_CF
2748449595gshapiro#   define _PATH_VENDOR_CF	"/usr/local/newmail/sendmail.cf"
2758449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
2768449595gshapiro#  ifndef _PATH_SENDMAILPID
2778449595gshapiro#   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
2788449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
2798449595gshapiro# endif /* AIX */
2808449595gshapiro
2818449595gshapiro# if defined(_AIX)
2828449595gshapiro#  define LDA_USE_LOCKF		1
2838449595gshapiro#  define LDA_USE_SETEUID	1
2848449595gshapiro# endif /* defined(_AIX) */
2858449595gshapiro
2868449595gshapiro/*
2878449595gshapiro**  Silicon Graphics IRIX
2888449595gshapiro**
2898449595gshapiro**	Compiles on 4.0.1.
2908449595gshapiro**
2918449595gshapiro**	Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
2928449595gshapiro**	Use IRIX5 instead of IRIX for IRIX 5.x.
2938449595gshapiro**
2948449595gshapiro**	IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
2958449595gshapiro**	IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
2968449595gshapiro*/
2978449595gshapiro
2988449595gshapiro# ifdef IRIX
2998449595gshapiro#  define SYSTEM5	1	/* this is a System-V derived system */
3008449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
3018449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
3028449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
3038449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
3048449595gshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
3058449595gshapiro#  define setpgid	BSDsetpgrp
3068449595gshapiro#  define GIDSET_T	gid_t
3078449595gshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
3088449595gshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
3098449595gshapiro#  define SYSLOG_BUFSIZE 512
310842b56bgshapiro#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
311842b56bgshapiro    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
312842b56bgshapiro#   define _SC_NPROCESSORS_ONLN	_SC_NPROC_ONLN
313842b56bgshapiro#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
3148449595gshapiro#  ifdef IRIX6
3158449595gshapiro#   define STAT64	1
3168449595gshapiro#   define QUAD_T	unsigned long long
3178449595gshapiro#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
3188449595gshapiro#   define SAFENFSPATHCONF 0	/* pathconf(2) lies on NFS filesystems */
3198449595gshapiro#  else /* IRIX6 */
3208449595gshapiro#   define LA_TYPE	LA_INT
3218449595gshapiro
3228449595gshapiro#   ifdef IRIX64
3238449595gshapiro#    define STAT64	1
3248449595gshapiro#    define QUAD_T	unsigned long long
3258449595gshapiro#    define NAMELISTMASK	0x7fffffffffffffff	/* mask for nlist() values */
3268449595gshapiro#   else /* IRIX64 */
3278449595gshapiro#    define STAT64	0
3288449595gshapiro#    define NAMELISTMASK	0x7fffffff		/* mask for nlist() values */
3298449595gshapiro#   endif /* IRIX64 */
3308449595gshapiro#  endif /* IRIX6 */
3318449595gshapiro#  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
3328449595gshapiro#   include <sys/cdefs.h>
3338449595gshapiro#   include <paths.h>
3348449595gshapiro#   define ARGV_T	char *const *
3358449595gshapiro#   define HASFCHOWN	1	/* has fchown(2) */
3368449595gshapiro#   define HASSETRLIMIT	1	/* has setrlimit(2) syscall */
3378449595gshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
3388449595gshapiro#   define HASSTRERROR	1	/* has strerror(3) */
3398449595gshapiro#  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
3408449595gshapiro#   define ARGV_T	const char **
3418449595gshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
3428449595gshapiro#  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
3438449595gshapiro# endif /* IRIX */
3448449595gshapiro
3458449595gshapiro
3468449595gshapiro/*
3478449595gshapiro**  SunOS and Solaris
3488449595gshapiro**
3498449595gshapiro**	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
3508449595gshapiro**	Solaris 2.4 (a.k.a. SunOS 5.4).
3518449595gshapiro*/
3528449595gshapiro
3538449595gshapiro# if defined(sun) && !defined(BSD)
3548449595gshapiro
3558449595gshapiro#  include <sys/time.h>
3568449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
3578449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
3588449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
3598449595gshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
3608449595gshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
3618449595gshapiro#  ifndef HASFCHOWN
3628449595gshapiro#   define HASFCHOWN	1	/* fchown(2) */
3638449595gshapiro#  endif /* ! HASFCHOWN */
3648449595gshapiro
3658449595gshapiro#  ifdef __svr4__
3668449595gshapiro#   define LDA_USE_LOCKF		1
3678449595gshapiro#   define LDA_USE_SETEUID	1
3688449595gshapiro#   define _PATH_MAILDIR		"/var/mail"
3698449595gshapiro#  endif /* __svr4__ */
3708449595gshapiro
3718449595gshapiro#  ifdef SOLARIS_2_3
3728449595gshapiro#   define SOLARIS	20300	/* for back compat only -- use -DSOLARIS=20300 */
3738449595gshapiro#  endif /* SOLARIS_2_3 */
3748449595gshapiro
3758449595gshapiro#  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
3768449595gshapiro#   define SOLARIS	1	/* unknown Solaris version */
3778449595gshapiro#  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
3788449595gshapiro
3798449595gshapiro#  ifdef SOLARIS
3808449595gshapiro			/* Solaris 2.x (a.k.a. SunOS 5.x) */
3818449595gshapiro#   ifndef __svr4__
3828449595gshapiro#    define __svr4__		/* use all System V Release 4 defines below */
3838449595gshapiro#   endif /* ! __svr4__ */
384dd85ecegshapiro#   if SOLARIS >= 21100
385dd85ecegshapiro#    include <paths.h>
386dd85ecegshapiro#   endif /* SOLARIS >= 21100 */
387dd85ecegshapiro#   ifndef _PATH_VARRUN
388dd85ecegshapiro#    define _PATH_VARRUN	"/var/run/"
389dd85ecegshapiro#   endif /* _PATH_VARRUN */
3908449595gshapiro#   define GIDSET_T	gid_t
3918449595gshapiro#   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
3928449595gshapiro#   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
3938449595gshapiro#   define HASSTRERROR	1	/* has strerror(3) */
3948449595gshapiro#   ifndef _PATH_UNIX
3958449595gshapiro#    define _PATH_UNIX		"/dev/ksyms"
3968449595gshapiro#   endif /* ! _PATH_UNIX */
3978449595gshapiro#   ifndef _PATH_VENDOR_CF
3988449595gshapiro#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
3998449595gshapiro#   endif /* ! _PATH_VENDOR_CF */
4008449595gshapiro#   ifndef _PATH_SENDMAILPID
4018449595gshapiro#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
4028449595gshapiro#   endif /* ! _PATH_SENDMAILPID */
4038449595gshapiro#   ifndef _PATH_HOSTS
4048449595gshapiro#    define _PATH_HOSTS		"/etc/inet/hosts"
4058449595gshapiro#   endif /* ! _PATH_HOSTS */
4068449595gshapiro#   ifndef SYSLOG_BUFSIZE
4078449595gshapiro#    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
4088449595gshapiro#   endif /* ! SYSLOG_BUFSIZE */
4098449595gshapiro#   ifndef TZ_TYPE
4108449595gshapiro#    define TZ_TYPE	TZ_TZNAME
4118449595gshapiro#   endif /* ! TZ_TYPE */
4128449595gshapiro#   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
4138449595gshapiro#    define USESETEUID		1	/* seteuid works as of 2.3 */
4148449595gshapiro#    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
4158449595gshapiro#   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
4168449595gshapiro#   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
4178449595gshapiro#    define HASSETREUID	1		/* setreuid works as of 2.5 */
4188449595gshapiro#    define HASSETREGID	1	/* use setregid(2) to set saved gid */
419ef97707gshapiro#   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
420ef97707gshapiro#    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
421ef97707gshapiro#   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
4228449595gshapiro#    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
4238449595gshapiro#     ifndef LA_TYPE
4248449595gshapiro#      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
4258449595gshapiro#     endif /* ! LA_TYPE */
4268449595gshapiro#     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
4278449595gshapiro#      define RANDOMSHIFT	8
4288449595gshapiro#     endif /* ! RANDOMSHIFT */
4298449595gshapiro#    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
4308449595gshapiro#   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
4318449595gshapiro#    ifndef HASRANDOM
4328449595gshapiro#     define HASRANDOM	0		/* doesn't have random(3) */
4338449595gshapiro#    endif /* ! HASRANDOM */
4348449595gshapiro#   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
4358449595gshapiro#   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
4368449595gshapiro#    define SM_INT32	int	/* 32bit integer */
4378449595gshapiro#   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
4388449595gshapiro#   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
4398449595gshapiro#    ifndef LA_TYPE
4408449595gshapiro#     include <sys/loadavg.h>
4418449595gshapiro#     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
4428449595gshapiro#      include <sys/pset.h>
4438449595gshapiro#      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
4448449595gshapiro#     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
4458449595gshapiro#      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
4468449595gshapiro#     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
4478449595gshapiro#    endif /* ! LA_TYPE */
4488449595gshapiro#    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
4498449595gshapiro#   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
4508449595gshapiro#   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
4518449595gshapiro#    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
452dd85ecegshapiro#    define _PATH_SENDMAILPID	_PATH_VARRUN "sendmail.pid"
45396b960fgshapiro#    ifndef SMRSH_CMDDIR
45496b960fgshapiro#     define SMRSH_CMDDIR	"/var/adm/sm.bin"
45596b960fgshapiro#    endif /* ! SMRSH_CMDDIR */
4568449595gshapiro#    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
45714e22b5gshapiro#    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
4588449595gshapiro#   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
4598449595gshapiro#   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
4608449595gshapiro#    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
4611fc446agshapiro#    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
4621fc446agshapiro#    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
4638449595gshapiro#   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
464238623agshapiro#   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
465238623agshapiro#    define HASUNSETENV 1       /* unsetenv() added in S10 */
466238623agshapiro#   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
467a2b986fgshapiro#   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
468a2b986fgshapiro#    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
469a845449gshapiro#    define HAVE_NANOSLEEP	1	/* moved from librt to libc in S11 */
470dd85ecegshapiro#    define SOCKADDR_LEN_T	socklen_t	/* arg#3 to accept, getsockname */
471dd85ecegshapiro#    define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
472a2b986fgshapiro#   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
4738449595gshapiro#   ifndef HASGETUSERSHELL
4748449595gshapiro#    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
4758449595gshapiro#   endif /* ! HASGETUSERSHELL */
476fe7726fgshapiro#   if SOLARIS < 21200
477fe7726fgshapiro#    define SIGWAIT_TAKES_1_ARG	1	/* S12 moves to UNIX V7 semantic */
478fe7726fgshapiro#   endif /* SOLARIS < 21200 */
4798449595gshapiro
4808449595gshapiro#  else /* SOLARIS */
4818449595gshapiro			/* SunOS 4.0.3 or 4.1.x */
4828449595gshapiro#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
4838449595gshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
4848449595gshapiro#   ifndef HASFLOCK
4858449595gshapiro#    define HASFLOCK	1	/* has flock(2) call */
4868449595gshapiro#   endif /* ! HASFLOCK */
4878449595gshapiro#   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
4888449595gshapiro#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
4898449595gshapiro#   include <memory.h>
4908449595gshapiro#   include <vfork.h>
4918449595gshapiro#   ifdef __GNUC__
4928449595gshapiro#    define strtoul	strtol	/* gcc library bogosity */
4938449595gshapiro#   endif /* __GNUC__ */
4948449595gshapiro#   define memmove(d, s, l)	(bcopy((s), (d), (l)))
4958449595gshapiro#   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
4968449595gshapiro#   define SM_INT32	int	/* 32bit integer */
4978449595gshapiro#   define SM_ALIGN_SIZE (sizeof(long))
4988449595gshapiro#   define GIDSET_T	int
4998449595gshapiro#   define SM_CONF_SYSLOG	0
5008449595gshapiro
5018449595gshapiro#   ifdef SUNOS403
5028449595gshapiro			/* special tweaking for SunOS 4.0.3 */
5038449595gshapiro#    include <malloc.h>
5048449595gshapiro#    define BSD4_3	1	/* 4.3 BSD-based */
5058449595gshapiro#    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
5068449595gshapiro#    define WAITUNION	1	/* use "union wait" as wait argument type */
5078449595gshapiro#    undef WIFEXITED
5088449595gshapiro#    undef WEXITSTATUS
5098449595gshapiro#    undef HASUNAME
5108449595gshapiro#    define setpgid	setpgrp
5118449595gshapiro#    define MODE_T	int
5128449595gshapirotypedef int		pid_t;
5138449595gshapiroextern char		*getenv();
5148449595gshapiro
5158449595gshapiro#   else /* SUNOS403 */
5168449595gshapiro			/* 4.1.x specifics */
5171fc446agshapiro#    define HASSETSID	1	/* has POSIX setsid(2) call */
5188449595gshapiro#    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
5198449595gshapiro
5208449595gshapiro#   endif /* SUNOS403 */
5218449595gshapiro#  endif /* SOLARIS */
5228449595gshapiro
5238449595gshapiro#  ifndef LA_TYPE
5248449595gshapiro#   define LA_TYPE	LA_INT
5258449595gshapiro#  endif /* ! LA_TYPE */
5268449595gshapiro
5278449595gshapiro# endif /* defined(sun) && !defined(BSD) */
5288449595gshapiro
5298449595gshapiro/*
5308449595gshapiro**  DG/UX
5318449595gshapiro**
5328449595gshapiro**	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
5338449595gshapiro**	older support.
5348449595gshapiro**	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
5358449595gshapiro*/
5368449595gshapiro
5378449595gshapiro# ifdef DGUX_5_4_2
5388449595gshapiro#  define DGUX		1
5398449595gshapiro# endif /* DGUX_5_4_2 */
5408449595gshapiro
5418449595gshapiro# ifdef DGUX
5428449595gshapiro#  define SYSTEM5	1
5438449595gshapiro#  define LA_TYPE	LA_DGUX
5448449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
5458449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
5461fc446agshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
5478449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
5488449595gshapiro#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
5498449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
5508449595gshapiro#  ifndef IDENTPROTO
5518449595gshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
5528449595gshapiro#  endif /* ! IDENTPROTO */
5538449595gshapiro#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
5548449595gshapiro#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
5558449595gshapiro#  define LDA_USE_LOCKF		1
5568449595gshapiro
5578449595gshapiro/* these include files must be included early on DG/UX */
5588449595gshapiro#  include <netinet/in.h>
5598449595gshapiro#  include <arpa/inet.h>
5608449595gshapiro
5618449595gshapiro/* compiler doesn't understand const? */
5628449595gshapiro#  define const
5638449595gshapiro
5648449595gshapiro#  ifdef DGUX_5_4_2
5658449595gshapiro#   define inet_addr	dgux_inet_addr
5668449595gshapiroextern long	dgux_inet_addr();
5678449595gshapiro#  endif /* DGUX_5_4_2 */
5688449595gshapiro# endif /* DGUX */
5698449595gshapiro
5708449595gshapiro
5718449595gshapiro/*
5728449595gshapiro**  Digital Ultrix 4.2 - 4.5
5738449595gshapiro**
5748449595gshapiro**	Apparently, fcntl locking is broken on 4.2A, in that locks are
5758449595gshapiro**	not dropped when the process exits.  This causes major problems,
5768449595gshapiro**	so flock is the only alternative.
5778449595gshapiro*/
5788449595gshapiro
5798449595gshapiro# ifdef ultrix
5808449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
5818449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
5828449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
5838449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
5848449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
5858449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
5868449595gshapiro#  ifndef HASFLOCK
5878449595gshapiro#   define HASFLOCK	1	/* has flock(2) call */
5888449595gshapiro#  endif /* ! HASFLOCK */
5898449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
5908449595gshapiro#  ifndef BROKEN_RES_SEARCH
5918449595gshapiro#   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
5928449595gshapiro#  endif /* ! BROKEN_RES_SEARCH */
5938449595gshapiro#  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
5948449595gshapiro#   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
5958449595gshapiro#  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
5968449595gshapiro#  ifdef vax
5978449595gshapiro#   define LA_TYPE	LA_FLOAT
5988449595gshapiro#  else /* vax */
5998449595gshapiro#   define LA_TYPE	LA_INT
6008449595gshapiro#   define LA_AVENRUN	"avenrun"
6018449595gshapiro#  endif /* vax */
6028449595gshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
6038449595gshapiro#  ifndef IDENTPROTO
6048449595gshapiro#   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
6058449595gshapiro#  endif /* ! IDENTPROTO */
6068449595gshapiro#  define SYSLOG_BUFSIZE	256
6078449595gshapiro#  define SM_CONF_SYSLOG	0
6088449595gshapiro# endif /* ultrix */
6098449595gshapiro
6108449595gshapiro
6118449595gshapiro/*
6128449595gshapiro**  OSF/1 for KSR.
6138449595gshapiro**
6148449595gshapiro**	Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
6158449595gshapiro*/
6168449595gshapiro
6178449595gshapiro# ifdef __ksr__
6188449595gshapiro#  define __osf__	1	/* get OSF/1 defines below */
6198449595gshapiro#  ifndef TZ_TYPE
6208449595gshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
6218449595gshapiro#  endif /* ! TZ_TYPE */
6228449595gshapiro# endif /* __ksr__ */
6238449595gshapiro
6248449595gshapiro
6258449595gshapiro/*
6268449595gshapiro**  OSF/1 for Intel Paragon.
6278449595gshapiro**
6288449595gshapiro**	Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
6298449595gshapiro**	of Intel Scalable Systems Divison.
6308449595gshapiro*/
6318449595gshapiro
6328449595gshapiro# ifdef __PARAGON__
6338449595gshapiro#  define __osf__	1	/* get OSF/1 defines below */
6348449595gshapiro#  ifndef TZ_TYPE
6358449595gshapiro#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
6368449595gshapiro#  endif /* ! TZ_TYPE */
6378449595gshapiro#  define GIDSET_T	gid_t
6388449595gshapiro#  define MAXNAMLEN	NAME_MAX
6398449595gshapiro# endif /* __PARAGON__ */
6408449595gshapiro
6418449595gshapiro
6428449595gshapiro/*
6438449595gshapiro**  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
6448449595gshapiro**
6458449595gshapiro**	Tested for 3.2 and 4.0.
6468449595gshapiro*/
6478449595gshapiro
6488449595gshapiro# ifdef __osf__
6498449595gshapiro#  define HASUNAME	1	/* has uname(2) call */
6508449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
6518449595gshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
6528449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
6538449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
6548449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
6558449595gshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
6568449595gshapiro#  define IP_SRCROUTE	1	/* can check IP source routing */
6578449595gshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
6588449595gshapiro#  define GIDSET_T	gid_t
6598449595gshapiro#  define SM_INT32	int	/* 32bit integer */
6608449595gshapiro#  ifndef HASFLOCK
661faacdfbgshapiro#   include <standards.h>
662faacdfbgshapiro#   if _XOPEN_SOURCE+0 >= 400
663faacdfbgshapiro#    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
664faacdfbgshapiro#   else /* _XOPEN_SOURCE+0 >= 400 */
665faacdfbgshapiro#    define HASFLOCK	1	/* has flock(2) call */
666faacdfbgshapiro#   endif /* _XOPEN_SOURCE+0 >= 400 */
6678449595gshapiro#  endif /* ! HASFLOCK */
6688449595gshapiro#  define LA_TYPE	LA_ALPHAOSF
6698449595gshapiro#  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
6708449595gshapiro#  ifndef _PATH_VENDOR_CF
6718449595gshapiro#   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
6728449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
6738449595gshapiro#  ifndef _PATH_SENDMAILPID
6748449595gshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
6758449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
6769e3bd35gshapiro#  if _FFR_DIGUNIX_SAFECHOWN
6779e3bd35gshapiro/*
6789e3bd35gshapiro**  Testing on a Digital UNIX 4.0a system showed this to be the correct
6799e3bd35gshapiro**  setting but given the security consequences, more testing and
6809e3bd35gshapiro**  verification is needed.  Unfortunately, the man page offers no
6819e3bd35gshapiro**  assistance.
6829e3bd35gshapiro*/
6839e3bd35gshapiro#   define IS_SAFE_CHOWN >= 0
6849e3bd35gshapiro#  endif /* _FFR_DIGUNIX_SAFECHOWN */
6858449595gshapiro# endif /* __osf__ */
6868449595gshapiro
6878449595gshapiro
6888449595gshapiro/*
6898449595gshapiro**  NeXTstep
6908449595gshapiro*/
6918449595gshapiro
6928449595gshapiro# ifdef NeXT
6938449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
6948449595gshapiro#  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
6958449595gshapiro#  ifndef HASFLOCK
6968449595gshapiro#   define HASFLOCK	1	/* has flock(2) call */
6978449595gshapiro#  endif /* ! HASFLOCK */
6988449595gshapiro#  define UID_T		int	/* compiler gripes on uid_t */
6998449595gshapiro#  define GID_T		int	/* ditto for gid_t */
7008449595gshapiro#  define MODE_T	int	/* and mode_t */
7018449595gshapiro#  define setpgid	setpgrp
7028449595gshapiro#  ifndef NOT_SENDMAIL
7038449595gshapiro#   define sleep		sleepX
7048449595gshapiro#  endif /* ! NOT_SENDMAIL */
7058449595gshapiro#  ifndef LA_TYPE
7068449595gshapiro#   define LA_TYPE	LA_MACH
7078449595gshapiro#  endif /* ! LA_TYPE */
7088449595gshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
7098449595gshapiro#  ifdef _POSIX_SOURCE
7108449595gshapiroextern struct passwd	*getpwent();
7118449595gshapiro#  else /* _POSIX_SOURCE */
7128449595gshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
7138449595gshapiro#   define WAITUNION	1	/* use "union wait" as wait argument type */
7148449595gshapirotypedef int		pid_t;
7158449595gshapiro#   undef WEXITSTATUS
7168449595gshapiro#   undef WIFEXITED
7178449595gshapiro#   undef WIFSTOPPED
7188449595gshapiro#   undef WTERMSIG
7198449595gshapiro#  endif /* _POSIX_SOURCE */
7208449595gshapiro#  ifndef _PATH_VENDOR_CF
7218449595gshapiro#   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
7228449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
7238449595gshapiro#  ifndef _PATH_SENDMAILPID
7248449595gshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
7258449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
7268449595gshapiro#  define SM_INT32	int	/* 32bit integer */
7278449595gshapiro
7288449595gshapiro#  ifdef TCPWRAPPERS
7298449595gshapiro#   ifndef HASUNSETENV
7308449595gshapiro#    define HASUNSETENV	1
7318449595gshapiro#   endif /* ! HASUNSETENV */
7328449595gshapiro#   undef NEEDPUTENV
7338449595gshapiro#  endif /* TCPWRAPPERS */
7348449595gshapiro#  ifndef __APPLE__
7358449595gshapiro#   include <libc.h>
7368449595gshapiro#   ifndef S_IRUSR
7378449595gshapiro#    define S_IRUSR	S_IREAD
7388449595gshapiro#   endif /* ! S_IRUSR */
7398449595gshapiro#   ifndef S_IWUSR
7408449595gshapiro#    define S_IWUSR	S_IWRITE
7418449595gshapiro#   endif /* ! S_IWUSR */
7428449595gshapiro#   define _PATH_MAILDIR	"/usr/spool/mail"
7438449595gshapiro#  endif /* ! __APPLE__ */
7448449595gshapiro#  ifndef isascii
7458449595gshapiro#   define isascii(c)	((unsigned)(c) <= 0177)
7468449595gshapiro#  endif /* ! isascii */
7478449595gshapiro# endif /* NeXT */
7488449595gshapiro
7498449595gshapiro/*
7501fc446agshapiro**  Apple Darwin
751842b56bgshapiro**      Contributed by Wilfredo Sanchez <wsanchez@mit.edu>
7528449595gshapiro*/
7538449595gshapiro
7548449595gshapiro# if defined(DARWIN)
755842b56bgshapiro#  define HASFCHMOD		1	/* has fchmod(2) */
756842b56bgshapiro#  define HASFCHOWN		1	/* has fchown(2) */
757842b56bgshapiro#  define HASFLOCK		1	/* has flock(2) */
758842b56bgshapiro#  define HASUNAME		1	/* has uname(2) */
759842b56bgshapiro#  define HASUNSETENV		1	/* has unsetenv(3) */
760ef97707gshapiro#  define HASSETSID		1	/* has POSIX setsid(2) call */
761ef97707gshapiro#  define HASINITGROUPS		1	/* has initgroups(3) */
762842b56bgshapiro#  define HASSETVBUF		1	/* has setvbuf (3) */
763842b56bgshapiro#  define HASSETREUID		0	/* setreuid(2) unusable */
764842b56bgshapiro#  define HASSETEUID		1	/* has seteuid(2) */
765842b56bgshapiro#  define USESETEUID		1	/* has seteuid(2) */
766842b56bgshapiro#  define HASSETEGID		1	/* has setegid(2) */
767842b56bgshapiro#  define HASSETREGID		1	/* has setregid(2) */
768842b56bgshapiro#  define HASSETRESGID		0	/* no setresgid(2) */
769842b56bgshapiro#  define HASLSTAT		1	/* has lstat(2) */
770842b56bgshapiro#  define HASSETRLIMIT		1	/* has setrlimit(2) */
771842b56bgshapiro#  define HASWAITPID		1	/* has waitpid(2) */
772842b56bgshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
773842b56bgshapiro#  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
774ef97707gshapiro#  define HASURANDOMDEV		1	/* has urandom(4) */
775842b56bgshapiro#  define HASSTRERROR		1	/* has strerror(3) */
776842b56bgshapiro#  define HASGETUSERSHELL	1	/* had getusershell(3) */
777842b56bgshapiro#  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
778842b56bgshapiro#  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
779842b56bgshapiro#  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
780ef97707gshapiro#  if DARWIN >= 70000
781ef97707gshapiro#   define SOCKADDR_LEN_T	socklen_t
782ef97707gshapiro#  endif
783ef97707gshapiro#  if DARWIN >= 80000
784ef97707gshapiro#   define SPT_TYPE		SPT_REUSEARGV
785ef97707gshapiro#   define SPT_PADCHAR		'\0'
786ef97707gshapiro#   define SOCKOPT_LEN_T	socklen_t
787ef97707gshapiro#  else
788ef97707gshapiro#   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
789ef97707gshapiro#  endif
790842b56bgshapiro#  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
791842b56bgshapiro#  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
792842b56bgshapiro#  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
793842b56bgshapiro#  define HAS_IN_H		1
794842b56bgshapiro#  define NETLINK		1	/* supports AF_LINK */
7959e3bd35gshapiro#  ifndef NOT_SENDMAIL
796842b56bgshapiro#   define sleep sleepX
79739e311bgshapiroextern unsigned int sleepX __P((unsigned int seconds));
7989e3bd35gshapiro#  endif /* ! NOT_SENDMAIL */
7998449595gshapiro# endif /* defined(DARWIN) */
8008449595gshapiro
8018449595gshapiro
8028449595gshapiro/*
8038449595gshapiro**  4.4 BSD
8048449595gshapiro**
8058449595gshapiro**	See also BSD defines.
8068449595gshapiro*/
8078449595gshapiro
808ef97707gshapiro# if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
8098449595gshapiro#  include <paths.h>
8108449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
8118449595gshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
8128449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
8138449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
8148449595gshapiro#  define HASSTRERROR	1	/* has strerror(3) */
8158449595gshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
8168449595gshapiro#  include <sys/cdefs.h>
8178449595gshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
8188449595gshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
8198449595gshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
8208449595gshapiro#  define NETLINK	1	/* supports AF_LINK */
8218449595gshapiro#  ifndef LA_TYPE
8228449595gshapiro#   define LA_TYPE	LA_SUBR
8238449595gshapiro#  endif /* ! LA_TYPE */
8248449595gshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
8258449595gshapiro#  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
826ef97707gshapiro# endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
8278449595gshapiro
8288449595gshapiro
8298449595gshapiro/*
8308449595gshapiro**  BSD/OS (was BSD/386) (all versions)
8318449595gshapiro**	From Tony Sanders, BSDI
8328449595gshapiro*/
8338449595gshapiro
8348449595gshapiro# ifdef __bsdi__
8358449595gshapiro#  include <paths.h>
8368449595gshapiro#  define HASUNSETENV	1	/* has the unsetenv(3) call */
8378449595gshapiro#  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
8381fc446agshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
8398449595gshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
8408449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
8418449595gshapiro#  define HASSETLOGIN	1	/* has setlogin(2) */
8428449595gshapiro#  define HASUNAME	1	/* has uname(2) syscall */
8438449595gshapiro#  define HASSTRERROR	1	/* has strerror(3) */
8448449595gshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
8458449595gshapiro#  include <sys/cdefs.h>
8468449595gshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
8478449595gshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
8488449595gshapiro#  define NETLINK	1	/* supports AF_LINK */
8498449595gshapiro#  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
8508449595gshapiro#  ifndef LA_TYPE
8518449595gshapiro#   define LA_TYPE	LA_SUBR
8528449595gshapiro#  endif /* ! LA_TYPE */
8538449595gshapiro#  define GIDSET_T	gid_t
8548449595gshapiro#  define QUAD_T		quad_t
8558449595gshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
8568449595gshapiro			/* version 1.1 or later */
8578449595gshapiro#   undef SPT_TYPE
8588449595gshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
8598449595gshapiro#  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
8608449595gshapiro			/* version 1.0 or earlier */
8618449595gshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
8628449595gshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
8638449595gshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
8648449595gshapiro#   define HASSETUSERCONTEXT 1	/* has setusercontext */
8658449595gshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
8668449595gshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
8678449595gshapiro#   define MODE_T	int	/* va_arg() can't handle less than int */
8688449595gshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
8698449595gshapiro#  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
8708449595gshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
8718449595gshapiro#  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
8728449595gshapiro# endif /* __bsdi__ */
8738449595gshapiro
8748449595gshapiro
87514e22b5gshapiro# if defined(__QNX__)
87614e22b5gshapiro#  if defined(__QNXNTO__)
87714e22b5gshapiro/* QNX 6 */
87814e22b5gshapiro#   include <unix.h>
87914e22b5gshapiro#   define HASUNSETENV	1	/* has unsetenv(3) call */
88014e22b5gshapiro#   define HASINITGROUPS	1	/* has initgroups(3) call */
88114e22b5gshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
88214e22b5gshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
88314e22b5gshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
88414e22b5gshapiro#   define HASFCHOWN	1	/* has fchown(2) syscall */
88514e22b5gshapiro#   define HASUNAME	1	/* has uname(2) syscall */
88614e22b5gshapiro#   define HASSTRERROR	1	/* has strerror(3) */
88714e22b5gshapiro#   define BSD4_4_SOCKADDR	/* has sa_len */
88814e22b5gshapiro#   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
88914e22b5gshapiro#   define NETLINK	1	/* supports AF_LINK */
89014e22b5gshapiro#   define GIDSET_T	gid_t
89114e22b5gshapiro#   define QUAD_T	uint64_t
89214e22b5gshapiro#   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
89314e22b5gshapiro#   define HASGETUSERSHELL 0
89414e22b5gshapiro
89514e22b5gshapiro/*
89614e22b5gshapiro**  We have a strrev() that doesn't allocate anything.
89714e22b5gshapiro**  Make sure the one here is used.
89814e22b5gshapiro*/
89914e22b5gshapiro
90014e22b5gshapiro#   define strrev strrev_sendmail
90114e22b5gshapiro
90214e22b5gshapiro#  else /* defined(__QNXNTO__) */
90314e22b5gshapiro
9048449595gshapiro/*
9058449595gshapiro**  QNX 4.2x
9068449595gshapiro**	Contributed by Glen McCready <glen@qnx.com>.
9078449595gshapiro**
90814e22b5gshapiro**	Should work with all versions of QNX 4.
9098449595gshapiro*/
9108449595gshapiro
91114e22b5gshapiro#   include <unix.h>
91214e22b5gshapiro#   include <sys/select.h>
91314e22b5gshapiro#   undef NGROUPS_MAX
91414e22b5gshapiro#   define HASSETSID	1	/* has POSIX setsid(2) call */
91514e22b5gshapiro#   define USESETEUID	1	/* has usable seteuid(2) call */
91614e22b5gshapiro#   define HASFCHMOD	1	/* has fchmod(2) syscall */
91714e22b5gshapiro#   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
91814e22b5gshapiro#   define HASSETREUID	1	/* has setreuid(2) call */
91914e22b5gshapiro#   define HASSTRERROR	1	/* has strerror(3) */
92014e22b5gshapiro#   define HASFLOCK	0
92114e22b5gshapiro#   undef HASINITGROUPS		/* has initgroups(3) call */
92214e22b5gshapiro#   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
92314e22b5gshapiro#   define IP_SRCROUTE	1	/* can check IP source routing */
92414e22b5gshapiro#   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
92514e22b5gshapiro#   define GIDSET_T	gid_t
92614e22b5gshapiro#   define LA_TYPE	LA_ZERO
92714e22b5gshapiro#   define SFS_TYPE	SFS_NONE
92814e22b5gshapiro#   define SPT_TYPE	SPT_REUSEARGV
92914e22b5gshapiro#   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
93014e22b5gshapiro#   define HASGETUSERSHELL 0
93114e22b5gshapiro#   define _FILE_H_INCLUDED
93214e22b5gshapiro#  endif /* defined(__QNXNTO__) */
9338449595gshapiro# endif /* defined(__QNX__) */
9348449595gshapiro
9358449595gshapiro
9368449595gshapiro/*
9379883351gshapiro**  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
9388449595gshapiro**
9398449595gshapiro**  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
9408449595gshapiro**  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
9418449595gshapiro**
9428449595gshapiro**	See also BSD defines.
9438449595gshapiro*/
9448449595gshapiro
9459883351gshapiro# if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
9468449595gshapiro#  include <paths.h>
9478449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
9481fc446agshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
9498449595gshapiro#  define USESETEUID	1	/* has usable seteuid(2) call */
9508449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) syscall */
9511fc446agshapiro#  define HASFCHOWN	1	/* has fchown(2) syscall */
9528449595gshapiro#  define HASUNAME	1	/* has uname(2) syscall */
9538449595gshapiro#  define HASSTRERROR	1	/* has strerror(3) */
9548449595gshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
9558449595gshapiro#  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
9568449595gshapiro#  include <sys/cdefs.h>
9578449595gshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
9588449595gshapiro#  define BSD4_4_SOCKADDR	/* has sa_len */
9598449595gshapiro#  define NETLINK	1	/* supports AF_LINK */
9608449595gshapiro#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
9618449595gshapiro#  define GIDSET_T	gid_t
962ef97707gshapiro#  define QUAD_T	unsigned long long
963ef97707gshapiro#  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
9648449595gshapiro#  ifndef LA_TYPE
9658449595gshapiro#   define LA_TYPE	LA_SUBR
9668449595gshapiro#  endif /* ! LA_TYPE */
967ef97707gshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
968ef97707gshapiro    ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
969ef97707gshapiro    (__NetBSD_Version__ >= 299000900))
9701fc446agshapiro#   undef SFS_TYPE
9711fc446agshapiro#   define SFS_TYPE	SFS_STATVFS
9721fc446agshapiro#  else
9731fc446agshapiro#   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
9741fc446agshapiro#  endif
9758449595gshapiro#  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
9768449595gshapiro#   undef SPT_TYPE
9778449595gshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
9788449595gshapiro#  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
9798449595gshapiro#  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
9808449595gshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
9818449595gshapiro#  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
9821fc446agshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
9831fc446agshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
9841fc446agshapiro#  endif
985ef97707gshapiro#  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
986ef97707gshapiro    ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
987ef97707gshapiro    (__NetBSD_Version__ >= 299000900))
9881fc446agshapiro#   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
9891fc446agshapiro#  endif
9901fc446agshapiro#  if defined(__NetBSD__)
9911fc446agshapiro#   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
9921fc446agshapiro#   include <sys/param.h>
9931fc446agshapiro#   include <sys/sysctl.h>
9941fc446agshapiro#  endif
9959883351gshapiro#  if defined(__DragonFly__)
9969883351gshapiro#   define HASSETLOGIN		1	/* has setlogin(2) */
9979883351gshapiro#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
9989883351gshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
9999883351gshapiro#   undef SPT_TYPE
10009883351gshapiro#   include <libutil.h>
10019883351gshapiro#   define SPT_TYPE		SPT_BUILTIN
10029883351gshapiro#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
10039883351gshapiro#   ifndef SMRSH_CMDDIR
10049883351gshapiro#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
10059883351gshapiro#   endif /* ! SMRSH_CMDDIR */
10069883351gshapiro#   ifndef SMRSH_PATH
10079883351gshapiro#    define SMRSH_PATH		"/bin:/usr/bin"
10089883351gshapiro#   endif /* ! SMRSH_PATH */
10099883351gshapiro#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
10109883351gshapiro#  include <sys/sysctl.h>
10119883351gshapiro#  endif /* defined(__DragonFly__) */
10128449595gshapiro#  if defined(__FreeBSD__)
10138449595gshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
10148449595gshapiro#   if __FreeBSD_version >= 227001
10158449595gshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
10168449595gshapiro#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
10178449595gshapiro#   endif /* __FreeBSD_version >= 227001 */
10188449595gshapiro#   undef SPT_TYPE
10198449595gshapiro#   if __FreeBSD__ >= 2
10208449595gshapiro#    include <osreldate.h>
10218449595gshapiro#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
10227f4494ebdrewery#      if __FreeBSD_version < 500012
10238449595gshapiro#     include <libutil.h>
10247f4494ebdrewery#      endif
10258449595gshapiro#     define SPT_TYPE	SPT_BUILTIN
10268449595gshapiro#    endif /* __FreeBSD_version >= 199512 */
10278449595gshapiro#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
10288449595gshapiro#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
10298449595gshapiro#    endif /* __FreeBSD_version >= 222000 */
1030dd85ecegshapiro#    if __FreeBSD_version >= 300000	/* 3.0.0-release and later */
1031dd85ecegshapiro#     define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1032dd85ecegshapiro#    endif /* __FreeBSD_version >= 300000 */
10338449595gshapiro#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
103496b960fgshapiro#     ifndef SMRSH_CMDDIR
103596b960fgshapiro#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
103696b960fgshapiro#     endif /* ! SMRSH_CMDDIR */
103796b960fgshapiro#     ifndef SMRSH_PATH
103896b960fgshapiro#      define SMRSH_PATH	"/bin:/usr/bin"
103996b960fgshapiro#     endif /* ! SMRSH_PATH */
10408449595gshapiro#    endif /* __FreeBSD_version >= 330000 */
1041a845449gshapiro#    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
1042a845449gshapiro#     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
1043a845449gshapiro#     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
1044a845449gshapiro#    endif /* __FreeBSD_version >= 430000 */
10458449595gshapiro#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
10468449595gshapiro#    include <sys/sysctl.h>
10478449595gshapiro#   endif /* __FreeBSD__ >= 2 */
10488449595gshapiro#   ifndef SPT_TYPE
10498449595gshapiro#    define SPT_TYPE	SPT_REUSEARGV
10508449595gshapiro#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
10518449595gshapiro#   endif /* ! SPT_TYPE */
10528449595gshapiro#  endif /* defined(__FreeBSD__) */
10538449595gshapiro#  if defined(__OpenBSD__)
10548449595gshapiro#   undef SPT_TYPE
10558449595gshapiro#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
10568449595gshapiro#   define HASSETLOGIN	1	/* has setlogin(2) */
105796b960fgshapiro#   if OpenBSD < 200305
105896b960fgshapiro#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
105996b960fgshapiro#   endif /* OpenBSD < 200305 */
10608449595gshapiro#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
10618449595gshapiro#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
10628449595gshapiro#   if OpenBSD >= 200006
10638449595gshapiro#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
10648449595gshapiro#   endif /* OpenBSD >= 200006 */
10658449595gshapiro#   if OpenBSD >= 200012
10668449595gshapiro#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
10678449595gshapiro#   endif /* OpenBSD >= 200012 */
10681fc446agshapiro#   if OpenBSD >= 200405
10691fc446agshapiro#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
10701fc446agshapiro#   endif /* OpenBSD >= 200405 */
1071ef97707gshapiro#   if OpenBSD >= 200505
1072ef97707gshapiro#    undef NETISO	/* iso.h removed in 3.7 */
1073ef97707gshapiro#   endif /* OpenBSD >= 200505 */
1074dd85ecegshapiro#   if OpenBSD >= 200800
1075dd85ecegshapiro#    define HAVE_NANOSLEEP	1	/* has nanosleep(2) */
1076dd85ecegshapiro#   endif /* OpenBSD >= 200800 */
10778449595gshapiro#  endif /* defined(__OpenBSD__) */
10789883351gshapiro# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
10798449595gshapiro
10808449595gshapiro
10818449595gshapiro/*
10828449595gshapiro**  Mach386
10838449595gshapiro**
10848449595gshapiro**	For mt Xinu's Mach386 system.
10858449595gshapiro*/
10868449595gshapiro
10878449595gshapiro# if defined(MACH) && defined(i386) && !defined(__GNU__)
10888449595gshapiro#  define MACH386	1
10898449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
10908449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
10918449595gshapiro#  ifndef HASFLOCK
10928449595gshapiro#   define HASFLOCK	1	/* has flock(2) call */
10938449595gshapiro#  endif /* ! HASFLOCK */
10948449595gshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
10958449595gshapiro#  define NEEDSTRTOL	1	/* need the strtol() function */
10968449595gshapiro#  define setpgid	setpgrp
10978449595gshapiro#  ifndef LA_TYPE
10988449595gshapiro#   define LA_TYPE	LA_FLOAT
10998449595gshapiro#  endif /* ! LA_TYPE */
11008449595gshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
11018449595gshapiro#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
11028449595gshapiro#  undef WEXITSTATUS
11038449595gshapiro#  undef WIFEXITED
11048449595gshapiro#  ifndef _PATH_VENDOR_CF
11058449595gshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
11068449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
11078449595gshapiro#  ifndef _PATH_SENDMAILPID
11088449595gshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
11098449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
11108449595gshapiro# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
11118449595gshapiro
11128449595gshapiro
11138449595gshapiro
11148449595gshapiro/*
11158449595gshapiro**  GNU OS (hurd)
11168449595gshapiro**	Largely BSD & posix compatible.
11178449595gshapiro**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
11188449595gshapiro**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
11198449595gshapiro*/
11208449595gshapiro
11218449595gshapiro# if defined(__GNU__) && !defined(NeXT)
11228449595gshapiro#  include <paths.h>
11238449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
11248449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
11258449595gshapiro#  define HASUNAME	1	/* has uname(2) call */
11268449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
11278449595gshapiro#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
11288449595gshapiro#  define HASSTRERROR	1	/* has strerror(3) */
11298449595gshapiro#  define GIDSET_T	gid_t
11308449595gshapiro#  define SOCKADDR_LEN_T	socklen_t
11318449595gshapiro#  define SOCKOPT_LEN_T	socklen_t
11328449595gshapiro#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
11338449595gshapiro#   define LA_TYPE	LA_SUBR
11348449595gshapiro#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
11358449595gshapiro#   define LA_TYPE	LA_MACH
11368449595gshapiro   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
11378449595gshapiro#   define host_self	mach_host_self
11388449595gshapiro#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
11398449595gshapiro#  define SFS_TYPE	SFS_STATFS
11408449595gshapiro#  define SPT_TYPE	SPT_CHANGEARGV
11418449595gshapiro#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
11428449595gshapiro#  define BSD4_4_SOCKADDR	1	/* has sa_len */
11438449595gshapiro#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
11448449595gshapiro#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
11458449595gshapiro/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
11468449595gshapiro#  define MAXPATHLEN	2048
11478449595gshapiro# endif /* defined(__GNU__) && !defined(NeXT) */
11488449595gshapiro
11498449595gshapiro/*
11508449595gshapiro**  4.3 BSD -- this is for very old systems
11518449595gshapiro**
11528449595gshapiro**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
11538449595gshapiro**
11548449595gshapiro**	You'll also have to install a new resolver library.
11558449595gshapiro**	I don't guarantee that support for this environment is complete.
11568449595gshapiro*/
11578449595gshapiro
11588449595gshapiro# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
11598449595gshapiro#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
11608449595gshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
11618449595gshapiro#  define ARBPTR_T	char *
11628449595gshapiro#  define setpgid	setpgrp
11638449595gshapiro#  ifndef LA_TYPE
11648449595gshapiro#   define LA_TYPE	LA_FLOAT
11658449595gshapiro#  endif /* ! LA_TYPE */
11668449595gshapiro#  ifndef _PATH_VENDOR_CF
11678449595gshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
11688449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
11698449595gshapiro#  ifndef IDENTPROTO
11708449595gshapiro#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
11718449595gshapiro#  endif /* ! IDENTPROTO */
11728449595gshapiro#  undef WEXITSTATUS
11738449595gshapiro#  undef WIFEXITED
11748449595gshapirotypedef short		pid_t;
11758449595gshapiro# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
11768449595gshapiro
11778449595gshapiro
11788449595gshapiro/*
11798449595gshapiro**  SCO Unix
11808449595gshapiro**
11818449595gshapiro**	This includes three parts:
11828449595gshapiro**
11838449595gshapiro**	The first is for SCO OpenServer 5.
11848449595gshapiro**	(Contributed by Keith Reynolds <keithr@sco.COM>).
11858449595gshapiro**
11868449595gshapiro**		SCO OpenServer 5 has a compiler version number macro,
11878449595gshapiro**		which we can use to figure out what version we're on.
11888449595gshapiro**		This may have to change in future releases.
11898449595gshapiro**
11908449595gshapiro**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
11918449595gshapiro**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
11928449595gshapiro**
11938449595gshapiro**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
11948449595gshapiro*/
11958449595gshapiro
11968449595gshapiro/* SCO OpenServer 5 */
11978449595gshapiro# if _SCO_DS >= 1
11988449595gshapiro#  include <paths.h>
11998449595gshapiro#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
12008449595gshapiro#  define HASFCHMOD	1	/* has fchmod(2) call */
12018449595gshapiro#  define HASFCHOWN	1	/* has fchown(2) call */
12028449595gshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
12038449595gshapiro#  define USESETEUID	1	/* has seteuid(2) call */
12048449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) call */
12058449595gshapiro#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
12068449595gshapiro#  define RLIMIT_NEEDS_SYS_TIME_H	1
12078449595gshapiro#  define LDA_USE_LOCKF	1
12088449595gshapiro#  ifndef LA_TYPE
12098449595gshapiro#   define LA_TYPE	LA_DEVSHORT
12108449595gshapiro#  endif /* ! LA_TYPE */
12118449595gshapiro#  define _PATH_AVENRUN	"/dev/table/avenrun"
12128449595gshapiro#  ifndef _SCO_unix_4_2
12138449595gshapiro#   define _SCO_unix_4_2
12148449595gshapiro#  else /* ! _SCO_unix_4_2 */
12158449595gshapiro#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1216125167cgshapiro#   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
12178449595gshapiro#  endif /* ! _SCO_unix_4_2 */
12188449595gshapiro# endif /* _SCO_DS >= 1 */
12198449595gshapiro
12208449595gshapiro/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
12218449595gshapiro# ifdef _SCO_unix_4_2
12228449595gshapiro#  define _SCO_unix_
12238449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
12248449595gshapiro# endif /* _SCO_unix_4_2 */
12258449595gshapiro
12268449595gshapiro/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
12278449595gshapiro# ifdef _SCO_unix_
12288449595gshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
12298449595gshapiro#  define SYSTEM5	1	/* include all the System V defines */
12308449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
12318449595gshapiro#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
12328449595gshapiro#  ifndef USE_SIGLONGJMP
12338449595gshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
12348449595gshapiro#  endif /* ! USE_SIGLONGJMP */
12358449595gshapiro#  define MAXPATHLEN	PATHSIZE
12368449595gshapiro#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
12378449595gshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
12388449595gshapiro#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
12398449595gshapiro#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
12408449595gshapiro#  define UID_T		uid_t
12418449595gshapiro#  define GID_T		gid_t
12428449595gshapiro#  define GIDSET_T	gid_t
12438449595gshapiro#  define _PATH_UNIX		"/unix"
12448449595gshapiro#  ifndef _PATH_VENDOR_CF
12458449595gshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
12468449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
12478449595gshapiro#  ifndef _PATH_SENDMAILPID
12488449595gshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
12498449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
12508449595gshapiro
12518449595gshapiro/* stuff fixed in later releases */
12528449595gshapiro#  ifndef _SCO_unix_4_2
12538449595gshapiro#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
12548449595gshapiro#  endif /* ! _SCO_unix_4_2 */
12558449595gshapiro
12568449595gshapiro#  ifndef _SCO_DS
12578449595gshapiro#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
12588449595gshapiro#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
12598449595gshapiro#   define NETUNIX	0	/* no unix domain socket support */
12608449595gshapiro#   define LA_TYPE	LA_SHORT
12618449595gshapiro#  endif /* ! _SCO_DS */
12628449595gshapiro
12638449595gshapiro# endif /* _SCO_unix_ */
12648449595gshapiro
12658449595gshapiro/*
12668449595gshapiro**  ISC (SunSoft) Unix.
12678449595gshapiro**
12688449595gshapiro**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
12698449595gshapiro*/
12708449595gshapiro
12718449595gshapiro# ifdef ISC_UNIX
12728449595gshapiro#  include <net/errno.h>
12738449595gshapiro#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
12748449595gshapiro#  include <sys/bsdtypes.h>
12758449595gshapiro#  define SYSTEM5	1	/* include all the System V defines */
12768449595gshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
12778449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
12788449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) call */
12798449595gshapiro#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
12808449595gshapiro#  define NETUNIX	0	/* no unix domain socket support */
12818449595gshapiro#  define MAXPATHLEN	1024
12828449595gshapiro#  define LA_TYPE	LA_SHORT
12838449595gshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
12848449595gshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
12858449595gshapiro#  define _PATH_UNIX		"/unix"
12868449595gshapiro#  ifndef _PATH_VENDOR_CF
12878449595gshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
12888449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
12898449595gshapiro#  ifndef _PATH_SENDMAILPID
12908449595gshapiro#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
12918449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
12928449595gshapiro# endif /* ISC_UNIX */
12938449595gshapiro
12948449595gshapiro
12958449595gshapiro/*
12968449595gshapiro**  Altos System V (5.3.1)
12978449595gshapiro**	Contributed by Tim Rice <tim@trr.metro.net>.
12988449595gshapiro*/
12998449595gshapiro
13008449595gshapiro# ifdef ALTOS_SYSTEM_V
13018449595gshapiro#  include <sys/stream.h>
13028449595gshapiro#  include <limits.h>
13038449595gshapiro#  define SYSTEM5	1	/* include all the System V defines */
13048449595gshapiro#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
13058449595gshapiro#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
13068449595gshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
13078449595gshapiro#  define NEEDFSYNC	1	/* no fsync(2) in system library */
13088449595gshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
13098449595gshapiro#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
13108449595gshapiro#  define MAXPATHLEN	PATH_MAX
13118449595gshapiro#  define LA_TYPE	LA_SHORT
13128449595gshapiro#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
13138449595gshapiro#  define SFS_BAVAIL	f_bfree		/* alternate field name */
13148449595gshapiro#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
13158449595gshapiro#  define NETUNIX	0	/* no unix domain socket support */
13168449595gshapiro#  undef WIFEXITED
13178449595gshapiro#  undef WEXITSTATUS
13188449595gshapiro#  define strtoul	strtol	/* gcc library bogosity */
13198449595gshapiro
13208449595gshapirotypedef unsigned short	uid_t;
13218449595gshapirotypedef unsigned short	gid_t;
13228449595gshapirotypedef short		pid_t;
13238449595gshapirotypedef unsigned long	mode_t;
13248449595gshapiro
13258449595gshapiro/* some stuff that should have been in the include files */
13268449595gshapiroextern char		*malloc();
13278449595gshapiroextern struct passwd	*getpwent();
13288449595gshapiroextern struct passwd	*getpwnam();
13298449595gshapiroextern struct passwd	*getpwuid();
13308449595gshapiroextern char		*getenv();
13318449595gshapiroextern struct group	*getgrgid();
13328449595gshapiroextern struct group	*getgrnam();
13338449595gshapiro
13348449595gshapiro# endif /* ALTOS_SYSTEM_V */
13358449595gshapiro
13368449595gshapiro
13378449595gshapiro/*
13388449595gshapiro**  ConvexOS 11.0 and later
13398449595gshapiro**
13408449595gshapiro**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
13418449595gshapiro**	works on 9.1 as well.
13428449595gshapiro**
13438449595gshapiro**  ConvexOS 11.5 and later, should work on 11.0 as defined.
13448449595gshapiro**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
13458449595gshapiro**
13468449595gshapiro**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
13478449595gshapiro**		(now the CONVEX Technologies Center of Hewlett Packard)
13488449595gshapiro*/
13498449595gshapiro
13508449595gshapiro# ifdef _CONVEX_SOURCE
13518449595gshapiro#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
13528449595gshapiro#  define HASINITGROUPS	1	/* has initgroups(3) */
13538449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
13548449595gshapiro#  define HASSETSID	1	/* has POSIX setsid(2) call */
13558449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) */
13568449595gshapiro#  define HASFLOCK	1	/* has flock(2) */
13578449595gshapiro#  define HASSETRLIMIT	1	/* has setrlimit(2) */
13588449595gshapiro#  define HASSETREUID	1	/* has setreuid(2) */
13598449595gshapiro#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
13608449595gshapiro#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
13618449595gshapiro#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
13628449595gshapiro#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
13638449595gshapiro#  define LA_TYPE	LA_FLOAT
13648449595gshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
13658449595gshapiro#  ifndef _PATH_VENDOR_CF
13668449595gshapiro#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
13678449595gshapiro#  endif /* ! _PATH_VENDOR_CF */
13688449595gshapiro#  ifndef S_IREAD
13698449595gshapiro#   define S_IREAD	_S_IREAD
13708449595gshapiro#   define S_IWRITE	_S_IWRITE
13718449595gshapiro#   define S_IEXEC	_S_IEXEC
13728449595gshapiro#   define S_IFMT	_S_IFMT
13738449595gshapiro#   define S_IFCHR	_S_IFCHR
13748449595gshapiro#   define S_IFBLK	_S_IFBLK
13758449595gshapiro#  endif /* ! S_IREAD */
13768449595gshapiro#  ifndef TZ_TYPE
13778449595gshapiro#   define TZ_TYPE	TZ_TIMEZONE
13788449595gshapiro#  endif /* ! TZ_TYPE */
13798449595gshapiro#  ifndef IDENTPROTO
13808449595gshapiro#   define IDENTPROTO	1
13818449595gshapiro#  endif /* ! IDENTPROTO */
13828449595gshapiro#  ifndef SHARE_V1
13838449595gshapiro#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
13848449595gshapiro#  endif /* ! SHARE_V1 */
13858449595gshapiro#  if !defined(__GNUC__ )
13868449595gshapiro#   define UID_T	int		/* GNUC gets it right, ConvexC botches */
13878449595gshapiro#   define GID_T	int		/* GNUC gets it right, ConvexC botches */
13888449595gshapiro#  endif /* !defined(__GNUC__ ) */
13898449595gshapiro#  if SECUREWARE
13908449595gshapiro#   define FORK	fork		/* SecureWare wants the real fork! */
13918449595gshapiro#  else /* SECUREWARE */
13928449595gshapiro#   define FORK	vfork		/* the rest of the OS versions don't care */
13938449595gshapiro#  endif /* SECUREWARE */
13948449595gshapiro# endif /* _CONVEX_SOURCE */
13958449595gshapiro
13968449595gshapiro
13978449595gshapiro/*
13988449595gshapiro**  RISC/os 4.52
13998449595gshapiro**
14008449595gshapiro**	Gives a ton of warning messages, but otherwise compiles.
14018449595gshapiro*/
14028449595gshapiro
14038449595gshapiro# ifdef RISCOS
14048449595gshapiro
14058449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
14068449595gshapiro#  ifndef HASFLOCK
14078449595gshapiro#   define HASFLOCK	1	/* has flock(2) call */
14088449595gshapiro#  endif /* ! HASFLOCK */
14098449595gshapiro#  define WAITUNION	1	/* use "union wait" as wait argument type */
14108449595gshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
14118449595gshapiro#  define NEEDPUTENV	1	/* need putenv(3) call */
14128449595gshapiro#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
14138449595gshapiro#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
14148449595gshapiro#  define LA_TYPE	LA_INT
14158449595gshapiro#  define LA_AVENRUN	"avenrun"
14168449595gshapiro#  define _PATH_UNIX	"/unix"
14178449595gshapiro#  undef WIFEXITED
14188449595gshapiro
14198449595gshapiro#  define setpgid	setpgrp
14208449595gshapiro
14218449595gshapirotypedef int		pid_t;
14228449595gshapiro#  define SIGFUNC_DEFINED
14238449595gshapiro#  define SIGFUNC_RETURN	(0)
14248449595gshapiro#  define SIGFUNC_DECL	int
14258449595gshapirotypedef int		(*sigfunc_t)();
14268449595gshapiroextern char		*getenv();
14278449595gshapiroextern void		*malloc();
14288449595gshapiro
14298449595gshapiro/* added for RISC/os 4.01...which is dumber than 4.50 */
14308449595gshapiro#  ifdef RISCOS_4_0
14318449595gshapiro#   ifndef ARBPTR_T
14328449595gshapiro#    define ARBPTR_T	char *
14338449595gshapiro#   endif /* ! ARBPTR_T */
14348449595gshapiro#   undef HASFLOCK
14358449595gshapiro#   define HASFLOCK	0
14368449595gshapiro#  endif /* RISCOS_4_0 */
14378449595gshapiro
14388449595gshapiro#  include <sys/time.h>
14398449595gshapiro
14408449595gshapiro# endif /* RISCOS */
14418449595gshapiro
14428449595gshapiro
14438449595gshapiro/*
14448449595gshapiro**  Linux 0.99pl10 and above...
14458449595gshapiro**
14468449595gshapiro**  Thanks to, in reverse order of contact:
14478449595gshapiro**
14488449595gshapiro**	John Kennedy <warlock@csuchico.edu>
14498449595gshapiro**	Andrew Pam <avatar@aus.xanadu.com>
14508449595gshapiro**	Florian La Roche <rzsfl@rz.uni-sb.de>
14518449595gshapiro**	Karl London <karl@borg.demon.co.uk>
14528449595gshapiro**
14538449595gshapiro**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
14548449595gshapiro**	file locking is no longer allowed.  In particular, make sure
14558449595gshapiro**	your DBM library and sendmail are both using either flock(2)
14568449595gshapiro**	*or* fcntl(2) file locking, but not both.
14578449595gshapiro*/
14588449595gshapiro
14598449595gshapiro# ifdef __linux__
14608449595gshapiro#  include <linux/version.h>
14618449595gshapiro#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
14628449595gshapiro#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
14638449595gshapiro#  endif /* !defined(KERNEL_VERSION) */
14648449595gshapiro#  define BSD		1	/* include BSD defines */
14658449595gshapiro#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
14668449595gshapiro#  ifndef REQUIRES_DIR_FSYNC
14678449595gshapiro#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
14688449595gshapiro#  endif /* REQUIRES_DIR_FSYNC */
14698449595gshapiro#  ifndef USESETEUID
14708449595gshapiro#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
14718449595gshapiro#  endif /* USESETEUID */
14723c5a1e8gshapiro#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
14738449595gshapiro#  define HASUNAME	1	/* use System V uname(2) system call */
14748449595gshapiro#  define HASUNSETENV	1	/* has unsetenv(3) call */
14758449595gshapiro#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
14768449595gshapiro#  define GIDSET_T	gid_t	/* from <linux/types.h> */
14778449595gshapiro#  ifndef HASGETUSERSHELL
14788449595gshapiro#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
14798449595gshapiro#  endif /* HASGETUSERSHELL */
14808449595gshapiro#  ifndef IP_SRCROUTE
14818449595gshapiro#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
14828449595gshapiro#  endif /* ! IP_SRCROUTE */
14838449595gshapiro#  ifndef HAS_IN_H
14848449595gshapiro#   define HAS_IN_H	1	/* use netinet/in.h */
14858449595gshapiro#  endif /* ! HAS_IN_H */
14868449595gshapiro#  ifndef USE_SIGLONGJMP
14878449595gshapiro#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
14888449595gshapiro#  endif /* ! USE_SIGLONGJMP */
14898449595gshapiro#  ifndef HASFLOCK
14908449595gshapiro#   if LINUX_VERSION_CODE < 66399
14918449595gshapiro#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
14928449595gshapiro#   else /* LINUX_VERSION_CODE < 66399 */
14931fc446agshapiro#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
14941fc446agshapiro#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
14951fc446agshapiro#     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
14961fc446agshapiro#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
14971fc446agshapiro#     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
14988449595gshapiro#   endif /* LINUX_VERSION_CODE < 66399 */
14998449595gshapiro#  endif /* ! HASFLOCK */
15008449595gshapiro#  ifndef LA_TYPE
15018449595gshapiro#   define LA_TYPE	LA_PROCSTR
15028449595gshapiro#  endif /* ! LA_TYPE */
15038449595gshapiro#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
15048449595gshapiro#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
15058449595gshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
15068449595gshapiro#   ifndef HASURANDOMDEV
15078449595gshapiro#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
15088449595gshapiro#   endif /* ! HASURANDOMDEV */
15098449595gshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
151096b960fgshapiro#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
15111fc446agshapiro#   define HASSTRERROR	1	/* has strerror(3) */
151296b960fgshapiro#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
15138449595gshapiro#  ifndef TZ_TYPE
15148449595gshapiro#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
15158449595gshapiro#  endif /* ! TZ_TYPE */
1516fc4e7b6gshapiro#  if (__GLIBC__ >= 2)
1517fc4e7b6gshapiro#   include <paths.h>
1518fc4e7b6gshapiro#  endif /* (__GLIBC__ >= 2) */
15198449595gshapiro#  ifndef _PATH_SENDMAILPID
15208449595gshapiro#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
15218449595gshapiro#  endif /* ! _PATH_SENDMAILPID */
15228449595gshapiro#  include <sys/sysmacros.h>
15238449595gshapiro#  undef atol			/* wounded in <stdlib.h> */
15248449595gshapiro#  if NETINET6
15258449595gshapiro   /*
15268449595gshapiro   **  Linux doesn't have a good way to tell userland what interfaces are
15278449595gshapiro   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
15288449595gshapiro   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
15298449595gshapiro   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
15308449595gshapiro   */
15318449595gshapiro#   define ADDRCONFIG_IS_BROKEN	1
15328449595gshapiro
15338449595gshapiro   /*
15348449595gshapiro   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
15358449595gshapiro   **  in 2.1 and later, but the APIs appear before the functions.
15368449595gshapiro   */
15378449595gshapiro#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
15388449595gshapiro#    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
15398449595gshapiro#    if (GLIBC_VERSION >= 0x201)
1540b649239gshapiro#     define SOCKADDR_LEN_T     socklen_t
1541b649239gshapiro#     define SOCKOPT_LEN_T      socklen_t
15428449595gshapiro#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
15438449595gshapiro#    else /* (GLIBC_VERSION >= 0x201) */
15448449595gshapiro#     include <linux/in6.h>	/* IPv6 support */
15458449595gshapiro#    endif /* (GLIBC_VERSION >= 0x201) */
15468449595gshapiro#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
15478449595gshapiro     /* Have APIs in <netdb.h>, but no support in glibc */
15488449595gshapiro#     define NEEDSGETIPNODE	1
15498449595gshapiro#    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
15508449595gshapiro#    undef GLIBC_VERSION
15518449595gshapiro#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
15528449595gshapiro#  endif /* NETINET6 */
15538449595gshapiro#  ifndef HASFCHOWN
15548449595gshapiro#   define HASFCHOWN	1	/* fchown(2) */
15558449595gshapiro#  endif /* ! HASFCHOWN */
15568449595gshapiro#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
15578449595gshapiro#    define HASFCHMOD	1	/* fchmod(2) */
15588449595gshapiro#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
15598449595gshapiro# endif /* __linux__ */
15608449595gshapiro
15618449595gshapiro
15628449595gshapiro/*
15638449595gshapiro**  DELL SVR4 Issue 2.2, and others
15648449595gshapiro**	From Kimmo Suominen <kim@grendel.lut.fi>
15658449595gshapiro**
15668449595gshapiro**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
15678449595gshapiro**	defined, and the definitions conflict.
15688449595gshapiro**
15698449595gshapiro**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
15708449595gshapiro**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
15718449595gshapiro**	(SVR4.0/386 version 3.0).
15728449595gshapiro*/
15738449595gshapiro
15748449595gshapiro# ifdef DELL_SVR4
1575