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