Home | History | Annotate | Download | only in sm
      1 /*
      2  * Copyright (c) 1998-2009 Sendmail, Inc. and its suppliers.
      3  *	All rights reserved.
      4  * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
      5  * Copyright (c) 1988, 1993
      6  *	The Regents of the University of California.  All rights reserved.
      7  *
      8  * By using this file, you agree to the terms and conditions set
      9  * forth in the LICENSE file which can be found at the top level of
     10  * the sendmail distribution.
     11  *
     12  *
     13  *	$Id: conf.h,v 1.139 2009/06/16 23:41:32 ca Exp $
     14  */
     15 
     16 /*
     17  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
     18  * Use is subject to license terms.
     19  */
     20 
     21 /*
     22 **  CONF.H -- All user-configurable parameters for sendmail
     23 **
     24 **	Send updates to Sendmail.ORG so they will be
     25 **	included in the next release; see
     26 **	http://www.sendmail.org/email-addresses.html
     27 **	for current e-mail address.
     28 */
     29 
     30 #ifndef SM_CONF_H
     31 # define SM_CONF_H 1
     32 
     33 
     34 # include <sm/config.h>
     35 # include <sm/varargs.h>
     36 
     37 /*
     38 **  General "standard C" defines.
     39 **
     40 **	These may be undone later, to cope with systems that claim to
     41 **	be Standard C but aren't.  Gcc is the biggest offender -- it
     42 **	doesn't realize that the library is part of the language.
     43 **
     44 **	Life would be much easier if we could get rid of this sort
     45 **	of bozo problems.
     46 */
     47 
     48 # ifdef __STDC__
     49 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
     50 # endif /* __STDC__ */
     51 
     52 /*
     53 **  Assume you have standard calls; can be #undefed below if necessary.
     54 */
     55 
     56 # ifndef HASLSTAT
     57 #  define HASLSTAT	1	/* has lstat(2) call */
     58 # endif /* ! HASLSTAT */
     59 
     60 # ifndef HASNICE
     61 #  define HASNICE	1	/* has nice(2) call */
     62 # endif /* ! HASNICE */
     63 
     64 # ifndef HASRRESVPORT
     65 #  define HASRRESVPORT	1	/* has rrsevport(3) call */
     66 # endif /* ! HASRRESVPORT */
     67 
     68 /**********************************************************************
     69 **  "Hard" compilation options.
     70 **	#define these if they are available; comment them out otherwise.
     71 **  These cannot be overridden from the Makefile, and should really not
     72 **  be turned off unless absolutely necessary.
     73 **********************************************************************/
     74 
     75 #define LOG		1	/* enable logging -- don't turn off */
     76 
     77 /**********************************************************************
     78 **  Operating system configuration.
     79 **
     80 **	Unless you are porting to a new OS, you shouldn't have to
     81 **	change these.
     82 **********************************************************************/
     83 
     84 /*
     85 **  HP-UX -- tested for 8.07, 9.00, and 9.01.
     86 **
     87 **	If V4FS is defined, compile for HP-UX 10.0.
     88 **	11.x support from Richard Allen <ra (at) hp.is>.
     89 */
     90 
     91 # ifdef __hpux
     92 		/* common definitions for HP-UX 9.x and 10.x */
     93 #  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
     94 #  define SYSTEM5	1	/* include all the System V defines */
     95 #  define HASINITGROUPS	1	/* has initgroups(3) call */
     96 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
     97 #  define USESETEUID	1	/* has usable seteuid(2) call */
     98 #  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
     99 #  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
    100 #  define seteuid(e)	setresuid(-1, e, -1)
    101 #  define IP_SRCROUTE	1	/* can check IP source routing */
    102 #  define LA_TYPE	LA_HPUX
    103 #  define SPT_TYPE	SPT_PSTAT
    104 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
    105 #  define GIDSET_T	gid_t
    106 #  define LDA_USE_LOCKF	1
    107 #  ifndef HASGETUSERSHELL
    108 #   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
    109 #  endif /* ! HASGETUSERSHELL */
    110 #  ifdef HPUX10
    111 #   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
    112 #   ifndef SMRSH_CMDDIR
    113 #    define SMRSH_CMDDIR	"/var/adm/sm.bin"
    114 #   endif /* ! SMRSH_CMDDIR */
    115 #  endif /* HPUX10 */
    116 #  ifdef HPUX11
    117 #   define HASSETREUID	1	/* setreuid(2) works on HP-UX 11.x */
    118 #   define HASFCHOWN	1	/* has fchown(2) */
    119 #   ifndef BROKEN_RES_SEARCH
    120 #    define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
    121 #   endif /* ! BROKEN_RES_SEARCH */
    122 #   ifndef SMRSH_CMDDIR
    123 #    define SMRSH_CMDDIR	"/var/adm/sm.bin"
    124 #   endif /* ! SMRSH_CMDDIR */
    125 #   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
    126 #  else /* HPUX11 */
    127 #   ifndef NOT_SENDMAIL
    128 #    define syslog	hard_syslog
    129 #   endif /* ! NOT_SENDMAIL */
    130 #  endif /* HPUX11 */
    131 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
    132 
    133 #  ifdef V4FS
    134 		/* HP-UX 10.x */
    135 #   define _PATH_UNIX		"/stand/vmunix"
    136 #   ifndef _PATH_VENDOR_CF
    137 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
    138 #   endif /* ! _PATH_VENDOR_CF */
    139 #   ifndef _PATH_SENDMAILPID
    140 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
    141 #   endif /* ! _PATH_SENDMAILPID */
    142 #   ifndef IDENTPROTO
    143 #    define IDENTPROTO	1	/* TCP/IP implementation fixed in 10.0 */
    144 #   endif /* ! IDENTPROTO */
    145 #   include <sys/mpctl.h>	/* for mpctl() in get_num_procs_online() */
    146 #  else /* V4FS */
    147 		/* HP-UX 9.x */
    148 #   define _PATH_UNIX		"/hp-ux"
    149 #   ifndef _PATH_VENDOR_CF
    150 #    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
    151 #   endif /* ! _PATH_VENDOR_CF */
    152 #   ifndef IDENTPROTO
    153 #    define IDENTPROTO	0	/* TCP/IP implementation is broken */
    154 #   endif /* ! IDENTPROTO */
    155 #   ifdef __STDC__
    156 extern void	hard_syslog(int, char *, ...);
    157 #   else /* __STDC__ */
    158 extern void	hard_syslog();
    159 #   endif /* __STDC__ */
    160 #   define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
    161 #  endif /* V4FS */
    162 
    163 # endif /* __hpux */
    164 
    165 /*
    166 **  IBM AIX 5.x
    167 */
    168 
    169 # ifdef _AIX5
    170 #  include <sys/signal.h>
    171 #  include <sys/wait.h>
    172 #  define _AIX4		40300
    173 #  define SOCKADDR_LEN_T socklen_t /* e.g., arg#3 to accept, getsockname */
    174 #  define SOCKOPT_LEN_T	socklen_t /* arg#5 to getsockopt */
    175 #  if _AIX5 >= 50200
    176 #   define HASUNSETENV	1	/* has unsetenv(3) call */
    177 #  endif /* _AIX5 >= 50200 */
    178 # endif /* _AIX5 */
    179 
    180 /*
    181 **  IBM AIX 4.x
    182 */
    183 
    184 # ifdef _AIX4
    185 #  define _AIX3		1	/* pull in AIX3 stuff */
    186 #  define BSD4_4_SOCKADDR	/* has sa_len */
    187 #  define USESETEUID	1	/* seteuid(2) works */
    188 #  define TZ_TYPE	TZ_NAME	/* use tzname[] vector */
    189 #  ifndef SOCKOPT_LEN_T
    190 #   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
    191 #  endif /* SOCKOPT_LEN_T */
    192 #  if _AIX4 >= 40200
    193 #   define HASSETREUID	1	/* setreuid(2) works as of AIX 4.2 */
    194 #   ifndef SOCKADDR_LEN_T
    195 #    define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
    196 #   endif /* SOCKADDR_LEN_T */
    197 #  endif /* _AIX4 >= 40200 */
    198 #  if defined(_ILS_MACROS)	/* IBM versions aren't side-effect clean */
    199 #   undef isascii
    200 #   define isascii(c)		!(c & ~0177)
    201 #   undef isdigit
    202 #   define isdigit(__a)		(_IS(__a,_ISDIGIT))
    203 #   undef isspace
    204 #   define isspace(__a)		(_IS(__a,_ISSPACE))
    205 #  endif /* defined(_ILS_MACROS) */
    206 # endif /* _AIX4 */
    207 
    208 
    209 /*
    210 **  IBM AIX 3.x -- actually tested for 3.2.3
    211 */
    212 
    213 # ifdef _AIX3
    214 #  include <paths.h>
    215 #  include <sys/machine.h>	/* to get byte order */
    216 #  include <sys/select.h>
    217 #  define HASFCHOWN	1	/* has fchown(2) */
    218 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    219 #  define HASUNAME	1	/* use System V uname(2) system call */
    220 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
    221 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    222 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
    223 #  define GIDSET_T	gid_t
    224 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
    225 #  define SPT_PADCHAR	'\0'	/* pad process title with nulls */
    226 #  ifndef LA_TYPE
    227 #   define LA_TYPE	LA_INT
    228 #  endif /* LA_TYPE */
    229 #  define FSHIFT	16
    230 #  define LA_AVENRUN	"avenrun"
    231 #  if !defined(_AIX4) || _AIX4 < 40300
    232 #   ifndef __BIT_TYPES_DEFINED__
    233 #    define SM_INT32	int
    234 #   endif /* __BIT_TYPES_DEFINED__ */
    235 #  endif /* !defined(_AIX4) || _AIX4 < 40300 */
    236 #  if !defined(_AIX4) || _AIX4 < 40200
    237 #   define SM_CONF_SYSLOG	0
    238 #  endif /* !defined(_AIX4) || _AIX4 < 40200 */
    239 # endif /* _AIX3 */
    240 
    241 
    242 /*
    243 **  IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
    244 **
    245 **	From Mark Whetzel <markw (at) wg.waii.com>.
    246 */
    247 
    248 # ifdef AIX			/* AIX/RT compiler pre-defines this */
    249 #  include <paths.h>
    250 #  include <sys/time.h>		/* AIX/RT resource.h does NOT include this */
    251 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    252 #  define HASUNAME	1	/* use System V uname(2) system call */
    253 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
    254 #  define HASFCHMOD	0	/* does not have fchmod(2) syscall */
    255 #  define HASSETREUID	1	/* use setreuid(2) -lbsd system call */
    256 #  define HASSETVBUF	1	/* use setvbuf(2) system call */
    257 #  define HASSETRLIMIT	0	/* does not have setrlimit call */
    258 #  define HASFLOCK	0	/* does not have flock call - use fcntl */
    259 #  define HASULIMIT	1	/* use ulimit instead of setrlimit call */
    260 #  define SM_CONF_GETOPT	0	/* Do we need theirs or ours */
    261 #  define SYS5SETPGRP	1	/* don't have setpgid on AIX/RT */
    262 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
    263 #  define BSD4_3		1	/* NOT bsd 4.4 or posix signals */
    264 #  define GIDSET_T	int
    265 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
    266 #  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
    267 #  define LA_TYPE	LA_SUBR		/* use our ported loadavgd daemon */
    268 #  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
    269 #  define ARBPTR_T	int *
    270 #  define void		int
    271 typedef int		pid_t;
    272 /* RTisms for BSD compatibility, specified in the Makefile
    273   define BSD		1
    274   define BSD_INCLUDES		1
    275   define BSD_REMAP_SIGNAL_TO_SIGVEC
    276     RTisms needed above */
    277 /* make this sendmail in a completely different place */
    278 #  ifndef _PATH_VENDOR_CF
    279 #   define _PATH_VENDOR_CF	"/usr/local/newmail/sendmail.cf"
    280 #  endif /* ! _PATH_VENDOR_CF */
    281 #  ifndef _PATH_SENDMAILPID
    282 #   define _PATH_SENDMAILPID	"/usr/local/newmail/sendmail.pid"
    283 #  endif /* ! _PATH_SENDMAILPID */
    284 # endif /* AIX */
    285 
    286 # if defined(_AIX)
    287 #  define LDA_USE_LOCKF		1
    288 #  define LDA_USE_SETEUID	1
    289 # endif /* defined(_AIX) */
    290 
    291 /*
    292 **  Silicon Graphics IRIX
    293 **
    294 **	Compiles on 4.0.1.
    295 **
    296 **	Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
    297 **	Use IRIX5 instead of IRIX for IRIX 5.x.
    298 **
    299 **	IRIX64 changes from Mark R. Levinson <ml (at) cvdev.rochester.edu>.
    300 **	IRIX5 changes from Kari E. Hurtta <Kari.Hurtta (at) fmi.fi>.
    301 */
    302 
    303 # ifdef IRIX
    304 #  define SYSTEM5	1	/* this is a System-V derived system */
    305 #  define HASSETREUID	1	/* has setreuid(2) call */
    306 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    307 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    308 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
    309 #  define IP_SRCROUTE	1	/* can check IP source routing */
    310 #  define setpgid	BSDsetpgrp
    311 #  define GIDSET_T	gid_t
    312 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
    313 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
    314 #  define SYSLOG_BUFSIZE 512
    315 #  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
    316     /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
    317 #   define _SC_NPROCESSORS_ONLN	_SC_NPROC_ONLN
    318 #  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
    319 #  ifdef IRIX6
    320 #   define STAT64	1
    321 #   define QUAD_T	unsigned long long
    322 #   define LA_TYPE	LA_IRIX6	/* figure out at run time */
    323 #   define SAFENFSPATHCONF 0	/* pathconf(2) lies on NFS filesystems */
    324 #  else /* IRIX6 */
    325 #   define LA_TYPE	LA_INT
    326 
    327 #   ifdef IRIX64
    328 #    define STAT64	1
    329 #    define QUAD_T	unsigned long long
    330 #    define NAMELISTMASK	0x7fffffffffffffff	/* mask for nlist() values */
    331 #   else /* IRIX64 */
    332 #    define STAT64	0
    333 #    define NAMELISTMASK	0x7fffffff		/* mask for nlist() values */
    334 #   endif /* IRIX64 */
    335 #  endif /* IRIX6 */
    336 #  if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
    337 #   include <sys/cdefs.h>
    338 #   include <paths.h>
    339 #   define ARGV_T	char *const *
    340 #   define HASFCHOWN	1	/* has fchown(2) */
    341 #   define HASSETRLIMIT	1	/* has setrlimit(2) syscall */
    342 #   define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
    343 #   define HASSTRERROR	1	/* has strerror(3) */
    344 #  else /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
    345 #   define ARGV_T	const char **
    346 #   define WAITUNION	1	/* use "union wait" as wait argument type */
    347 #  endif /* defined(IRIX64) || defined(IRIX5) || defined(IRIX6) */
    348 # endif /* IRIX */
    349 
    350 
    351 /*
    352 **  SunOS and Solaris
    353 **
    354 **	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
    355 **	Solaris 2.4 (a.k.a. SunOS 5.4).
    356 */
    357 
    358 # if defined(sun) && !defined(BSD)
    359 
    360 #  include <sys/time.h>
    361 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    362 #  define HASUNAME	1	/* use System V uname(2) system call */
    363 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    364 #  define IP_SRCROUTE	1	/* can check IP source routing */
    365 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
    366 #  ifndef HASFCHOWN
    367 #   define HASFCHOWN	1	/* fchown(2) */
    368 #  endif /* ! HASFCHOWN */
    369 
    370 #  ifdef __svr4__
    371 #   define LDA_USE_LOCKF		1
    372 #   define LDA_USE_SETEUID	1
    373 #   define _PATH_MAILDIR		"/var/mail"
    374 #  endif /* __svr4__ */
    375 
    376 #  ifdef SOLARIS_2_3
    377 #   define SOLARIS	20300	/* for back compat only -- use -DSOLARIS=20300 */
    378 #  endif /* SOLARIS_2_3 */
    379 
    380 #  if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
    381 #   define SOLARIS	1	/* unknown Solaris version */
    382 #  endif /* defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4)) */
    383 
    384 #  ifdef SOLARIS
    385 			/* Solaris 2.x (a.k.a. SunOS 5.x) */
    386 #   ifndef __svr4__
    387 #    define __svr4__		/* use all System V Release 4 defines below */
    388 #   endif /* ! __svr4__ */
    389 #   define GIDSET_T	gid_t
    390 #   define USE_SA_SIGACTION	1	/* use sa_sigaction field */
    391 #   define BROKEN_PTHREAD_SLEEP	1	/* sleep after pthread_create() fails */
    392 #   define HASSTRERROR	1	/* has strerror(3) */
    393 #   ifndef _PATH_UNIX
    394 #    define _PATH_UNIX		"/dev/ksyms"
    395 #   endif /* ! _PATH_UNIX */
    396 #   ifndef _PATH_VENDOR_CF
    397 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
    398 #   endif /* ! _PATH_VENDOR_CF */
    399 #   ifndef _PATH_SENDMAILPID
    400 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
    401 #   endif /* ! _PATH_SENDMAILPID */
    402 #   ifndef _PATH_HOSTS
    403 #    define _PATH_HOSTS		"/etc/inet/hosts"
    404 #   endif /* ! _PATH_HOSTS */
    405 #   ifndef SYSLOG_BUFSIZE
    406 #    define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
    407 #   endif /* ! SYSLOG_BUFSIZE */
    408 #   ifndef TZ_TYPE
    409 #    define TZ_TYPE	TZ_TZNAME
    410 #   endif /* ! TZ_TYPE */
    411 #   if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
    412 #    define USESETEUID		1	/* seteuid works as of 2.3 */
    413 #    define LDA_CONTENTLENGTH	1	/* Needs the Content-Length header */
    414 #   endif /* SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203) */
    415 #   if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
    416 #    define HASSETREUID	1		/* setreuid works as of 2.5 */
    417 #    define HASSETREGID	1	/* use setregid(2) to set saved gid */
    418 #   if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
    419 #    define HASSNPRINTF 1	/* has snprintf(3c) starting in 2.6 */
    420 #   endif /* SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206) */
    421 #    if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
    422 #     ifndef LA_TYPE
    423 #      define LA_TYPE	LA_KSTAT	/* use kstat(3k) -- may work in < 2.5 */
    424 #     endif /* ! LA_TYPE */
    425 #     ifndef RANDOMSHIFT		/* random() doesn't work well (sometimes) */
    426 #      define RANDOMSHIFT	8
    427 #     endif /* ! RANDOMSHIFT */
    428 #    endif /* SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700) */
    429 #   else /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
    430 #    ifndef HASRANDOM
    431 #     define HASRANDOM	0		/* doesn't have random(3) */
    432 #    endif /* ! HASRANDOM */
    433 #   endif /* SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) */
    434 #   if (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206
    435 #    define SM_INT32	int	/* 32bit integer */
    436 #   endif /* (SOLARIS > 10000 && SOLARIS < 20600) || SOLARIS < 206 */
    437 #   if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
    438 #    ifndef LA_TYPE
    439 #     include <sys/loadavg.h>
    440 #     if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
    441 #      include <sys/pset.h>
    442 #      define LA_TYPE	LA_PSET	/* pset_getloadavg(3c) appears in 2.9 */
    443 #     else /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
    444 #      define LA_TYPE	LA_SUBR	/* getloadavg(3c) appears in 2.7 */
    445 #     endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
    446 #    endif /* ! LA_TYPE */
    447 #    define HASGETUSERSHELL 1	/* getusershell(3c) bug fixed in 2.7 */
    448 #   endif /* SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207) */
    449 #   if SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208)
    450 #    undef _PATH_SENDMAILPID	/* tmpfs /var/run added in 2.8 */
    451 #    define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
    452 #    ifndef SMRSH_CMDDIR
    453 #     define SMRSH_CMDDIR	"/var/adm/sm.bin"
    454 #    endif /* ! SMRSH_CMDDIR */
    455 #    define SL_FUDGE	34	/* fudge offset for SyslogPrefixLen */
    456 #    define HASLDAPGETALIASBYNAME	1	/* added in S8 */
    457 #   endif /* SOLARIS >= 20800 || (SOLARIS < 10000 && SOLARIS >= 208) */
    458 #   if SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209)
    459 #    define HASURANDOMDEV	1	/* /dev/[u]random added in S9 */
    460 #    define HASCLOSEFROM	1	/* closefrom(3c) added in S9 */
    461 #    define HASFDWALK		1	/* fdwalk(3c) added in S9 */
    462 #   endif /* SOLARIS >= 20900 || (SOLARIS < 10000 && SOLARIS >= 209) */
    463 #   if SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210)
    464 #    define HASUNSETENV 1       /* unsetenv() added in S10 */
    465 #   endif /* SOLARIS >= 21000 || (SOLARIS < 10000 && SOLARIS >= 210) */
    466 #   if SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211)
    467 #    define GETLDAPALIASBYNAME_VERSION 2	/* changed in S11 */
    468 #    define HAVE_NANOSLEEP	1	/* moved from librt to libc in S11 */
    469 #   endif /* SOLARIS >= 21100 || (SOLARIS < 10000 && SOLARIS >= 211) */
    470 #   ifndef HASGETUSERSHELL
    471 #    define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps pre-2.7 */
    472 #   endif /* ! HASGETUSERSHELL */
    473 
    474 #  else /* SOLARIS */
    475 			/* SunOS 4.0.3 or 4.1.x */
    476 #   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
    477 #   define HASSETREUID	1	/* has setreuid(2) call */
    478 #   ifndef HASFLOCK
    479 #    define HASFLOCK	1	/* has flock(2) call */
    480 #   endif /* ! HASFLOCK */
    481 #   define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
    482 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
    483 #   include <memory.h>
    484 #   include <vfork.h>
    485 #   ifdef __GNUC__
    486 #    define strtoul	strtol	/* gcc library bogosity */
    487 #   endif /* __GNUC__ */
    488 #   define memmove(d, s, l)	(bcopy((s), (d), (l)))
    489 #   define atexit(f)	on_exit((f), 0)	/* ugly hack for SunOS */
    490 #   define SM_INT32	int	/* 32bit integer */
    491 #   define SM_ALIGN_SIZE (sizeof(long))
    492 #   define GIDSET_T	int
    493 #   define SM_CONF_SYSLOG	0
    494 
    495 #   ifdef SUNOS403
    496 			/* special tweaking for SunOS 4.0.3 */
    497 #    include <malloc.h>
    498 #    define BSD4_3	1	/* 4.3 BSD-based */
    499 #    define NEEDSTRSTR	1	/* need emulation of strstr(3) routine */
    500 #    define WAITUNION	1	/* use "union wait" as wait argument type */
    501 #    undef WIFEXITED
    502 #    undef WEXITSTATUS
    503 #    undef HASUNAME
    504 #    define setpgid	setpgrp
    505 #    define MODE_T	int
    506 typedef int		pid_t;
    507 extern char		*getenv();
    508 
    509 #   else /* SUNOS403 */
    510 			/* 4.1.x specifics */
    511 #    define HASSETSID	1	/* has POSIX setsid(2) call */
    512 #    define HASSETVBUF	1	/* we have setvbuf(3) in libc */
    513 
    514 #   endif /* SUNOS403 */
    515 #  endif /* SOLARIS */
    516 
    517 #  ifndef LA_TYPE
    518 #   define LA_TYPE	LA_INT
    519 #  endif /* ! LA_TYPE */
    520 
    521 # endif /* defined(sun) && !defined(BSD) */
    522 
    523 /*
    524 **  DG/UX
    525 **
    526 **	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
    527 **	older support.
    528 **	5.4.3 changes from Mark T. Robinson <mtr (at) ornl.gov>.
    529 */
    530 
    531 # ifdef DGUX_5_4_2
    532 #  define DGUX		1
    533 # endif /* DGUX_5_4_2 */
    534 
    535 # ifdef DGUX
    536 #  define SYSTEM5	1
    537 #  define LA_TYPE	LA_DGUX
    538 #  define HASSETREUID	1	/* has setreuid(2) call */
    539 #  define HASUNAME	1	/* use System V uname(2) system call */
    540 #  define HASSETSID	1	/* has POSIX setsid(2) call */
    541 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    542 #  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
    543 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) */
    544 #  ifndef IDENTPROTO
    545 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
    546 #  endif /* ! IDENTPROTO */
    547 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
    548 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
    549 #  define LDA_USE_LOCKF		1
    550 
    551 /* these include files must be included early on DG/UX */
    552 #  include <netinet/in.h>
    553 #  include <arpa/inet.h>
    554 
    555 /* compiler doesn't understand const? */
    556 #  define const
    557 
    558 #  ifdef DGUX_5_4_2
    559 #   define inet_addr	dgux_inet_addr
    560 extern long	dgux_inet_addr();
    561 #  endif /* DGUX_5_4_2 */
    562 # endif /* DGUX */
    563 
    564 
    565 /*
    566 **  Digital Ultrix 4.2 - 4.5
    567 **
    568 **	Apparently, fcntl locking is broken on 4.2A, in that locks are
    569 **	not dropped when the process exits.  This causes major problems,
    570 **	so flock is the only alternative.
    571 */
    572 
    573 # ifdef ultrix
    574 #  define HASSETREUID	1	/* has setreuid(2) call */
    575 #  define HASUNSETENV	1	/* has unsetenv(3) call */
    576 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    577 #  define HASUNAME	1	/* use System V uname(2) system call */
    578 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    579 #  define HASFCHOWN	1	/* has fchown(2) syscall */
    580 #  ifndef HASFLOCK
    581 #   define HASFLOCK	1	/* has flock(2) call */
    582 #  endif /* ! HASFLOCK */
    583 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
    584 #  ifndef BROKEN_RES_SEARCH
    585 #   define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
    586 #  endif /* ! BROKEN_RES_SEARCH */
    587 #  if !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621
    588 #   define NEEDLOCAL_HOSTNAME_LENGTH	1	/* see sendmail/README */
    589 #  endif /* !defined(NEEDLOCAL_HOSTNAME_LENGTH) && NAMED_BIND && __RES >= 19931104 && __RES < 19950621 */
    590 #  ifdef vax
    591 #   define LA_TYPE	LA_FLOAT
    592 #  else /* vax */
    593 #   define LA_TYPE	LA_INT
    594 #   define LA_AVENRUN	"avenrun"
    595 #  endif /* vax */
    596 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
    597 #  ifndef IDENTPROTO
    598 #   define IDENTPROTO	0	/* pre-4.4 TCP/IP implementation is broken */
    599 #  endif /* ! IDENTPROTO */
    600 #  define SYSLOG_BUFSIZE	256
    601 #  define SM_CONF_SYSLOG	0
    602 # endif /* ultrix */
    603 
    604 
    605 /*
    606 **  OSF/1 for KSR.
    607 **
    608 **	Contributed by Todd C. Miller <Todd.Miller (at) cs.colorado.edu>
    609 */
    610 
    611 # ifdef __ksr__
    612 #  define __osf__	1	/* get OSF/1 defines below */
    613 #  ifndef TZ_TYPE
    614 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
    615 #  endif /* ! TZ_TYPE */
    616 # endif /* __ksr__ */
    617 
    618 
    619 /*
    620 **  OSF/1 for Intel Paragon.
    621 **
    622 **	Contributed by Jeff A. Earickson <jeff (at) ssd.intel.com>
    623 **	of Intel Scalable Systems Divison.
    624 */
    625 
    626 # ifdef __PARAGON__
    627 #  define __osf__	1	/* get OSF/1 defines below */
    628 #  ifndef TZ_TYPE
    629 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
    630 #  endif /* ! TZ_TYPE */
    631 #  define GIDSET_T	gid_t
    632 #  define MAXNAMLEN	NAME_MAX
    633 # endif /* __PARAGON__ */
    634 
    635 
    636 /*
    637 **  Tru64 UNIX, formerly known as Digital UNIX, formerly known as DEC OSF/1
    638 **
    639 **	Tested for 3.2 and 4.0.
    640 */
    641 
    642 # ifdef __osf__
    643 #  define HASUNAME	1	/* has uname(2) call */
    644 #  define HASUNSETENV	1	/* has unsetenv(3) call */
    645 #  define USESETEUID	1	/* has usable seteuid(2) call */
    646 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    647 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    648 #  define HASFCHOWN	1	/* has fchown(2) syscall */
    649 #  define HASSETLOGIN	1	/* has setlogin(2) */
    650 #  define IP_SRCROUTE	1	/* can check IP source routing */
    651 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
    652 #  define GIDSET_T	gid_t
    653 #  define SM_INT32	int	/* 32bit integer */
    654 #  ifndef HASFLOCK
    655 #   include <standards.h>
    656 #   if _XOPEN_SOURCE+0 >= 400
    657 #    define HASFLOCK	0	/* 5.0 and later has bad flock(2) call */
    658 #   else /* _XOPEN_SOURCE+0 >= 400 */
    659 #    define HASFLOCK	1	/* has flock(2) call */
    660 #   endif /* _XOPEN_SOURCE+0 >= 400 */
    661 #  endif /* ! HASFLOCK */
    662 #  define LA_TYPE	LA_ALPHAOSF
    663 #  define SFS_TYPE	SFS_STATVFS	/* use <sys/statvfs.h> statfs() impl */
    664 #  ifndef _PATH_VENDOR_CF
    665 #   define _PATH_VENDOR_CF	"/var/adm/sendmail/sendmail.cf"
    666 #  endif /* ! _PATH_VENDOR_CF */
    667 #  ifndef _PATH_SENDMAILPID
    668 #   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
    669 #  endif /* ! _PATH_SENDMAILPID */
    670 #  if _FFR_DIGUNIX_SAFECHOWN
    671 /*
    672 **  Testing on a Digital UNIX 4.0a system showed this to be the correct
    673 **  setting but given the security consequences, more testing and
    674 **  verification is needed.  Unfortunately, the man page offers no
    675 **  assistance.
    676 */
    677 #   define IS_SAFE_CHOWN >= 0
    678 #  endif /* _FFR_DIGUNIX_SAFECHOWN */
    679 # endif /* __osf__ */
    680 
    681 
    682 /*
    683 **  NeXTstep
    684 */
    685 
    686 # ifdef NeXT
    687 #  define HASINITGROUPS	1	/* has initgroups(3) call */
    688 #  define NEEDPUTENV	2	/* need putenv(3) call; no setenv(3) call */
    689 #  ifndef HASFLOCK
    690 #   define HASFLOCK	1	/* has flock(2) call */
    691 #  endif /* ! HASFLOCK */
    692 #  define UID_T		int	/* compiler gripes on uid_t */
    693 #  define GID_T		int	/* ditto for gid_t */
    694 #  define MODE_T	int	/* and mode_t */
    695 #  define setpgid	setpgrp
    696 #  ifndef NOT_SENDMAIL
    697 #   define sleep		sleepX
    698 #  endif /* ! NOT_SENDMAIL */
    699 #  ifndef LA_TYPE
    700 #   define LA_TYPE	LA_MACH
    701 #  endif /* ! LA_TYPE */
    702 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
    703 #  ifdef _POSIX_SOURCE
    704 extern struct passwd	*getpwent();
    705 #  else /* _POSIX_SOURCE */
    706 #   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
    707 #   define WAITUNION	1	/* use "union wait" as wait argument type */
    708 typedef int		pid_t;
    709 #   undef WEXITSTATUS
    710 #   undef WIFEXITED
    711 #   undef WIFSTOPPED
    712 #   undef WTERMSIG
    713 #  endif /* _POSIX_SOURCE */
    714 #  ifndef _PATH_VENDOR_CF
    715 #   define _PATH_VENDOR_CF	"/etc/sendmail/sendmail.cf"
    716 #  endif /* ! _PATH_VENDOR_CF */
    717 #  ifndef _PATH_SENDMAILPID
    718 #   define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
    719 #  endif /* ! _PATH_SENDMAILPID */
    720 #  define SM_INT32	int	/* 32bit integer */
    721 
    722 #  ifdef TCPWRAPPERS
    723 #   ifndef HASUNSETENV
    724 #    define HASUNSETENV	1
    725 #   endif /* ! HASUNSETENV */
    726 #   undef NEEDPUTENV
    727 #  endif /* TCPWRAPPERS */
    728 #  ifndef __APPLE__
    729 #   include <libc.h>
    730 #   ifndef S_IRUSR
    731 #    define S_IRUSR	S_IREAD
    732 #   endif /* ! S_IRUSR */
    733 #   ifndef S_IWUSR
    734 #    define S_IWUSR	S_IWRITE
    735 #   endif /* ! S_IWUSR */
    736 #   define _PATH_MAILDIR	"/usr/spool/mail"
    737 #  endif /* ! __APPLE__ */
    738 #  ifndef isascii
    739 #   define isascii(c)	((unsigned)(c) <= 0177)
    740 #  endif /* ! isascii */
    741 # endif /* NeXT */
    742 
    743 /*
    744 **  Apple Darwin
    745 **      Contributed by Wilfredo Sanchez <wsanchez (at) mit.edu>
    746 */
    747 
    748 # if defined(DARWIN)
    749 #  define HASFCHMOD		1	/* has fchmod(2) */
    750 #  define HASFCHOWN		1	/* has fchown(2) */
    751 #  define HASFLOCK		1	/* has flock(2) */
    752 #  define HASUNAME		1	/* has uname(2) */
    753 #  define HASUNSETENV		1	/* has unsetenv(3) */
    754 #  define HASSETSID		1	/* has POSIX setsid(2) call */
    755 #  define HASINITGROUPS		1	/* has initgroups(3) */
    756 #  define HASSETVBUF		1	/* has setvbuf (3) */
    757 #  define HASSETREUID		0	/* setreuid(2) unusable */
    758 #  define HASSETEUID		1	/* has seteuid(2) */
    759 #  define USESETEUID		1	/* has seteuid(2) */
    760 #  define HASSETEGID		1	/* has setegid(2) */
    761 #  define HASSETREGID		1	/* has setregid(2) */
    762 #  define HASSETRESGID		0	/* no setresgid(2) */
    763 #  define HASLSTAT		1	/* has lstat(2) */
    764 #  define HASSETRLIMIT		1	/* has setrlimit(2) */
    765 #  define HASWAITPID		1	/* has waitpid(2) */
    766 #  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
    767 #  define HAS_ST_GEN		1	/* has st_gen field in struct stat */
    768 #  define HASURANDOMDEV		1	/* has urandom(4) */
    769 #  define HASSTRERROR		1	/* has strerror(3) */
    770 #  define HASGETUSERSHELL	1	/* had getusershell(3) */
    771 #  define GIDSET_T		gid_t	/* getgroups(2) takes gid_t */
    772 #  define LA_TYPE		LA_SUBR	/* use getloadavg(3) */
    773 #  define SFS_TYPE		SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
    774 #  if DARWIN >= 70000
    775 #   define SOCKADDR_LEN_T	socklen_t
    776 #  endif
    777 #  if DARWIN >= 80000
    778 #   define SPT_TYPE		SPT_REUSEARGV
    779 #   define SPT_PADCHAR		'\0'
    780 #   define SOCKOPT_LEN_T	socklen_t
    781 #  else
    782 #   define SPT_TYPE		SPT_PSSTRINGS	/* use magic PS_STRINGS pointer for setproctitle */
    783 #  endif
    784 #  define ERRLIST_PREDEFINED		/* don't declare sys_errlist */
    785 #  define BSD4_4_SOCKADDR		/* struct sockaddr has sa_len */
    786 #  define SAFENFSPATHCONF	0	/* unverified: pathconf(2) doesn't work on NFS */
    787 #  define HAS_IN_H		1
    788 #  define NETLINK		1	/* supports AF_LINK */
    789 #  ifndef NOT_SENDMAIL
    790 #   define sleep sleepX
    791 extern unsigned int sleepX __P((unsigned int seconds));
    792 #  endif /* ! NOT_SENDMAIL */
    793 # endif /* defined(DARWIN) */
    794 
    795 
    796 /*
    797 **  4.4 BSD
    798 **
    799 **	See also BSD defines.
    800 */
    801 
    802 # if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)
    803 #  include <paths.h>
    804 #  define HASUNSETENV	1	/* has unsetenv(3) call */
    805 #  define USESETEUID	1	/* has usable seteuid(2) call */
    806 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    807 #  define HASFCHOWN	1	/* has fchown(2) syscall */
    808 #  define HASSTRERROR	1	/* has strerror(3) */
    809 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
    810 #  include <sys/cdefs.h>
    811 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
    812 #  define BSD4_4_SOCKADDR	/* has sa_len */
    813 #  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
    814 #  define NETLINK	1	/* supports AF_LINK */
    815 #  ifndef LA_TYPE
    816 #   define LA_TYPE	LA_SUBR
    817 #  endif /* ! LA_TYPE */
    818 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
    819 #  define SPT_TYPE	SPT_PSSTRINGS	/* use PS_STRINGS pointer */
    820 # endif /* defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__) && !defined(DARWIN)*/
    821 
    822 
    823 /*
    824 **  BSD/OS (was BSD/386) (all versions)
    825 **	From Tony Sanders, BSDI
    826 */
    827 
    828 # ifdef __bsdi__
    829 #  include <paths.h>
    830 #  define HASUNSETENV	1	/* has the unsetenv(3) call */
    831 #  define HASSETREUID	0	/* BSD-OS has broken setreuid(2) emulation */
    832 #  define HASSETSID	1	/* has POSIX setsid(2) call */
    833 #  define USESETEUID	1	/* has usable seteuid(2) call */
    834 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    835 #  define HASSETLOGIN	1	/* has setlogin(2) */
    836 #  define HASUNAME	1	/* has uname(2) syscall */
    837 #  define HASSTRERROR	1	/* has strerror(3) */
    838 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
    839 #  include <sys/cdefs.h>
    840 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
    841 #  define BSD4_4_SOCKADDR	/* has sa_len */
    842 #  define NETLINK	1	/* supports AF_LINK */
    843 #  define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
    844 #  ifndef LA_TYPE
    845 #   define LA_TYPE	LA_SUBR
    846 #  endif /* ! LA_TYPE */
    847 #  define GIDSET_T	gid_t
    848 #  define QUAD_T		quad_t
    849 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
    850 			/* version 1.1 or later */
    851 #   undef SPT_TYPE
    852 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
    853 #  else /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
    854 			/* version 1.0 or earlier */
    855 #   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
    856 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312 */
    857 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701	/* on 3.x */
    858 #   define HASSETUSERCONTEXT 1	/* has setusercontext */
    859 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 */
    860 #  if defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701	/* 3.1 and earlier */
    861 #   define MODE_T	int	/* va_arg() can't handle less than int */
    862 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION <= 199701 */
    863 #  if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910	/* on 4.x */
    864 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
    865 #  endif /* defined(_BSDI_VERSION) && _BSDI_VERSION >= 199910 */
    866 # endif /* __bsdi__ */
    867 
    868 
    869 # if defined(__QNX__)
    870 #  if defined(__QNXNTO__)
    871 /* QNX 6 */
    872 #   include <unix.h>
    873 #   define HASUNSETENV	1	/* has unsetenv(3) call */
    874 #   define HASINITGROUPS	1	/* has initgroups(3) call */
    875 #   define HASSETSID	1	/* has POSIX setsid(2) call */
    876 #   define USESETEUID	1	/* has usable seteuid(2) call */
    877 #   define HASFCHMOD	1	/* has fchmod(2) syscall */
    878 #   define HASFCHOWN	1	/* has fchown(2) syscall */
    879 #   define HASUNAME	1	/* has uname(2) syscall */
    880 #   define HASSTRERROR	1	/* has strerror(3) */
    881 #   define BSD4_4_SOCKADDR	/* has sa_len */
    882 #   define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
    883 #   define NETLINK	1	/* supports AF_LINK */
    884 #   define GIDSET_T	gid_t
    885 #   define QUAD_T	uint64_t
    886 #   define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
    887 #   define HASGETUSERSHELL 0
    888 
    889 /*
    890 **  We have a strrev() that doesn't allocate anything.
    891 **  Make sure the one here is used.
    892 */
    893 
    894 #   define strrev strrev_sendmail
    895 
    896 #  else /* defined(__QNXNTO__) */
    897 
    898 /*
    899 **  QNX 4.2x
    900 **	Contributed by Glen McCready <glen (at) qnx.com>.
    901 **
    902 **	Should work with all versions of QNX 4.
    903 */
    904 
    905 #   include <unix.h>
    906 #   include <sys/select.h>
    907 #   undef NGROUPS_MAX
    908 #   define HASSETSID	1	/* has POSIX setsid(2) call */
    909 #   define USESETEUID	1	/* has usable seteuid(2) call */
    910 #   define HASFCHMOD	1	/* has fchmod(2) syscall */
    911 #   define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
    912 #   define HASSETREUID	1	/* has setreuid(2) call */
    913 #   define HASSTRERROR	1	/* has strerror(3) */
    914 #   define HASFLOCK	0
    915 #   undef HASINITGROUPS		/* has initgroups(3) call */
    916 #   define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
    917 #   define IP_SRCROUTE	1	/* can check IP source routing */
    918 #   define TZ_TYPE	TZ_TMNAME	/* use tmname variable */
    919 #   define GIDSET_T	gid_t
    920 #   define LA_TYPE	LA_ZERO
    921 #   define SFS_TYPE	SFS_NONE
    922 #   define SPT_TYPE	SPT_REUSEARGV
    923 #   define SPT_PADCHAR	'\0'	/* pad process title with nulls */
    924 #   define HASGETUSERSHELL 0
    925 #   define _FILE_H_INCLUDED
    926 #  endif /* defined(__QNXNTO__) */
    927 # endif /* defined(__QNX__) */
    928 
    929 
    930 /*
    931 **  DragonFly BSD/ FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
    932 **
    933 **  4.3BSD clone, closer to 4.4BSD	for FreeBSD 1.x and NetBSD 0.9x
    934 **  4.4BSD-Lite based			for FreeBSD 2.x and NetBSD 1.x
    935 **
    936 **	See also BSD defines.
    937 */
    938 
    939 # if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
    940 #  include <paths.h>
    941 #  define HASUNSETENV	1	/* has unsetenv(3) call */
    942 #  define HASSETSID	1	/* has POSIX setsid(2) call */
    943 #  define USESETEUID	1	/* has usable seteuid(2) call */
    944 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
    945 #  define HASFCHOWN	1	/* has fchown(2) syscall */
    946 #  define HASUNAME	1	/* has uname(2) syscall */
    947 #  define HASSTRERROR	1	/* has strerror(3) */
    948 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
    949 #  define NEED_PRINTF_PERCENTQ	1	/* doesn't have %lld */
    950 #  include <sys/cdefs.h>
    951 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
    952 #  define BSD4_4_SOCKADDR	/* has sa_len */
    953 #  define NETLINK	1	/* supports AF_LINK */
    954 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
    955 #  define GIDSET_T	gid_t
    956 #  define QUAD_T	unsigned long long
    957 #  define HASSNPRINTF	1	/* has snprintf(3) (all versions?) */
    958 #  ifndef LA_TYPE
    959 #   define LA_TYPE	LA_SUBR
    960 #  endif /* ! LA_TYPE */
    961 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
    962     ((__NetBSD_Version__ >= 200040000 && __NetBSD_Version__ < 200090000) || \
    963     (__NetBSD_Version__ >= 299000900))
    964 #   undef SFS_TYPE
    965 #   define SFS_TYPE	SFS_STATVFS
    966 #  else
    967 #   define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
    968 #  endif
    969 #  if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
    970 #   undef SPT_TYPE
    971 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
    972 #  endif /* defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1) */
    973 #  if defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3))
    974 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
    975 #  endif /* defined(__NetBSD__) && ((__NetBSD_Version__ > 102070000) || (NetBSD1_2 > 8) || defined(NetBSD1_4) || defined(NetBSD1_3)) */
    976 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104170000
    977 #   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
    978 #  endif
    979 #  if defined(__NetBSD__) && defined(__NetBSD_Version__) && \
    980     ((__NetBSD_Version__ >= 200060000 && __NetBSD_Version__ < 200090000) || \
    981     (__NetBSD_Version__ >= 299000900))
    982 #   define HASCLOSEFROM	1	/* closefrom(3) added in 2.0F */
    983 #  endif
    984 #  if defined(__NetBSD__)
    985 #   define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
    986 #   include <sys/param.h>
    987 #   include <sys/sysctl.h>
    988 #  endif
    989 #  if defined(__DragonFly__)
    990 #   define HASSETLOGIN		1	/* has setlogin(2) */
    991 #   define HASSRANDOMDEV	1	/* has srandomdev(3) */
    992 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
    993 #   undef SPT_TYPE
    994 #   include <libutil.h>
    995 #   define SPT_TYPE		SPT_BUILTIN
    996 #   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
    997 #   ifndef SMRSH_CMDDIR
    998 #    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
    999 #   endif /* ! SMRSH_CMDDIR */
   1000 #   ifndef SMRSH_PATH
   1001 #    define SMRSH_PATH		"/bin:/usr/bin"
   1002 #   endif /* ! SMRSH_PATH */
   1003 #  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
   1004 #  include <sys/sysctl.h>
   1005 #  endif /* defined(__DragonFly__) */
   1006 #  if defined(__FreeBSD__)
   1007 #   define HASSETLOGIN	1	/* has setlogin(2) */
   1008 #   if __FreeBSD_version >= 227001
   1009 #    define HASSRANDOMDEV	1	/* has srandomdev(3) */
   1010 #    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
   1011 #   endif /* __FreeBSD_version >= 227001 */
   1012 #   undef SPT_TYPE
   1013 #   if __FreeBSD__ >= 2
   1014 #    include <osreldate.h>
   1015 #    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
   1016 #     include <libutil.h>
   1017 #     define SPT_TYPE	SPT_BUILTIN
   1018 #    endif /* __FreeBSD_version >= 199512 */
   1019 #    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
   1020 #     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
   1021 #    endif /* __FreeBSD_version >= 222000 */
   1022 #    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
   1023 #     ifndef SMRSH_CMDDIR
   1024 #      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
   1025 #     endif /* ! SMRSH_CMDDIR */
   1026 #     ifndef SMRSH_PATH
   1027 #      define SMRSH_PATH	"/bin:/usr/bin"
   1028 #     endif /* ! SMRSH_PATH */
   1029 #    endif /* __FreeBSD_version >= 330000 */
   1030 #    if __FreeBSD_version >= 430000	/* 4.3.0-release and later */
   1031 #     define SOCKADDR_LEN_T	socklen_t	/* e.g., arg#3 to accept, getsockname */
   1032 #     define SOCKOPT_LEN_T	socklen_t	/* arg#5 to getsockopt */
   1033 #    endif /* __FreeBSD_version >= 430000 */
   1034 #    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
   1035 #    include <sys/sysctl.h>
   1036 #   endif /* __FreeBSD__ >= 2 */
   1037 #   ifndef SPT_TYPE
   1038 #    define SPT_TYPE	SPT_REUSEARGV
   1039 #    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
   1040 #   endif /* ! SPT_TYPE */
   1041 #  endif /* defined(__FreeBSD__) */
   1042 #  if defined(__OpenBSD__)
   1043 #   undef SPT_TYPE
   1044 #   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
   1045 #   define HASSETLOGIN	1	/* has setlogin(2) */
   1046 #   if OpenBSD < 200305
   1047 #    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
   1048 #   endif /* OpenBSD < 200305 */
   1049 #   define HASSETEGID	1	/* use setegid(2) to set saved gid */
   1050 #   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
   1051 #   if OpenBSD >= 200006
   1052 #    define HASSRANDOMDEV	1	/* has srandomdev(3) */
   1053 #   endif /* OpenBSD >= 200006 */
   1054 #   if OpenBSD >= 200012
   1055 #    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
   1056 #   endif /* OpenBSD >= 200012 */
   1057 #   if OpenBSD >= 200405
   1058 #    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
   1059 #   endif /* OpenBSD >= 200405 */
   1060 #   if OpenBSD >= 200505
   1061 #    undef NETISO	/* iso.h removed in 3.7 */
   1062 #   endif /* OpenBSD >= 200505 */
   1063 #  endif /* defined(__OpenBSD__) */
   1064 # endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
   1065 
   1066 
   1067 /*
   1068 **  Mach386
   1069 **
   1070 **	For mt Xinu's Mach386 system.
   1071 */
   1072 
   1073 # if defined(MACH) && defined(i386) && !defined(__GNU__)
   1074 #  define MACH386	1
   1075 #  define HASUNSETENV	1	/* has unsetenv(3) call */
   1076 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1077 #  ifndef HASFLOCK
   1078 #   define HASFLOCK	1	/* has flock(2) call */
   1079 #  endif /* ! HASFLOCK */
   1080 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
   1081 #  define NEEDSTRTOL	1	/* need the strtol() function */
   1082 #  define setpgid	setpgrp
   1083 #  ifndef LA_TYPE
   1084 #   define LA_TYPE	LA_FLOAT
   1085 #  endif /* ! LA_TYPE */
   1086 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
   1087 #  undef HASSETVBUF		/* don't actually have setvbuf(3) */
   1088 #  undef WEXITSTATUS
   1089 #  undef WIFEXITED
   1090 #  ifndef _PATH_VENDOR_CF
   1091 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1092 #  endif /* ! _PATH_VENDOR_CF */
   1093 #  ifndef _PATH_SENDMAILPID
   1094 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1095 #  endif /* ! _PATH_SENDMAILPID */
   1096 # endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
   1097 
   1098 
   1099 
   1100 /*
   1101 **  GNU OS (hurd)
   1102 **	Largely BSD & posix compatible.
   1103 **	Port contributed by Miles Bader <miles (at) gnu.ai.mit.edu>.
   1104 **	Updated by Mark Kettenis <kettenis (at) wins.uva.nl>.
   1105 */
   1106 
   1107 # if defined(__GNU__) && !defined(NeXT)
   1108 #  include <paths.h>
   1109 #  define HASFCHMOD	1	/* has fchmod(2) call */
   1110 #  define HASFCHOWN	1	/* has fchown(2) call */
   1111 #  define HASUNAME	1	/* has uname(2) call */
   1112 #  define HASUNSETENV	1	/* has unsetenv(3) call */
   1113 #  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
   1114 #  define HASSTRERROR	1	/* has strerror(3) */
   1115 #  define GIDSET_T	gid_t
   1116 #  define SOCKADDR_LEN_T	socklen_t
   1117 #  define SOCKOPT_LEN_T	socklen_t
   1118 #  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
   1119 #   define LA_TYPE	LA_SUBR
   1120 #  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
   1121 #   define LA_TYPE	LA_MACH
   1122    /* GNU uses mach[34], which renames some rpcs from mach2.x. */
   1123 #   define host_self	mach_host_self
   1124 #  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
   1125 #  define SFS_TYPE	SFS_STATFS
   1126 #  define SPT_TYPE	SPT_CHANGEARGV
   1127 #  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
   1128 #  define BSD4_4_SOCKADDR	1	/* has sa_len */
   1129 #  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
   1130 #  define HAS_IN_H	1	/* GNU has netinet/in.h. */
   1131 /* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
   1132 #  define MAXPATHLEN	2048
   1133 # endif /* defined(__GNU__) && !defined(NeXT) */
   1134 
   1135 /*
   1136 **  4.3 BSD -- this is for very old systems
   1137 **
   1138 **	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
   1139 **
   1140 **	You'll also have to install a new resolver library.
   1141 **	I don't guarantee that support for this environment is complete.
   1142 */
   1143 
   1144 # if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
   1145 #  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
   1146 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
   1147 #  define ARBPTR_T	char *
   1148 #  define setpgid	setpgrp
   1149 #  ifndef LA_TYPE
   1150 #   define LA_TYPE	LA_FLOAT
   1151 #  endif /* ! LA_TYPE */
   1152 #  ifndef _PATH_VENDOR_CF
   1153 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1154 #  endif /* ! _PATH_VENDOR_CF */
   1155 #  ifndef IDENTPROTO
   1156 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   1157 #  endif /* ! IDENTPROTO */
   1158 #  undef WEXITSTATUS
   1159 #  undef WIFEXITED
   1160 typedef short		pid_t;
   1161 # endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
   1162 
   1163 
   1164 /*
   1165 **  SCO Unix
   1166 **
   1167 **	This includes three parts:
   1168 **
   1169 **	The first is for SCO OpenServer 5.
   1170 **	(Contributed by Keith Reynolds <keithr (at) sco.COM>).
   1171 **
   1172 **		SCO OpenServer 5 has a compiler version number macro,
   1173 **		which we can use to figure out what version we're on.
   1174 **		This may have to change in future releases.
   1175 **
   1176 **	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
   1177 **	(Contributed by Philippe Brand <phb (at) colombo.telesys-innov.fr>).
   1178 **
   1179 **	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
   1180 */
   1181 
   1182 /* SCO OpenServer 5 */
   1183 # if _SCO_DS >= 1
   1184 #  include <paths.h>
   1185 #  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
   1186 #  define HASFCHMOD	1	/* has fchmod(2) call */
   1187 #  define HASFCHOWN	1	/* has fchown(2) call */
   1188 #  define HASSETRLIMIT	1	/* has setrlimit(2) call */
   1189 #  define USESETEUID	1	/* has seteuid(2) call */
   1190 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1191 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
   1192 #  define RLIMIT_NEEDS_SYS_TIME_H	1
   1193 #  define LDA_USE_LOCKF	1
   1194 #  ifndef LA_TYPE
   1195 #   define LA_TYPE	LA_DEVSHORT
   1196 #  endif /* ! LA_TYPE */
   1197 #  define _PATH_AVENRUN	"/dev/table/avenrun"
   1198 #  ifndef _SCO_unix_4_2
   1199 #   define _SCO_unix_4_2
   1200 #  else /* ! _SCO_unix_4_2 */
   1201 #   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
   1202 #   define SOCKOPT_LEN_T	size_t	/* arg#5 to getsockopt */
   1203 #  endif /* ! _SCO_unix_4_2 */
   1204 # endif /* _SCO_DS >= 1 */
   1205 
   1206 /* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
   1207 # ifdef _SCO_unix_4_2
   1208 #  define _SCO_unix_
   1209 #  define HASSETREUID	1	/* has setreuid(2) call */
   1210 # endif /* _SCO_unix_4_2 */
   1211 
   1212 /* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
   1213 # ifdef _SCO_unix_
   1214 #  include <sys/stream.h>	/* needed for IP_SRCROUTE */
   1215 #  define SYSTEM5	1	/* include all the System V defines */
   1216 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1217 #  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
   1218 #  ifndef USE_SIGLONGJMP
   1219 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
   1220 #  endif /* ! USE_SIGLONGJMP */
   1221 #  define MAXPATHLEN	PATHSIZE
   1222 #  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
   1223 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   1224 #  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
   1225 #  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
   1226 #  define UID_T		uid_t
   1227 #  define GID_T		gid_t
   1228 #  define GIDSET_T	gid_t
   1229 #  define _PATH_UNIX		"/unix"
   1230 #  ifndef _PATH_VENDOR_CF
   1231 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1232 #  endif /* ! _PATH_VENDOR_CF */
   1233 #  ifndef _PATH_SENDMAILPID
   1234 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1235 #  endif /* ! _PATH_SENDMAILPID */
   1236 
   1237 /* stuff fixed in later releases */
   1238 #  ifndef _SCO_unix_4_2
   1239 #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   1240 #  endif /* ! _SCO_unix_4_2 */
   1241 
   1242 #  ifndef _SCO_DS
   1243 #   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
   1244 #   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
   1245 #   define NETUNIX	0	/* no unix domain socket support */
   1246 #   define LA_TYPE	LA_SHORT
   1247 #  endif /* ! _SCO_DS */
   1248 
   1249 # endif /* _SCO_unix_ */
   1250 
   1251 /*
   1252 **  ISC (SunSoft) Unix.
   1253 **
   1254 **	Contributed by J.J. Bailey <jjb (at) jagware.bcc.com>
   1255 */
   1256 
   1257 # ifdef ISC_UNIX
   1258 #  include <net/errno.h>
   1259 #  include <sys/stream.h>	/* needed for IP_SRCROUTE */
   1260 #  include <sys/bsdtypes.h>
   1261 #  define SYSTEM5	1	/* include all the System V defines */
   1262 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   1263 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1264 #  define HASSETREUID	1	/* has setreuid(2) call */
   1265 #  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
   1266 #  define NETUNIX	0	/* no unix domain socket support */
   1267 #  define MAXPATHLEN	1024
   1268 #  define LA_TYPE	LA_SHORT
   1269 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
   1270 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   1271 #  define _PATH_UNIX		"/unix"
   1272 #  ifndef _PATH_VENDOR_CF
   1273 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1274 #  endif /* ! _PATH_VENDOR_CF */
   1275 #  ifndef _PATH_SENDMAILPID
   1276 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1277 #  endif /* ! _PATH_SENDMAILPID */
   1278 # endif /* ISC_UNIX */
   1279 
   1280 
   1281 /*
   1282 **  Altos System V (5.3.1)
   1283 **	Contributed by Tim Rice <tim (at) trr.metro.net>.
   1284 */
   1285 
   1286 # ifdef ALTOS_SYSTEM_V
   1287 #  include <sys/stream.h>
   1288 #  include <limits.h>
   1289 #  define SYSTEM5	1	/* include all the System V defines */
   1290 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   1291 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1292 #  define WAITUNION	1	/* use "union wait" as wait argument type */
   1293 #  define NEEDFSYNC	1	/* no fsync(2) in system library */
   1294 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
   1295 #  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
   1296 #  define MAXPATHLEN	PATH_MAX
   1297 #  define LA_TYPE	LA_SHORT
   1298 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
   1299 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   1300 #  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
   1301 #  define NETUNIX	0	/* no unix domain socket support */
   1302 #  undef WIFEXITED
   1303 #  undef WEXITSTATUS
   1304 #  define strtoul	strtol	/* gcc library bogosity */
   1305 
   1306 typedef unsigned short	uid_t;
   1307 typedef unsigned short	gid_t;
   1308 typedef short		pid_t;
   1309 typedef unsigned long	mode_t;
   1310 
   1311 /* some stuff that should have been in the include files */
   1312 extern char		*malloc();
   1313 extern struct passwd	*getpwent();
   1314 extern struct passwd	*getpwnam();
   1315 extern struct passwd	*getpwuid();
   1316 extern char		*getenv();
   1317 extern struct group	*getgrgid();
   1318 extern struct group	*getgrnam();
   1319 
   1320 # endif /* ALTOS_SYSTEM_V */
   1321 
   1322 
   1323 /*
   1324 **  ConvexOS 11.0 and later
   1325 **
   1326 **	"Todd C. Miller" <millert (at) mroe.cs.colorado.edu> claims this
   1327 **	works on 9.1 as well.
   1328 **
   1329 **  ConvexOS 11.5 and later, should work on 11.0 as defined.
   1330 **  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
   1331 **
   1332 **	Eric Schnoebelen (eric (at) cirr.com) For CONVEX Computer Corp.
   1333 **		(now the CONVEX Technologies Center of Hewlett Packard)
   1334 */
   1335 
   1336 # ifdef _CONVEX_SOURCE
   1337 #  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
   1338 #  define HASINITGROUPS	1	/* has initgroups(3) */
   1339 #  define HASUNAME	1	/* use System V uname(2) system call */
   1340 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   1341 #  define HASUNSETENV	1	/* has unsetenv(3) */
   1342 #  define HASFLOCK	1	/* has flock(2) */
   1343 #  define HASSETRLIMIT	1	/* has setrlimit(2) */
   1344 #  define HASSETREUID	1	/* has setreuid(2) */
   1345 #  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
   1346 #  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
   1347 #  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
   1348 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
   1349 #  define LA_TYPE	LA_FLOAT
   1350 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
   1351 #  ifndef _PATH_VENDOR_CF
   1352 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1353 #  endif /* ! _PATH_VENDOR_CF */
   1354 #  ifndef S_IREAD
   1355 #   define S_IREAD	_S_IREAD
   1356 #   define S_IWRITE	_S_IWRITE
   1357 #   define S_IEXEC	_S_IEXEC
   1358 #   define S_IFMT	_S_IFMT
   1359 #   define S_IFCHR	_S_IFCHR
   1360 #   define S_IFBLK	_S_IFBLK
   1361 #  endif /* ! S_IREAD */
   1362 #  ifndef TZ_TYPE
   1363 #   define TZ_TYPE	TZ_TIMEZONE
   1364 #  endif /* ! TZ_TYPE */
   1365 #  ifndef IDENTPROTO
   1366 #   define IDENTPROTO	1
   1367 #  endif /* ! IDENTPROTO */
   1368 #  ifndef SHARE_V1
   1369 #   define SHARE_V1	1	/* version 1 of the fair share scheduler */
   1370 #  endif /* ! SHARE_V1 */
   1371 #  if !defined(__GNUC__ )
   1372 #   define UID_T	int		/* GNUC gets it right, ConvexC botches */
   1373 #   define GID_T	int		/* GNUC gets it right, ConvexC botches */
   1374 #  endif /* !defined(__GNUC__ ) */
   1375 #  if SECUREWARE
   1376 #   define FORK	fork		/* SecureWare wants the real fork! */
   1377 #  else /* SECUREWARE */
   1378 #   define FORK	vfork		/* the rest of the OS versions don't care */
   1379 #  endif /* SECUREWARE */
   1380 # endif /* _CONVEX_SOURCE */
   1381 
   1382 
   1383 /*
   1384 **  RISC/os 4.52
   1385 **
   1386 **	Gives a ton of warning messages, but otherwise compiles.
   1387 */
   1388 
   1389 # ifdef RISCOS
   1390 
   1391 #  define HASUNSETENV	1	/* has unsetenv(3) call */
   1392 #  ifndef HASFLOCK
   1393 #   define HASFLOCK	1	/* has flock(2) call */
   1394 #  endif /* ! HASFLOCK */
   1395 #  define WAITUNION	1	/* use "union wait" as wait argument type */
   1396 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
   1397 #  define NEEDPUTENV	1	/* need putenv(3) call */
   1398 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
   1399 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
   1400 #  define LA_TYPE	LA_INT
   1401 #  define LA_AVENRUN	"avenrun"
   1402 #  define _PATH_UNIX	"/unix"
   1403 #  undef WIFEXITED
   1404 
   1405 #  define setpgid	setpgrp
   1406 
   1407 typedef int		pid_t;
   1408 #  define SIGFUNC_DEFINED
   1409 #  define SIGFUNC_RETURN	(0)
   1410 #  define SIGFUNC_DECL	int
   1411 typedef int		(*sigfunc_t)();
   1412 extern char		*getenv();
   1413 extern void		*malloc();
   1414 
   1415 /* added for RISC/os 4.01...which is dumber than 4.50 */
   1416 #  ifdef RISCOS_4_0
   1417 #   ifndef ARBPTR_T
   1418 #    define ARBPTR_T	char *
   1419 #   endif /* ! ARBPTR_T */
   1420 #   undef HASFLOCK
   1421 #   define HASFLOCK	0
   1422 #  endif /* RISCOS_4_0 */
   1423 
   1424 #  include <sys/time.h>
   1425 
   1426 # endif /* RISCOS */
   1427 
   1428 
   1429 /*
   1430 **  Linux 0.99pl10 and above...
   1431 **
   1432 **  Thanks to, in reverse order of contact:
   1433 **
   1434 **	John Kennedy <warlock (at) csuchico.edu>
   1435 **	Andrew Pam <avatar (at) aus.xanadu.com>
   1436 **	Florian La Roche <rzsfl (at) rz.uni-sb.de>
   1437 **	Karl London <karl (at) borg.demon.co.uk>
   1438 **
   1439 **  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
   1440 **	file locking is no longer allowed.  In particular, make sure
   1441 **	your DBM library and sendmail are both using either flock(2)
   1442 **	*or* fcntl(2) file locking, but not both.
   1443 */
   1444 
   1445 # ifdef __linux__
   1446 #  include <linux/version.h>
   1447 #  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
   1448 #   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
   1449 #  endif /* !defined(KERNEL_VERSION) */
   1450 #  define BSD		1	/* include BSD defines */
   1451 #  define HASSETREGID	1	/* use setregid(2) to set saved gid */
   1452 #  ifndef REQUIRES_DIR_FSYNC
   1453 #   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
   1454 #  endif /* REQUIRES_DIR_FSYNC */
   1455 #  ifndef USESETEUID
   1456 #   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
   1457 #  endif /* USESETEUID */
   1458 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
   1459 #  define HASUNAME	1	/* use System V uname(2) system call */
   1460 #  define HASUNSETENV	1	/* has unsetenv(3) call */
   1461 #  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
   1462 #  define GIDSET_T	gid_t	/* from <linux/types.h> */
   1463 #  ifndef HASGETUSERSHELL
   1464 #   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
   1465 #  endif /* HASGETUSERSHELL */
   1466 #  ifndef IP_SRCROUTE
   1467 #   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
   1468 #  endif /* ! IP_SRCROUTE */
   1469 #  ifndef HAS_IN_H
   1470 #   define HAS_IN_H	1	/* use netinet/in.h */
   1471 #  endif /* ! HAS_IN_H */
   1472 #  ifndef USE_SIGLONGJMP
   1473 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
   1474 #  endif /* ! USE_SIGLONGJMP */
   1475 #  ifndef HASFLOCK
   1476 #   if LINUX_VERSION_CODE < 66399
   1477 #    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
   1478 #   else /* LINUX_VERSION_CODE < 66399 */
   1479 #     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
   1480 #      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
   1481 #     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
   1482 #      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
   1483 #     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
   1484 #   endif /* LINUX_VERSION_CODE < 66399 */
   1485 #  endif /* ! HASFLOCK */
   1486 #  ifndef LA_TYPE
   1487 #   define LA_TYPE	LA_PROCSTR
   1488 #  endif /* ! LA_TYPE */
   1489 #  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
   1490 #  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
   1491 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
   1492 #   ifndef HASURANDOMDEV
   1493 #    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
   1494 #   endif /* ! HASURANDOMDEV */
   1495 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
   1496 #  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
   1497 #   define HASSTRERROR	1	/* has strerror(3) */
   1498 #  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
   1499 #  ifndef TZ_TYPE
   1500 #   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
   1501 #  endif /* ! TZ_TYPE */
   1502 #  if (__GLIBC__ >= 2)
   1503 #   include <paths.h>
   1504 #  endif /* (__GLIBC__ >= 2) */
   1505 #  ifndef _PATH_SENDMAILPID
   1506 #   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
   1507 #  endif /* ! _PATH_SENDMAILPID */
   1508 #  include <sys/sysmacros.h>
   1509 #  undef atol			/* wounded in <stdlib.h> */
   1510 #  if NETINET6
   1511    /*
   1512    **  Linux doesn't have a good way to tell userland what interfaces are
   1513    **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
   1514    **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
   1515    **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
   1516    */
   1517 #   define ADDRCONFIG_IS_BROKEN	1
   1518 
   1519    /*
   1520    **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
   1521    **  in 2.1 and later, but the APIs appear before the functions.
   1522    */
   1523 #   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
   1524 #    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
   1525 #    if (GLIBC_VERSION >= 0x201)
   1526 #     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
   1527 #    else /* (GLIBC_VERSION >= 0x201) */
   1528 #     include <linux/in6.h>	/* IPv6 support */
   1529 #    endif /* (GLIBC_VERSION >= 0x201) */
   1530 #    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
   1531      /* Have APIs in <netdb.h>, but no support in glibc */
   1532 #     define NEEDSGETIPNODE	1
   1533 #    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
   1534 #    undef GLIBC_VERSION
   1535 #   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
   1536 #  endif /* NETINET6 */
   1537 #  ifndef HASFCHOWN
   1538 #   define HASFCHOWN	1	/* fchown(2) */
   1539 #  endif /* ! HASFCHOWN */
   1540 #  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
   1541 #    define HASFCHMOD	1	/* fchmod(2) */
   1542 #  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
   1543 # endif /* __linux__ */
   1544 
   1545 
   1546 /*
   1547 **  DELL SVR4 Issue 2.2, and others
   1548 **	From Kimmo Suominen <kim (at) grendel.lut.fi>
   1549 **
   1550 **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
   1551 **	defined, and the definitions conflict.
   1552 **
   1553 **	Peter Wemm <peter (at) perth.DIALix.oz.au> claims that the setreuid
   1554 **	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
   1555 **	(SVR4.0/386 version 3.0).
   1556 */
   1557 
   1558 # ifdef DELL_SVR4
   1559 				/* no changes necessary */
   1560 				/* see general __svr4__ defines below */
   1561 # endif /* DELL_SVR4 */
   1562 
   1563 
   1564 /*
   1565 **  Apple A/UX 3.0
   1566 */
   1567 
   1568 # ifdef _AUX_SOURCE
   1569 #  include <sys/sysmacros.h>
   1570 #  define BSD			/* has BSD routines */
   1571 #  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
   1572 #  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
   1573 #  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
   1574 #  define HASUNAME	1	/* use System V uname(2) system call */
   1575 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
   1576 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1577 #  define HASSETVBUF	1	/* has setvbuf(3) in libc */
   1578 #  define HASSTRERROR	1	/* has strerror(3) */
   1579 #  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
   1580 #  define SIGFUNC_RETURN		/* POSIX-mode */
   1581 #  define SIGFUNC_DECL	void	/* POSIX-mode */
   1582 #  define ERRLIST_PREDEFINED	1
   1583 #  ifndef IDENTPROTO
   1584 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   1585 #  endif /* ! IDENTPROTO */
   1586 #  ifndef LA_TYPE
   1587 #   define LA_TYPE	LA_INT
   1588 #   define FSHIFT	16
   1589 #  endif /* ! LA_TYPE */
   1590 #  define LA_AVENRUN	"avenrun"
   1591 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
   1592 #  define TZ_TYPE	TZ_TZNAME
   1593 #  ifndef _PATH_UNIX
   1594 #   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
   1595 #  endif /* ! _PATH_UNIX */
   1596 #  ifndef _PATH_VENDOR_CF
   1597 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1598 #  endif /* ! _PATH_VENDOR_CF */
   1599 #  undef WIFEXITED
   1600 #  undef WEXITSTATUS
   1601 # endif /* _AUX_SOURCE */
   1602 
   1603 
   1604 /*
   1605 **  Encore UMAX V
   1606 **
   1607 **	Not extensively tested.
   1608 */
   1609 
   1610 # ifdef UMAXV
   1611 #  define HASUNAME	1	/* use System V uname(2) system call */
   1612 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
   1613 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1614 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1615 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   1616 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
   1617 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
   1618 #  define MAXPATHLEN	PATH_MAX
   1619 extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
   1620 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
   1621 #  undef WIFEXITED
   1622 #  undef WEXITSTATUS
   1623 # endif /* UMAXV */
   1624 
   1625 
   1626 /*
   1627 **  Stardent Titan 3000 running TitanOS 4.2.
   1628 **
   1629 **	Must be compiled in "cc -43" mode.
   1630 **
   1631 **	From Kate Hedstrom <kate (at) ahab.rutgers.edu>.
   1632 **
   1633 **	Note the tweaking below after the BSD defines are set.
   1634 */
   1635 
   1636 # ifdef titan
   1637 #  define setpgid	setpgrp
   1638 typedef int		pid_t;
   1639 #  undef WIFEXITED
   1640 #  undef WEXITSTATUS
   1641 # endif /* titan */
   1642 
   1643 
   1644 /*
   1645 **  Sequent DYNIX 3.2.0
   1646 **
   1647 **	From Jim Davis <jdavis (at) cs.arizona.edu>.
   1648 */
   1649 
   1650 # ifdef sequent
   1651 
   1652 #  define BSD		1
   1653 #  define HASUNSETENV	1
   1654 #  define BSD4_3		1	/* to get signal() in conf.c */
   1655 #  define WAITUNION	1
   1656 #  define LA_TYPE	LA_FLOAT
   1657 #  ifdef _POSIX_VERSION
   1658 #   undef _POSIX_VERSION		/* set in <unistd.h> */
   1659 #  endif /* _POSIX_VERSION */
   1660 #  undef HASSETVBUF		/* don't actually have setvbuf(3) */
   1661 #  define setpgid	setpgrp
   1662 
   1663 /* Have to redefine WIFEXITED to take an int, to work with waitfor() */
   1664 #  undef	WIFEXITED
   1665 #  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
   1666 			 ((union wait*)&(s))->w_termsig == 0)
   1667 #  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
   1668 typedef int		pid_t;
   1669 #  define isgraph(c)	(isprint(c) && (c != ' '))
   1670 
   1671 #  ifndef IDENTPROTO
   1672 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   1673 #  endif /* ! IDENTPROTO */
   1674 
   1675 #  ifndef _PATH_UNIX
   1676 #   define _PATH_UNIX		"/dynix"
   1677 #  endif /* ! _PATH_UNIX */
   1678 #  ifndef _PATH_VENDOR_CF
   1679 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1680 #  endif /* ! _PATH_VENDOR_CF */
   1681 # endif /* sequent */
   1682 
   1683 
   1684 /*
   1685 **  Sequent DYNIX/ptx v2.0 (and higher)
   1686 **
   1687 **	For DYNIX/ptx v1.x, undefine HASSETREUID.
   1688 **
   1689 **	From Tim Wright <timw (at) sequent.com>.
   1690 **	Update from Jack Woolley <jwoolley (at) sctcorp.com>, 26 Dec 1995,
   1691 **		for DYNIX/ptx 4.0.2.
   1692 */
   1693 
   1694 # ifdef _SEQUENT_
   1695 #  include <sys/stream.h>
   1696 #  define SYSTEM5	1	/* include all the System V defines */
   1697 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   1698 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1699 #  define HASSETREUID	1	/* has setreuid(2) call */
   1700 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1701 #  define GIDSET_T	gid_t
   1702 #  define LA_TYPE	LA_INT
   1703 #  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
   1704 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
   1705 #  ifndef IDENTPROTO
   1706 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   1707 #  endif /* ! IDENTPROTO */
   1708 #  ifndef _PATH_VENDOR_CF
   1709 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1710 #  endif /* ! _PATH_VENDOR_CF */
   1711 #  ifndef _PATH_SENDMAILPID
   1712 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1713 #  endif /* ! _PATH_SENDMAILPID */
   1714 # endif /* _SEQUENT_ */
   1715 
   1716 /*
   1717 **  Cray UNICOS, UNICOS/mk, and UNICOS/mp
   1718 **
   1719 **    UNICOS:
   1720 **	Ported by David L. Kensiski, Sterling Sofware <kensiski (at) nas.nasa.gov>
   1721 **	Update Brian Ginsbach <ginsbach (at) cray.com>
   1722 **    UNICOS/mk (Cray T3E):
   1723 **	Contributed by Manu Mahonen <mailadm (at) csc.fi>
   1724 **	of Center for Scientific Computing.
   1725 **	Update Brian Ginsbach <ginsbach (at) cray.com>
   1726 **    UNICOS/mp:
   1727 **	From Aaron Davis <awd (at) cray.com> & Brian Ginsbach <ginsbach (at) cray.com>
   1728 */
   1729 
   1730 # if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
   1731 #  define SYSTEM5	1	/* include all the System V defines */
   1732 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
   1733 #  define HASFCHOWN	1	/* has fchown(2) */
   1734 #  define HASUNSETENV	1	/* has unsetenv(3) call */
   1735 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   1736 #  define HASSETREUID	1	/* has setreuid(2) call */
   1737 #  define USESETEUID	1	/* has usable seteuid(2) call */
   1738 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
   1739 #  define HASSTRERROR	1	/* has strerror(3) */
   1740 #  define GIDSET_T	gid_t
   1741 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
   1742 #  define SFS_BAVAIL	f_bfree	/* alternate field name */
   1743 #  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
   1744 #  ifdef UNICOS
   1745 #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   1746 #   define LA_TYPE	LA_ZERO
   1747 #   define _PATH_MAILDIR	"/usr/spool/mail"
   1748 #   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
   1749 #   ifndef MAXPATHLEN
   1750 #    define MAXPATHLEN PATHSIZE
   1751 #   endif /* ! MAXPATHLEN */
   1752 #   ifndef _PATH_UNIX
   1753 #    ifdef UNICOSMK
   1754 #     define _PATH_UNIX		"/unicosmk.ar"
   1755 #    else
   1756 #     define _PATH_UNIX		"/unicos"
   1757 #    endif /* UNICOSMK */
   1758 #   endif /* ! _PATH_UNIX */
   1759 #   ifndef _PATH_VENDOR_CF
   1760 #    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1761 #   endif /* ! _PATH_VENDOR_CF */
   1762 #  endif /* UNICOS */
   1763 #  ifdef _UNICOSMP
   1764 #  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
   1765     /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
   1766 #   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
   1767 #  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
   1768 #   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
   1769 #   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
   1770 #   define LA_TYPE	LA_IRIX6	/* figure out at run time */
   1771 #   include <sys/cdefs.h>
   1772 #   include <paths.h>
   1773 #   define ARGV_T char *const *
   1774 #  endif /* _UNICOSMP */
   1775 # endif /* _CRAY */
   1776 
   1777 /*
   1778 **  Apollo DomainOS
   1779 **
   1780 **  From Todd Martin <tmartint (at) tus.ssi1.com> & Don Lewis <gdonl (at) gv.ssi1.com>
   1781 **
   1782 **  15 Jan 1994; updated 2 Aug 1995
   1783 **
   1784 */
   1785 
   1786 # ifdef apollo
   1787 #  define HASSETREUID	1	/* has setreuid(2) call */
   1788 #  define HASINITGROUPS	1	/* has initgroups(2) call */
   1789 #  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
   1790 #  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
   1791 #  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
   1792 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
   1793 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   1794 #  define TZ_TYPE	TZ_TZNAME
   1795 #  ifndef _PATH_VENDOR_CF
   1796 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   1797 #  endif /* ! _PATH_VENDOR_CF */
   1798 #  ifndef _PATH_SENDMAILPID
   1799 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1800 #  endif /* ! _PATH_SENDMAILPID */
   1801 #  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
   1802 #  undef	 S_IFIFO
   1803 #  define S_IFIFO	0010000
   1804 #  ifndef IDENTPROTO
   1805 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   1806 #  endif /* ! IDENTPROTO */
   1807 #  define RLIMIT_NEEDS_SYS_TIME_H	1
   1808 #  if defined(NGROUPS_MAX) && !NGROUPS_MAX
   1809 #   undef NGROUPS_MAX
   1810 #  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
   1811 # endif /* apollo */
   1812 
   1813 /*
   1814 **  MPE-iX
   1815 **
   1816 **	Requires MPE 6.0 or greater.  See sendmail/README for more info.
   1817 **
   1818 **	From Mark Bixby <mark_bixby (at) hp.com> or <mark (at) bixby.org>.
   1819 */
   1820 
   1821 # ifdef MPE
   1822 
   1823 #  include <sys/sysmacros.h>
   1824 #  include <fcntl.h>
   1825 
   1826 /* Sendmail stuff */
   1827 #  define HASFCHOWN		0	/* lacks fchown() */
   1828 #  define HASGETUSERSHELL	0	/* lacks getusershell() */
   1829 #  ifdef HASNICE
   1830 #   undef  HASNICE
   1831 #  endif /* HASNICE */
   1832 #  define HASNICE		0	/* lacks nice() */
   1833 #  define HASRANDOM		0	/* lacks random() */
   1834 #  ifdef HASRRESVPORT
   1835 #   undef HASRRESVPORT
   1836 #  endif /* HASRRESVPORT */
   1837 #  define HASRRESVPORT		0	/* lacks rresvport() */
   1838 #  define IP_SRCROUTE		0	/* lacks IP source routing fields */
   1839 #  ifdef MATCHGECOS
   1840 #   undef MATCHGECOS
   1841 #  endif /* MATCHGECOS */
   1842 #  define MATCHGECOS		0	/* lacks an initialized GECOS field */
   1843 #  define NEEDFSYNC		1	/* use sendmail's fsync() */
   1844 #  define NEEDLINK		1	/* use sendmail's link() */
   1845 #  define NOFTRUNCATE		1	/* lacks ftruncate() */
   1846 #  define SFS_TYPE		SFS_NONE /* can't determine disk space */
   1847 #  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
   1848 #  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
   1849 #  define USE_ENVIRON		1	/* use environ instead of envp */
   1850 
   1851 /* Missing header stuff */
   1852 #  define AF_UNSPEC		0
   1853 #  define AF_MAX		AF_INET
   1854 #  define IFF_LOOPBACK		0x8
   1855 #  define IN_LOOPBACKNET	127
   1856 #  define MAXNAMLEN		NAME_MAX
   1857 #  define S_IEXEC		S_IXUSR
   1858 #  define S_IREAD		S_IRUSR
   1859 #  define S_IWRITE		S_IWUSR
   1860 
   1861 /* Present header stuff that needs to be missing */
   1862 #  undef NGROUPS_MAX
   1863 
   1864 /* Shadow functions */
   1865 #  define bind		sendmail_mpe_bind
   1866 #  define _exit		sendmail_mpe__exit
   1867 #  define exit		sendmail_mpe_exit
   1868 #  define fcntl		sendmail_mpe_fcntl
   1869 #  define getegid	sendmail_mpe_getegid
   1870 #  define geteuid	sendmail_mpe_geteuid
   1871 #  define getpwnam	sendmail_mpe_getpwnam
   1872 #  define getpwuid	sendmail_mpe_getpwuid
   1873 #  define setgid	sendmail_mpe_setgid
   1874 #  define setuid	sendmail_mpe_setuid
   1875 extern int		sendmail_mpe_fcntl __P((int, int, ...));
   1876 extern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
   1877 extern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
   1878 # endif /* MPE */
   1879 
   1880 /*
   1881 **  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
   1882 **
   1883 **	Contributed by Paul Gampe <paulg (at) apnic.net>
   1884 */
   1885 
   1886 # ifdef __svr5__
   1887 #  include <sys/mkdev.h>
   1888 #  define __svr4__
   1889 #  define SYS5SIGNALS		1
   1890 #  define HASFCHOWN		1	/* has fchown(2) call */
   1891 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   1892 #  define HASSETREUID		1
   1893 #  define HASWAITPID		1
   1894 #  define HASGETDTABLESIZE	1
   1895 #  define GIDSET_T		gid_t
   1896 #  define SOCKADDR_LEN_T	size_t
   1897 #  define SOCKOPT_LEN_T		size_t
   1898 #  ifndef _PATH_UNIX
   1899 #   define _PATH_UNIX		"/stand/unix"
   1900 #  endif /* ! _PATH_UNIX */
   1901 #  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
   1902 #  ifndef SYSLOG_BUFSIZE
   1903 #   define SYSLOG_BUFSIZE	1024	/* unsure */
   1904 #  endif /* ! SYSLOG_BUFSIZE */
   1905 #  ifndef _PATH_VENDOR_CF
   1906 #   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
   1907 #  endif /* ! _PATH_VENDOR_CF */
   1908 #  ifndef _PATH_SENDMAILPID
   1909 #   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
   1910 #  endif /* ! _PATH_SENDMAILPID */
   1911 #  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
   1912 #if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
   1913 # define SM_SET_H_ERRNO(err)	set_h_errno((err))
   1914 #endif /* ! SM_SET_H_ERRNO && _REENTRANT */
   1915 # endif /* __svr5__ */
   1916 
   1917 /* ###################################################################### */
   1918 
   1919 /*
   1920 **  UnixWare 2.x
   1921 */
   1922 
   1923 # ifdef UNIXWARE2
   1924 #  define UNIXWARE	1
   1925 #  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
   1926 # endif /* UNIXWARE2 */
   1927 
   1928 
   1929 /*
   1930 **  UnixWare 1.1.2.
   1931 **
   1932 **	Updated by Petr Lampa <lampa (at) fee.vutbr.cz>.
   1933 **	From Evan Champion <evanc (at) spatial.synapse.org>.
   1934 */
   1935 
   1936 # ifdef UNIXWARE
   1937 #  include <sys/mkdev.h>
   1938 #  define SYSTEM5		1
   1939 #  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
   1940 #  define HASSETREUID		1
   1941 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   1942 #  define HASINITGROUPS		1
   1943 #  define GIDSET_T		gid_t
   1944 #  define SLEEP_T		unsigned
   1945 #  define SFS_TYPE		SFS_STATVFS
   1946 #  define LA_TYPE		LA_ZERO
   1947 #  undef WIFEXITED
   1948 #  undef WEXITSTATUS
   1949 #  ifndef _PATH_UNIX
   1950 #   define _PATH_UNIX		"/unix"
   1951 #  endif /* ! _PATH_UNIX */
   1952 #  ifndef _PATH_VENDOR_CF
   1953 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
   1954 #  endif /* ! _PATH_VENDOR_CF */
   1955 #  ifndef _PATH_SENDMAILPID
   1956 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
   1957 #  endif /* ! _PATH_SENDMAILPID */
   1958 #  define SYSLOG_BUFSIZE	128
   1959 # endif /* UNIXWARE */
   1960 
   1961 
   1962 /*
   1963 **  Intergraph CLIX 3.1
   1964 **
   1965 **	From Paul Southworth <pauls (at) locust.cic.net>
   1966 */
   1967 
   1968 # ifdef CLIX
   1969 #  define SYSTEM5	1	/* looks like System V */
   1970 #  ifndef HASGETUSERSHELL
   1971 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   1972 #  endif /* ! HASGETUSERSHELL */
   1973 #  define DEV_BSIZE	512	/* device block size not defined */
   1974 #  define GIDSET_T	gid_t
   1975 #  undef LOG			/* syslog not available */
   1976 #  define NEEDFSYNC	1	/* no fsync in system library */
   1977 #  define GETSHORT	_getshort
   1978 # endif /* CLIX */
   1979 
   1980 
   1981 /*
   1982 **  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
   1983 **
   1984 **	From Kevin Darcy <kevin (at) tech.mis.cfc.com>.
   1985 */
   1986 
   1987 # ifdef NCR_MP_RAS2
   1988 #  include <sys/sockio.h>
   1989 #  define __svr4__
   1990 #  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
   1991 #  define SYSLOG_BUFSIZE	1024
   1992 #  define SPT_TYPE  SPT_NONE
   1993 # endif /* NCR_MP_RAS2 */
   1994 
   1995 
   1996 /*
   1997 **  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
   1998 **
   1999 **	From Tom Moore <Tom.Moore (at) DaytonOH.NCR.COM>
   2000 */
   2001 
   2002 # ifdef NCR_MP_RAS3
   2003 #  define __svr4__
   2004 #  define HASFCHOWN		1	/* has fchown(2) call */
   2005 #  define LDA_USE_LOCKF		1
   2006 #  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
   2007 #  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
   2008 #  define SYSLOG_BUFSIZE	1024
   2009 #  define SPT_TYPE	SPT_NONE
   2010 #  define _PATH_MAILDIR	"/var/mail"
   2011 #  ifndef _XOPEN_SOURCE
   2012 #   define _XOPEN_SOURCE
   2013 #   define _XOPEN_SOURCE_EXTENDED 1
   2014 #   include <sys/resource.h>
   2015 #   undef _XOPEN_SOURCE
   2016 #   undef _XOPEN_SOURCE_EXTENDED
   2017 #  endif /* ! _XOPEN_SOURCE */
   2018 # endif /* NCR_MP_RAS3 */
   2019 
   2020 
   2021 /*
   2022 **  Tandem NonStop-UX SVR4
   2023 **
   2024 **	From Rick McCarty <mccarty (at) mpd.tandem.com>.
   2025 */
   2026 
   2027 # ifdef NonStop_UX_BXX
   2028 #  define __svr4__
   2029 # endif /* NonStop_UX_BXX */
   2030 
   2031 
   2032 /*
   2033 **  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
   2034 **
   2035 **	Tested for 1.04, 1.03
   2036 **	From Akihiro Hashimoto ("Hash") <hash (at) dominic.ipc.chiba-u.ac.jp>.
   2037 **
   2038 **	Tested for 4.02, 6.10 and 7.10
   2039 **	From Motonori NAKAMURA <motonori (at) media.kyoto-u.ac.jp>.
   2040 */
   2041 
   2042 # if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
   2043 #  define SYSTEM5	1	/* include all the System V defines */
   2044 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   2045 #  define HASFCHMOD	1	/* has fchmod(2) syscall */
   2046 #  define setreuid(r, e)	setresuid(r, e, -1)
   2047 #  define LA_TYPE	LA_FLOAT
   2048 #  define SPT_TYPE	SPT_PSTAT
   2049 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
   2050 #  ifndef HASSETVBUF
   2051 #   define HASSETVBUF	/* HI-UX has no setlinebuf */
   2052 #  endif /* ! HASSETVBUF */
   2053 #  ifndef GIDSET_T
   2054 #   define GIDSET_T	gid_t
   2055 #  endif /* ! GIDSET_T */
   2056 #  ifndef _PATH_UNIX
   2057 #   define _PATH_UNIX		"/HI-UX"
   2058 #  endif /* ! _PATH_UNIX */
   2059 #  ifndef _PATH_VENDOR_CF
   2060 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   2061 #  endif /* ! _PATH_VENDOR_CF */
   2062 #  ifndef IDENTPROTO
   2063 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   2064 #  endif /* ! IDENTPROTO */
   2065 #  ifndef HASGETUSERSHELL
   2066 #   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
   2067 #  endif /* ! HASGETUSERSHELL */
   2068 #  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
   2069 
   2070 /*
   2071 **  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
   2072 **  on HIUX 3050
   2073 */
   2074 #  undef m_flags
   2075 
   2076 #  define SM_CONF_SYSLOG	0
   2077 
   2078 # endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
   2079 
   2080 
   2081 /*
   2082 **  Amdahl UTS System V 2.1.5 (SVr3-based)
   2083 **
   2084 **    From: Janet Jackson <janet (at) dialix.oz.au>.
   2085 */
   2086 
   2087 # ifdef _UTS
   2088 #  include <sys/sysmacros.h>
   2089 #  undef HASLSTAT		/* has symlinks, but they cause problems */
   2090 #  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
   2091 #  define SYS5SIGNALS	1	/* System V signal semantics */
   2092 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
   2093 #  define HASUNAME	1	/* use System V uname(2) system call */
   2094 #  define HASINITGROUPS	1	/* has initgroups(3) function */
   2095 #  define HASSETVBUF	1	/* has setvbuf(3) function */
   2096 #  ifndef HASGETUSERSHELL
   2097 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
   2098 #  endif /* ! HASGETUSERSHELL */
   2099 #  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
   2100 #  define LA_TYPE	LA_ZERO		/* doesn't have load average */
   2101 #  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
   2102 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   2103 #  define _PATH_UNIX		"/unix"
   2104 #  ifndef _PATH_VENDOR_CF
   2105 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   2106 #  endif /* ! _PATH_VENDOR_CF */
   2107 # endif /* _UTS */
   2108 
   2109 /*
   2110 **  Cray Computer Corporation's CSOS
   2111 **
   2112 **	From Scott Bolte <scott (at) craycos.com>.
   2113 */
   2114 
   2115 # ifdef _CRAYCOM
   2116 #  define SYSTEM5	1	/* include all the System V defines */
   2117 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   2118 #  define NEEDFSYNC	1	/* no fsync in system library */
   2119 #  define MAXPATHLEN	PATHSIZE
   2120 #  define LA_TYPE	LA_ZERO
   2121 #  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
   2122 #  define SFS_BAVAIL	f_bfree		/* alternate field name */
   2123 #  define _POSIX_CHOWN_RESTRICTED	-1
   2124 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
   2125 # endif /* _CRAYCOM */
   2126 
   2127 
   2128 /*
   2129 **  Sony NEWS-OS 4.2.1R and 6.0.3
   2130 **
   2131 **	From Motonori NAKAMURA <motonori (at) cs.ritsumei.ac.jp>.
   2132 */
   2133 
   2134 # ifdef sony_news
   2135 #  ifndef __svr4
   2136 			/* NEWS-OS 4.2.1R */
   2137 #   ifndef BSD
   2138 #    define BSD			/* has BSD routines */
   2139 #   endif /* ! BSD */
   2140 #   define HASUNSETENV	1	/* has unsetenv(2) call */
   2141 #   undef HASSETVBUF		/* don't actually have setvbuf(3) */
   2142 #   define WAITUNION	1	/* use "union wait" as wait argument type */
   2143 #   define LA_TYPE	LA_INT
   2144 #   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
   2145 #   ifndef HASFLOCK
   2146 #    define HASFLOCK	1	/* has flock(2) call */
   2147 #   endif /* ! HASFLOCK */
   2148 #   define setpgid	setpgrp
   2149 #   undef WIFEXITED
   2150 #   undef WEXITSTATUS
   2151 #   define MODE_T	int	/* system include files have no mode_t */
   2152 typedef int		pid_t;
   2153 typedef int		(*sigfunc_t)();
   2154 #   define SIGFUNC_DEFINED
   2155 #   define SIGFUNC_RETURN	(0)
   2156 #   define SIGFUNC_DECL		int
   2157 
   2158 #  else /* ! __svr4 */
   2159 			/* NEWS-OS 6.0.3 with /bin/cc */
   2160 #   ifndef __svr4__
   2161 #    define __svr4__		/* use all System V Release 4 defines below */
   2162 #   endif /* ! __svr4__ */
   2163 #   define HASSETSID	1	/* has POSIX setsid(2) call */
   2164 #   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
   2165 #   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
   2166 #   ifndef SPT_TYPE
   2167 #    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
   2168 #   endif /* ! SPT_TYPE */
   2169 #   define GIDSET_T	gid_t
   2170 #   undef WIFEXITED
   2171 #   undef WEXITSTATUS
   2172 #   ifndef SYSLOG_BUFSIZE
   2173 #    define SYSLOG_BUFSIZE	256
   2174 #   endif /* ! SYSLOG_BUFSIZE */
   2175 #   define _PATH_UNIX		"/stand/unix"
   2176 #   ifndef _PATH_VENDOR_CF
   2177 #    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
   2178 #   endif /* ! _PATH_VENDOR_CF */
   2179 #   ifndef _PATH_SENDMAILPID
   2180 #    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
   2181 #   endif /* ! _PATH_SENDMAILPID */
   2182 
   2183 #  endif /* ! __svr4 */
   2184 # endif /* sony_news */
   2185 
   2186 
   2187 /*
   2188 **  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
   2189 **
   2190 **	From Motonori NAKAMURA <motonori (at) cs.ritsumei.ac.jp>.
   2191 */
   2192 
   2193 # ifdef luna
   2194 #  ifndef IDENTPROTO
   2195 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   2196 #  endif /* ! IDENTPROTO */
   2197 #  define HASUNSETENV	1	/* has unsetenv(2) call */
   2198 #  define NEEDPUTENV	1	/* need putenv(3) call */
   2199 #  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
   2200 #  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
   2201 #  define WAITUNION	1	/* use "union wait" as wait argument type */
   2202 #  ifdef uniosb
   2203 #   include <sys/time.h>
   2204 #   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
   2205 #   define LA_TYPE	LA_INT
   2206 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
   2207 #  endif /* uniosb */
   2208 #  ifdef luna2
   2209 #   define LA_TYPE	LA_SUBR
   2210 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
   2211 #  endif /* luna2 */
   2212 #  ifdef luna88k
   2213 #   define LA_TYPE	LA_INT
   2214 #  endif /* luna88k */
   2215 #  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
   2216 #  define setpgid	setpgrp
   2217 #  undef WIFEXITED
   2218 #  undef WEXITSTATUS
   2219 typedef int		pid_t;
   2220 typedef int		(*sigfunc_t)();
   2221 #  define SIGFUNC_DEFINED
   2222 #  define SIGFUNC_RETURN	(0)
   2223 #  define SIGFUNC_DECL	int
   2224 extern char	*getenv();
   2225 #  ifndef _PATH_VENDOR_CF
   2226 #   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
   2227 #  endif /* ! _PATH_VENDOR_CF */
   2228 # endif /* luna */
   2229 
   2230 
   2231 /*
   2232 **  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
   2233 **
   2234 **	From Motonori NAKAMURA <motonori (at) cs.ritsumei.ac.jp>.
   2235 */
   2236 
   2237 # if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
   2238 #  ifndef __svr4__
   2239 #   define __svr4__		/* use all System V Release 4 defines below */
   2240 #  endif /* ! __svr4__ */
   2241 #  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
   2242 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   2243 #  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
   2244 #  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
   2245 #  define GIDSET_T	gid_t
   2246 #  undef WIFEXITED
   2247 #  undef WEXITSTATUS
   2248 #  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
   2249 #  ifndef _PATH_VENDOR_CF
   2250 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
   2251 #  endif /* ! _PATH_VENDOR_CF */
   2252 #  ifndef _PATH_SENDMAILPID
   2253 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
   2254 #  endif /* ! _PATH_SENDMAILPID */
   2255 #  ifndef SYSLOG_BUFSIZE
   2256 #   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
   2257 #  endif /* ! SYSLOG_BUFSIZE */
   2258 # endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
   2259 
   2260 
   2261 /*
   2262 **  Fujitsu/ICL UXP/DS (For the DS/90 Series)
   2263 **
   2264 **	From Diego R. Lopez <drlopez (at) cica.es>.
   2265 **	Additional changes from Fumio Moriya and Toshiaki Nomura of the
   2266 **		Fujitsu Fresoftware group <dsfrsoft (at) oai6.yk.fujitsu.co.jp>.
   2267 */
   2268 
   2269 # ifdef __uxp__
   2270 #  include <arpa/nameser.h>
   2271 #  include <sys/sysmacros.h>
   2272 #  include <sys/mkdev.h>
   2273 #  define __svr4__
   2274 #  define HASGETUSERSHELL	0
   2275 #  define HASFLOCK		0
   2276 #  define _PATH_UNIX		"/stand/unix"
   2277 #  ifndef _PATH_VENDOR_CF
   2278 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
   2279 #  endif /* ! _PATH_VENDOR_CF */
   2280 #  ifndef _PATH_SENDMAILPID
   2281 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
   2282 #  endif /* ! _PATH_SENDMAILPID */
   2283 # endif /* __uxp__ */
   2284 
   2285 /*
   2286 **  Pyramid DC/OSx
   2287 **
   2288 **	From Earle Ake <akee (at) wpdiss1.wpafb.af.mil>.
   2289 */
   2290 
   2291 # ifdef DCOSx
   2292 #  define GIDSET_T	gid_t
   2293 #  ifndef IDENTPROTO
   2294 #   define IDENTPROTO	0	/* TCP/IP implementation is broken */
   2295 #  endif /* ! IDENTPROTO */
   2296 # endif /* DCOSx */
   2297 
   2298 /*
   2299 **  Concurrent Computer Corporation Maxion
   2300 **
   2301 **	From Donald R. Laster Jr. <laster (at) access.digex.net>.
   2302 */
   2303 
   2304 # ifdef __MAXION__
   2305 
   2306 #  include <sys/stream.h>
   2307 #  define __svr4__		1	/* SVR4.2MP */
   2308 #  define HASSETREUID		1	/* have setreuid(2) */
   2309 #  define HASLSTAT		1	/* have lstat(2) */
   2310 #  define HASSETRLIMIT		1	/* have setrlimit(2) */
   2311 #  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
   2312 #  define HASGETUSERSHELL	1	/* have getusershell(3) */
   2313 #  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
   2314 #  define SLEEP_T		unsigned
   2315 #  define SFS_TYPE		SFS_STATVFS
   2316 #  define SFS_BAVAIL		f_bavail
   2317 #  ifndef SYSLOG_BUFSIZE
   2318 #   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
   2319 #  endif /* ! SYSLOG_BUFSIZE */
   2320 
   2321 #  undef WUNTRACED
   2322 #  undef WIFEXITED
   2323 #  undef WIFSIGNALED
   2324 #  undef WIFSTOPPED
   2325 #  undef WEXITSTATUS
   2326 #  undef WTERMSIG
   2327 #  undef WSTOPSIG
   2328 
   2329 # endif /* __MAXION__ */
   2330 
   2331 /*
   2332 **  Harris Nighthawk PowerUX (nh6000 box)
   2333 **
   2334 **  Contributed by Bob Miorelli, Pratt & Whitney <miorelli (at) pweh.com>
   2335 */
   2336 
   2337 # ifdef _PowerUX
   2338 #  ifndef __svr4__
   2339 #   define __svr4__
   2340 #  endif /* ! __svr4__ */
   2341 #  ifndef _PATH_VENDOR_CF
   2342 #   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
   2343 #  endif /* ! _PATH_VENDOR_CF */
   2344 #  ifndef _PATH_SENDMAILPID
   2345 #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
   2346 #  endif /* ! _PATH_SENDMAILPID */
   2347 #  define SYSLOG_BUFSIZE		1024
   2348 #  define LA_TYPE		LA_ZERO
   2349 typedef struct msgb		mblk_t;
   2350 #  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
   2351 # endif /* _PowerUX */
   2352 
   2353 /*
   2354 **  Siemens Nixdorf Informationssysteme AG SINIX
   2355 **
   2356 **	Contributed by Gerald Rinske of Siemens Business Services VAS.
   2357 */
   2358 # ifdef sinix
   2359 #  define HASRANDOM		0	/* has random(3) */
   2360 #  define SYSLOG_BUFSIZE	1024
   2361 #  define SM_INT32		int	/* 32bit integer */
   2362 # endif /* sinix */
   2363 
   2364 
   2365 /*
   2366 **  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
   2367 **
   2368 **	Contributed by Sergey Rusanov <rsm (at) utfoms.udmnet.ru>
   2369 */
   2370 
   2371 # ifdef MOTO
   2372 #  define HASFCHMOD		1
   2373 #  define HASSETRLIMIT		0
   2374 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   2375 #  define HASSETREUID		1
   2376 #  define HASULIMIT		1
   2377 #  define HASWAITPID		1
   2378 #  define HASGETDTABLESIZE	1
   2379 #  define HASGETUSERSHELL	1
   2380 #  define IP_SRCROUTE		0
   2381 #  define IDENTPROTO		0
   2382 #  define RES_DNSRCH_VARIABLE	_res_dnsrch
   2383 #  define _PATH_UNIX		"/unix"
   2384 #  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
   2385 #  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
   2386 # endif /* MOTO */
   2387 
   2388 /*
   2389 **  Interix
   2390 **	Contributed by Nedelcho Stanev <nedelcho.stanev (at) atlanticsky.com>
   2391 **
   2392 **	Used for Interix support.
   2393 */
   2394 
   2395 # if defined(__INTERIX)
   2396 #  define HASURANDOMDEV		1
   2397 #  define HASGETUSERSHELL	0
   2398 #  define HASSTRERROR		1
   2399 #  define HASUNSETENV		1
   2400 #  define HASFCHOWN		1
   2401 #  undef HAVE_SYS_ERRLIST
   2402 #  define sys_errlist		__sys_errlist
   2403 #  define sys_nerr		__sys_nerr
   2404 #  include <sys/mkdev.h>
   2405 #  ifndef major
   2406 #   define major(dev)		((int)(((dev) >> 8) & 0xff))
   2407 #  endif /* ! major */
   2408 #  ifndef minor
   2409 #   define minor(dev)		((int)((dev) & 0xff))
   2410 #  endif /* ! minor */
   2411 # endif /* defined(__INTERIX) */
   2412 
   2413 
   2414 /**********************************************************************
   2415 **  End of Per-Operating System defines
   2416 **********************************************************************/
   2417 /**********************************************************************
   2418 **  More general defines
   2419 **********************************************************************/
   2420 
   2421 /* general BSD defines */
   2422 # ifdef BSD
   2423 #  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
   2424 #  ifndef HASSETREUID
   2425 #   define HASSETREUID	1	/* has setreuid(2) call */
   2426 #  endif /* ! HASSETREUID */
   2427 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   2428 #  ifndef IP_SRCROUTE
   2429 #   define IP_SRCROUTE	1	/* can check IP source routing */
   2430 #  endif /* ! IP_SRCROUTE */
   2431 #  ifndef HASSETRLIMIT
   2432 #   define HASSETRLIMIT	1	/* has setrlimit(2) call */
   2433 #  endif /* ! HASSETRLIMIT */
   2434 #  ifndef HASFLOCK
   2435 #   define HASFLOCK	1	/* has flock(2) call */
   2436 #  endif /* ! HASFLOCK */
   2437 #  ifndef TZ_TYPE
   2438 #   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
   2439 #  endif /* ! TZ_TYPE */
   2440 # endif /* BSD */
   2441 
   2442 /* general System V Release 4 defines */
   2443 # ifdef __svr4__
   2444 #  define SYSTEM5	1
   2445 #  define USESETEUID	1	/* has usable seteuid(2) call */
   2446 #  define HASINITGROUPS	1	/* has initgroups(3) call */
   2447 #  define BSD_COMP	1	/* get BSD ioctl calls */
   2448 #  ifndef HASSETRLIMIT
   2449 #   define HASSETRLIMIT	1	/* has setrlimit(2) call */
   2450 #  endif /* ! HASSETRLIMIT */
   2451 #  ifndef HASGETUSERSHELL
   2452 #   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
   2453 #  endif /* ! HASGETUSERSHELL */
   2454 #  ifndef HASFCHMOD
   2455 #   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
   2456 #  endif /* ! HASFCHMOD */
   2457 
   2458 #  ifndef _PATH_UNIX
   2459 #   define _PATH_UNIX		"/unix"
   2460 #  endif /* ! _PATH_UNIX */
   2461 #  ifndef _PATH_VENDOR_CF
   2462 #   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
   2463 #  endif /* ! _PATH_VENDOR_CF */
   2464 #  ifndef _PATH_SENDMAILPID
   2465 #   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
   2466 #  endif /* ! _PATH_SENDMAILPID */
   2467 #  ifndef SYSLOG_BUFSIZE
   2468 #   define SYSLOG_BUFSIZE	128
   2469 #  endif /* ! SYSLOG_BUFSIZE */
   2470 #  ifndef SFS_TYPE
   2471 #   define SFS_TYPE		SFS_STATVFS
   2472 #  endif /* ! SFS_TYPE */
   2473 
   2474 #  ifndef USE_SIGLONGJMP
   2475 #   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
   2476 #  endif /* ! USE_SIGLONGJMP */
   2477 # endif /* __svr4__ */
   2478 
   2479 # ifdef __SVR4
   2480 #  define LDA_USE_LOCKF		1
   2481 #  define LDA_USE_SETEUID	1
   2482 #  define _PATH_MAILDIR		"/var/mail"
   2483 # endif /* __SVR4 */
   2484 
   2485 /* general System V defines */
   2486 # ifdef SYSTEM5
   2487 #  include <sys/sysmacros.h>
   2488 #  define HASUNAME	1	/* use System V uname(2) system call */
   2489 #  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
   2490 #  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
   2491 #  ifndef HASULIMIT
   2492 #   define HASULIMIT	1	/* has the ulimit(2) syscall */
   2493 #  endif /* ! HASULIMIT */
   2494 #  ifndef LA_TYPE
   2495 #   ifdef MIOC_READKSYM
   2496 #    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
   2497 #   else /* MIOC_READKSYM */
   2498 #    define LA_TYPE	LA_INT		/* assume integer load average */
   2499 #   endif /* MIOC_READKSYM */
   2500 #  endif /* ! LA_TYPE */
   2501 #  ifndef SFS_TYPE
   2502 #   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
   2503 #  endif /* ! SFS_TYPE */
   2504 #  ifndef TZ_TYPE
   2505 #   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
   2506 #  endif /* ! TZ_TYPE */
   2507 # endif /* SYSTEM5 */
   2508 
   2509 /* general POSIX defines */
   2510 # ifdef _POSIX_VERSION
   2511 #  define HASSETSID	1	/* has POSIX setsid(2) call */
   2512 #  define HASWAITPID	1	/* has POSIX waitpid(2) call */
   2513 #  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
   2514 #   define USESETEUID	1	/* has usable seteuid(2) call */
   2515 #  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
   2516 # endif /* _POSIX_VERSION */
   2517 /*
   2518 **  Tweaking for systems that (for example) claim to be BSD or POSIX
   2519 **  but don't have all the standard BSD or POSIX routines (boo hiss).
   2520 */
   2521 
   2522 # ifdef titan
   2523 #  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
   2524 # endif /* titan */
   2525 
   2526 # ifdef _CRAYCOM
   2527 #  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
   2528 # endif /* _CRAYCOM */
   2529 
   2530 # ifdef MOTO
   2531 #  undef USESETEUID
   2532 # endif /* MOTO */
   2533 
   2534 /*
   2535 **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
   2536 **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
   2537 **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
   2538 **  are closed.  Some firewalls return this error if you try to connect
   2539 **  to the IDENT port (113), so you can't receive email from these hosts
   2540 **  on these systems.  The firewall really should use a more specific
   2541 **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
   2542 **  not explicitly set to zero above, default it on.
   2543 */
   2544 
   2545 # ifndef IDENTPROTO
   2546 #  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
   2547 # endif /* ! IDENTPROTO */
   2548 
   2549 # ifndef IP_SRCROUTE
   2550 #  define IP_SRCROUTE	1	/* Detect IP source routing */
   2551 # endif /* ! IP_SRCROUTE */
   2552 
   2553 # ifndef HASGETUSERSHELL
   2554 #  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
   2555 # endif /* ! HASGETUSERSHELL */
   2556 
   2557 # ifndef NETUNIX
   2558 #  define NETUNIX	1	/* include unix domain support */
   2559 # endif /* ! NETUNIX */
   2560 
   2561 # ifndef HASRANDOM
   2562 #  define HASRANDOM	1	/* has random(3) support */
   2563 # endif /* ! HASRANDOM */
   2564 
   2565 # ifndef HASFLOCK
   2566 #  define HASFLOCK	0	/* assume no flock(2) support */
   2567 # endif /* ! HASFLOCK */
   2568 
   2569 # ifndef HASSETREUID
   2570 #  define HASSETREUID	0	/* assume no setreuid(2) call */
   2571 # endif /* ! HASSETREUID */
   2572 
   2573 # ifndef HASFCHMOD
   2574 #  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
   2575 # endif /* ! HASFCHMOD */
   2576 
   2577 # ifndef USESETEUID
   2578 #  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
   2579 # endif /* ! USESETEUID */
   2580 
   2581 # ifndef HASSETRLIMIT
   2582 #  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
   2583 # endif /* ! HASSETRLIMIT */
   2584 
   2585 # ifndef HASULIMIT
   2586 #  define HASULIMIT	0	/* assume no ulimit(2) support */
   2587 # endif /* ! HASULIMIT */
   2588 
   2589 # ifndef SECUREWARE
   2590 #  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
   2591 # endif /* ! SECUREWARE */
   2592 
   2593 # ifndef USE_DOUBLE_FORK
   2594 #  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
   2595 # endif /* ! USE_DOUBLE_FORK */
   2596 
   2597 # ifndef USE_ENVIRON
   2598 #  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
   2599 # endif /* ! USE_ENVIRON */
   2600 
   2601 # ifndef USE_SIGLONGJMP
   2602 #  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
   2603 # endif /* ! USE_SIGLONGJMP */
   2604 
   2605 # ifndef FDSET_CAST
   2606 #  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
   2607 # endif /* ! FDSET_CAST */
   2608 
   2609 /*
   2610 **  Pick a mailer setuid method for changing the current uid
   2611 */
   2612 
   2613 # define USE_SETEUID	0
   2614 # define USE_SETREUID	1
   2615 # define USE_SETUID	2
   2616 
   2617 # if USESETEUID
   2618 #  define MAILER_SETUID_METHOD	USE_SETEUID
   2619 # else /* USESETEUID */
   2620 #  if HASSETREUID
   2621 #   define MAILER_SETUID_METHOD	USE_SETREUID
   2622 #  else /* HASSETREUID */
   2623 #   define MAILER_SETUID_METHOD	USE_SETUID
   2624 #  endif /* HASSETREUID */
   2625 # endif /* USESETEUID */
   2626 
   2627 /*
   2628 **  If no type for argument two of getgroups call is defined, assume
   2629 **  it's an integer -- unfortunately, there seem to be several choices
   2630 **  here.
   2631 */
   2632 
   2633 # ifndef GIDSET_T
   2634 #  define GIDSET_T	int
   2635 # endif /* ! GIDSET_T */
   2636 
   2637 # ifndef UID_T
   2638 #  define UID_T		uid_t
   2639 # endif /* ! UID_T */
   2640 
   2641 # ifndef GID_T
   2642 #  define GID_T		gid_t
   2643 # endif /* ! GID_T */
   2644 
   2645 # ifndef MODE_T
   2646 #  define MODE_T		mode_t
   2647 # endif /* ! MODE_T */
   2648 
   2649 # ifndef ARGV_T
   2650 #  define ARGV_T		char **
   2651 # endif /* ! ARGV_T */
   2652 
   2653 # ifndef SOCKADDR_LEN_T
   2654 #  define SOCKADDR_LEN_T	int
   2655 # endif /* ! SOCKADDR_LEN_T */
   2656 
   2657 # ifndef SOCKOPT_LEN_T
   2658 #  define SOCKOPT_LEN_T	int
   2659 # endif /* ! SOCKOPT_LEN_T */
   2660 
   2661 # ifndef QUAD_T
   2662 #  define QUAD_T	unsigned long
   2663 # endif /* ! QUAD_T */
   2664 /**********************************************************************
   2665 **  Remaining definitions should never have to be changed.  They are
   2666 **  primarily to provide back compatibility for older systems -- for
   2667 **  example, it includes some POSIX compatibility definitions
   2668 **********************************************************************/
   2669 
   2670 /* System 5 compatibility */
   2671 # ifndef S_ISREG
   2672 #  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
   2673 # endif /* ! S_ISREG */
   2674 # ifndef S_ISDIR
   2675 #  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
   2676 # endif /* ! S_ISDIR */
   2677 # if !defined(S_ISLNK) && defined(S_IFLNK)
   2678 #  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
   2679 # endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
   2680 # if !defined(S_ISFIFO)
   2681 #  if defined(S_IFIFO)
   2682 #   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
   2683 #  else /* defined(S_IFIFO) */
   2684 #   define S_ISFIFO(foo)	false
   2685 #  endif /* defined(S_IFIFO) */
   2686 # endif /* !defined(S_ISFIFO) */
   2687 # ifndef S_IRUSR
   2688 #  define S_IRUSR		0400
   2689 # endif /* ! S_IRUSR */
   2690 # ifndef S_IWUSR
   2691 #  define S_IWUSR		0200
   2692 # endif /* ! S_IWUSR */
   2693 # ifndef S_IRGRP
   2694 #  define S_IRGRP		0040
   2695 # endif /* ! S_IRGRP */
   2696 # ifndef S_IWGRP
   2697 #  define S_IWGRP		0020
   2698 # endif /* ! S_IWGRP */
   2699 # ifndef S_IROTH
   2700 #  define S_IROTH		0004
   2701 # endif /* ! S_IROTH */
   2702 # ifndef S_IWOTH
   2703 #  define S_IWOTH		0002
   2704 # endif /* ! S_IWOTH */
   2705 
   2706 /* close-on-exec flag */
   2707 # ifndef FD_CLOEXEC
   2708 #  define FD_CLOEXEC	1
   2709 # endif /* ! FD_CLOEXEC */
   2710 
   2711 /*
   2712 **  Older systems don't have this error code -- it should be in
   2713 **  /usr/include/sysexits.h.
   2714 */
   2715 
   2716 # ifndef EX_CONFIG
   2717 #  define EX_CONFIG	78	/* configuration error */
   2718 # endif /* ! EX_CONFIG */
   2719 
   2720 /* pseudo-codes */
   2721 # define EX_QUIT	22	/* drop out of server immediately */
   2722 # define EX_RESTART	23	/* restart sendmail daemon */
   2723 # define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
   2724 
   2725 #ifndef EX_NOTFOUND
   2726 # define EX_NOTFOUND	EX_NOHOST
   2727 #endif /* ! EX_NOTFOUND */
   2728 
   2729 /* pseudo-code used for mci_setstat */
   2730 # define EX_NOTSTICKY	(-5)	/* don't save persistent status */
   2731 
   2732 
   2733 /*
   2734 **  An "impossible" file mode to indicate that the file does not exist.
   2735 */
   2736 
   2737 # define ST_MODE_NOFILE	0171147		/* unlikely to occur */
   2738 
   2739 
   2740 /* type of arbitrary pointer */
   2741 # ifndef ARBPTR_T
   2742 #  define ARBPTR_T	void *
   2743 # endif /* ! ARBPTR_T */
   2744 
   2745 # ifndef __P
   2746 #  include "sm/cdefs.h"
   2747 # endif /* ! __P */
   2748 
   2749 # if HESIOD && !defined(NAMED_BIND)
   2750 #  define NAMED_BIND	1	/* not one without the other */
   2751 # endif /* HESIOD && !defined(NAMED_BIND) */
   2752 
   2753 #  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
   2754 extern int	h_errno;
   2755 #  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
   2756 
   2757 # if NEEDPUTENV
   2758 extern int	putenv __P((char *));
   2759 # endif /* NEEDPUTENV */
   2760 
   2761 #if !HASUNSETENV
   2762 extern void	unsetenv __P((char *));
   2763 #endif /* !HASUNSETENV */
   2764 
   2765 # ifdef LDAPMAP
   2766 #  include <sys/time.h>
   2767 #  include <lber.h>
   2768 #  include <ldap.h>
   2769 
   2770 /* Some LDAP constants */
   2771 #  define LDAPMAP_FALSE		0
   2772 #  define LDAPMAP_TRUE		1
   2773 
   2774 /*
   2775 **  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
   2776 **  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
   2777 **  and assume (falsely) that all old API implementations are broken.
   2778 **  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
   2779 */
   2780 
   2781 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
   2782 #   define USE_LDAP_INIT	1
   2783 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
   2784 
   2785 /*
   2786 **  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
   2787 **  hence ldap_set_option() must not exist.
   2788 */
   2789 
   2790 #  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
   2791 #   define USE_LDAP_SET_OPTION	1
   2792 #  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
   2793 
   2794 # endif /* LDAPMAP */
   2795 
   2796 # if HASUNAME
   2797 #  include <sys/utsname.h>
   2798 #  ifdef newstr
   2799 #   undef newstr
   2800 #  endif /* newstr */
   2801 # else /* HASUNAME */
   2802 #  define NODE_LENGTH 32
   2803 struct utsname
   2804 {
   2805 	char nodename[NODE_LENGTH + 1];
   2806 };
   2807 # endif /* HASUNAME */
   2808 
   2809 # if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
   2810 #  define MAXHOSTNAMELEN	256
   2811 # endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
   2812 
   2813 
   2814 # if _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255
   2815    /*
   2816    **  override Linux wierdness: a FQHN can be 255 chars long
   2817    **  SUSv3 requires HOST_NAME_MAX ("Maximum length of a host
   2818    **  name (not including the terminating null) as returned from the
   2819    **  gethostname() function.") to be at least 255.  c.f.:
   2820    **  http://www.opengroup.org/onlinepubs/009695399
   2821    **  but Linux defines that to 64 too.
   2822    */
   2823 #  undef MAXHOSTNAMELEN
   2824 #  define MAXHOSTNAMELEN	256
   2825 # endif /* _FFR_LINUX_MHNL && defined(__linux__) && MAXHOSTNAMELEN < 255 */
   2826 
   2827 # if !defined(SIGCHLD) && defined(SIGCLD)
   2828 #  define SIGCHLD	SIGCLD
   2829 # endif /* !defined(SIGCHLD) && defined(SIGCLD) */
   2830 
   2831 # ifndef STDIN_FILENO
   2832 #  define STDIN_FILENO	0
   2833 # endif /* ! STDIN_FILENO */
   2834 
   2835 # ifndef STDOUT_FILENO
   2836 #  define STDOUT_FILENO	1
   2837 # endif /* ! STDOUT_FILENO */
   2838 
   2839 # ifndef STDERR_FILENO
   2840 #  define STDERR_FILENO	2
   2841 # endif /* ! STDERR_FILENO */
   2842 
   2843 # ifndef LOCK_SH
   2844 #  define LOCK_SH	0x01	/* shared lock */
   2845 #  define LOCK_EX	0x02	/* exclusive lock */
   2846 #  define LOCK_NB	0x04	/* non-blocking lock */
   2847 #  define LOCK_UN	0x08	/* unlock */
   2848 # endif /* ! LOCK_SH */
   2849 
   2850 # ifndef S_IXOTH
   2851 #  define S_IXOTH	(S_IEXEC >> 6)
   2852 # endif /* ! S_IXOTH */
   2853 
   2854 # ifndef S_IXGRP
   2855 #  define S_IXGRP	(S_IEXEC >> 3)
   2856 # endif /* ! S_IXGRP */
   2857 
   2858 # ifndef S_IXUSR
   2859 #  define S_IXUSR	(S_IEXEC)
   2860 # endif /* ! S_IXUSR */
   2861 
   2862 #ifndef O_ACCMODE
   2863 # define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
   2864 #endif /* ! O_ACCMODE */
   2865 
   2866 # ifndef SEEK_SET
   2867 #  define SEEK_SET	0
   2868 #  define SEEK_CUR	1
   2869 #  define SEEK_END	2
   2870 # endif /* ! SEEK_SET */
   2871 
   2872 # ifndef SIG_ERR
   2873 #  define SIG_ERR	((void (*)()) -1)
   2874 # endif /* ! SIG_ERR */
   2875 
   2876 # ifndef WEXITSTATUS
   2877 #  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
   2878 # endif /* ! WEXITSTATUS */
   2879 # ifndef WIFEXITED
   2880 #  define WIFEXITED(st)		(((st) & 0377) == 0)
   2881 # endif /* ! WIFEXITED */
   2882 # ifndef WIFSTOPPED
   2883 #  define WIFSTOPPED(st)		(((st) & 0100) == 0)
   2884 # endif /* ! WIFSTOPPED */
   2885 # ifndef WCOREDUMP
   2886 #  define WCOREDUMP(st)		(((st) & 0200) != 0)
   2887 # endif /* ! WCOREDUMP */
   2888 # ifndef WTERMSIG
   2889 #  define WTERMSIG(st)		(((st) & 0177))
   2890 # endif /* ! WTERMSIG */
   2891 
   2892 # ifndef SIGFUNC_DEFINED
   2893 typedef void		(*sigfunc_t) __P((int));
   2894 # endif /* ! SIGFUNC_DEFINED */
   2895 # ifndef SIGFUNC_RETURN
   2896 #  define SIGFUNC_RETURN
   2897 # endif /* ! SIGFUNC_RETURN */
   2898 # ifndef SIGFUNC_DECL
   2899 #  define SIGFUNC_DECL	void
   2900 # endif /* ! SIGFUNC_DECL */
   2901 
   2902 /* size of syslog buffer */
   2903 # ifndef SYSLOG_BUFSIZE
   2904 #  define SYSLOG_BUFSIZE	1024
   2905 # endif /* ! SYSLOG_BUFSIZE */
   2906 
   2907 /* for FD_SET() */
   2908 #ifndef FD_SETSIZE
   2909 # define FD_SETSIZE	256
   2910 #endif /* ! FD_SETSIZE */
   2911 
   2912 /*
   2913 **  Size of prescan buffer.
   2914 **	Despite comments in the _sendmail_ book, this probably should
   2915 **	not be changed; there are some hard-to-define dependencies.
   2916 */
   2917 
   2918 # define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
   2919 
   2920 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
   2921 # ifndef FORK
   2922 #  define FORK		fork		/* function to call to fork mailer */
   2923 # endif /* ! FORK */
   2924 
   2925 /* setting h_errno */
   2926 # ifndef SM_SET_H_ERRNO
   2927 #  define SM_SET_H_ERRNO(err)	h_errno = (err)
   2928 # endif /* SM_SET_H_ERRNO */
   2929 
   2930 # ifndef SM_CONF_GETOPT
   2931 #  define SM_CONF_GETOPT	1
   2932 # endif /* ! SM_CONF_GETOPT */
   2933 
   2934 /* random routine -- set above using #ifdef _osname_ or in Makefile */
   2935 # if HASRANDOM
   2936 #  define get_random()	random()
   2937 # else /* HASRANDOM */
   2938 #  define get_random()	((long) rand())
   2939 #  ifndef RANDOMSHIFT
   2940 #   define RANDOMSHIFT	8
   2941 #  endif /* ! RANDOMSHIFT */
   2942 # endif /* HASRANDOM */
   2943 
   2944 /*
   2945 **  Default to using scanf in readcf.
   2946 */
   2947 
   2948 # ifndef SCANF
   2949 #  define SCANF		1
   2950 # endif /* ! SCANF */
   2951 
   2952 /* XXX  32 bit type */
   2953 # ifndef SM_INT32
   2954 #  define SM_INT32	int32_t
   2955 # endif /* ! SM_INT32 */
   2956 
   2957 /*
   2958 **  SVr4 and similar systems use different routines for setjmp/longjmp
   2959 **  with signal support
   2960 */
   2961 
   2962 # if USE_SIGLONGJMP
   2963 #  ifdef jmp_buf
   2964 #   undef jmp_buf
   2965 #  endif /* jmp_buf */
   2966 #  define jmp_buf		sigjmp_buf
   2967 #  ifdef setjmp
   2968 #   undef setjmp
   2969 #  endif /* setjmp */
   2970 #  define setjmp(env)		sigsetjmp(env, 1)
   2971 #  ifdef longjmp
   2972 #   undef longjmp
   2973 #  endif /* longjmp */
   2974 #  define longjmp(env, val)	siglongjmp(env, val)
   2975 # endif /* USE_SIGLONGJMP */
   2976 
   2977 # if !defined(NGROUPS_MAX) && defined(NGROUPS)
   2978 #  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
   2979 # endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
   2980 
   2981 /*
   2982 **  Some snprintf() implementations are rumored not to NUL terminate.
   2983 */
   2984 # if SNPRINTF_IS_BROKEN
   2985 #  ifdef snprintf
   2986 #   undef snprintf
   2987 #  endif /* snprintf */
   2988 #  define snprintf	sm_snprintf
   2989 #  ifdef vsnprintf
   2990 #   undef vsnprintf
   2991 #  endif /* vsnprintf */
   2992 #  define vsnprintf	sm_vsnprintf
   2993 # endif /* SNPRINTF_IS_BROKEN */
   2994 
   2995 /*
   2996 **  If we don't have a system syslog, simulate it.
   2997 */
   2998 
   2999 # if !LOG
   3000 #  define LOG_EMERG	0	/* system is unusable */
   3001 #  define LOG_ALERT	1	/* action must be taken immediately */
   3002 #  define LOG_CRIT	2	/* critical conditions */
   3003 #  define LOG_ERR	3	/* error conditions */
   3004 #  define LOG_WARNING	4	/* warning conditions */
   3005 #  define LOG_NOTICE	5	/* normal but significant condition */
   3006 #  define LOG_INFO	6	/* informational */
   3007 #  define LOG_DEBUG	7	/* debug-level messages */
   3008 # endif /* !LOG */
   3009 
   3010 # ifndef SM_CONF_SYSLOG
   3011 #  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
   3012 # endif /* SM_CONF_SYSLOG */
   3013 
   3014 # if !SM_CONF_SYSLOG
   3015 #   ifdef __STDC__
   3016 extern void	syslog(int, const char *, ...);
   3017 #   else /* __STDC__ */
   3018 extern void	syslog();
   3019 #   endif /* __STDC__ */
   3020 # endif /* !SM_CONF_SYSLOG */
   3021 
   3022 /* portable(?) definition for alignment */
   3023 # ifndef SM_ALIGN_SIZE
   3024 struct sm_align
   3025 {
   3026 	char al_c;
   3027 	union
   3028 	{
   3029 		long	al_l;
   3030 		void	*al_p;
   3031 		double	al_d;
   3032 		void	(*al_f) __P((void));
   3033 	} al_u;
   3034 };
   3035 #  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
   3036 # endif /* ! SM_ALIGN_SIZE */
   3037 # define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
   3038 
   3039 #endif /* ! SM_CONF_H */
   3040