conf.h revision 141858
1/*
2 * Copyright (c) 1998-2004 Sendmail, Inc. and its suppliers.
3 *	All rights reserved.
4 * Copyright (c) 1983, 1995-1997 Eric P. Allman.  All rights reserved.
5 * Copyright (c) 1988, 1993
6 *	The Regents of the University of California.  All rights reserved.
7 *
8 * By using this file, you agree to the terms and conditions set
9 * forth in the LICENSE file which can be found at the top level of
10 * the sendmail distribution.
11 *
12 *
13 *	$Id: conf.h,v 1.118 2004/08/20 20:30:32 ca Exp $
14 */
15
16/*
17**  CONF.H -- All user-configurable parameters for sendmail
18**
19**	Send updates to sendmail@Sendmail.ORG so they will be
20**	included in the next release.
21*/
22
23#ifndef SM_CONF_H
24# define SM_CONF_H 1
25
26
27# include <sm/config.h>
28# include <sm/varargs.h>
29
30/*
31**  General "standard C" defines.
32**
33**	These may be undone later, to cope with systems that claim to
34**	be Standard C but aren't.  Gcc is the biggest offender -- it
35**	doesn't realize that the library is part of the language.
36**
37**	Life would be much easier if we could get rid of this sort
38**	of bozo problems.
39*/
40
41# ifdef __STDC__
42#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
43# endif /* __STDC__ */
44
45/*
46**  Assume you have standard calls; can be #undefed below if necessary.
47*/
48
49# ifndef HASLSTAT
50#  define HASLSTAT	1	/* has lstat(2) call */
51# endif /* ! HASLSTAT */
52
53# ifndef HASNICE
54#  define HASNICE	1	/* has nice(2) call */
55# endif /* ! HASNICE */
56
57# ifndef HASRRESVPORT
58#  define HASRRESVPORT	1	/* has rrsevport(3) call */
59# endif /* ! HASRRESVPORT */
60
61/**********************************************************************
62**  "Hard" compilation options.
63**	#define these if they are available; comment them out otherwise.
64**  These cannot be overridden from the Makefile, and should really not
65**  be turned off unless absolutely necessary.
66**********************************************************************/
67
68#define LOG		1	/* enable logging -- don't turn off */
69
70/**********************************************************************
71**  Operating system configuration.
72**
73**	Unless you are porting to a new OS, you shouldn't have to
74**	change these.
75**********************************************************************/
76
77/*
78**  HP-UX -- tested for 8.07, 9.00, and 9.01.
79**
80**	If V4FS is defined, compile for HP-UX 10.0.
81**	11.x support from Richard Allen <ra@hp.is>.
82*/
83
84# ifdef __hpux
85		/* common definitions for HP-UX 9.x and 10.x */
86#  undef m_flags		/* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
87#  define SYSTEM5	1	/* include all the System V defines */
88#  define HASINITGROUPS	1	/* has initgroups(3) call */
89#  define HASFCHMOD	1	/* has fchmod(2) syscall */
90#  define USESETEUID	1	/* has usable seteuid(2) call */
91#  define HASSETRESGID	1	/* use setresgid(2) to set saved gid */
92#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
93#  define seteuid(e)	setresuid(-1, e, -1)
94#  define IP_SRCROUTE	1	/* can check IP source routing */
95#  define LA_TYPE	LA_HPUX
96#  define SPT_TYPE	SPT_PSTAT
97#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
98#  define GIDSET_T	gid_t
99#  define LDA_USE_LOCKF	1
100#  ifndef HASGETUSERSHELL
101#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
102#  endif /* ! HASGETUSERSHELL */
103#  ifdef HPUX10
104#   define _PATH_SENDMAIL	"/usr/sbin/sendmail"
105#   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**  DragonFly BSD/ 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(__DragonFly__) || 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(__DragonFly__)
923#   define HASSETLOGIN		1	/* has setlogin(2) */
924#   define HASSRANDOMDEV	1	/* has srandomdev(3) */
925#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
926#   undef SPT_TYPE
927#   include <libutil.h>
928#   define SPT_TYPE		SPT_BUILTIN
929#   define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
930#   ifndef SMRSH_CMDDIR
931#    define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
932#   endif /* ! SMRSH_CMDDIR */
933#   ifndef SMRSH_PATH
934#    define SMRSH_PATH		"/bin:/usr/bin"
935#   endif /* ! SMRSH_PATH */
936#  define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
937#  include <sys/sysctl.h>
938#  endif /* defined(__DragonFly__) */
939#  if defined(__FreeBSD__)
940#   define HASSETLOGIN	1	/* has setlogin(2) */
941#   if __FreeBSD_version >= 227001
942#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
943#    define HASURANDOMDEV	1	/* has /dev/urandom(4) */
944#   endif /* __FreeBSD_version >= 227001 */
945#   undef SPT_TYPE
946#   if __FreeBSD__ >= 2
947#    include <osreldate.h>
948#    if __FreeBSD_version >= 199512	/* 2.2-current when it appeared */
949#     include <libutil.h>
950#     define SPT_TYPE	SPT_BUILTIN
951#    endif /* __FreeBSD_version >= 199512 */
952#    if __FreeBSD_version >= 222000	/* 2.2.2-release and later */
953#     define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
954#    endif /* __FreeBSD_version >= 222000 */
955#    if __FreeBSD_version >= 330000	/* 3.3.0-release and later */
956#     ifndef SMRSH_CMDDIR
957#      define SMRSH_CMDDIR	"/usr/libexec/sm.bin"
958#     endif /* ! SMRSH_CMDDIR */
959#     ifndef SMRSH_PATH
960#      define SMRSH_PATH	"/bin:/usr/bin"
961#     endif /* ! SMRSH_PATH */
962#    endif /* __FreeBSD_version >= 330000 */
963#    define USESYSCTL		1	/* use sysctl(3) for getting ncpus */
964#    include <sys/sysctl.h>
965#   endif /* __FreeBSD__ >= 2 */
966#   ifndef SPT_TYPE
967#    define SPT_TYPE	SPT_REUSEARGV
968#    define SPT_PADCHAR	'\0'		/* pad process title with nulls */
969#   endif /* ! SPT_TYPE */
970#  endif /* defined(__FreeBSD__) */
971#  if defined(__OpenBSD__)
972#   undef SPT_TYPE
973#   define SPT_TYPE	SPT_BUILTIN	/* setproctitle is in libc */
974#   define HASSETLOGIN	1	/* has setlogin(2) */
975#   if OpenBSD < 200305
976#    define HASSETREUID	0	/* setreuid(2) broken in OpenBSD < 3.3 */
977#   endif /* OpenBSD < 200305 */
978#   define HASSETEGID	1	/* use setegid(2) to set saved gid */
979#   define HASURANDOMDEV	1	/* has /dev/urandom(4) */
980#   if OpenBSD >= 200006
981#    define HASSRANDOMDEV	1	/* has srandomdev(3) */
982#   endif /* OpenBSD >= 200006 */
983#   if OpenBSD >= 200012
984#    define HASSETUSERCONTEXT	1	/* BSDI-style login classes */
985#   endif /* OpenBSD >= 200012 */
986#   if OpenBSD >= 200405
987#    define HASCLOSEFROM	1	/* closefrom(3) added in 3.5 */
988#   endif /* OpenBSD >= 200405 */
989#  endif /* defined(__OpenBSD__) */
990# endif /* defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) */
991
992
993/*
994**  Mach386
995**
996**	For mt Xinu's Mach386 system.
997*/
998
999# if defined(MACH) && defined(i386) && !defined(__GNU__)
1000#  define MACH386	1
1001#  define HASUNSETENV	1	/* has unsetenv(3) call */
1002#  define HASINITGROUPS	1	/* has initgroups(3) call */
1003#  ifndef HASFLOCK
1004#   define HASFLOCK	1	/* has flock(2) call */
1005#  endif /* ! HASFLOCK */
1006#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1007#  define NEEDSTRTOL	1	/* need the strtol() function */
1008#  define setpgid	setpgrp
1009#  ifndef LA_TYPE
1010#   define LA_TYPE	LA_FLOAT
1011#  endif /* ! LA_TYPE */
1012#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1013#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
1014#  undef WEXITSTATUS
1015#  undef WIFEXITED
1016#  ifndef _PATH_VENDOR_CF
1017#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1018#  endif /* ! _PATH_VENDOR_CF */
1019#  ifndef _PATH_SENDMAILPID
1020#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1021#  endif /* ! _PATH_SENDMAILPID */
1022# endif /* defined(MACH) && defined(i386) && !defined(__GNU__) */
1023
1024
1025
1026/*
1027**  GNU OS (hurd)
1028**	Largely BSD & posix compatible.
1029**	Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
1030**	Updated by Mark Kettenis <kettenis@wins.uva.nl>.
1031*/
1032
1033# if defined(__GNU__) && !defined(NeXT)
1034#  include <paths.h>
1035#  define HASFCHMOD	1	/* has fchmod(2) call */
1036#  define HASFCHOWN	1	/* has fchown(2) call */
1037#  define HASUNAME	1	/* has uname(2) call */
1038#  define HASUNSETENV	1	/* has unsetenv(3) call */
1039#  define HAS_ST_GEN	1	/* has st_gen field in stat struct */
1040#  define HASSTRERROR	1	/* has strerror(3) */
1041#  define GIDSET_T	gid_t
1042#  define SOCKADDR_LEN_T	socklen_t
1043#  define SOCKOPT_LEN_T	socklen_t
1044#  if (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2
1045#   define LA_TYPE	LA_SUBR
1046#  else /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1047#   define LA_TYPE	LA_MACH
1048   /* GNU uses mach[34], which renames some rpcs from mach2.x. */
1049#   define host_self	mach_host_self
1050#  endif /* (__GLIBC__ == 2 && __GLIBC_MINOR__ > 1) || __GLIBC__ > 2 */
1051#  define SFS_TYPE	SFS_STATFS
1052#  define SPT_TYPE	SPT_CHANGEARGV
1053#  define ERRLIST_PREDEFINED	1	/* don't declare sys_errlist */
1054#  define BSD4_4_SOCKADDR	1	/* has sa_len */
1055#  define SIOCGIFCONF_IS_BROKEN  1	/* SIOCGFCONF doesn't work */
1056#  define HAS_IN_H	1	/* GNU has netinet/in.h. */
1057/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
1058#  define MAXPATHLEN	2048
1059# endif /* defined(__GNU__) && !defined(NeXT) */
1060
1061/*
1062**  4.3 BSD -- this is for very old systems
1063**
1064**	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
1065**
1066**	You'll also have to install a new resolver library.
1067**	I don't guarantee that support for this environment is complete.
1068*/
1069
1070# if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
1071#  define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
1072#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1073#  define ARBPTR_T	char *
1074#  define setpgid	setpgrp
1075#  ifndef LA_TYPE
1076#   define LA_TYPE	LA_FLOAT
1077#  endif /* ! LA_TYPE */
1078#  ifndef _PATH_VENDOR_CF
1079#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1080#  endif /* ! _PATH_VENDOR_CF */
1081#  ifndef IDENTPROTO
1082#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1083#  endif /* ! IDENTPROTO */
1084#  undef WEXITSTATUS
1085#  undef WIFEXITED
1086typedef short		pid_t;
1087# endif /* defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd) */
1088
1089
1090/*
1091**  SCO Unix
1092**
1093**	This includes three parts:
1094**
1095**	The first is for SCO OpenServer 5.
1096**	(Contributed by Keith Reynolds <keithr@sco.COM>).
1097**
1098**		SCO OpenServer 5 has a compiler version number macro,
1099**		which we can use to figure out what version we're on.
1100**		This may have to change in future releases.
1101**
1102**	The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
1103**	(Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
1104**
1105**	The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
1106*/
1107
1108/* SCO OpenServer 5 */
1109# if _SCO_DS >= 1
1110#  include <paths.h>
1111#  define SIOCGIFNUM_IS_BROKEN 1	/* SIOCGIFNUM returns bogus value */
1112#  define HASFCHMOD	1	/* has fchmod(2) call */
1113#  define HASFCHOWN	1	/* has fchown(2) call */
1114#  define HASSETRLIMIT	1	/* has setrlimit(2) call */
1115#  define USESETEUID	1	/* has seteuid(2) call */
1116#  define HASINITGROUPS	1	/* has initgroups(3) call */
1117#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
1118#  define RLIMIT_NEEDS_SYS_TIME_H	1
1119#  define LDA_USE_LOCKF	1
1120#  ifndef LA_TYPE
1121#   define LA_TYPE	LA_DEVSHORT
1122#  endif /* ! LA_TYPE */
1123#  define _PATH_AVENRUN	"/dev/table/avenrun"
1124#  ifndef _SCO_unix_4_2
1125#   define _SCO_unix_4_2
1126#  else /* ! _SCO_unix_4_2 */
1127#   define SOCKADDR_LEN_T	size_t	/* e.g., arg#3 to accept, getsockname */
1128#   define SOCKOPT_LEN_T		size_t	/* arg#5 to getsockopt */
1129#  endif /* ! _SCO_unix_4_2 */
1130# endif /* _SCO_DS >= 1 */
1131
1132/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
1133# ifdef _SCO_unix_4_2
1134#  define _SCO_unix_
1135#  define HASSETREUID	1	/* has setreuid(2) call */
1136# endif /* _SCO_unix_4_2 */
1137
1138/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
1139# ifdef _SCO_unix_
1140#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1141#  define SYSTEM5	1	/* include all the System V defines */
1142#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1143#  define NOFTRUNCATE	0	/* has (simulated) ftruncate call */
1144#  ifndef USE_SIGLONGJMP
1145#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1146#  endif /* ! USE_SIGLONGJMP */
1147#  define MAXPATHLEN	PATHSIZE
1148#  define SFS_TYPE	SFS_4ARGS	/* use <sys/statfs.h> 4-arg impl */
1149#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1150#  define SPT_TYPE	SPT_SCO		/* write kernel u. area */
1151#  define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
1152#  define UID_T		uid_t
1153#  define GID_T		gid_t
1154#  define GIDSET_T	gid_t
1155#  define _PATH_UNIX		"/unix"
1156#  ifndef _PATH_VENDOR_CF
1157#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1158#  endif /* ! _PATH_VENDOR_CF */
1159#  ifndef _PATH_SENDMAILPID
1160#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1161#  endif /* ! _PATH_SENDMAILPID */
1162
1163/* stuff fixed in later releases */
1164#  ifndef _SCO_unix_4_2
1165#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1166#  endif /* ! _SCO_unix_4_2 */
1167
1168#  ifndef _SCO_DS
1169#   define ftruncate	chsize	/* use chsize(2) to emulate ftruncate */
1170#   define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1171#   define NETUNIX	0	/* no unix domain socket support */
1172#   define LA_TYPE	LA_SHORT
1173#  endif /* ! _SCO_DS */
1174
1175# endif /* _SCO_unix_ */
1176
1177/*
1178**  ISC (SunSoft) Unix.
1179**
1180**	Contributed by J.J. Bailey <jjb@jagware.bcc.com>
1181*/
1182
1183# ifdef ISC_UNIX
1184#  include <net/errno.h>
1185#  include <sys/stream.h>	/* needed for IP_SRCROUTE */
1186#  include <sys/bsdtypes.h>
1187#  define SYSTEM5	1	/* include all the System V defines */
1188#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1189#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1190#  define HASSETREUID	1	/* has setreuid(2) call */
1191#  define NEEDFSYNC	1	/* needs the fsync(2) call stub */
1192#  define NETUNIX	0	/* no unix domain socket support */
1193#  define MAXPATHLEN	1024
1194#  define LA_TYPE	LA_SHORT
1195#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1196#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1197#  define _PATH_UNIX		"/unix"
1198#  ifndef _PATH_VENDOR_CF
1199#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1200#  endif /* ! _PATH_VENDOR_CF */
1201#  ifndef _PATH_SENDMAILPID
1202#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1203#  endif /* ! _PATH_SENDMAILPID */
1204# endif /* ISC_UNIX */
1205
1206
1207/*
1208**  Altos System V (5.3.1)
1209**	Contributed by Tim Rice <tim@trr.metro.net>.
1210*/
1211
1212# ifdef ALTOS_SYSTEM_V
1213#  include <sys/stream.h>
1214#  include <limits.h>
1215#  define SYSTEM5	1	/* include all the System V defines */
1216#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1217#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1218#  define WAITUNION	1	/* use "union wait" as wait argument type */
1219#  define NEEDFSYNC	1	/* no fsync(2) in system library */
1220#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
1221#  define NOFTRUNCATE	1	/* do not have ftruncate(2) */
1222#  define MAXPATHLEN	PATH_MAX
1223#  define LA_TYPE	LA_SHORT
1224#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1225#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1226#  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
1227#  define NETUNIX	0	/* no unix domain socket support */
1228#  undef WIFEXITED
1229#  undef WEXITSTATUS
1230#  define strtoul	strtol	/* gcc library bogosity */
1231
1232typedef unsigned short	uid_t;
1233typedef unsigned short	gid_t;
1234typedef short		pid_t;
1235typedef unsigned long	mode_t;
1236
1237/* some stuff that should have been in the include files */
1238extern char		*malloc();
1239extern struct passwd	*getpwent();
1240extern struct passwd	*getpwnam();
1241extern struct passwd	*getpwuid();
1242extern char		*getenv();
1243extern struct group	*getgrgid();
1244extern struct group	*getgrnam();
1245
1246# endif /* ALTOS_SYSTEM_V */
1247
1248
1249/*
1250**  ConvexOS 11.0 and later
1251**
1252**	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
1253**	works on 9.1 as well.
1254**
1255**  ConvexOS 11.5 and later, should work on 11.0 as defined.
1256**  For pre-ConvexOOS 11.0, define SM_CONF_GETOPT=0, undef IDENTPROTO
1257**
1258**	Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
1259**		(now the CONVEX Technologies Center of Hewlett Packard)
1260*/
1261
1262# ifdef _CONVEX_SOURCE
1263#  define HASGETDTABLESIZE	1	/* has getdtablesize(2) */
1264#  define HASINITGROUPS	1	/* has initgroups(3) */
1265#  define HASUNAME	1	/* use System V uname(2) system call */
1266#  define HASSETSID	1	/* has POSIX setsid(2) call */
1267#  define HASUNSETENV	1	/* has unsetenv(3) */
1268#  define HASFLOCK	1	/* has flock(2) */
1269#  define HASSETRLIMIT	1	/* has setrlimit(2) */
1270#  define HASSETREUID	1	/* has setreuid(2) */
1271#  define BROKEN_RES_SEARCH	1	/* res_search(unknown) returns h_error=0 */
1272#  define NEEDPUTENV	1	/* needs putenv (written in terms of setenv) */
1273#  define SM_CONF_GETOPT	1	/* need a replacement for getopt(3) */
1274#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
1275#  define LA_TYPE	LA_FLOAT
1276#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1277#  ifndef _PATH_VENDOR_CF
1278#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1279#  endif /* ! _PATH_VENDOR_CF */
1280#  ifndef S_IREAD
1281#   define S_IREAD	_S_IREAD
1282#   define S_IWRITE	_S_IWRITE
1283#   define S_IEXEC	_S_IEXEC
1284#   define S_IFMT	_S_IFMT
1285#   define S_IFCHR	_S_IFCHR
1286#   define S_IFBLK	_S_IFBLK
1287#  endif /* ! S_IREAD */
1288#  ifndef TZ_TYPE
1289#   define TZ_TYPE	TZ_TIMEZONE
1290#  endif /* ! TZ_TYPE */
1291#  ifndef IDENTPROTO
1292#   define IDENTPROTO	1
1293#  endif /* ! IDENTPROTO */
1294#  ifndef SHARE_V1
1295#   define SHARE_V1	1	/* version 1 of the fair share scheduler */
1296#  endif /* ! SHARE_V1 */
1297#  if !defined(__GNUC__ )
1298#   define UID_T	int		/* GNUC gets it right, ConvexC botches */
1299#   define GID_T	int		/* GNUC gets it right, ConvexC botches */
1300#  endif /* !defined(__GNUC__ ) */
1301#  if SECUREWARE
1302#   define FORK	fork		/* SecureWare wants the real fork! */
1303#  else /* SECUREWARE */
1304#   define FORK	vfork		/* the rest of the OS versions don't care */
1305#  endif /* SECUREWARE */
1306# endif /* _CONVEX_SOURCE */
1307
1308
1309/*
1310**  RISC/os 4.52
1311**
1312**	Gives a ton of warning messages, but otherwise compiles.
1313*/
1314
1315# ifdef RISCOS
1316
1317#  define HASUNSETENV	1	/* has unsetenv(3) call */
1318#  ifndef HASFLOCK
1319#   define HASFLOCK	1	/* has flock(2) call */
1320#  endif /* ! HASFLOCK */
1321#  define WAITUNION	1	/* use "union wait" as wait argument type */
1322#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1323#  define NEEDPUTENV	1	/* need putenv(3) call */
1324#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
1325#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1326#  define LA_TYPE	LA_INT
1327#  define LA_AVENRUN	"avenrun"
1328#  define _PATH_UNIX	"/unix"
1329#  undef WIFEXITED
1330
1331#  define setpgid	setpgrp
1332
1333typedef int		pid_t;
1334#  define SIGFUNC_DEFINED
1335#  define SIGFUNC_RETURN	(0)
1336#  define SIGFUNC_DECL	int
1337typedef int		(*sigfunc_t)();
1338extern char		*getenv();
1339extern void		*malloc();
1340
1341/* added for RISC/os 4.01...which is dumber than 4.50 */
1342#  ifdef RISCOS_4_0
1343#   ifndef ARBPTR_T
1344#    define ARBPTR_T	char *
1345#   endif /* ! ARBPTR_T */
1346#   undef HASFLOCK
1347#   define HASFLOCK	0
1348#  endif /* RISCOS_4_0 */
1349
1350#  include <sys/time.h>
1351
1352# endif /* RISCOS */
1353
1354
1355/*
1356**  Linux 0.99pl10 and above...
1357**
1358**  Thanks to, in reverse order of contact:
1359**
1360**	John Kennedy <warlock@csuchico.edu>
1361**	Andrew Pam <avatar@aus.xanadu.com>
1362**	Florian La Roche <rzsfl@rz.uni-sb.de>
1363**	Karl London <karl@borg.demon.co.uk>
1364**
1365**  NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
1366**	file locking is no longer allowed.  In particular, make sure
1367**	your DBM library and sendmail are both using either flock(2)
1368**	*or* fcntl(2) file locking, but not both.
1369*/
1370
1371# ifdef __linux__
1372#  include <linux/version.h>
1373#  if !defined(KERNEL_VERSION)	/* not defined in 2.0.x kernel series */
1374#   define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
1375#  endif /* !defined(KERNEL_VERSION) */
1376#  define BSD		1	/* include BSD defines */
1377#  define HASSETREGID	1	/* use setregid(2) to set saved gid */
1378#  ifndef REQUIRES_DIR_FSYNC
1379#   define REQUIRES_DIR_FSYNC	1	/* requires fsync() on directory */
1380#  endif /* REQUIRES_DIR_FSYNC */
1381#  ifndef USESETEUID
1382#   define USESETEUID	0	/* has it due to POSIX, but doesn't work */
1383#  endif /* USESETEUID */
1384#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
1385#  define HASUNAME	1	/* use System V uname(2) system call */
1386#  define HASUNSETENV	1	/* has unsetenv(3) call */
1387#  define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
1388#  define GIDSET_T	gid_t	/* from <linux/types.h> */
1389#  ifndef HASGETUSERSHELL
1390#   define HASGETUSERSHELL 0	/* getusershell(3) broken in Slackware 2.0 */
1391#  endif /* HASGETUSERSHELL */
1392#  ifndef IP_SRCROUTE
1393#   define IP_SRCROUTE	0	/* linux <= 1.2.8 doesn't support IP_OPTIONS */
1394#  endif /* ! IP_SRCROUTE */
1395#  ifndef HAS_IN_H
1396#   define HAS_IN_H	1	/* use netinet/in.h */
1397#  endif /* ! HAS_IN_H */
1398#  ifndef USE_SIGLONGJMP
1399#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
1400#  endif /* ! USE_SIGLONGJMP */
1401#  ifndef HASFLOCK
1402#   if LINUX_VERSION_CODE < 66399
1403#    define HASFLOCK	0	/* flock(2) is broken after 0.99.13 */
1404#   else /* LINUX_VERSION_CODE < 66399 */
1405#     if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
1406#      define HASFLOCK	1	/* flock(2) fixed after 1.3.95 */
1407#     else /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1408#      define HASFLOCK	0	/* flock(2) is broken (again) after 2.4.0 */
1409#     endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)) */
1410#   endif /* LINUX_VERSION_CODE < 66399 */
1411#  endif /* ! HASFLOCK */
1412#  ifndef LA_TYPE
1413#   define LA_TYPE	LA_PROCSTR
1414#  endif /* ! LA_TYPE */
1415#  define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
1416#  define SPT_PADCHAR	'\0'		/* pad process title with nulls */
1417#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0))
1418#   ifndef HASURANDOMDEV
1419#    define HASURANDOMDEV 1	/* 2.0 (at least) has linux/drivers/char/random.c */
1420#   endif /* ! HASURANDOMDEV */
1421#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,0)) */
1422#  if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1423#   define HASSTRERROR	1	/* has strerror(3) */
1424#  endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1425#  ifndef TZ_TYPE
1426#   define TZ_TYPE	TZ_NONE		/* no standard for Linux */
1427#  endif /* ! TZ_TYPE */
1428#  if (__GLIBC__ >= 2)
1429#   include <paths.h>
1430#  endif /* (__GLIBC__ >= 2) */
1431#  ifndef _PATH_SENDMAILPID
1432#   define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
1433#  endif /* ! _PATH_SENDMAILPID */
1434#  include <sys/sysmacros.h>
1435#  undef atol			/* wounded in <stdlib.h> */
1436#  if NETINET6
1437   /*
1438   **  Linux doesn't have a good way to tell userland what interfaces are
1439   **  IPv6-capable.  Therefore, the BIND resolver can not determine if there
1440   **  are IPv6 interfaces to honor AI_ADDRCONFIG.  Unfortunately, it assumes
1441   **  that none are present.  (Excuse the macro name ADDRCONFIG_IS_BROKEN.)
1442   */
1443#   define ADDRCONFIG_IS_BROKEN	1
1444
1445   /*
1446   **  Indirectly included from glibc's <feature.h>.  IPv6 support is native
1447   **  in 2.1 and later, but the APIs appear before the functions.
1448   */
1449#   if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
1450#    define GLIBC_VERSION ((__GLIBC__ << 8) + __GLIBC_MINOR__)
1451#    if (GLIBC_VERSION >= 0x201)
1452#     undef IPPROTO_ICMPV6	/* linux #defines, glibc enums */
1453#    else /* (GLIBC_VERSION >= 0x201) */
1454#     include <linux/in6.h>	/* IPv6 support */
1455#    endif /* (GLIBC_VERSION >= 0x201) */
1456#    if (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE))
1457     /* Have APIs in <netdb.h>, but no support in glibc */
1458#     define NEEDSGETIPNODE	1
1459#    endif /* (GLIBC_VERSION >= 0x201 && !defined(NEEDSGETIPNODE)) */
1460#    undef GLIBC_VERSION
1461#   endif /* defined(__GLIBC__) && defined(__GLIBC_MINOR__) */
1462#  endif /* NETINET6 */
1463#  ifndef HASFCHOWN
1464#   define HASFCHOWN	1	/* fchown(2) */
1465#  endif /* ! HASFCHOWN */
1466#  if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD)
1467#    define HASFCHMOD	1	/* fchmod(2) */
1468#  endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2,0,36)) && !defined(HASFCHMOD) */
1469# endif /* __linux__ */
1470
1471
1472/*
1473**  DELL SVR4 Issue 2.2, and others
1474**	From Kimmo Suominen <kim@grendel.lut.fi>
1475**
1476**	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
1477**	defined, and the definitions conflict.
1478**
1479**	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
1480**	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
1481**	(SVR4.0/386 version 3.0).
1482*/
1483
1484# ifdef DELL_SVR4
1485				/* no changes necessary */
1486				/* see general __svr4__ defines below */
1487# endif /* DELL_SVR4 */
1488
1489
1490/*
1491**  Apple A/UX 3.0
1492*/
1493
1494# ifdef _AUX_SOURCE
1495#  include <sys/sysmacros.h>
1496#  define BSD			/* has BSD routines */
1497#  define HASSETRLIMIT	0	/* ... but not setrlimit(2) */
1498#  define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
1499#  define BOGUS_O_EXCL	1	/* exclusive open follows symlinks */
1500#  define HASUNAME	1	/* use System V uname(2) system call */
1501#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1502#  define HASINITGROUPS	1	/* has initgroups(3) call */
1503#  define HASSETVBUF	1	/* has setvbuf(3) in libc */
1504#  define HASSTRERROR	1	/* has strerror(3) */
1505#  define SIGFUNC_DEFINED	/* sigfunc_t already defined */
1506#  define SIGFUNC_RETURN		/* POSIX-mode */
1507#  define SIGFUNC_DECL	void	/* POSIX-mode */
1508#  define ERRLIST_PREDEFINED	1
1509#  ifndef IDENTPROTO
1510#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1511#  endif /* ! IDENTPROTO */
1512#  ifndef LA_TYPE
1513#   define LA_TYPE	LA_INT
1514#   define FSHIFT	16
1515#  endif /* ! LA_TYPE */
1516#  define LA_AVENRUN	"avenrun"
1517#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1518#  define TZ_TYPE	TZ_TZNAME
1519#  ifndef _PATH_UNIX
1520#   define _PATH_UNIX		"/unix"		/* should be in <paths.h> */
1521#  endif /* ! _PATH_UNIX */
1522#  ifndef _PATH_VENDOR_CF
1523#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1524#  endif /* ! _PATH_VENDOR_CF */
1525#  undef WIFEXITED
1526#  undef WEXITSTATUS
1527# endif /* _AUX_SOURCE */
1528
1529
1530/*
1531**  Encore UMAX V
1532**
1533**	Not extensively tested.
1534*/
1535
1536# ifdef UMAXV
1537#  define HASUNAME	1	/* use System V uname(2) system call */
1538#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
1539#  define HASINITGROUPS	1	/* has initgroups(3) call */
1540#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1541#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1542#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
1543#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1544#  define MAXPATHLEN	PATH_MAX
1545extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
1546extern struct group	*getgrent(), *getgrnam(), *getgrgid();
1547#  undef WIFEXITED
1548#  undef WEXITSTATUS
1549# endif /* UMAXV */
1550
1551
1552/*
1553**  Stardent Titan 3000 running TitanOS 4.2.
1554**
1555**	Must be compiled in "cc -43" mode.
1556**
1557**	From Kate Hedstrom <kate@ahab.rutgers.edu>.
1558**
1559**	Note the tweaking below after the BSD defines are set.
1560*/
1561
1562# ifdef titan
1563#  define setpgid	setpgrp
1564typedef int		pid_t;
1565#  undef WIFEXITED
1566#  undef WEXITSTATUS
1567# endif /* titan */
1568
1569
1570/*
1571**  Sequent DYNIX 3.2.0
1572**
1573**	From Jim Davis <jdavis@cs.arizona.edu>.
1574*/
1575
1576# ifdef sequent
1577
1578#  define BSD		1
1579#  define HASUNSETENV	1
1580#  define BSD4_3		1	/* to get signal() in conf.c */
1581#  define WAITUNION	1
1582#  define LA_TYPE	LA_FLOAT
1583#  ifdef _POSIX_VERSION
1584#   undef _POSIX_VERSION		/* set in <unistd.h> */
1585#  endif /* _POSIX_VERSION */
1586#  undef HASSETVBUF		/* don't actually have setvbuf(3) */
1587#  define setpgid	setpgrp
1588
1589/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
1590#  undef	WIFEXITED
1591#  define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
1592			 ((union wait*)&(s))->w_termsig == 0)
1593#  define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
1594typedef int		pid_t;
1595#  define isgraph(c)	(isprint(c) && (c != ' '))
1596
1597#  ifndef IDENTPROTO
1598#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1599#  endif /* ! IDENTPROTO */
1600
1601#  ifndef _PATH_UNIX
1602#   define _PATH_UNIX		"/dynix"
1603#  endif /* ! _PATH_UNIX */
1604#  ifndef _PATH_VENDOR_CF
1605#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1606#  endif /* ! _PATH_VENDOR_CF */
1607# endif /* sequent */
1608
1609
1610/*
1611**  Sequent DYNIX/ptx v2.0 (and higher)
1612**
1613**	For DYNIX/ptx v1.x, undefine HASSETREUID.
1614**
1615**	From Tim Wright <timw@sequent.com>.
1616**	Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
1617**		for DYNIX/ptx 4.0.2.
1618*/
1619
1620# ifdef _SEQUENT_
1621#  include <sys/stream.h>
1622#  define SYSTEM5	1	/* include all the System V defines */
1623#  define HASSETSID	1	/* has POSIX setsid(2) call */
1624#  define HASINITGROUPS	1	/* has initgroups(3) call */
1625#  define HASSETREUID	1	/* has setreuid(2) call */
1626#  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1627#  define GIDSET_T	gid_t
1628#  define LA_TYPE	LA_INT
1629#  define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
1630#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
1631#  ifndef IDENTPROTO
1632#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1633#  endif /* ! IDENTPROTO */
1634#  ifndef _PATH_VENDOR_CF
1635#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1636#  endif /* ! _PATH_VENDOR_CF */
1637#  ifndef _PATH_SENDMAILPID
1638#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1639#  endif /* ! _PATH_SENDMAILPID */
1640# endif /* _SEQUENT_ */
1641
1642/*
1643**  Cray UNICOS, UNICOS/mk, and UNICOS/mp
1644**
1645**    UNICOS:
1646**	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
1647**	Update Brian Ginsbach <ginsbach@cray.com>
1648**    UNICOS/mk (Cray T3E):
1649**	Contributed by Manu Mahonen <mailadm@csc.fi>
1650**	of Center for Scientific Computing.
1651**	Update Brian Ginsbach <ginsbach@cray.com>
1652**    UNICOS/mp:
1653**	From Aaron Davis <awd@cray.com> & Brian Ginsbach <ginsbach@cray.com>
1654*/
1655
1656# if defined(_CRAY) || defined(UNICOS) || defined(_UNICOSMP)
1657#  define SYSTEM5	1	/* include all the System V defines */
1658#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1659#  define HASFCHOWN	1	/* has fchown(2) */
1660#  define HASUNSETENV	1	/* has unsetenv(3) call */
1661#  define HASINITGROUPS	1	/* has initgroups(3) call */
1662#  define HASSETREUID	1	/* has setreuid(2) call */
1663#  define USESETEUID	1	/* has usable seteuid(2) call */
1664#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) syscall */
1665#  define HASSTRERROR	1	/* has strerror(3) */
1666#  define GIDSET_T	gid_t
1667#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1668#  define SFS_BAVAIL	f_bfree	/* alternate field name */
1669#  define SAFENFSPATHCONF 1	/* pathconf(2) pessimizes on NFS filesystems */
1670#  ifdef UNICOS
1671#   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
1672#   define LA_TYPE	LA_ZERO
1673#   define _PATH_MAILDIR	"/usr/spool/mail"
1674#   define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
1675#   ifndef MAXPATHLEN
1676#    define MAXPATHLEN PATHSIZE
1677#   endif /* ! MAXPATHLEN */
1678#   ifndef _PATH_UNIX
1679#    ifdef UNICOSMK
1680#     define _PATH_UNIX		"/unicosmk.ar"
1681#    else
1682#     define _PATH_UNIX		"/unicos"
1683#    endif /* UNICOSMK */
1684#   endif /* ! _PATH_UNIX */
1685#   ifndef _PATH_VENDOR_CF
1686#    define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1687#   endif /* ! _PATH_VENDOR_CF */
1688#  endif /* UNICOS */
1689#  ifdef _UNICOSMP
1690#  if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN)
1691    /* _SC_NPROC_ONLN is 'mpadmin -u', total # of unrestricted processors */
1692#   define _SC_NPROCESSORS_ONLN  _SC_NPROC_ONLN
1693#  endif /* if defined(_SC_NPROC_ONLN) && !defined(_SC_NPROCESSORS_ONLN) */
1694#   define HASGETUSERSHELL 0		/* does not have getusershell(3) call */
1695#   define HASSETRLIMIT	   1		/* has setrlimit(2) syscall */
1696#   define LA_TYPE	LA_IRIX6	/* figure out at run time */
1697#   include <sys/cdefs.h>
1698#   include <paths.h>
1699#   define ARGV_T char *const *
1700#  endif /* _UNICOSMP */
1701# endif /* _CRAY */
1702
1703/*
1704**  Apollo DomainOS
1705**
1706**  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
1707**
1708**  15 Jan 1994; updated 2 Aug 1995
1709**
1710*/
1711
1712# ifdef apollo
1713#  define HASSETREUID	1	/* has setreuid(2) call */
1714#  define HASINITGROUPS	1	/* has initgroups(2) call */
1715#  define IP_SRCROUTE	0	/* does not have <netinet/ip_var.h> */
1716#  define SPT_TYPE	SPT_NONE	/* don't use setproctitle */
1717#  define LA_TYPE	LA_SUBR		/* use getloadavg.c */
1718#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
1719#  define SFS_BAVAIL	f_bfree		/* alternate field name */
1720#  define TZ_TYPE	TZ_TZNAME
1721#  ifndef _PATH_VENDOR_CF
1722#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1723#  endif /* ! _PATH_VENDOR_CF */
1724#  ifndef _PATH_SENDMAILPID
1725#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1726#  endif /* ! _PATH_SENDMAILPID */
1727#  undef	 S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
1728#  undef	 S_IFIFO
1729#  define S_IFIFO	0010000
1730#  ifndef IDENTPROTO
1731#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1732#  endif /* ! IDENTPROTO */
1733#  define RLIMIT_NEEDS_SYS_TIME_H	1
1734#  if defined(NGROUPS_MAX) && !NGROUPS_MAX
1735#   undef NGROUPS_MAX
1736#  endif /* defined(NGROUPS_MAX) && !NGROUPS_MAX */
1737# endif /* apollo */
1738
1739/*
1740**  MPE-iX
1741**
1742**	Requires MPE 6.0 or greater.  See sendmail/README for more info.
1743**
1744**	From Mark Bixby <mark_bixby@hp.com> or <mark@bixby.org>.
1745*/
1746
1747# ifdef MPE
1748
1749#  include <sys/sysmacros.h>
1750#  include <fcntl.h>
1751
1752/* Sendmail stuff */
1753#  define HASFCHOWN		0	/* lacks fchown() */
1754#  define HASGETUSERSHELL	0	/* lacks getusershell() */
1755#  ifdef HASNICE
1756#   undef  HASNICE
1757#  endif /* HASNICE */
1758#  define HASNICE		0	/* lacks nice() */
1759#  define HASRANDOM		0	/* lacks random() */
1760#  ifdef HASRRESVPORT
1761#   undef HASRRESVPORT
1762#  endif /* HASRRESVPORT */
1763#  define HASRRESVPORT		0	/* lacks rresvport() */
1764#  define IP_SRCROUTE		0	/* lacks IP source routing fields */
1765#  ifdef MATCHGECOS
1766#   undef MATCHGECOS
1767#  endif /* MATCHGECOS */
1768#  define MATCHGECOS		0	/* lacks an initialized GECOS field */
1769#  define NEEDFSYNC		1	/* use sendmail's fsync() */
1770#  define NEEDLINK		1	/* use sendmail's link() */
1771#  define NOFTRUNCATE		1	/* lacks ftruncate() */
1772#  define SFS_TYPE		SFS_NONE /* can't determine disk space */
1773#  define SM_CONF_SYSLOG	0	/* use sendmail decl of syslog() */
1774#  define USE_DOUBLE_FORK	0	/* don't fork an intermediate zombie */
1775#  define USE_ENVIRON		1	/* use environ instead of envp */
1776
1777/* Missing header stuff */
1778#  define AF_UNSPEC		0
1779#  define AF_MAX		AF_INET
1780#  define IFF_LOOPBACK		0x8
1781#  define IN_LOOPBACKNET	127
1782#  define MAXNAMLEN		NAME_MAX
1783#  define S_IEXEC		S_IXUSR
1784#  define S_IREAD		S_IRUSR
1785#  define S_IWRITE		S_IWUSR
1786
1787/* Present header stuff that needs to be missing */
1788#  undef NGROUPS_MAX
1789
1790/* Shadow functions */
1791#  define bind		sendmail_mpe_bind
1792#  define _exit		sendmail_mpe__exit
1793#  define exit		sendmail_mpe_exit
1794#  define fcntl		sendmail_mpe_fcntl
1795#  define getegid	sendmail_mpe_getegid
1796#  define geteuid	sendmail_mpe_geteuid
1797#  define getpwnam	sendmail_mpe_getpwnam
1798#  define getpwuid	sendmail_mpe_getpwuid
1799#  define setgid	sendmail_mpe_setgid
1800#  define setuid	sendmail_mpe_setuid
1801extern int		sendmail_mpe_fcntl __P((int, int, ...));
1802extern struct passwd *	sendmail_mpe_getpwnam __P((const char *));
1803extern struct passwd *	sendmail_mpe_getpwuid __P((uid_t));
1804# endif /* MPE */
1805
1806/*
1807**  System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatibility Libs ie. native)
1808**
1809**	Contributed by Paul Gampe <paulg@apnic.net>
1810*/
1811
1812# ifdef __svr5__
1813#  include <sys/mkdev.h>
1814#  define __svr4__
1815#  define SYS5SIGNALS		1
1816#  define HASFCHOWN		1	/* has fchown(2) call */
1817#  define HASSETSID	1	/* has POSIX setsid(2) call */
1818#  define HASSETREUID		1
1819#  define HASWAITPID		1
1820#  define HASGETDTABLESIZE	1
1821#  define GIDSET_T		gid_t
1822#  define SOCKADDR_LEN_T		size_t
1823#  define SOCKOPT_LEN_T		size_t
1824#  ifndef _PATH_UNIX
1825#   define _PATH_UNIX		"/stand/unix"
1826#  endif /* ! _PATH_UNIX */
1827#  define SPT_PADCHAR		'\0'	/* pad process title with nulls */
1828#  ifndef SYSLOG_BUFSIZE
1829#   define SYSLOG_BUFSIZE	1024	/* unsure */
1830#  endif /* ! SYSLOG_BUFSIZE */
1831#  ifndef _PATH_VENDOR_CF
1832#   define _PATH_VENDOR_CF	"/etc/sendmail.cf"
1833#  endif /* ! _PATH_VENDOR_CF */
1834#  ifndef _PATH_SENDMAILPID
1835#   define _PATH_SENDMAILPID	"/etc/sendmail.pid"
1836#  endif /* ! _PATH_SENDMAILPID */
1837#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
1838#if !defined(SM_SET_H_ERRNO) && defined(_REENTRANT)
1839# define SM_SET_H_ERRNO(err)	set_h_errno((err))
1840#endif /* ! SM_SET_H_ERRNO && _REENTRANT */
1841# endif /* __svr5__ */
1842
1843/* ###################################################################### */
1844
1845/*
1846**  UnixWare 2.x
1847*/
1848
1849# ifdef UNIXWARE2
1850#  define UNIXWARE	1
1851#  undef offsetof		/* avoid stddefs.h, sys/sysmacros.h conflict */
1852# endif /* UNIXWARE2 */
1853
1854
1855/*
1856**  UnixWare 1.1.2.
1857**
1858**	Updated by Petr Lampa <lampa@fee.vutbr.cz>.
1859**	From Evan Champion <evanc@spatial.synapse.org>.
1860*/
1861
1862# ifdef UNIXWARE
1863#  include <sys/mkdev.h>
1864#  define SYSTEM5		1
1865#  define HASGETUSERSHELL	0	/* does not have getusershell(3) call */
1866#  define HASSETREUID		1
1867#  define HASSETSID	1	/* has POSIX setsid(2) call */
1868#  define HASINITGROUPS		1
1869#  define GIDSET_T		gid_t
1870#  define SLEEP_T		unsigned
1871#  define SFS_TYPE		SFS_STATVFS
1872#  define LA_TYPE		LA_ZERO
1873#  undef WIFEXITED
1874#  undef WEXITSTATUS
1875#  ifndef _PATH_UNIX
1876#   define _PATH_UNIX		"/unix"
1877#  endif /* ! _PATH_UNIX */
1878#  ifndef _PATH_VENDOR_CF
1879#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
1880#  endif /* ! _PATH_VENDOR_CF */
1881#  ifndef _PATH_SENDMAILPID
1882#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
1883#  endif /* ! _PATH_SENDMAILPID */
1884#  define SYSLOG_BUFSIZE	128
1885# endif /* UNIXWARE */
1886
1887
1888/*
1889**  Intergraph CLIX 3.1
1890**
1891**	From Paul Southworth <pauls@locust.cic.net>
1892*/
1893
1894# ifdef CLIX
1895#  define SYSTEM5	1	/* looks like System V */
1896#  ifndef HASGETUSERSHELL
1897#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
1898#  endif /* ! HASGETUSERSHELL */
1899#  define DEV_BSIZE	512	/* device block size not defined */
1900#  define GIDSET_T	gid_t
1901#  undef LOG			/* syslog not available */
1902#  define NEEDFSYNC	1	/* no fsync in system library */
1903#  define GETSHORT	_getshort
1904# endif /* CLIX */
1905
1906
1907/*
1908**  NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
1909**
1910**	From Kevin Darcy <kevin@tech.mis.cfc.com>.
1911*/
1912
1913# ifdef NCR_MP_RAS2
1914#  include <sys/sockio.h>
1915#  define __svr4__
1916#  define IP_SRCROUTE	0	/* Something is broken with getsockopt() */
1917#  define SYSLOG_BUFSIZE	1024
1918#  define SPT_TYPE  SPT_NONE
1919# endif /* NCR_MP_RAS2 */
1920
1921
1922/*
1923**  NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
1924**
1925**	From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
1926*/
1927
1928# ifdef NCR_MP_RAS3
1929#  define __svr4__
1930#  define HASFCHOWN		1	/* has fchown(2) call */
1931#  define LDA_USE_LOCKF		1
1932#  define SIOCGIFNUM_IS_BROKEN	1	/* SIOCGIFNUM has non-std interface */
1933#  define SO_REUSEADDR_IS_BROKEN	1	/* doesn't work if accept() fails */
1934#  define SYSLOG_BUFSIZE	1024
1935#  define SPT_TYPE	SPT_NONE
1936#  define _PATH_MAILDIR	"/var/mail"
1937#  ifndef _XOPEN_SOURCE
1938#   define _XOPEN_SOURCE
1939#   define _XOPEN_SOURCE_EXTENDED 1
1940#   include <sys/resource.h>
1941#   undef _XOPEN_SOURCE
1942#   undef _XOPEN_SOURCE_EXTENDED
1943#  endif /* ! _XOPEN_SOURCE */
1944# endif /* NCR_MP_RAS3 */
1945
1946
1947/*
1948**  Tandem NonStop-UX SVR4
1949**
1950**	From Rick McCarty <mccarty@mpd.tandem.com>.
1951*/
1952
1953# ifdef NonStop_UX_BXX
1954#  define __svr4__
1955# endif /* NonStop_UX_BXX */
1956
1957
1958/*
1959**  Hitachi 3050R/3050RX and 3500 Workstations running HI-UX/WE2.
1960**
1961**	Tested for 1.04, 1.03
1962**	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
1963**
1964**	Tested for 4.02, 6.10 and 7.10
1965**	From Motonori NAKAMURA <motonori@media.kyoto-u.ac.jp>.
1966*/
1967
1968# if !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE))
1969#  define SYSTEM5	1	/* include all the System V defines */
1970#  define HASINITGROUPS	1	/* has initgroups(3) call */
1971#  define HASFCHMOD	1	/* has fchmod(2) syscall */
1972#  define setreuid(r, e)	setresuid(r, e, -1)
1973#  define LA_TYPE	LA_FLOAT
1974#  define SPT_TYPE	SPT_PSTAT
1975#  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
1976#  ifndef HASSETVBUF
1977#   define HASSETVBUF	/* HI-UX has no setlinebuf */
1978#  endif /* ! HASSETVBUF */
1979#  ifndef GIDSET_T
1980#   define GIDSET_T	gid_t
1981#  endif /* ! GIDSET_T */
1982#  ifndef _PATH_UNIX
1983#   define _PATH_UNIX		"/HI-UX"
1984#  endif /* ! _PATH_UNIX */
1985#  ifndef _PATH_VENDOR_CF
1986#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
1987#  endif /* ! _PATH_VENDOR_CF */
1988#  ifndef IDENTPROTO
1989#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
1990#  endif /* ! IDENTPROTO */
1991#  ifndef HASGETUSERSHELL
1992#   define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
1993#  endif /* ! HASGETUSERSHELL */
1994#  define FDSET_CAST	(int *)	/* cast for fd_set parameters to select */
1995
1996/*
1997**  avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
1998**  on HIUX 3050
1999*/
2000#  undef m_flags
2001
2002#  define SM_CONF_SYSLOG	0
2003
2004# endif /* !defined(__hpux) && (defined(_H3050R) || defined(_HIUX_SOURCE)) */
2005
2006
2007/*
2008**  Amdahl UTS System V 2.1.5 (SVr3-based)
2009**
2010**    From: Janet Jackson <janet@dialix.oz.au>.
2011*/
2012
2013# ifdef _UTS
2014#  include <sys/sysmacros.h>
2015#  undef HASLSTAT		/* has symlinks, but they cause problems */
2016#  define NEEDFSYNC	1	/* system fsync(2) fails on non-EFS filesys */
2017#  define SYS5SIGNALS	1	/* System V signal semantics */
2018#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
2019#  define HASUNAME	1	/* use System V uname(2) system call */
2020#  define HASINITGROUPS	1	/* has initgroups(3) function */
2021#  define HASSETVBUF	1	/* has setvbuf(3) function */
2022#  ifndef HASGETUSERSHELL
2023#   define HASGETUSERSHELL 0	/* does not have getusershell(3) function */
2024#  endif /* ! HASGETUSERSHELL */
2025#  define GIDSET_T	gid_t	/* type of 2nd arg to getgroups(2) isn't int */
2026#  define LA_TYPE	LA_ZERO		/* doesn't have load average */
2027#  define SFS_TYPE	SFS_4ARGS	/* use 4-arg statfs() */
2028#  define SFS_BAVAIL	f_bfree		/* alternate field name */
2029#  define _PATH_UNIX		"/unix"
2030#  ifndef _PATH_VENDOR_CF
2031#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2032#  endif /* ! _PATH_VENDOR_CF */
2033# endif /* _UTS */
2034
2035/*
2036**  Cray Computer Corporation's CSOS
2037**
2038**	From Scott Bolte <scott@craycos.com>.
2039*/
2040
2041# ifdef _CRAYCOM
2042#  define SYSTEM5	1	/* include all the System V defines */
2043#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2044#  define NEEDFSYNC	1	/* no fsync in system library */
2045#  define MAXPATHLEN	PATHSIZE
2046#  define LA_TYPE	LA_ZERO
2047#  define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
2048#  define SFS_BAVAIL	f_bfree		/* alternate field name */
2049#  define _POSIX_CHOWN_RESTRICTED	-1
2050extern struct group	*getgrent(), *getgrnam(), *getgrgid();
2051# endif /* _CRAYCOM */
2052
2053
2054/*
2055**  Sony NEWS-OS 4.2.1R and 6.0.3
2056**
2057**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2058*/
2059
2060# ifdef sony_news
2061#  ifndef __svr4
2062			/* NEWS-OS 4.2.1R */
2063#   ifndef BSD
2064#    define BSD			/* has BSD routines */
2065#   endif /* ! BSD */
2066#   define HASUNSETENV	1	/* has unsetenv(2) call */
2067#   undef HASSETVBUF		/* don't actually have setvbuf(3) */
2068#   define WAITUNION	1	/* use "union wait" as wait argument type */
2069#   define LA_TYPE	LA_INT
2070#   define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
2071#   ifndef HASFLOCK
2072#    define HASFLOCK	1	/* has flock(2) call */
2073#   endif /* ! HASFLOCK */
2074#   define setpgid	setpgrp
2075#   undef WIFEXITED
2076#   undef WEXITSTATUS
2077#   define MODE_T	int	/* system include files have no mode_t */
2078typedef int		pid_t;
2079typedef int		(*sigfunc_t)();
2080#   define SIGFUNC_DEFINED
2081#   define SIGFUNC_RETURN	(0)
2082#   define SIGFUNC_DECL		int
2083
2084#  else /* ! __svr4 */
2085			/* NEWS-OS 6.0.3 with /bin/cc */
2086#   ifndef __svr4__
2087#    define __svr4__		/* use all System V Release 4 defines below */
2088#   endif /* ! __svr4__ */
2089#   define HASSETSID	1	/* has POSIX setsid(2) call */
2090#   define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
2091#   define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2092#   ifndef SPT_TYPE
2093#    define SPT_TYPE	SPT_SYSMIPS	/* use sysmips() (OS 6.0.2 or later) */
2094#   endif /* ! SPT_TYPE */
2095#   define GIDSET_T	gid_t
2096#   undef WIFEXITED
2097#   undef WEXITSTATUS
2098#   ifndef SYSLOG_BUFSIZE
2099#    define SYSLOG_BUFSIZE	256
2100#   endif /* ! SYSLOG_BUFSIZE */
2101#   define _PATH_UNIX		"/stand/unix"
2102#   ifndef _PATH_VENDOR_CF
2103#    define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2104#   endif /* ! _PATH_VENDOR_CF */
2105#   ifndef _PATH_SENDMAILPID
2106#    define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2107#   endif /* ! _PATH_SENDMAILPID */
2108
2109#  endif /* ! __svr4 */
2110# endif /* sony_news */
2111
2112
2113/*
2114**  Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
2115**
2116**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2117*/
2118
2119# ifdef luna
2120#  ifndef IDENTPROTO
2121#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2122#  endif /* ! IDENTPROTO */
2123#  define HASUNSETENV	1	/* has unsetenv(2) call */
2124#  define NEEDPUTENV	1	/* need putenv(3) call */
2125#  define SM_CONF_GETOPT	0	/* need a replacement for getopt(3) */
2126#  define NEEDSTRSTR	1	/* need emulation of the strstr(3) call */
2127#  define WAITUNION	1	/* use "union wait" as wait argument type */
2128#  ifdef uniosb
2129#   include <sys/time.h>
2130#   define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
2131#   define LA_TYPE	LA_INT
2132#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2133#  endif /* uniosb */
2134#  ifdef luna2
2135#   define LA_TYPE	LA_SUBR
2136#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone */
2137#  endif /* luna2 */
2138#  ifdef luna88k
2139#   define LA_TYPE	LA_INT
2140#  endif /* luna88k */
2141#  define SFS_TYPE	SFS_VFS /* use <sys/vfs.h> statfs() implementation */
2142#  define setpgid	setpgrp
2143#  undef WIFEXITED
2144#  undef WEXITSTATUS
2145typedef int		pid_t;
2146typedef int		(*sigfunc_t)();
2147#  define SIGFUNC_DEFINED
2148#  define SIGFUNC_RETURN	(0)
2149#  define SIGFUNC_DECL	int
2150extern char	*getenv();
2151#  ifndef _PATH_VENDOR_CF
2152#   define _PATH_VENDOR_CF	"/usr/lib/sendmail.cf"
2153#  endif /* ! _PATH_VENDOR_CF */
2154# endif /* luna */
2155
2156
2157/*
2158**  NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
2159**
2160**	From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
2161*/
2162
2163# if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
2164#  ifndef __svr4__
2165#   define __svr4__		/* use all System V Release 4 defines below */
2166#  endif /* ! __svr4__ */
2167#  define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
2168#  define HASSETSID	1	/* has POSIX setsid(2) call */
2169#  define LA_TYPE	LA_READKSYM	/* use MIOC_READSYM ioctl */
2170#  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2171#  define GIDSET_T	gid_t
2172#  undef WIFEXITED
2173#  undef WEXITSTATUS
2174#  define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
2175#  ifndef _PATH_VENDOR_CF
2176#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2177#  endif /* ! _PATH_VENDOR_CF */
2178#  ifndef _PATH_SENDMAILPID
2179#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2180#  endif /* ! _PATH_SENDMAILPID */
2181#  ifndef SYSLOG_BUFSIZE
2182#   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
2183#  endif /* ! SYSLOG_BUFSIZE */
2184# endif /* defined(nec_ews_svr4) || defined(_nec_ews_svr4) */
2185
2186
2187/*
2188**  Fujitsu/ICL UXP/DS (For the DS/90 Series)
2189**
2190**	From Diego R. Lopez <drlopez@cica.es>.
2191**	Additional changes from Fumio Moriya and Toshiaki Nomura of the
2192**		Fujitsu Fresoftware group <dsfrsoft@oai6.yk.fujitsu.co.jp>.
2193*/
2194
2195# ifdef __uxp__
2196#  include <arpa/nameser.h>
2197#  include <sys/sysmacros.h>
2198#  include <sys/mkdev.h>
2199#  define __svr4__
2200#  define HASGETUSERSHELL	0
2201#  define HASFLOCK		0
2202#  define _PATH_UNIX		"/stand/unix"
2203#  ifndef _PATH_VENDOR_CF
2204#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2205#  endif /* ! _PATH_VENDOR_CF */
2206#  ifndef _PATH_SENDMAILPID
2207#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2208#  endif /* ! _PATH_SENDMAILPID */
2209# endif /* __uxp__ */
2210
2211/*
2212**  Pyramid DC/OSx
2213**
2214**	From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
2215*/
2216
2217# ifdef DCOSx
2218#  define GIDSET_T	gid_t
2219#  ifndef IDENTPROTO
2220#   define IDENTPROTO	0	/* TCP/IP implementation is broken */
2221#  endif /* ! IDENTPROTO */
2222# endif /* DCOSx */
2223
2224/*
2225**  Concurrent Computer Corporation Maxion
2226**
2227**	From Donald R. Laster Jr. <laster@access.digex.net>.
2228*/
2229
2230# ifdef __MAXION__
2231
2232#  include <sys/stream.h>
2233#  define __svr4__		1	/* SVR4.2MP */
2234#  define HASSETREUID		1	/* have setreuid(2) */
2235#  define HASLSTAT		1	/* have lstat(2) */
2236#  define HASSETRLIMIT		1	/* have setrlimit(2) */
2237#  define HASGETDTABLESIZE	1	/* have getdtablesize(2) */
2238#  define HASGETUSERSHELL	1	/* have getusershell(3) */
2239#  define NOFTRUNCATE		1	/* do not have ftruncate(2) */
2240#  define SLEEP_T		unsigned
2241#  define SFS_TYPE		SFS_STATVFS
2242#  define SFS_BAVAIL		f_bavail
2243#  ifndef SYSLOG_BUFSIZE
2244#   define SYSLOG_BUFSIZE	256	/* Use 256 bytes */
2245#  endif /* ! SYSLOG_BUFSIZE */
2246
2247#  undef WUNTRACED
2248#  undef WIFEXITED
2249#  undef WIFSIGNALED
2250#  undef WIFSTOPPED
2251#  undef WEXITSTATUS
2252#  undef WTERMSIG
2253#  undef WSTOPSIG
2254
2255# endif /* __MAXION__ */
2256
2257/*
2258**  Harris Nighthawk PowerUX (nh6000 box)
2259**
2260**  Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
2261*/
2262
2263# ifdef _PowerUX
2264#  ifndef __svr4__
2265#   define __svr4__
2266#  endif /* ! __svr4__ */
2267#  ifndef _PATH_VENDOR_CF
2268#   define _PATH_VENDOR_CF	"/etc/mail/sendmail.cf"
2269#  endif /* ! _PATH_VENDOR_CF */
2270#  ifndef _PATH_SENDMAILPID
2271#   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
2272#  endif /* ! _PATH_SENDMAILPID */
2273#  define SYSLOG_BUFSIZE		1024
2274#  define LA_TYPE		LA_ZERO
2275typedef struct msgb		mblk_t;
2276#  undef offsetof	/* avoid stddefs.h and sys/sysmacros.h conflict */
2277# endif /* _PowerUX */
2278
2279/*
2280**  Siemens Nixdorf Informationssysteme AG SINIX
2281**
2282**	Contributed by Gerald Rinske of Siemens Business Services VAS.
2283*/
2284# ifdef sinix
2285#  define HASRANDOM		0	/* has random(3) */
2286#  define SYSLOG_BUFSIZE	1024
2287#  define SM_INT32		int	/* 32bit integer */
2288# endif /* sinix */
2289
2290
2291/*
2292**  Motorola 922, MC88110, UNIX SYSTEM V/88 Release 4.0 Version 4.3
2293**
2294**	Contributed by Sergey Rusanov <rsm@utfoms.udmnet.ru>
2295*/
2296
2297# ifdef MOTO
2298#  define HASFCHMOD		1
2299#  define HASSETRLIMIT		0
2300#  define HASSETSID	1	/* has POSIX setsid(2) call */
2301#  define HASSETREUID		1
2302#  define HASULIMIT		1
2303#  define HASWAITPID		1
2304#  define HASGETDTABLESIZE	1
2305#  define HASGETUSERSHELL	1
2306#  define IP_SRCROUTE		0
2307#  define IDENTPROTO		0
2308#  define RES_DNSRCH_VARIABLE	_res_dnsrch
2309#  define _PATH_UNIX		"/unix"
2310#  define _PATH_VENDOR_CF	"/etc/sendmail.cf"
2311#  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
2312# endif /* MOTO */
2313
2314/*
2315**  Interix
2316**	Contributed by Nedelcho Stanev <nedelcho.stanev@atlanticsky.com>
2317**
2318**	Used for Interix support.
2319*/
2320
2321# if defined(__INTERIX)
2322#  define HASURANDOMDEV		1
2323#  define HASGETUSERSHELL	0
2324#  define HASSTRERROR		1
2325#  define HASUNSETENV		1
2326#  define HASFCHOWN		1
2327#  undef HAVE_SYS_ERRLIST
2328#  define sys_errlist		__sys_errlist
2329#  define sys_nerr		__sys_nerr
2330#  include <sys/mkdev.h>
2331#  ifndef major
2332#   define major(dev)		((int)(((dev) >> 8) & 0xff))
2333#  endif /* ! major */
2334#  ifndef minor
2335#   define minor(dev)		((int)((dev) & 0xff))
2336#  endif /* ! minor */
2337# endif /* defined(__INTERIX) */
2338
2339
2340/**********************************************************************
2341**  End of Per-Operating System defines
2342**********************************************************************/
2343/**********************************************************************
2344**  More general defines
2345**********************************************************************/
2346
2347/* general BSD defines */
2348# ifdef BSD
2349#  define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
2350#  ifndef HASSETREUID
2351#   define HASSETREUID	1	/* has setreuid(2) call */
2352#  endif /* ! HASSETREUID */
2353#  define HASINITGROUPS	1	/* has initgroups(3) call */
2354#  ifndef IP_SRCROUTE
2355#   define IP_SRCROUTE	1	/* can check IP source routing */
2356#  endif /* ! IP_SRCROUTE */
2357#  ifndef HASSETRLIMIT
2358#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2359#  endif /* ! HASSETRLIMIT */
2360#  ifndef HASFLOCK
2361#   define HASFLOCK	1	/* has flock(2) call */
2362#  endif /* ! HASFLOCK */
2363#  ifndef TZ_TYPE
2364#   define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
2365#  endif /* ! TZ_TYPE */
2366# endif /* BSD */
2367
2368/* general System V Release 4 defines */
2369# ifdef __svr4__
2370#  define SYSTEM5	1
2371#  define USESETEUID	1	/* has usable seteuid(2) call */
2372#  define HASINITGROUPS	1	/* has initgroups(3) call */
2373#  define BSD_COMP	1	/* get BSD ioctl calls */
2374#  ifndef HASSETRLIMIT
2375#   define HASSETRLIMIT	1	/* has setrlimit(2) call */
2376#  endif /* ! HASSETRLIMIT */
2377#  ifndef HASGETUSERSHELL
2378#   define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
2379#  endif /* ! HASGETUSERSHELL */
2380#  ifndef HASFCHMOD
2381#   define HASFCHMOD	1	/* most (all?) SVr4s seem to have fchmod(2) */
2382#  endif /* ! HASFCHMOD */
2383
2384#  ifndef _PATH_UNIX
2385#   define _PATH_UNIX		"/unix"
2386#  endif /* ! _PATH_UNIX */
2387#  ifndef _PATH_VENDOR_CF
2388#   define _PATH_VENDOR_CF	"/usr/ucblib/sendmail.cf"
2389#  endif /* ! _PATH_VENDOR_CF */
2390#  ifndef _PATH_SENDMAILPID
2391#   define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
2392#  endif /* ! _PATH_SENDMAILPID */
2393#  ifndef SYSLOG_BUFSIZE
2394#   define SYSLOG_BUFSIZE	128
2395#  endif /* ! SYSLOG_BUFSIZE */
2396#  ifndef SFS_TYPE
2397#   define SFS_TYPE		SFS_STATVFS
2398#  endif /* ! SFS_TYPE */
2399
2400#  ifndef USE_SIGLONGJMP
2401#   define USE_SIGLONGJMP	1 /* sigsetjmp needed for signal handling */
2402#  endif /* ! USE_SIGLONGJMP */
2403# endif /* __svr4__ */
2404
2405# ifdef __SVR4
2406#  define LDA_USE_LOCKF		1
2407#  define LDA_USE_SETEUID	1
2408#  define _PATH_MAILDIR		"/var/mail"
2409# endif /* __SVR4 */
2410
2411/* general System V defines */
2412# ifdef SYSTEM5
2413#  include <sys/sysmacros.h>
2414#  define HASUNAME	1	/* use System V uname(2) system call */
2415#  define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
2416#  define HASSETVBUF	1	/* we have setvbuf(3) in libc */
2417#  ifndef HASULIMIT
2418#   define HASULIMIT	1	/* has the ulimit(2) syscall */
2419#  endif /* ! HASULIMIT */
2420#  ifndef LA_TYPE
2421#   ifdef MIOC_READKSYM
2422#    define LA_TYPE	LA_READKSYM	/* use MIOC_READKSYM ioctl */
2423#   else /* MIOC_READKSYM */
2424#    define LA_TYPE	LA_INT		/* assume integer load average */
2425#   endif /* MIOC_READKSYM */
2426#  endif /* ! LA_TYPE */
2427#  ifndef SFS_TYPE
2428#   define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
2429#  endif /* ! SFS_TYPE */
2430#  ifndef TZ_TYPE
2431#   define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
2432#  endif /* ! TZ_TYPE */
2433# endif /* SYSTEM5 */
2434
2435/* general POSIX defines */
2436# ifdef _POSIX_VERSION
2437#  define HASSETSID	1	/* has POSIX setsid(2) call */
2438#  define HASWAITPID	1	/* has POSIX waitpid(2) call */
2439#  if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
2440#   define USESETEUID	1	/* has usable seteuid(2) call */
2441#  endif /* _POSIX_VERSION >= 199500 && !defined(USESETEUID) */
2442# endif /* _POSIX_VERSION */
2443/*
2444**  Tweaking for systems that (for example) claim to be BSD or POSIX
2445**  but don't have all the standard BSD or POSIX routines (boo hiss).
2446*/
2447
2448# ifdef titan
2449#  undef HASINITGROUPS		/* doesn't have initgroups(3) call */
2450# endif /* titan */
2451
2452# ifdef _CRAYCOM
2453#  undef HASSETSID		/* despite POSIX claim, doesn't have setsid */
2454# endif /* _CRAYCOM */
2455
2456# ifdef MOTO
2457#  undef USESETEUID
2458# endif /* MOTO */
2459
2460/*
2461**  Due to a "feature" in some operating systems such as Ultrix 4.3 and
2462**  HPUX 8.0, if you receive a "No route to host" message (ICMP message
2463**  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
2464**  are closed.  Some firewalls return this error if you try to connect
2465**  to the IDENT port (113), so you can't receive email from these hosts
2466**  on these systems.  The firewall really should use a more specific
2467**  message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB.  If
2468**  not explicitly set to zero above, default it on.
2469*/
2470
2471# ifndef IDENTPROTO
2472#  define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
2473# endif /* ! IDENTPROTO */
2474
2475# ifndef IP_SRCROUTE
2476#  define IP_SRCROUTE	1	/* Detect IP source routing */
2477# endif /* ! IP_SRCROUTE */
2478
2479# ifndef HASGETUSERSHELL
2480#  define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
2481# endif /* ! HASGETUSERSHELL */
2482
2483# ifndef NETUNIX
2484#  define NETUNIX	1	/* include unix domain support */
2485# endif /* ! NETUNIX */
2486
2487# ifndef HASRANDOM
2488#  define HASRANDOM	1	/* has random(3) support */
2489# endif /* ! HASRANDOM */
2490
2491# ifndef HASFLOCK
2492#  define HASFLOCK	0	/* assume no flock(2) support */
2493# endif /* ! HASFLOCK */
2494
2495# ifndef HASSETREUID
2496#  define HASSETREUID	0	/* assume no setreuid(2) call */
2497# endif /* ! HASSETREUID */
2498
2499# ifndef HASFCHMOD
2500#  define HASFCHMOD	0	/* assume no fchmod(2) syscall */
2501# endif /* ! HASFCHMOD */
2502
2503# ifndef USESETEUID
2504#  define USESETEUID	0	/* assume no seteuid(2) call or no saved ids */
2505# endif /* ! USESETEUID */
2506
2507# ifndef HASSETRLIMIT
2508#  define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
2509# endif /* ! HASSETRLIMIT */
2510
2511# ifndef HASULIMIT
2512#  define HASULIMIT	0	/* assume no ulimit(2) support */
2513# endif /* ! HASULIMIT */
2514
2515# ifndef SECUREWARE
2516#  define SECUREWARE	0	/* assume no SecureWare C2 auditing hooks */
2517# endif /* ! SECUREWARE */
2518
2519# ifndef USE_DOUBLE_FORK
2520#  define USE_DOUBLE_FORK	1	/* avoid intermediate zombies */
2521# endif /* ! USE_DOUBLE_FORK */
2522
2523# ifndef USE_ENVIRON
2524#  define USE_ENVIRON	0	/* use main() envp instead of extern environ */
2525# endif /* ! USE_ENVIRON */
2526
2527# ifndef USE_SIGLONGJMP
2528#  define USE_SIGLONGJMP	0	/* assume setjmp handles signals properly */
2529# endif /* ! USE_SIGLONGJMP */
2530
2531# ifndef FDSET_CAST
2532#  define FDSET_CAST		/* (empty) cast for fd_set arg to select */
2533# endif /* ! FDSET_CAST */
2534
2535/*
2536**  Pick a mailer setuid method for changing the current uid
2537*/
2538
2539# define USE_SETEUID	0
2540# define USE_SETREUID	1
2541# define USE_SETUID	2
2542
2543# if USESETEUID
2544#  define MAILER_SETUID_METHOD	USE_SETEUID
2545# else /* USESETEUID */
2546#  if HASSETREUID
2547#   define MAILER_SETUID_METHOD	USE_SETREUID
2548#  else /* HASSETREUID */
2549#   define MAILER_SETUID_METHOD	USE_SETUID
2550#  endif /* HASSETREUID */
2551# endif /* USESETEUID */
2552
2553/*
2554**  If no type for argument two of getgroups call is defined, assume
2555**  it's an integer -- unfortunately, there seem to be several choices
2556**  here.
2557*/
2558
2559# ifndef GIDSET_T
2560#  define GIDSET_T	int
2561# endif /* ! GIDSET_T */
2562
2563# ifndef UID_T
2564#  define UID_T		uid_t
2565# endif /* ! UID_T */
2566
2567# ifndef GID_T
2568#  define GID_T		gid_t
2569# endif /* ! GID_T */
2570
2571# ifndef MODE_T
2572#  define MODE_T		mode_t
2573# endif /* ! MODE_T */
2574
2575# ifndef ARGV_T
2576#  define ARGV_T		char **
2577# endif /* ! ARGV_T */
2578
2579# ifndef SOCKADDR_LEN_T
2580#  define SOCKADDR_LEN_T	int
2581# endif /* ! SOCKADDR_LEN_T */
2582
2583# ifndef SOCKOPT_LEN_T
2584#  define SOCKOPT_LEN_T	int
2585# endif /* ! SOCKOPT_LEN_T */
2586
2587# ifndef QUAD_T
2588#  define QUAD_T	unsigned long
2589# endif /* ! QUAD_T */
2590/**********************************************************************
2591**  Remaining definitions should never have to be changed.  They are
2592**  primarily to provide back compatibility for older systems -- for
2593**  example, it includes some POSIX compatibility definitions
2594**********************************************************************/
2595
2596/* System 5 compatibility */
2597# ifndef S_ISREG
2598#  define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
2599# endif /* ! S_ISREG */
2600# ifndef S_ISDIR
2601#  define S_ISDIR(foo)	((foo & S_IFMT) == S_IFDIR)
2602# endif /* ! S_ISDIR */
2603# if !defined(S_ISLNK) && defined(S_IFLNK)
2604#  define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
2605# endif /* !defined(S_ISLNK) && defined(S_IFLNK) */
2606# if !defined(S_ISFIFO)
2607#  if defined(S_IFIFO)
2608#   define S_ISFIFO(foo)	((foo & S_IFMT) == S_IFIFO)
2609#  else /* defined(S_IFIFO) */
2610#   define S_ISFIFO(foo)	false
2611#  endif /* defined(S_IFIFO) */
2612# endif /* !defined(S_ISFIFO) */
2613# ifndef S_IRUSR
2614#  define S_IRUSR		0400
2615# endif /* ! S_IRUSR */
2616# ifndef S_IWUSR
2617#  define S_IWUSR		0200
2618# endif /* ! S_IWUSR */
2619# ifndef S_IRGRP
2620#  define S_IRGRP		0040
2621# endif /* ! S_IRGRP */
2622# ifndef S_IWGRP
2623#  define S_IWGRP		0020
2624# endif /* ! S_IWGRP */
2625# ifndef S_IROTH
2626#  define S_IROTH		0004
2627# endif /* ! S_IROTH */
2628# ifndef S_IWOTH
2629#  define S_IWOTH		0002
2630# endif /* ! S_IWOTH */
2631
2632/* close-on-exec flag */
2633# ifndef FD_CLOEXEC
2634#  define FD_CLOEXEC	1
2635# endif /* ! FD_CLOEXEC */
2636
2637/*
2638**  Older systems don't have this error code -- it should be in
2639**  /usr/include/sysexits.h.
2640*/
2641
2642# ifndef EX_CONFIG
2643#  define EX_CONFIG	78	/* configuration error */
2644# endif /* ! EX_CONFIG */
2645
2646/* pseudo-codes */
2647# define EX_QUIT	22	/* drop out of server immediately */
2648# define EX_RESTART	23	/* restart sendmail daemon */
2649# define EX_SHUTDOWN	24	/* shutdown sendmail daemon */
2650
2651#ifndef EX_NOTFOUND
2652# define EX_NOTFOUND	EX_NOHOST
2653#endif /* ! EX_NOTFOUND */
2654
2655/* pseudo-code used for mci_setstat */
2656# define EX_NOTSTICKY	(-5)	/* don't save persistent status */
2657
2658
2659/*
2660**  An "impossible" file mode to indicate that the file does not exist.
2661*/
2662
2663# define ST_MODE_NOFILE	0171147		/* unlikely to occur */
2664
2665
2666/* type of arbitrary pointer */
2667# ifndef ARBPTR_T
2668#  define ARBPTR_T	void *
2669# endif /* ! ARBPTR_T */
2670
2671# ifndef __P
2672#  include "sm/cdefs.h"
2673# endif /* ! __P */
2674
2675# if HESIOD && !defined(NAMED_BIND)
2676#  define NAMED_BIND	1	/* not one without the other */
2677# endif /* HESIOD && !defined(NAMED_BIND) */
2678
2679#  if NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno )
2680extern int	h_errno;
2681#  endif /* NAMED_BIND && !defined( __ksr__ ) && !defined( h_errno ) */
2682
2683# if NEEDPUTENV
2684extern int	putenv __P((char *));
2685# endif /* NEEDPUTENV */
2686
2687#if !HASUNSETENV
2688extern void	unsetenv __P((char *));
2689#endif /* !HASUNSETENV */
2690
2691# ifdef LDAPMAP
2692#  include <sys/time.h>
2693#  include <lber.h>
2694#  include <ldap.h>
2695
2696/* Some LDAP constants */
2697#  define LDAPMAP_FALSE		0
2698#  define LDAPMAP_TRUE		1
2699
2700/*
2701**  ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
2702**  Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
2703**  and assume (falsely) that all old API implementations are broken.
2704**  (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
2705*/
2706
2707#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
2708#   define USE_LDAP_INIT	1
2709#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT) */
2710
2711/*
2712**  LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
2713**  hence ldap_set_option() must not exist.
2714*/
2715
2716#  if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
2717#   define USE_LDAP_SET_OPTION	1
2718#  endif /* defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION) */
2719
2720# endif /* LDAPMAP */
2721
2722# if HASUNAME
2723#  include <sys/utsname.h>
2724#  ifdef newstr
2725#   undef newstr
2726#  endif /* newstr */
2727# else /* HASUNAME */
2728#  define NODE_LENGTH 32
2729struct utsname
2730{
2731	char nodename[NODE_LENGTH + 1];
2732};
2733# endif /* HASUNAME */
2734
2735# if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
2736#  define MAXHOSTNAMELEN	256
2737# endif /* !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V) */
2738
2739# if !defined(SIGCHLD) && defined(SIGCLD)
2740#  define SIGCHLD	SIGCLD
2741# endif /* !defined(SIGCHLD) && defined(SIGCLD) */
2742
2743# ifndef STDIN_FILENO
2744#  define STDIN_FILENO	0
2745# endif /* ! STDIN_FILENO */
2746
2747# ifndef STDOUT_FILENO
2748#  define STDOUT_FILENO	1
2749# endif /* ! STDOUT_FILENO */
2750
2751# ifndef STDERR_FILENO
2752#  define STDERR_FILENO	2
2753# endif /* ! STDERR_FILENO */
2754
2755# ifndef LOCK_SH
2756#  define LOCK_SH	0x01	/* shared lock */
2757#  define LOCK_EX	0x02	/* exclusive lock */
2758#  define LOCK_NB	0x04	/* non-blocking lock */
2759#  define LOCK_UN	0x08	/* unlock */
2760# endif /* ! LOCK_SH */
2761
2762# ifndef S_IXOTH
2763#  define S_IXOTH	(S_IEXEC >> 6)
2764# endif /* ! S_IXOTH */
2765
2766# ifndef S_IXGRP
2767#  define S_IXGRP	(S_IEXEC >> 3)
2768# endif /* ! S_IXGRP */
2769
2770# ifndef S_IXUSR
2771#  define S_IXUSR	(S_IEXEC)
2772# endif /* ! S_IXUSR */
2773
2774#ifndef O_ACCMODE
2775# define O_ACCMODE	(O_RDONLY|O_WRONLY|O_RDWR)
2776#endif /* ! O_ACCMODE */
2777
2778# ifndef SEEK_SET
2779#  define SEEK_SET	0
2780#  define SEEK_CUR	1
2781#  define SEEK_END	2
2782# endif /* ! SEEK_SET */
2783
2784# ifndef SIG_ERR
2785#  define SIG_ERR	((void (*)()) -1)
2786# endif /* ! SIG_ERR */
2787
2788# ifndef WEXITSTATUS
2789#  define WEXITSTATUS(st)	(((st) >> 8) & 0377)
2790# endif /* ! WEXITSTATUS */
2791# ifndef WIFEXITED
2792#  define WIFEXITED(st)		(((st) & 0377) == 0)
2793# endif /* ! WIFEXITED */
2794# ifndef WIFSTOPPED
2795#  define WIFSTOPPED(st)		(((st) & 0100) == 0)
2796# endif /* ! WIFSTOPPED */
2797# ifndef WCOREDUMP
2798#  define WCOREDUMP(st)		(((st) & 0200) != 0)
2799# endif /* ! WCOREDUMP */
2800# ifndef WTERMSIG
2801#  define WTERMSIG(st)		(((st) & 0177))
2802# endif /* ! WTERMSIG */
2803
2804# ifndef SIGFUNC_DEFINED
2805typedef void		(*sigfunc_t) __P((int));
2806# endif /* ! SIGFUNC_DEFINED */
2807# ifndef SIGFUNC_RETURN
2808#  define SIGFUNC_RETURN
2809# endif /* ! SIGFUNC_RETURN */
2810# ifndef SIGFUNC_DECL
2811#  define SIGFUNC_DECL	void
2812# endif /* ! SIGFUNC_DECL */
2813
2814/* size of syslog buffer */
2815# ifndef SYSLOG_BUFSIZE
2816#  define SYSLOG_BUFSIZE	1024
2817# endif /* ! SYSLOG_BUFSIZE */
2818
2819/* for FD_SET() */
2820#ifndef FD_SETSIZE
2821# define FD_SETSIZE	256
2822#endif /* ! FD_SETSIZE */
2823
2824/*
2825**  Size of prescan buffer.
2826**	Despite comments in the _sendmail_ book, this probably should
2827**	not be changed; there are some hard-to-define dependencies.
2828*/
2829
2830# define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
2831
2832/* fork routine -- set above using #ifdef _osname_ or in Makefile */
2833# ifndef FORK
2834#  define FORK		fork		/* function to call to fork mailer */
2835# endif /* ! FORK */
2836
2837/* setting h_errno */
2838# ifndef SM_SET_H_ERRNO
2839#  define SM_SET_H_ERRNO(err)	h_errno = (err)
2840# endif /* SM_SET_H_ERRNO */
2841
2842# ifndef SM_CONF_GETOPT
2843#  define SM_CONF_GETOPT	1
2844# endif /* ! SM_CONF_GETOPT */
2845
2846/* random routine -- set above using #ifdef _osname_ or in Makefile */
2847# if HASRANDOM
2848#  define get_random()	random()
2849# else /* HASRANDOM */
2850#  define get_random()	((long) rand())
2851#  ifndef RANDOMSHIFT
2852#   define RANDOMSHIFT	8
2853#  endif /* ! RANDOMSHIFT */
2854# endif /* HASRANDOM */
2855
2856/*
2857**  Default to using scanf in readcf.
2858*/
2859
2860# ifndef SCANF
2861#  define SCANF		1
2862# endif /* ! SCANF */
2863
2864/* XXX  32 bit type */
2865# ifndef SM_INT32
2866#  define SM_INT32	int32_t
2867# endif /* ! SM_INT32 */
2868
2869/*
2870**  SVr4 and similar systems use different routines for setjmp/longjmp
2871**  with signal support
2872*/
2873
2874# if USE_SIGLONGJMP
2875#  ifdef jmp_buf
2876#   undef jmp_buf
2877#  endif /* jmp_buf */
2878#  define jmp_buf		sigjmp_buf
2879#  ifdef setjmp
2880#   undef setjmp
2881#  endif /* setjmp */
2882#  define setjmp(env)		sigsetjmp(env, 1)
2883#  ifdef longjmp
2884#   undef longjmp
2885#  endif /* longjmp */
2886#  define longjmp(env, val)	siglongjmp(env, val)
2887# endif /* USE_SIGLONGJMP */
2888
2889# if !defined(NGROUPS_MAX) && defined(NGROUPS)
2890#  define NGROUPS_MAX	NGROUPS		/* POSIX naming convention */
2891# endif /* !defined(NGROUPS_MAX) && defined(NGROUPS) */
2892
2893/*
2894**  Some snprintf() implementations are rumored not to NUL terminate.
2895*/
2896# if SNPRINTF_IS_BROKEN
2897#  ifdef snprintf
2898#   undef snprintf
2899#  endif /* snprintf */
2900#  define snprintf	sm_snprintf
2901#  ifdef vsnprintf
2902#   undef vsnprintf
2903#  endif /* vsnprintf */
2904#  define vsnprintf	sm_vsnprintf
2905# endif /* SNPRINTF_IS_BROKEN */
2906
2907/*
2908**  If we don't have a system syslog, simulate it.
2909*/
2910
2911# if !LOG
2912#  define LOG_EMERG	0	/* system is unusable */
2913#  define LOG_ALERT	1	/* action must be taken immediately */
2914#  define LOG_CRIT	2	/* critical conditions */
2915#  define LOG_ERR	3	/* error conditions */
2916#  define LOG_WARNING	4	/* warning conditions */
2917#  define LOG_NOTICE	5	/* normal but significant condition */
2918#  define LOG_INFO	6	/* informational */
2919#  define LOG_DEBUG	7	/* debug-level messages */
2920# endif /* !LOG */
2921
2922# ifndef SM_CONF_SYSLOG
2923#  define SM_CONF_SYSLOG 1	/* syslog.h has prototype for syslog() */
2924# endif /* SM_CONF_SYSLOG */
2925
2926# if !SM_CONF_SYSLOG
2927#   ifdef __STDC__
2928extern void	syslog(int, const char *, ...);
2929#   else /* __STDC__ */
2930extern void	syslog();
2931#   endif /* __STDC__ */
2932# endif /* !SM_CONF_SYSLOG */
2933
2934/* portable(?) definition for alignment */
2935# ifndef SM_ALIGN_SIZE
2936struct sm_align
2937{
2938	char al_c;
2939	union
2940	{
2941		long	al_l;
2942		void	*al_p;
2943		double	al_d;
2944		void	(*al_f) __P((void));
2945	} al_u;
2946};
2947#  define SM_ALIGN_SIZE offsetof(struct sm_align, al_u)
2948# endif /* ! SM_ALIGN_SIZE */
2949# define SM_ALIGN_BITS (SM_ALIGN_SIZE - 1)
2950
2951#endif /* ! SM_CONF_H */
2952