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