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