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