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