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