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