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