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