xref: /original-bsd/usr.sbin/sendmail/src/conf.h (revision b6592f3d)
1 /*
2  * Copyright (c) 1983 Eric P. Allman
3  * Copyright (c) 1988, 1993
4  *	The Regents of the University of California.  All rights reserved.
5  *
6  * %sccs.include.redist.c%
7  *
8  *	@(#)conf.h	8.118 (Berkeley) 08/27/94
9  */
10 
11 /*
12 **  CONF.H -- All user-configurable parameters for sendmail
13 */
14 
15 # include <sys/param.h>
16 # include <sys/types.h>
17 # include <sys/stat.h>
18 # include <sys/file.h>
19 # include <sys/wait.h>
20 # include <fcntl.h>
21 # include <signal.h>
22 
23 /**********************************************************************
24 **  Table sizes, etc....
25 **	There shouldn't be much need to change these....
26 **********************************************************************/
27 
28 # define MAXLINE	2048		/* max line length */
29 # define MAXNAME	256		/* max length of a name */
30 # define MAXPV		40		/* max # of parms to mailers */
31 # define MAXATOM	200		/* max atoms per address */
32 # define MAXMAILERS	25		/* maximum mailers known to system */
33 # define MAXRWSETS	100		/* max # of sets of rewriting rules */
34 # define MAXPRIORITIES	25		/* max values for Precedence: field */
35 # define MAXMXHOSTS	20		/* max # of MX records */
36 # define SMTPLINELIM	990		/* maximum SMTP line length */
37 # define MAXKEY		128		/* maximum size of a database key */
38 # define MEMCHUNKSIZE	1024		/* chunk size for memory allocation */
39 # define MAXUSERENVIRON	100		/* max envars saved, must be >= 3 */
40 # define MAXALIASDB	12		/* max # of alias databases */
41 # define MAXMAPSTACK	12		/* max # of stacked or sequenced maps */
42 # define MAXTOCLASS	8		/* max # of message timeout classes */
43 
44 # ifndef QUEUESIZE
45 # define QUEUESIZE	1000		/* max # of jobs per queue run */
46 # endif
47 
48 /**********************************************************************
49 **  Compilation options.
50 **
51 **	#define these if they are available; comment them out otherwise.
52 **********************************************************************/
53 
54 # define LOG		1	/* enable logging */
55 # define UGLYUUCP	1	/* output ugly UUCP From lines */
56 # define NETUNIX	1	/* include unix domain support */
57 # define NETINET	1	/* include internet support */
58 # define SETPROCTITLE	1	/* munge argv to display current status */
59 # define MATCHGECOS	1	/* match user names from gecos field */
60 # define XDEBUG		1	/* enable extended debugging */
61 # ifdef NEWDB
62 # define USERDB		1	/* look in user database (requires NEWDB) */
63 # endif
64 
65 /**********************************************************************
66 **  0/1 Compilation options.
67 **	#define these to 1 if they are available;
68 **	#define them to 0 otherwise.
69 **********************************************************************/
70 
71 # ifndef NAMED_BIND
72 #  define NAMED_BIND	1	/* use Berkeley Internet Domain Server */
73 # endif
74 
75 /*
76 **  Most systems have symbolic links today, so default them on.  You
77 **  can turn them off by #undef'ing this below.
78 */
79 
80 # define HASLSTAT	1	/* has lstat(2) call */
81 
82 /*
83 **  General "standard C" defines.
84 **
85 **	These may be undone later, to cope with systems that claim to
86 **	be Standard C but aren't.  Gcc is the biggest offender -- it
87 **	doesn't realize that the library is part of the language.
88 **
89 **	Life would be much easier if we could get rid of this sort
90 **	of bozo problems.
91 */
92 
93 #ifdef __STDC__
94 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
95 #endif
96 
97 /**********************************************************************
98 **  Operating system configuration.
99 **
100 **	Unless you are porting to a new OS, you shouldn't have to
101 **	change these.
102 **********************************************************************/
103 
104 /*
105 **  Per-Operating System defines
106 */
107 
108 
109 /*
110 **  HP-UX -- tested for 8.07, 9.00, and 9.01.
111 */
112 
113 #ifdef __hpux
114 /* avoid m_flags conflict between db.h & sys/sysmacros.h on HP 300 */
115 # undef m_flags
116 # define SYSTEM5	1	/* include all the System V defines */
117 # define HASINITGROUPS	1	/* has initgroups(3) call */
118 # define HASSETREUID	1	/* has setreuid(2) call */
119 # define setreuid(r, e)		setresuid(r, e, -1)
120 # define LA_TYPE	LA_FLOAT
121 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
122 # define GIDSET_T	gid_t
123 # define _PATH_UNIX	"/hp-ux"
124 # ifndef _PATH_SENDMAILCF
125 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
126 # endif
127 # ifndef IDENTPROTO
128 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
129 # endif
130 # ifndef HASGETUSERSHELL
131 #  define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
132 # endif
133 # define syslog		hard_syslog
134 # ifdef __STDC__
135 extern int	syslog(int, char *, ...);
136 # endif
137 #endif
138 
139 
140 /*
141 **  IBM AIX 3.x -- actually tested for 3.2.3
142 */
143 
144 #ifdef _AIX3
145 # define HASINITGROUPS	1	/* has initgroups(3) call */
146 # define HASUNAME	1	/* use System V uname(2) system call */
147 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
148 # define FORK		fork	/* no vfork primitive available */
149 # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
150 #endif
151 
152 
153 /*
154 **  Silicon Graphics IRIX
155 **
156 **	Compiles on 4.0.1.
157 */
158 
159 #ifdef IRIX
160 # define SYSTEM5	1	/* this is a System-V derived system */
161 # define HASSETREUID	1	/* has setreuid(2) call */
162 # define HASINITGROUPS	1	/* has initgroups(3) call */
163 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
164 # define FORK		fork	/* no vfork primitive available */
165 # define WAITUNION	1	/* use "union wait" as wait argument type */
166 # define setpgid	BSDsetpgrp
167 # define GIDSET_T	gid_t
168 # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
169 # define LA_TYPE	LA_INT
170 # define NAMELISTMASK	0x7fffffff	/* mask for nlist() values */
171 #endif
172 
173 
174 /*
175 **  SunOS and Solaris
176 **
177 **	Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
178 **	Solaris 2.2 (a.k.a. SunOS 5.2).
179 */
180 
181 #if defined(sun) && !defined(BSD)
182 
183 # define HASINITGROUPS	1	/* has initgroups(3) call */
184 # define HASUNAME	1	/* use System V uname(2) system call */
185 # define HASGETUSERSHELL 1	/* DOES have getusershell(3) call in libc */
186 # define LA_TYPE	LA_INT
187 
188 # ifdef SOLARIS_2_3
189 #  define SOLARIS
190 # endif
191 
192 # ifdef SOLARIS
193 			/* Solaris 2.x (a.k.a. SunOS 5.x) */
194 #  ifndef __svr4__
195 #   define __svr4__		/* use all System V Releae 4 defines below */
196 #  endif
197 #  include <sys/time.h>
198 #  define gethostbyname	solaris_gethostbyname	/* get working version */
199 #  define gethostbyaddr	solaris_gethostbyaddr	/* get working version */
200 #  define GIDSET_T	gid_t
201 #  ifndef _PATH_UNIX
202 #   define _PATH_UNIX	"/dev/ksyms"
203 #  endif
204 #  ifndef _PATH_SENDMAILCF
205 #   define _PATH_SENDMAILCF	"/etc/mail/sendmail.cf"
206 #  endif
207 #  ifndef _PATH_SENDMAILPID
208 #   define _PATH_SENDMAILPID	"/etc/mail/sendmail.pid"
209 #  endif
210 #  ifndef SYSLOG_BUFSIZE
211 #   define SYSLOG_BUFSIZE	1024	/* allow full size syslog buffer */
212 #  endif
213 
214 # else
215 			/* SunOS 4.0.3 or 4.1.x */
216 #  define HASSETREUID	1	/* has setreuid(2) call */
217 #  ifndef HASFLOCK
218 #   define HASFLOCK	1	/* has flock(2) call */
219 #  endif
220 #  define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
221 #  include <vfork.h>
222 
223 #  ifdef SUNOS403
224 			/* special tweaking for SunOS 4.0.3 */
225 #   include <malloc.h>
226 #   define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
227 #   define WAITUNION	1	/* use "union wait" as wait argument type */
228 #   undef WIFEXITED
229 #   undef WEXITSTATUS
230 #   undef HASUNAME
231 #   define setpgid	setpgrp
232 typedef int		pid_t;
233 extern char		*getenv();
234 
235 #  else
236 			/* 4.1.x specifics */
237 #   define HASSETSID	1	/* has Posix setsid(2) call */
238 #   define HASSETVBUF	1	/* we have setvbuf(3) in libc */
239 
240 #  endif
241 # endif
242 #endif
243 
244 /*
245 **  DG/UX
246 **
247 **	Tested on 5.4.2 and 5.4.3.  Use DGUX_5_4_2 to get the
248 **	older support.
249 **	5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
250 */
251 
252 #ifdef DGUX_5_4_2
253 # define DGUX		1
254 #endif
255 
256 #ifdef	DGUX
257 # define SYSTEM5	1
258 # define LA_TYPE	LA_SUBR
259 # define HASSETREUID	1	/* has setreuid(2) call */
260 # define HASUNAME	1	/* use System V uname(2) system call */
261 # define HASSETSID	1	/* has Posix setsid(2) call */
262 # define HASINITGROUPS	1	/* has initgroups(3) call */
263 # define HASGETUSERSHELL 0	/* does not have getusershell(3) */
264 # ifndef IDENTPROTO
265 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
266 # endif
267 # undef SETPROCTITLE
268 # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
269 
270 /* these include files must be included early on DG/UX */
271 # include <netinet/in.h>
272 # include <arpa/inet.h>
273 
274 # ifdef DGUX_5_4_2
275 #  define inet_addr	dgux_inet_addr
276 extern long	dgux_inet_addr();
277 # endif
278 #endif
279 
280 
281 /*
282 **  Digital Ultrix 4.2A or 4.3
283 **
284 **	Apparently, fcntl locking is broken on 4.2A, in that locks are
285 **	not dropped when the process exits.  This causes major problems,
286 **	so flock is the only alternative.
287 */
288 
289 #ifdef ultrix
290 # define HASSETREUID	1	/* has setreuid(2) call */
291 # define HASUNSETENV	1	/* has unsetenv(3) call */
292 # define HASINITGROUPS	1	/* has initgroups(3) call */
293 # define HASUNAME	1	/* use System V uname(2) system call */
294 # ifndef HASFLOCK
295 #  define HASFLOCK	1	/* has flock(2) call */
296 # endif
297 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
298 # define BROKEN_RES_SEARCH 1	/* res_search(unknown) returns h_errno=0 */
299 # ifdef vax
300 #  define LA_TYPE	LA_FLOAT
301 # else
302 #  define LA_TYPE	LA_INT
303 #  define LA_AVENRUN	"avenrun"
304 # endif
305 # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
306 # ifndef IDENTPROTO
307 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
308 # endif
309 #endif
310 
311 
312 /*
313 **  OSF/1 (tested on Alpha)
314 */
315 
316 #ifdef __osf__
317 # define HASUNSETENV	1	/* has unsetenv(3) call */
318 # define HASSETREUID	1	/* has setreuid(2) call */
319 # define HASINITGROUPS	1	/* has initgroups(3) call */
320 # ifndef HASFLOCK
321 #  define HASFLOCK	1	/* has flock(2) call */
322 # endif
323 # define LA_TYPE	LA_INT
324 # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
325 # ifndef _PATH_SENDMAILPID
326 #  define _PATH_SENDMAILPID	"/var/run/sendmail.pid"
327 # endif
328 #endif
329 
330 
331 /*
332 **  NeXTstep
333 */
334 
335 #ifdef NeXT
336 # define HASINITGROUPS	1	/* has initgroups(3) call */
337 # ifndef HASFLOCK
338 #  define HASFLOCK	1	/* has flock(2) call */
339 # endif
340 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
341 # define WAITUNION	1	/* use "union wait" as wait argument type */
342 # define sleep		sleepX
343 # define setpgid	setpgrp
344 # ifndef LA_TYPE
345 #  define LA_TYPE	LA_MACH
346 # endif
347 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
348 # ifndef _POSIX_SOURCE
349 typedef int		pid_t;
350 #  undef WEXITSTATUS
351 #  undef WIFEXITED
352 # endif
353 # ifndef _PATH_SENDMAILCF
354 #  define _PATH_SENDMAILCF	"/etc/sendmail/sendmail.cf"
355 # endif
356 # ifndef _PATH_SENDMAILPID
357 #  define _PATH_SENDMAILPID	"/etc/sendmail/sendmail.pid"
358 # endif
359 #endif
360 
361 
362 /*
363 **  4.4 BSD
364 **
365 **	See also BSD defines.
366 */
367 
368 #ifdef BSD4_4
369 # define HASUNSETENV	1	/* has unsetenv(3) call */
370 # include <sys/cdefs.h>
371 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
372 # ifndef LA_TYPE
373 #  define LA_TYPE	LA_SUBR
374 # endif
375 # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
376 #endif
377 
378 
379 /*
380 **  BSD/386 (all versions)
381 **	From Tony Sanders, BSDI
382 */
383 
384 #ifdef __bsdi__
385 # define HASUNSETENV	1	/* has the unsetenv(3) call */
386 # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
387 # include <sys/cdefs.h>
388 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
389 # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
390 # ifndef LA_TYPE
391 #  define LA_TYPE	LA_SUBR
392 # endif
393 # if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
394 			/* version 1.1 or later */
395 #  define HASSETPROCTITLE 1	/* setproctitle is in libc */
396 #  undef SETPROCTITLE		/* so don't redefine it in conf.c */
397 # else
398 			/* version 1.0 or earlier */
399 #  ifndef OLD_NEWDB
400 #   define OLD_NEWDB	1	/* old version of newdb library */
401 #  endif
402 # endif
403 #endif
404 
405 
406 
407 /*
408 **  386BSD / FreeBSD 1.0E / NetBSD (all architectures, all versions)
409 **
410 **  4.3BSD clone, closer to 4.4BSD
411 **
412 **	See also BSD defines.
413 */
414 
415 #if defined(__386BSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
416 # define HASUNSETENV	1	/* has unsetenv(3) call */
417 # define HASSETSID	1	/* has the setsid(2) POSIX syscall */
418 # ifdef __NetBSD__
419 #  define HASUNAME	1	/* has uname(2) syscall */
420 # endif
421 # include <sys/cdefs.h>
422 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
423 # ifndef LA_TYPE
424 #  define LA_TYPE	LA_SUBR
425 # endif
426 # define SFS_TYPE	SFS_MOUNT	/* use <sys/mount.h> statfs() impl */
427 #endif
428 
429 
430 /*
431 **  Mach386
432 **
433 **	For mt Xinu's Mach386 system.
434 */
435 
436 #if defined(MACH) && defined(i386)
437 # define MACH386	1
438 # define HASUNSETENV	1	/* has unsetenv(3) call */
439 # define HASINITGROUPS	1	/* has initgroups(3) call */
440 # ifndef HASFLOCK
441 #  define HASFLOCK	1	/* has flock(2) call */
442 # endif
443 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
444 # define NEEDSTRTOL	1	/* need the strtol() function */
445 # define setpgid	setpgrp
446 # ifndef LA_TYPE
447 #  define LA_TYPE	LA_FLOAT
448 # endif
449 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
450 # undef HASSETVBUF		/* don't actually have setvbuf(3) */
451 # undef WEXITSTATUS
452 # undef WIFEXITED
453 # ifndef _PATH_SENDMAILCF
454 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
455 # endif
456 # ifndef _PATH_SENDMAILPID
457 #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
458 # endif
459 #endif
460 
461 
462 /*
463 **  4.3 BSD -- this is for very old systems
464 **
465 **	Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
466 **
467 **	You'll also have to install a new resolver library.
468 **	I don't guarantee that support for this environment is complete.
469 */
470 
471 #if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
472 # define NEEDVPRINTF	1	/* need a replacement for vprintf(3) */
473 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
474 # define ARBPTR_T	char *
475 # define setpgid	setpgrp
476 # ifndef LA_TYPE
477 #  define LA_TYPE	LA_FLOAT
478 # endif
479 # ifndef _PATH_SENDMAILCF
480 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
481 # endif
482 # ifndef IDENTPROTO
483 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
484 # endif
485 # undef WEXITSTATUS
486 # undef WIFEXITED
487 typedef short		pid_t;
488 extern int		errno;
489 #endif
490 
491 
492 /*
493 **  SCO Unix
494 **
495 **	This includes two parts -- the first is for SCO Open Server 3.2v4
496 **	(contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
497 **	The second is, I believe, for an older version.
498 */
499 
500 #ifdef _SCO_unix_4_2
501 # define _SCO_unix_
502 # define HASSETREUID	1	/* has setreuid(2) call */
503 # define NEEDFSYNC	1	/* needs the fsync(2) call stub */
504 # define _PATH_UNIX	"/unix"
505 # ifndef _PATH_SENDMAILCF
506 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
507 # endif
508 # ifndef _PATH_SENDMAILPID
509 #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
510 # endif
511 #endif
512 
513 #ifdef _SCO_unix_
514 # define SYSTEM5	1	/* include all the System V defines */
515 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
516 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
517 # define FORK		fork
518 # define MAXPATHLEN	PATHSIZE
519 # define LA_TYPE	LA_SHORT
520 # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
521 # define TZ_TYPE	TZ_TM_NAME	/* use tm->tm_name */
522 # undef NETUNIX			/* no unix domain socket support */
523 #endif
524 
525 
526 /*
527 **  ConvexOS 11.0 and later
528 **
529 **	"Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
530 **	works on 9.1 as well.
531 */
532 
533 #ifdef _CONVEX_SOURCE
534 # define BSD		1	/* include all the BSD defines */
535 # define HASUNAME	1	/* use System V uname(2) system call */
536 # define HASSETSID	1	/* has POSIX setsid(2) call */
537 # define NEEDGETOPT	1	/* need replacement for getopt(3) */
538 # define LA_TYPE	LA_FLOAT
539 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
540 # ifndef _PATH_SENDMAILCF
541 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
542 # endif
543 # ifndef S_IREAD
544 #  define S_IREAD	_S_IREAD
545 #  define S_IWRITE	_S_IWRITE
546 #  define S_IEXEC	_S_IEXEC
547 #  define S_IFMT	_S_IFMT
548 #  define S_IFCHR	_S_IFCHR
549 #  define S_IFBLK	_S_IFBLK
550 # endif
551 # ifndef IDENTPROTO
552 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
553 # endif
554 #endif
555 
556 
557 /*
558 **  RISC/os 4.52
559 **
560 **	Gives a ton of warning messages, but otherwise compiles.
561 */
562 
563 #ifdef RISCOS
564 
565 # define HASUNSETENV	1	/* has unsetenv(3) call */
566 # ifndef HASFLOCK
567 #  define HASFLOCK	1	/* has flock(2) call */
568 # endif
569 # define WAITUNION	1	/* use "union wait" as wait argument type */
570 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
571 # define LA_TYPE	LA_INT
572 # define LA_AVENRUN	"avenrun"
573 # define _PATH_UNIX	"/unix"
574 # undef WIFEXITED
575 
576 # define setpgid	setpgrp
577 
578 extern int		errno;
579 typedef int		pid_t;
580 #define			SIGFUNC_DEFINED
581 typedef int		(*sigfunc_t)();
582 extern char		*getenv();
583 extern void		*malloc();
584 
585 #endif
586 
587 
588 /*
589 **  Linux 0.99pl10 and above...
590 **
591 **  Thanks to, in reverse order of contact:
592 **
593 **	John Kennedy <warlock@csuchico.edu>
594 **	Florian La Roche <rzsfl@rz.uni-sb.de>
595 **	Karl London <karl@borg.demon.co.uk>
596 **
597 **  Last compiled against:	[03/02/94 @ 05:34 PM (Wednesday)]
598 **	sendmail 8.6.6.b9	named 4.9.2-931205-p1	db-1.73
599 **	gcc 2.5.8		libc.so.4.5.19
600 **	slackware 1.1.2		linux 0.99.15
601 */
602 
603 #ifdef __linux__
604 # define BSD		1	/* include BSD defines */
605 # define NEEDGETOPT	1	/* need a replacement for getopt(3) */
606 # define HASUNAME	1	/* use System V uname(2) system call */
607 # define HASUNSETENV	1	/* has unsetenv(3) call */
608 # define ERRLIST_PREDEFINED	/* don't declare sys_errlist */
609 # define GIDSET_T	gid_t	/* from <linux/types.h> */
610 # ifndef LA_TYPE
611 #  define LA_TYPE	LA_PROCSTR
612 # endif
613 # define SFS_TYPE	SFS_VFS		/* use <sys/vfs.h> statfs() impl */
614 # include <sys/sysmacros.h>
615 # undef atol			/* wounded in <stdlib.h> */
616 #endif
617 
618 
619 /*
620 **  DELL SVR4 Issue 2.2, and others
621 **	From Kimmo Suominen <kim@grendel.lut.fi>
622 **
623 **	It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
624 **	defined, and the definitions conflict.
625 **
626 **	Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
627 **	trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
628 **	(SVR4.0/386 version 3.0).
629 */
630 
631 #ifdef DELL_SVR4
632 				/* no changes necessary */
633 				/* see general __svr4__ defines below */
634 #endif
635 
636 
637 /*
638 **  Apple A/UX 3.0
639 */
640 
641 #ifdef _AUX_SOURCE
642 # include <sys/sysmacros.h>
643 # define BSD			/* has BSD routines */
644 # define HASUNAME	1	/* use System V uname(2) system call */
645 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
646 # define SIGFUNC_DEFINED	/* sigfunc_t already defined */
647 # ifndef IDENTPROTO
648 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
649 # endif
650 # define FORK		fork
651 # ifndef _PATH_SENDMAILCF
652 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
653 # endif
654 # ifndef LA_TYPE
655 #  define LA_TYPE	LA_ZERO
656 # endif
657 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
658 # undef WIFEXITED
659 # undef WEXITSTATUS
660 #endif
661 
662 
663 /*
664 **  Encore UMAX V
665 **
666 **	Not extensively tested.
667 */
668 
669 #ifdef UMAXV
670 # include <limits.h>
671 # define HASUNAME	1	/* use System V uname(2) system call */
672 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
673 # define HASINITGROUPS	1	/* has initgroups(3) call */
674 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
675 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
676 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
677 # define FORK		fork	/* no vfork(2) primitive available */
678 # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
679 # define MAXPATHLEN	PATH_MAX
680 extern struct passwd	*getpwent(), *getpwnam(), *getpwuid();
681 extern struct group	*getgrent(), *getgrnam(), *getgrgid();
682 # undef WIFEXITED
683 # undef WEXITSTATUS
684 #endif
685 
686 
687 /*
688 **  Stardent Titan 3000 running TitanOS 4.2.
689 **
690 **	Must be compiled in "cc -43" mode.
691 **
692 **	From Kate Hedstrom <kate@ahab.rutgers.edu>.
693 **
694 **	Note the tweaking below after the BSD defines are set.
695 */
696 
697 #ifdef titan
698 # define setpgid	setpgrp
699 typedef int		pid_t;
700 # undef WIFEXITED
701 # undef WEXITSTATUS
702 #endif
703 
704 
705 /*
706 **  Sequent DYNIX 3.2.0
707 **
708 **	From Jim Davis <jdavis@cs.arizona.edu>.
709 */
710 
711 #ifdef sequent
712 
713 # define BSD		1
714 # define HASUNSETENV	1
715 # define BSD4_3		1	/* to get signal() in conf.c */
716 # define WAITUNION	1
717 # define LA_TYPE	LA_FLOAT
718 # ifdef	_POSIX_VERSION
719 #  undef _POSIX_VERSION		/* set in <unistd.h> */
720 # endif
721 # undef HASSETVBUF		/* don't actually have setvbuf(3) */
722 # define setpgid	setpgrp
723 
724 /* Have to redefine WIFEXITED to take an int, to work with waitfor() */
725 # undef	WIFEXITED
726 # define WIFEXITED(s)	(((union wait*)&(s))->w_stopval != WSTOPPED && \
727 			 ((union wait*)&(s))->w_termsig == 0)
728 # define WEXITSTATUS(s)	(((union wait*)&(s))->w_retcode)
729 typedef int		pid_t;
730 # define isgraph(c)	(isprint(c) && (c != ' '))
731 
732 # ifndef IDENTPROTO
733 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
734 # endif
735 
736 # ifndef _PATH_UNIX
737 #  define _PATH_UNIX	"/dynix"
738 # endif
739 # ifndef _PATH_SENDMAILCF
740 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
741 # endif
742 
743 #endif
744 
745 
746 /*
747 **  Sequent DYNIX/ptx v2.0 (and higher)
748 **
749 **	For DYNIX/ptx v1.x, undefine HASSETREUID.
750 **
751 **	From Tim Wright <timw@sequent.com>.
752 */
753 
754 #ifdef _SEQUENT_
755 # define SYSTEM5	1	/* include all the System V defines */
756 # define HASSETSID	1	/* has POSIX setsid(2) call */
757 # define HASINITGROUPS	1	/* has initgroups(3) call */
758 # define HASSETREUID	1	/* has setreuid(2) call */
759 # define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
760 # define GIDSET_T	gid_t
761 # define LA_TYPE	LA_INT
762 # define SFS_TYPE	SFS_STATFS	/* use <sys/statfs.h> statfs() impl */
763 # undef SETPROCTITLE
764 # ifndef IDENTPROTO
765 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
766 # endif
767 # ifndef _PATH_SENDMAILCF
768 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
769 # endif
770 # ifndef _PATH_SENDMAILPID
771 #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
772 # endif
773 #endif
774 
775 
776 /*
777 **  Cray Unicos
778 **
779 **	Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
780 */
781 
782 #ifdef UNICOS
783 # define SYSTEM5	1	/* include all the System V defines */
784 # define SYS5SIGNALS	1	/* SysV signal semantics -- reset on each sig */
785 # define MAXPATHLEN	PATHSIZE
786 # define LA_TYPE	LA_ZERO
787 # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
788 #endif
789 
790 
791 /*
792 **  Apollo DomainOS
793 **
794 **  From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
795 **
796 **  15 Jan 1994
797 **
798 */
799 
800 #ifdef apollo
801 # define HASSETREUID	1	/* has setreuid(2) call */
802 # define HASINITGROUPS	1	/* has initgroups(2) call */
803 # undef  SETPROCTITLE
804 # define LA_TYPE	LA_SUBR		/* use getloadavg.c */
805 # define SFS_TYPE	SFS_4ARGS	/* four argument statfs() call */
806 # ifndef _PATH_SENDMAILCF
807 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
808 # endif
809 # ifndef _PATH_SENDMAILPID
810 #  define _PATH_SENDMAILPID	"/etc/sendmail.pid"
811 # endif
812 # undef  S_IFSOCK		/* S_IFSOCK and S_IFIFO are the same */
813 # undef  S_IFIFO
814 # define S_IFIFO	0010000
815 # ifndef IDENTPROTO
816 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
817 # endif
818 #endif
819 
820 
821 /*
822 **  UnixWare
823 **
824 **	From Evan Champion <evanc@spatial.synapse.org>.
825 */
826 
827 #ifdef UNIXWARE
828 # define SYSTEM5		1
829 # ifndef HASGETUSERSHELL
830 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
831 # endif
832 # define GIDSET_T		int
833 # define SLEEP_T		int
834 # define SFS_TYPE		SFS_STATVFS
835 # define LA_TYPE		LA_ZERO
836 # undef WIFEXITED
837 # undef WEXITSTATUS
838 # define _PATH_UNIX		"/unix"
839 # ifndef _PATH_SENDMAILCF
840 #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
841 # endif
842 # ifndef _PATH_SENDMAILPID
843 #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
844 # endif
845 # define SYSLOG_BUFSIZE	128
846 #endif
847 
848 
849 /*
850 **  Intergraph CLIX 3.1
851 **
852 **	From Paul Southworth <pauls@locust.cic.net>
853 */
854 
855 #ifdef CLIX
856 # define SYSTEM5	1	/* looks like System V */
857 # ifndef HASGETUSERSHELL
858 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
859 # endif
860 # define DEV_BSIZE	512	/* device block size not defined */
861 # define GIDSET_T	gid_t
862 # undef LOG			/* syslog not available */
863 # define NEEDFSYNC	1	/* no fsync in system library */
864 # define GETSHORT	_getshort
865 #endif
866 
867 
868 /*
869 **  NCR 3000 Series (SysVr4)
870 **
871 **	From Kevin Darcy <kevin@tech.mis.cfc.com>.
872 */
873 
874 #ifdef NCR3000
875 # define __svr4__
876 # undef BSD
877 # define LA_AVENRUN	"avenrun"
878 #endif
879 
880 
881 /*
882 **  Tandem NonStop-UX SVR4
883 **
884 **	From Rick McCarty <mccarty@mpd.tandem.com>.
885 */
886 
887 #ifdef NonStop_UX_BXX
888 # define __svr4__
889 #endif
890 
891 
892 /*
893 **  Hitachi 3050R & 3050RX Workstations running HI-UX/WE2.
894 **
895 **	Tested for 1.04 and 1.03
896 **	From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
897 */
898 
899 #ifdef __H3050R
900 # define SYSTEM5	1	/* include all the System V defines */
901 # define HASINITGROUPS	1	/* has initgroups(3) call */
902 # define setreuid(r, e)	setresuid(r, e, -1)
903 # define LA_TYPE	LA_FLOAT
904 # define SFS_TYPE	SFS_VFS	/* use <sys/vfs.h> statfs() implementation */
905 # define HASSETVBUF	/* HI-UX has no setlinebuf */
906 # ifndef GIDSET_T
907 #  define GIDSET_T	gid_t
908 # endif
909 # ifndef _PATH_UNIX
910 #  define _PATH_UNIX	"/HI-UX"
911 # endif
912 # ifndef _PATH_SENDMAILCF
913 #  define _PATH_SENDMAILCF	"/usr/lib/sendmail.cf"
914 # endif
915 # ifndef IDENTPROTO
916 #  define IDENTPROTO	0	/* TCP/IP implementation is broken */
917 # endif
918 # ifndef HASGETUSERSHELL
919 #  define HASGETUSERSHELL 0	/* getusershell(3) causes core dumps */
920 # endif
921 
922 /* avoid m_flags conflict between db.h & sys/sysmacros.h on HIUX 3050 */
923 # undef m_flags
924 
925 # ifdef __STDC__
926 extern int	syslog(int, char *, ...);
927 # endif
928 
929 #endif
930 
931 
932 
933 /**********************************************************************
934 **  End of Per-Operating System defines
935 **********************************************************************/
936 
937 /**********************************************************************
938 **  More general defines
939 **********************************************************************/
940 
941 /* general BSD defines */
942 #ifdef BSD
943 # define HASGETDTABLESIZE 1	/* has getdtablesize(2) call */
944 # define HASSETREUID	1	/* has setreuid(2) call */
945 # define HASINITGROUPS	1	/* has initgroups(3) call */
946 # ifndef HASSETRLIMIT
947 #  define HASSETRLIMIT	1	/* has setrlimit(2) call */
948 # endif
949 # ifndef HASFLOCK
950 #  define HASFLOCK	1	/* has flock(2) call */
951 # endif
952 # ifndef TZ_TYPE
953 #  define TZ_TYPE	TZ_TM_ZONE	/* use tm->tm_zone variable */
954 # endif
955 #endif
956 
957 /* general System V Release 4 defines */
958 #ifdef __svr4__
959 # define SYSTEM5	1
960 # define HASSETREUID	1	/* has seteuid(2) call & working saved uids */
961 # define HASINITGROUPS	1	/* has initgroups(3) call */
962 # ifndef HASSETRLIMIT
963 #  define HASSETRLIMIT	1	/* has setrlimit(2) call */
964 # endif
965 # ifndef HASGETUSERSHELL
966 #  define HASGETUSERSHELL 0	/* does not have getusershell(3) call */
967 # endif
968 # define setreuid(r, e)	seteuid(e)
969 
970 # ifndef _PATH_UNIX
971 #  define _PATH_UNIX		"/unix"
972 # endif
973 # ifndef _PATH_SENDMAILCF
974 #  define _PATH_SENDMAILCF	"/usr/ucblib/sendmail.cf"
975 # endif
976 # ifndef _PATH_SENDMAILPID
977 #  define _PATH_SENDMAILPID	"/usr/ucblib/sendmail.pid"
978 # endif
979 # ifndef SYSLOG_BUFSIZE
980 #  define SYSLOG_BUFSIZE	128
981 # endif
982 # ifndef SFS_TYPE
983 #  define SFS_TYPE		SFS_STATVFS
984 # endif
985 #endif
986 
987 /* general System V defines */
988 #ifdef SYSTEM5
989 # include <sys/sysmacros.h>
990 # define HASUNAME	1	/* use System V uname(2) system call */
991 # define SYS5SETPGRP	1	/* use System V setpgrp(2) syscall */
992 # define HASSETVBUF	1	/* we have setvbuf(3) in libc */
993 # ifndef HASULIMIT
994 #  define HASULIMIT	1	/* has the ulimit(2) syscall */
995 # endif
996 # ifndef LA_TYPE
997 #  define LA_TYPE	LA_INT		/* assume integer load average */
998 # endif
999 # ifndef SFS_TYPE
1000 #  define SFS_TYPE	SFS_USTAT	/* use System V ustat(2) syscall */
1001 # endif
1002 # ifndef TZ_TYPE
1003 #  define TZ_TYPE	TZ_TZNAME	/* use tzname[] vector */
1004 # endif
1005 # define bcopy(s, d, l)		(memmove((d), (s), (l)))
1006 # define bzero(d, l)		(memset((d), '\0', (l)))
1007 # define bcmp(s, d, l)		(memcmp((s), (d), (l)))
1008 #endif
1009 
1010 /* general POSIX defines */
1011 #ifdef _POSIX_VERSION
1012 # define HASSETSID	1	/* has Posix setsid(2) call */
1013 # define HASWAITPID	1	/* has Posix waitpid(2) call */
1014 #endif
1015 
1016 /*
1017 **  If no type for argument two of getgroups call is defined, assume
1018 **  it's an integer -- unfortunately, there seem to be several choices
1019 **  here.
1020 */
1021 
1022 #ifndef GIDSET_T
1023 # define GIDSET_T	int
1024 #endif
1025 
1026 /*
1027 **  Tweaking for systems that (for example) claim to be BSD but
1028 **  don't have all the standard BSD routines (boo hiss).
1029 */
1030 
1031 #ifdef titan
1032 # undef HASINITGROUPS		/* doesn't have initgroups(3) call */
1033 #endif
1034 
1035 
1036 /*
1037 **  Due to a "feature" in some operating systems such as Ultrix 4.3 and
1038 **  HPUX 8.0, if you receive a "No route to host" message (ICMP message
1039 **  ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
1040 **  are closed.  Some firewalls return this error if you try to connect
1041 **  to the IDENT port (113), so you can't receive email from these hosts
1042 **  on these systems.  The firewall really should use a more specific
1043 **  message such as ICMP_UNREACH_PROTOCOL or _PORT or _NET_PROHIB.  If
1044 **  not explicitly set to zero above, default it on.
1045 */
1046 
1047 #ifndef IDENTPROTO
1048 # define IDENTPROTO	1	/* use IDENT proto (RFC 1413) */
1049 #endif
1050 
1051 #ifndef HASGETUSERSHELL
1052 # define HASGETUSERSHELL 1	/* libc has getusershell(3) call */
1053 #endif
1054 
1055 #ifndef HASFLOCK
1056 # define HASFLOCK	0	/* assume no flock(2) support */
1057 #endif
1058 
1059 #ifndef HASSETRLIMIT
1060 # define HASSETRLIMIT	0	/* assume no setrlimit(2) support */
1061 #endif
1062 
1063 #ifndef HASULIMIT
1064 # define HASULIMIT	0	/* assume no ulimit(2) support */
1065 #endif
1066 
1067 #ifndef OLD_NEWDB
1068 # define OLD_NEWDB	0	/* assume newer version of newdb */
1069 #endif
1070 
1071 
1072 /**********************************************************************
1073 **  Remaining definitions should never have to be changed.  They are
1074 **  primarily to provide back compatibility for older systems -- for
1075 **  example, it includes some POSIX compatibility definitions
1076 **********************************************************************/
1077 
1078 /* System 5 compatibility */
1079 #ifndef S_ISREG
1080 # define S_ISREG(foo)	((foo & S_IFMT) == S_IFREG)
1081 #endif
1082 #if !defined(S_ISLNK) && defined(S_IFLNK)
1083 # define S_ISLNK(foo)	((foo & S_IFMT) == S_IFLNK)
1084 #endif
1085 #ifndef S_IWGRP
1086 #define S_IWGRP		020
1087 #endif
1088 #ifndef S_IWOTH
1089 #define S_IWOTH		002
1090 #endif
1091 
1092 /*
1093 **  Older systems don't have this error code -- it should be in
1094 **  /usr/include/sysexits.h.
1095 */
1096 
1097 # ifndef EX_CONFIG
1098 # define EX_CONFIG	78	/* configuration error */
1099 # endif
1100 
1101 /* pseudo-code used in server SMTP */
1102 # define EX_QUIT	22	/* drop out of server immediately */
1103 
1104 
1105 /*
1106 **  These are used in a few cases where we need some special
1107 **  error codes, but where the system doesn't provide something
1108 **  reasonable.  They are printed in errstring.
1109 */
1110 
1111 #ifndef E_PSEUDOBASE
1112 # define E_PSEUDOBASE	256
1113 #endif
1114 
1115 #define EOPENTIMEOUT	(E_PSEUDOBASE + 0)	/* timeout on open */
1116 #define E_DNSBASE	(E_PSEUDOBASE + 20)	/* base for DNS h_errno */
1117 
1118 /* type of arbitrary pointer */
1119 #ifndef ARBPTR_T
1120 # define ARBPTR_T	void *
1121 #endif
1122 
1123 #ifndef __P
1124 # include "cdefs.h"
1125 #endif
1126 
1127 #if NAMED_BIND
1128 # include <arpa/nameser.h>
1129 # ifdef __svr4__
1130 #  ifdef NOERROR
1131 #   undef NOERROR		/* avoid compiler conflict with stream.h */
1132 #  endif
1133 # endif
1134 #endif
1135 
1136 /*
1137 **  The size of an IP address -- can't use sizeof because of problems
1138 **  on Crays, where everything is 64 bits.  This will break if/when
1139 **  IP addresses are expanded to eight bytes.
1140 */
1141 
1142 #ifndef INADDRSZ
1143 # define INADDRSZ	4
1144 #endif
1145 
1146 /*
1147 **  The size of various known types -- for reading network protocols.
1148 **  Again, we can't use sizeof because of compiler randomness.
1149 */
1150 
1151 #ifndef INT16SZ
1152 # define INT16SZ	2
1153 #endif
1154 #ifndef INT32SZ
1155 # define INT32SZ	4
1156 #endif
1157 
1158 /*
1159 **  Do some required dependencies
1160 */
1161 
1162 #if defined(NETINET) || defined(NETISO)
1163 # define SMTP		1	/* enable user and server SMTP */
1164 # define QUEUE		1	/* enable queueing */
1165 # define DAEMON		1	/* include the daemon (requires IPC & SMTP) */
1166 #endif
1167 
1168 
1169 /*
1170 **  Arrange to use either varargs or stdargs
1171 */
1172 
1173 # ifdef __STDC__
1174 
1175 # include <stdarg.h>
1176 
1177 # define VA_LOCAL_DECL	va_list ap;
1178 # define VA_START(f)	va_start(ap, f)
1179 # define VA_END		va_end(ap)
1180 
1181 # else
1182 
1183 # include <varargs.h>
1184 
1185 # define VA_LOCAL_DECL	va_list ap;
1186 # define VA_START(f)	va_start(ap)
1187 # define VA_END		va_end(ap)
1188 
1189 # endif
1190 
1191 #ifdef HASUNAME
1192 # include <sys/utsname.h>
1193 # ifdef newstr
1194 #  undef newstr
1195 # endif
1196 #else /* ! HASUNAME */
1197 # define NODE_LENGTH 32
1198 struct utsname
1199 {
1200 	char nodename[NODE_LENGTH+1];
1201 };
1202 #endif /* HASUNAME */
1203 
1204 #if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX)
1205 # define MAXHOSTNAMELEN	256
1206 #endif
1207 
1208 #if !defined(SIGCHLD) && defined(SIGCLD)
1209 # define SIGCHLD	SIGCLD
1210 #endif
1211 
1212 #ifndef STDIN_FILENO
1213 #define STDIN_FILENO	0
1214 #endif
1215 
1216 #ifndef STDOUT_FILENO
1217 #define STDOUT_FILENO	1
1218 #endif
1219 
1220 #ifndef STDERR_FILENO
1221 #define STDERR_FILENO	2
1222 #endif
1223 
1224 #ifndef LOCK_SH
1225 # define LOCK_SH	0x01	/* shared lock */
1226 # define LOCK_EX	0x02	/* exclusive lock */
1227 # define LOCK_NB	0x04	/* non-blocking lock */
1228 # define LOCK_UN	0x08	/* unlock */
1229 #endif
1230 
1231 #ifndef SIG_ERR
1232 # define SIG_ERR	((void (*)()) -1)
1233 #endif
1234 
1235 #ifndef WEXITSTATUS
1236 # define WEXITSTATUS(st)	(((st) >> 8) & 0377)
1237 #endif
1238 #ifndef WIFEXITED
1239 # define WIFEXITED(st)		(((st) & 0377) == 0)
1240 #endif
1241 
1242 #ifndef SIGFUNC_DEFINED
1243 typedef void		(*sigfunc_t) __P((int));
1244 #endif
1245 
1246 /* size of syslog buffer */
1247 #ifndef SYSLOG_BUFSIZE
1248 # define SYSLOG_BUFSIZE	1024
1249 #endif
1250 
1251 /*
1252 **  Size of tobuf (deliver.c)
1253 **	Tweak this to match your syslog implementation.  It will have to
1254 **	allow for the extra information printed.
1255 */
1256 
1257 #ifndef TOBUFSIZE
1258 # if (SYSLOG_BUFSIZE) > 512
1259 #  define TOBUFSIZE	(SYSLOG_BUFSIZE - 256)
1260 # else
1261 #  define TOBUFSIZE	256
1262 # endif
1263 #endif
1264 
1265 /*
1266 **  Size of prescan buffer.
1267 **	Despite comments in the _sendmail_ book, this probably should
1268 **	not be changed; there are some hard-to-define dependencies.
1269 */
1270 
1271 # define PSBUFSIZE	(MAXNAME + MAXATOM)	/* size of prescan buffer */
1272 /* fork routine -- set above using #ifdef _osname_ or in Makefile */
1273 # ifndef FORK
1274 # define FORK		vfork		/* function to call to fork mailer */
1275 # endif
1276 
1277 /*
1278 **  If we are going to link scanf anyway, use it in readcf
1279 */
1280 
1281 #if !defined(HASUNAME) && !defined(SCANF)
1282 # define SCANF		1
1283 #endif
1284